<!--
//Copyright 2001.  InfoMax Consulting Services Inc.
//www.e-infomax.com
//File created by Jason Au   July 16,2001

var iBannerCount = 1;
var sBanner;

//==============================================================================
// Check browser type
// Description: Check user's browser if 4.0 and up
//==============================================================================

var NS4 = (document.layers);
var IE4 = (document.all);

var NS6 = (navigator.appName.indexOf("Netscape") > -1)
		&& (navigator.appVersion.substring(0,1) >= 5);

//var OP5 = (navigator.appName.indexOf("Opera") > -1)
		//&& (navigator.appVersion.substring(0,1) >= 5);

IE4=(IE4 || NS6)

var ver4 = (NS4 || IE4 || NS6);
var isMac = (navigator.appVersion.indexOf("Mac") != -1);

// redirect if no version 4+ browser
if (!ver4) {
	window.location="/warning.asp?sMiss=browser"
}


//==============================================================================
// Function: checkFlash( )
// Description: Detect Macromedia Flash Player
//==============================================================================
// put the script here

//==============================================================================
// Function: testCookies( )
// Description: Detect Cookie
//==============================================================================
function testCookies() {
   var sVal = "true";
   var expdate = new Date ();
   var expString = "";
   
   expdate.setTime (expdate.getTime() + (1000 * 60 * 60));
   expString = "expires=" + expdate.toGMTString();

   document.cookie = "COOKIE_TEST=" + escape(sVal) + ";" + expString + ";";
   document.cookie = "SESSCOOKIETEST=" + escape(sVal) + ";";
   //alert(document.cookie);
   sCoo = getCookie("COOKIE_TEST");
   sSess = getCookie("SESSCOOKIETEST");
   //alert("Cookie=" + sCoo + " Session=" + sSess);
   
   if (sCoo != "true" || sSess != "true") {
      //alert("cookies are OFF");
      window.location='warning.asp?sMiss=cookie';
   //} else {
      //alert("cookies are ON");
   }
   document.cookie = "COOKIE_TEST=";
}


//==============================================================================
// Function: setCookie( [Promo Item names], [Promo Item values] )
// Description: Check user's browser if 4.0 and up
//==============================================================================
function setCookie(sName, sValue) {
   var expdate = new Date ();
   var expString = "";

   //expdate.setTime (expdate.getTime() + (1000 * 60 * 60));
   //expString = "expires=" + expdate.toGMTString();
   
   //document.cookie = sName + "=" + escape(sValue) + ";" + expString + ";";
   document.cookie = sName + "=" + escape(sValue) + ";";
}


//==============================================================================
// Function: getCookie( [Promo Item names] )
// Description: Get cookie values
//==============================================================================
function getCookie(sName) {
   var sValue = null;
   var myCookie = document.cookie + ";";
   var sTag = sName + "=";
   var endPos;
   
   if (myCookie.length > 0) {
      var beginPos = myCookie.indexOf(sTag);
	  if (beginPos != -1) {
	     beginPos = beginPos + sTag.length;
		 endPos = myCookie.indexOf(";", beginPos);
		 if (endPos == -1) {
		    endPos = myCookie.length;
	     }
		 sValue = unescape(myCookie.substring(beginPos, endPos));
	  }
   }
   return sValue;
}


