<!--Start Functions
<!--PopUp
function openWindow(url,h,w) {
var wint = (screen.height - h) / 2;
var winl = (screen.width - w) / 2;
insWin = window.open(url,"consWin",'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1,top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',width='+w+',innerWidth='+w+',height='+h+',innerHeight='+h);
}
function closeWin() {
if (!insWin.closed){ 
window.insWin.close();
}
}
<!--Work Around
function delayURL(url, msec){
setTimeout("window.location='" + url + "'", msec);
}
function delayLinkFull(url1,url2,msec) {
openWindow(url1,100,300);
setTimeout("window.location='" + url2 + "'", msec);
setTimeout(closeWin, msec+1);
}
function setURLs(){
 for (i=0; i<document.links.length; i++) {
 if (document.links[i].href.indexOf('thirtyone.') != -1 ) {
 strCurURL = document.links[i].href;
 document.links[i].onclick=function() {javascript:delayLinkFull('http://www.mythirtyone.com/18867/',this.href,3000);return false;};
}
}
}
<!-- Days Left Countdown
function daysleft() {
//Daysleft
//This script and many more are available free online at 
// The JavaScript Source!! http://javascript.internet.com
//Modifed 11.21.2004 by ciancomp
var endDate = "December 14";
var suf = "th";
var today = new Date();
var year = today.getYear();
if ((navigator.appName == "Microsoft Internet Explorer") && (year < 2000))		
year="19" + year;
if (navigator.appName == "Netscape")
year=1900 + year;
var date = new Date(endDate +", " + year);
var diff = date.getTime() - today.getTime();
var days = Math.floor(diff / (1000 * 60 * 60 * 24)+1);
var strTmp = "";
if (days > 1)
strTmp = "There are only <strong><span style=\"color:green; font-size:11pt; \">" + (days+1) + " DAYS</span></strong> left to place your order for guaranteed Christmas delivery! <a href=\"http://www.HGPshop.com/shop/\">Place Your Order</a> before " + endDate + suf + " so you dont miss out!.";
else if (days == 1)
strTmp = "<strong><span style=\"color:green; font-size:11pt; \">TOMORROW</span></strong>, " + endDate + suf + ", is the deadline for guaranteed Christmas delivery. As an added incentive HGPshop.com will give you 15% off your next order if you place <a href=\"http://www.HGPshop.com/shop/\">Your Order</a> Today! ";
else if (days == 0)
strTmp = "<strong><span style=\"color:green; font-size:11pt; \">TODAY</span></strong> is the deadline for guaranteed Christmas delivery so place your <a href=index.asp?page=contact&#38;order=checked>Order Today</a> before midnight central time! To help those that are unsure make up their mind I am given a 15% discount for orders placed before midmight. So what is your excuse? <a href=\"http://www.HGPshop.com/shop/\">Order Today</a>!";
else if (days < 0)
//strTmp = "The deadline for guaranteed Christmas delivery was " + ((days)*-1) + (days < -1 ? " days" : " day") + " ago. You can still <a href=\"http://www.HGPshop.com/shop/\">Order Today</a> but the corporate office makes no guarantees that it will arrive before Christmas. ";
strTmp = "The deadline for guaranteed Christmas delivery was " + ((days)*-1) + (days < -1 ? " days" : " day") + " ago. You can still get your special person a HGPshop.com eGift Certificate that will be sent to their email Send an <a href=\"http://www.HGPshop.com/gift_cert.htm\">eGift Certificate today</a>!. ";
return (strTmp);
}
<!--Happy Fingers
   var submitted = 0;
   function isSubmit() {
   if(submitted == 0)
   return true;
   else 
   alert("Your transaction is being processed. \n Please be Patient");
   return false;
   }
<!--Data Checks
   function isFilled(elm,type,label) {
   if (type == "Text") {
   if (elm.value != "" && elm.value != null && elm.value.indexOf("<") == "-1")
   return true;
   else
   alert(label + " is a Required field. (No HTML)")
   elm.focus();
   return false;
   }
   else if (type == "Option") {
   var iStateIndx = elm.selectedIndex
   if (iStateIndx != 0)
   return true;
   else
   alert(label + " is a Required field. \n Please Pick from the Pull Down List.")
   elm.focus();
   return false;
   }
   else if (type == "Check") {
   if (elm.checked == true)
   return true;
   else
   elm.focus();
   return false;
   }
   else if (type == "Number") {
   if (elm.value >= 0)
   return true;
   else
   alert(label + " requires numbers only. \n Please re-enter")
   elm.focus();
   elm.select();
   return false;
   }
   else if (type == "Email") {
   if (elm.value.indexOf("@") != "-1" &&
       elm.value.indexOf(".") != "-1" &&
       elm.value != "")
   return true;
   else
   alert("Please enter a vaild Email Address in " + label + " \n (eg. screenname@aol.com  No Spaces)");
   elm.focus();
   return false;
   }
   }
   function isLength(elm,len,label) {
   if (elm.value.length >= len)
   return true;
   else
   alert(label + " must be at \n least " + len + " characters.")
   elm.focus();
   return false;
   }
   function doReplace(elm) {
   var str = elm.value;
   var newstr = str.replace(/'/g, "''");
   var newstr = newstr.replace(/</g, "-");
   elm.value = newstr
   }

   function onAction(act)  {
   Action = act;
   }

	 	 
<!-- Search Ready
function isReadySrch(form) {
   if (isFilled(form.keyword,"Text","Search Keyword") == false) {
   return false;
   }
return true;
}

<!-- Recommend Ready
function isReadyRec(form) {
   if (isFilled(form.SendTo,"Email","Send To") == false) {
   return false;
}
   if (isFilled(form.SendFrom,"Email","Send From") == false) {
   return false;
}
return true;
}


<!--Checks
function CheckAll(elm)    {
     var mylist = document.CatList;
     var mylen = mylist.elements.length;
     for (var i = 0; i < mylen; i++) {
     var e = mylist.elements[i];
     if (elm == true) {
     e.checked = true;
     } else { 
     e.checked = false;
      }
    }
}
//-->

