// JavaScript Document
				function MM_preloadImages() { //v3.0
					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 MM_findObj(n, d) { //v4.01
					var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
					d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
					if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
					for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
					if(!x && d.getElementById) x=d.getElementById(n); return x;
				}
				
				function MM_nbGroup(event, grpName) { //v6.0
				var i,img,nbArr,args=MM_nbGroup.arguments;
				if (event == "init" && args.length > 2) {
					if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
						img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
						if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
						nbArr[nbArr.length] = img;
					for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
						if (!img.MM_up) img.MM_up = img.src;
						img.src = img.MM_dn = args[i+1];
						nbArr[nbArr.length] = img;
					} 
				}
				} else if (event == "over") {
					document.MM_nbOver = nbArr = new Array();
					for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
					if (!img.MM_up) img.MM_up = img.src;
					img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
					nbArr[nbArr.length] = img;
					}
				} else if (event == "out" ) {
					for (i=0; i < document.MM_nbOver.length; i++) {
					img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
				} else if (event == "down") {
					nbArr = document[grpName];
					if (nbArr)
						for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
						document[grpName] = nbArr = new Array();
						for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
						if (!img.MM_up) img.MM_up = img.src;
						img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
						nbArr[nbArr.length] = img;
						} 
					}
				}
				
				/*
	** Function populate():
		@@ who = what ID to be checked.
		
		This function will populate per request the shiping OR payables form fields 
		with the head office form fields values.
	
	** Function aonthefly():
		@@ key = who is calling;
		@@ who = first name of the field
		@@ who_add = last name of the filed (if it exists)
		@@ action = if the caller is a textfield or a select box.
		
		This function will populate the shipping AND payables whenever head office is changed if requested.
	*/
	
	var doc = document.all
	var ar_fields = new Array("ship","acc");
	function papulate(who)
	{
		if(!doc[who+"_sameAs"].checked)
		{
			doc["address_"+who+"1"].value = "";
			doc["address_"+who+"2"].value = "";
			doc["city_"+who].value = "";
			doc["state_"+who].options[0].selected = true;
			doc["zip_"+who].value = "";
			doc["country_"+who].options[0].selected = true;
		}
		if(doc[who+"_sameAs"].checked)
		{
			doc["address_"+who+"1"].value = doc.address_def1.value;
			doc["address_"+who+"2"].value = doc.address_def2.value;
			doc["city_"+who].value = doc.city_def.value;
			doc["state_"+who].options[doc.state_def.selectedIndex].selected = true;
			doc["zip_"+who].value = doc.zip_def.value;
			doc["country_"+who].options[doc.country_def.selectedIndex].selected = true;
		}
	}
	function onthefly(key,who,who_add,action)
	{
		for(x=0;x<ar_fields.length;x++)
		{
			if(doc[ar_fields[x]+"_sameAs"].checked)
			{
				if(action == "text")
				{
					doc[who+ar_fields[x]+who_add].value = key.value;
				}
				else
				{
					doc[who+ar_fields[x]+who_add].options[key.selectedIndex].selected = true;
				}
			}
		}
	}
	
    function changeCode(index)
	{     
        doc["whereCode"].style.visibility     = 'visible';
        doc["whereCodeText"].style.visibility = 'visible';

        if( index == '1' )
        {
            doc["whereCode"].style.visibility     = 'visible';
            doc["whereCodeText"].style.visibility = 'visible';
        }
        else if( index == '2' )
        {
            doc["whereCode"].style.visibility     = 'visible';
            doc["whereCodeText"].style.visibility = 'visible';
        }
        else
        {
            doc["whereCode"].style.visibility     = 'hidden';
            doc["whereCodeText"].style.visibility = 'hidden';
        }
	}

	// For products display page
	function getIMG(who)
	{
		doc.holder.src = "../media/PrIMG_big_" + who + ".gif";
	}
	
	
	// for check out page - paysystems
	
	function processing()
    {
      myWin = window.open('https://auth.mypaysystems.com/cgi-v310/payment/processing.asp','popup1','left=150,top=50,fullscreen=0,toolbar=No,status=No,menubar=No,scrollbars=Yes,resizable=No,width=365,height=200');
    }
    function MM_displayStatusMsg(msgStr)
    {
      //v2.0
      status=msgStr;
      document.MM_returnValue = true;
    }

    function CA_openUkazkaWindow(theURL,winName,features)
    {
       //v2.0
      msgWindow=window.open(theURL,winName,features);
    }
    function statusbar(text)
    {
      window.status = text;
    }
    function changeCase(frmObj)
    {
      var index;
      var tmpStr;
      var tmpChar;
      var preString;
      var postString;
      var strlen;
      tmpStr = frmObj.value.toLowerCase();
      strLen = tmpStr.length;
      if (strLen > 0)
      {
        for (index = 0; index < strLen; index++)
        {
          if (index == 0)
          {
            tmpChar = tmpStr.substring(0,1).toUpperCase();
            postString = tmpStr.substring(1,strLen);
            tmpStr = tmpChar + postString;
          }
          else
          {
            tmpChar = tmpStr.substring(index, index+1);
            if (tmpChar == " " && index < (strLen-1))
            {
              tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
              preString = tmpStr.substring(0, index+1);
              postString = tmpStr.substring(index+2,strLen);
              tmpStr = preString + tmpChar + postString;
             }
          }
        }
      }
      frmObj.value = tmpStr;
    }
	
	function ccValidate(theform)
{
  var sCCnum  = theform.CardNumber.value;
  var sYear   = theform.exp_year.value;
  var sMonth  = theform.exp_month.value;
  var iNumLen = sCCnum.length;
  var myDate  = new Date()
  var agree   = theform.agree.checked;
  if(iNumLen > 0 && sYear == "")
  {
    alert("Please enter the expiry year")
    theform.exp_year.focus();
    return false;
  }
  if(iNumLen > 0 && sMonth == "")
  {
    alert("Please enter the expiry month")
    theform.exp_month.focus();
    return false;
  }
  var theYear    = myDate.getYear()+ ""
  var theMonth   = myDate.getMonth() + ""
  var monthsGone = parseInt(theYear.substr(2,2),10)*12 + parseInt(theMonth,10)
  var monthstoGo = parseInt(sYear,10)*12 + parseInt(sMonth,10)
  if (monthstoGo - monthsGone < 1)
  {
    alert("The credit card expiry is out of date")
    theform.exp_year.focus();
    return false;
  }
  return true;
}
function semeAsBilling(){
  theForm = document.form1;
  if (theForm.sameasbilling.checked == true)
  {
    theForm.sfirstname.value  = theForm.firstname.value;
    theForm.smiddlename.value = theForm.middlename.value;
    theForm.slastname.value   = theForm.lastname.value;
    theForm.saddress.value    = theForm.address.value;
    theForm.scity.value       = theForm.city.value;
    theForm.sstate.value      = theForm.state.value;
    theForm.szip.value        = theForm.zip.value;
    theForm.scountry.value    = theForm.country.value;
    theForm.stelephone.value  = theForm.telephone.value;
  }
  else
  {
    theForm.reset();
  }
}
	
	