//==============================================================================
// Function: check_Blanks( [Form path] )
// Description: Check if blank space
//==============================================================================
function check_Blanks(sform) {
   var sVal, sObj, sMessage;
   var sMessage2 = "Please specify the ";
   var sMessage3 = "Billing address is incomplete - ";
   var sMessage4 = "Shipping address is incomplete - ";

   for (i = 0; i < 17; i++) {
      switch (i) {
         case 0:
		    sObj = "CONTACT";
			sMessage = sMessage2 + "contact person.";
	        break;
         case 1:
	        sObj = "CON_PHONE";
			sMessage = sMessage2 + "contact phone.";
	        break;
         case 2:
		    sObj = "POnum";
			sMessage = sMessage2 + "PO number.";
	        break;
         case 3:
	        sObj = "BILLname";
			sMessage = sMessage3 + "name.";
	        break;
         case 4:
		    sObj = "BILLaddr";
			sMessage = sMessage3 + "address.";
	        break;
         case 5:
	        sObj = "BILLcity";
			sMessage = sMessage3 + "city.";
	        break;
         case 6:
		    sObj = "BILLstatprov";
			sMessage = sMessage3 + "province/state.";
	        break;
         case 7:
	        sObj = "BILLcountry";
			sMessage = sMessage3 + "country.";
	        break;
         case 8:
		    sObj = "BILLpostalzip";
			sMessage = sMessage3 + "postal/zip code.";
	        break;
         case 9:
	        sObj = "SHIPname";
			sMessage = sMessage4 + "name.";
	        break;
         case 10:
		    sObj = "SHIPaddr";
			sMessage = sMessage4 + "address.";
	        break;
         case 11:
	        sObj = "SHIPcity";
			sMessage = sMessage4 + "city.";
	        break;
         case 12:
		    sObj = "SHIPstatprov";
			sMessage = sMessage4 + "province/state.";
	        break;
         case 13:
	        sObj = "SHIPcountry";
			sMessage = sMessage4 + "country.";
	        break;
         case 14:
		    sObj = "SHIPpostalzip";
			sMessage = sMessage4 + "postal/zip code.";
	        break;
         case 15:
	        sObj = "BILLphone";
			sMessage = sMessage3 + "phone number.";
	        break;
         case 16:
	        sObj = "SHIPphone";
			sMessage = sMessage4 + "phone number.";
	        break;
      }

      sVal = document.Confirm[sObj].value;
      if (sVal == "") {
         alert(sMessage);
	     document.Confirm[sObj].focus();

		 return false;
      }
	  sVal = "";
   }
   
   sObj = "SHIP_METHOD";
   sMessage = sMessage2 + "shipping method.";  
   sObj_2 = "SHIP_ACCOUNT";
   sMessage_2 = sMessage2 + "shipping account.";  

   if (NS4) {
      sVal = sform.SHIP_METHOD.options[sform.SHIP_METHOD.selectedIndex].value;
   } else {	
      sVal = document.Confirm[sObj].value;
   }
   
   sVal_2 = document.Confirm[sObj_2].value;
   sValue = sVal.substring(0,1)
   
   if (sValue == "0") {
      alert(sMessage);
	  document.Confirm[sObj].focus();

	  return false;
   } else if (sValue == "2" && sVal_2 == "") {
      alert(sMessage_2);
	  document.Confirm[sObj_2].focus();
	  
	  return false;
   }
   //var agree = confirm('Proceed with submission?');
   //if (!agree)
      //return false;
	  
   sVal = sVal.substring(1,sVal.length)
   document.Confirm.METHOD.value = sVal;

   bDate = Combine_Date(sform)
   
   return true;
}


//==============================================================================
// Function: CheckInput(  )
// Description: Check form
//==============================================================================
function CheckInput() {

  var sPassword;

  with (document.forms.set_passwd) {

    if (custcode.value == "") {
      alert("Please enter your customer code.");
      custcode.focus();
      return false;
    }

    if (faxno.value == "") {
      alert("Please enter your fax number.");
      faxno.focus();
      return false;
    }

    if ((country.selectedIndex == 0) || (country.selectedIndex == 1)) {
      alert("Please select a country.");
      country.focus();
      return false;
    }
    sPassword = pwd.value;
    if (sPassword.length < 6) {
      alert("The password you entered is too short.  It must contain at least 6 characters.  Please try again.");
      pwd.value = "";
      cnfm_pwd.value = "";
      pwd.focus();
      return false;
    }

    if (pwd.value == cnfm_pwd.value) {
      return true;
    }
    else {
      alert("The passwords you typed do not match.  Type your new password in the two text boxes.");
      pwd.value = "";
      cnfm_pwd.value = "";
      pwd.focus();
      return false;
    }

  }
}


//==============================================================================
// Function: checkForm( [Form path] )
// Description: Check form
//==============================================================================
function checkForm(sform) {
   var bSubmit = false;
   
   if (NS4) {
      var sColor = sform.COLOR.options[sform.COLOR.selectedIndex].value;
      var sQuan = sform.QUANTITY.value;
   } else {
      var sColor = document.Prod_Item.COLOR.value;
      var sQuan = document.Prod_Item.QUANTITY.value;
   }
   
   sQuan = parseInt(sQuan);
   var sQuantity = isNaN(sQuan);
   sColor = aProd[sColor][2];
   
   if ((sQuantity == true) || (sQuan < 1)) {
      alert("Please enter a valid quantity.");
      if (NS4) {
         sform.QUANTITY.value = "1";
         sform.QUANTITY.focus();
      } else {
		 document.Prod_Item.QUANTITY.value = "1";
         document.Prod_Item.QUANTITY.focus();
      }
      return false;
   } else {
      if (NS4) {
         sform.QUANTITY.value = sQuan;
		 sform.PROD_COLORCODE.value = sColor;
      } else {
		 document.Prod_Item.QUANTITY.value = sQuan;
		 document.Prod_Item.PROD_COLORCODE.value = sColor;
      }
   }
}


//==============================================================================
// Function:  CheckRequest( [Form path] )
// Description: Check form
//==============================================================================
function CheckRequest(sform) {
   var sVal, sIsNumber, sObj, sMessage;
   var iCount;
   
   sVal = document.Request["CUST_CODE"].value;
   if (sVal == "") {
      iCount = 10;
   } else {
      iCount = 3;
   }
   sVal = "";

   for (i = 0; i < iCount; i++) {
      switch (i) {
         case 0:
		    sObj = "NAME";
			sMessage = "name.";
	        break;
         case 1:
	        sObj = "EMAIL";
			sMessage = "e-mail.";
	        break;
         case 2:
	        sObj = "CONTACT";
			sMessage = "contact person.";
	        break;			
         case 3:
		    sObj = "STREET";
			sMessage = "street.";
	        break;
         case 4:
	        sObj = "CITY";
			sMessage = "city.";
	        break;
         case 5:
		    sObj = "PROV_STATE";
			sMessage = "province/state.";
	        break;
         case 6:
	        sObj = "COUNTRY";
			sMessage = "country.";
	        break;
         case 7:
		    sObj = "POSTAL_ZIP";
			sMessage = "postal/zip code.";
	        break;
         case 8:
	        sObj = "HOW_ABOUT";
			sMessage = "Please answer all questions!";
	        break;
         case 9:
		    sObj = "WHAT_NATURE";
			sMessage = "Please answer all questions!";
	        break;
      }

      sVal = document.Request[sObj].value;	
      if (sVal == "") {
         if (i == 8 || i == 9) {
		    alert(sMessage);
		 } else {
            alert("Please specify the " + sMessage);
		 }
	     document.Request[sObj].focus();

		 return false;
      } else {
	     if ((i == 1) && (sVal.indexOf("@") < 1)) {
		    alert("Please specify the " + sMessage);
			
			document.Request[sObj].focus();
			return false;
		 }
	  }
	  sVal = "";
   }

   sVal = document.Request["CUST_CODE"].value; 
   if (sVal == "") {  
      sObj = "HOW_LONG";
      sMessage = "Please answer all questions.";   

      if (NS4) {
         sVal = sform.HOW_LONG.options[sform.HOW_LONG.selectedIndex].value;
      } else {	
         sVal = document.Request[sObj].value;
      }

      if (sVal == "0") {
         alert(sMessage);
	     document.Request[sObj].focus();
	  
	     return false;
      }
   }
   
   sObj = "AREACODE";
   sMessage = "Please enter your phone number."

   sVal_1 = document.Request[sObj].value; 
   sIsNumber = parseInt(sVal_1);
   if ((sVal_1 == "") || (isNaN(sIsNumber))) {
      alert (sMessage);
	  document.Request[sObj].focus();
	  
	  return false;    
   } else {
      sObj = "PHONE1";
      sVal_2 = document.Request[sObj].value;
	  sIsNumber = parseInt(sVal_2);
	  if ((sVal_2 == "") || (isNaN(sIsNumber))) {
	     sMessage = "Please enter your phone number."
	     alert (sMessage);
		 document.Request[sObj].focus();
		 
		 return false;
	  } else {
	     sObj = "PHONE2";
	     sVal_3 = document.Request[sObj].value;
		 sIsNumber = parseInt(sVal_3);
		 sMessage = "Please enter your phone number."
		 if ((sVal_3 == "") || (isNaN(sIsNumber))) {
		    alert (sMessage);
			document.Request[sObj].focus();
			
			return false;
		 }
	  }
   }
   
   var agree = confirm('Proceed with submission?');
   if (!agree)
      return false;
   
   document.Request["PHONE"].value = "(" + sVal_1 + ")" + sVal_2 + "-" + sVal_3;
   
   return true;
}


//==============================================================================
// Function:  Combine_Date( [Form path] )
// Description: Check form
//==============================================================================
function Combine_Date(sform) {
   var iMonth,iDay, iYear, iDate;

   if (NS4) {
      iMonth = sform.D_Month.options[sform.D_Month.selectedIndex].value
	  if (iMonth < 10) {
	     iMonth = "0" + iMonth;
	  }
	  iDay = sform.D_Day.options[sform.D_Day.selectedIndex].value
	  if (iDay < 10) {
	     iDay = "0" + iDay;
	  }
	  iYear = sform.D_Year.options[sform.D_Year.selectedIndex].value
	  iDate = iMonth + "/" + iDay + "/" + iYear;
	  sform.DELIVERY.value = iDate;
   } else {
      iMonth = document.Confirm.D_Month.value;
	  if (iMonth < 10) {
	     iMonth = "0" + iMonth;
	  }
	  iDay = document.Confirm.D_Day.value;
	  if (iDay < 10) {
	     iDay = "0" + iDay;
	  }
	  iYear = document.Confirm.D_Year.value;
	  iDate = iMonth + "/" + iDay + "/" + iYear;
	  document.Confirm.DELIVERY.value = iDate;
   }

   return true;
}


//==============================================================================
// Function: Confirm_Order(  )
// Description: Confirm submission
//==============================================================================
function Confirm_Order() {
   var agree = confirm('Proceed with submission?');

   if (!agree)
      return false;
}


//==============================================================================
// Function: onONE( [Item file names], [Form path] )
// Description: Change Image when selected
//==============================================================================
function onONE(sVal, sform) {

   if (sVal == null) {
      if (NS4) {
		 sVal = sform.selectedIndex;
      } else {
         sVal = document.Prod_Item.COLOR.value;
      }
	  sImage = aProd[sVal][0];
	  
   } else {
      sImage = aProd[sVal][0];
      if (NS4) {
		 document.Prod_Item.COLOR.selectedIndex = sVal;
      } else {
         document.Prod_Item.COLOR.value = sVal;
      }
   }
   document.Large.src = "../images/products/250x250/" + sImage;
}


//==============================================================================
// Function: onSize( [Item file names] )
// Description: Change size depends on size availabilities
//==============================================================================
function onSize(sVal) {
   var sProduct_Size = 0;
			var aSizeNames = new Array("L", "M", "S", "XS");
			
   if (sVal == null) {
      if (NS4) {
		       sVal = oFORM.COLOR.selectedIndex;
      } else {
         sVal = document.Prod_Item.COLOR.value;
      }	  
   }
			
   sProduct_Size = aProd[sVal][1];
   var aMySizes=sProduct_Size.split(",");
			
   if (NS4) {
      document.Prod_Item.SIZE.selectedIndex = "0";
						oFORM.SIZE.length = 0;
   } else {
      document.Prod_Item.SIZE.value = "0";
						Prod_Item.SIZE.length = 0;
   }
   
			var j = 0;
			var intDropDownSize = 0
			
			for (i=0; i < aMySizes.length; i++) {
			   if (aMySizes[i] == "True") {
						   intDropDownSize++;
						}
			}
			
			for (i=0; i < aMySizes.length; i++) {
			   if (aMySizes[i] == "True") {
         if (NS6 || NS4) {
	           oFORM.SIZE.length = intDropDownSize;
	         	 oFORM.SIZE.options[j].value = aSizeNames[i];
	           oFORM.SIZE.options[j].text = aSizeNames[i];

         } else {
               Prod_Item.SIZE.length = intDropDownSize;
	            	 Prod_Item.SIZE.options[j].value = aSizeNames[i];
               Prod_Item.SIZE.options[j].text = aSizeNames[i];
         }
									j++;
      }
			}
}


//==============================================================================
// Function: onSize_AUS( [Item file names] )
// Description: Change size depends on size availabilities
//==============================================================================
function onSize_AUS(sVal) {
   var sProduct_Size = 0;
   
   if (sVal == null) {
      if (NS4) {
		 sVal = oFORM.COLOR.selectedIndex;
      } else {
         sVal = document.Prod_Item.COLOR.value;
      }	  
   }
   
   sProduct_Size = aProd[sVal][1];
      
   if (NS4) {
      document.Prod_Item.SIZE.selectedIndex = "0";
   } else {
      document.Prod_Item.SIZE.value = "0";
   }
   
   if (NS6 || NS4) {
	  oFORM.SIZE.length = 1;
	  
	  if (sProduct_Size == 1) {
	     oFORM.SIZE.length = 2;
		 oFORM.SIZE.options[1].value = "1";
	     oFORM.SIZE.options[1].text = "M";
	  }
   } else {
      Prod_Item.SIZE.length = 1;
	  
      if (sProduct_Size == 1) {
         Prod_Item.SIZE.length = 2;
		 Prod_Item.SIZE.options[1].value = "1";
         Prod_Item.SIZE.options[1].text = "M";
      }
   }
}

//==============================================================================
// Function: ChangeProduct( [Form path] )
// Description: Change Category for header jump menu
//==============================================================================
function ChangeProduct(sform) {

   if (NS4) {
      var sCatalog = sform.Prod_Cat.options[sform.Prod_Cat.selectedIndex].value;
   } else {
      var sCatalog = document.Catalog.Prod_Cat.value;
   }

   if (sCatalog == "search") {
     document.location.href="search.asp";
   } else if (sCatalog != 0) {
     document.location.href="product_list.asp?iCat=" + sCatalog;
   }
}


//==============================================================================
// Function: knp_Link( [Link to file] )
// Description: redirect and link to another page
//==============================================================================
function knp_Link(sLink) {
   document.location.href = sLink;
}


//==============================================================================
// Function: roll_banner( )
// Description: rotate banner for promotional products
//==============================================================================
function roll_banner() {
   var iCount = getCookie('iCount');
   if (iBannerCount == iCount) {
      iBannerCount = 0;
   }
 
   var sImage = getCookie('sImage' + iBannerCount);
 
   document.Banner.src = "../images/products/90x90/" + sImage;
	 
   iBannerCount++;

   if (iCount > 1) {
      sBanner = setTimeout("roll_banner()",5000);
   }
}


//==============================================================================
// Function: PromoItems( [Width of table], [Number] )
// Description: Display Promotion Items
//==============================================================================
function PromoItems(iWidth, iNum) {
   var sNowColor = "E8EFF9";
   var sImage = getCookie('sImage0');
   var iCount = getCookie('iCount');
   var sProdCatID;
   var sProdName;
   var sProdCode;

   if (iWidth != "100%") {
      document.write ("<img src='../images/products/90x90/" + sImage + "' width='90' height='90' name='Banner' border='0'><br>");
      document.write ("<p>");
   }
   
   
   document.write ("<table width='" + iWidth + "' border='0' cellpadding='3' bordercolor='#E8EFF9' cellspacing='0'");

   for (i = 0; i < iCount; i++) {
     sImage = getCookie('sImage' + i);
     sProdCatID = getCookie('sProdCatID' + i);
	 sProdName = getCookie('sProdName' + i);
	 sProdCode = getCookie('sProdCode' + i);
	 
     if (iNum != null) {
	    if (i % 2 == 0) {
	       sNowColor = "E8EFF9";
	    } else {
	       sNowColor = "D2DFF2";
        }
     }

	 document.write ("<tr bgcolor='#" + sNowColor + "'>"); 
     document.write ("<td width='15' align='center' valign='top'><img src='../images/bullet.gif' width='10' height='10' name='bullet" + i + "'></td>");
     document.write ("<td align='left' valign='top'><div class='noline'><a href='product.asp?iCat=" + sProdCatID + "&prodID=" + sProdCode + "' onMouseOver=\"swap_img('Banner','" + sImage + "', 'bullet" + i + "')\" onMouseOut=\"unswap_img('Banner', 'bullet" + i + "')\">" + sProdName + "</a></div></td>");
     document.write ("</tr>");
   }
   document.write ("</table>");
   
   if (iWidth != "100%") {
      document.write ("</p><p>&nbsp;</p>");
   }
}


//==============================================================================
// Function: swap_img( [Image name], [Item file names], [Bullet name] )
// Description: Swap images if mouse over
//==============================================================================
function swap_img (imgName, sImage, bullet) {
   document[imgName].src = "../images/products/90x90/" + sImage;
   document[bullet].src = "../images/bullet-on.gif";
   clearTimeout(sBanner);
}


//==============================================================================
// Function: swap_img( [Image name], [Bullet name] )
// Description: Swap images if mouse out
//==============================================================================
function unswap_img (imgName, bullet) {
   var iCount = getCookie('iCount');

   document[bullet].src = "../images/bullet.gif";
   
   if (iCount > 1) {
      sBanner = setTimeout("roll_banner()",5000);
   }
}


//==============================================================================
// Function: MM_preloadImages( )
// Description: Preload Images
//==============================================================================
function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


//==============================================================================
// Function: openLink( [Link to file] )
// Description: Open another window
//==============================================================================
function openLink(sLink) {
  window.open(sLink,'ImageWindow','location=no,toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,width=400,height=400')
}


//==============================================================================
// Function: goBack(  )
// Description: Go back one page
//==============================================================================
function goBack() {
   window.history.go(-1);
}
//-->
