closetime = 0;
  function resetHgt()
  {
	 document.getElementById('sidemenu').style.height=document.getElementById('contentarea').clientHeight+70;
	 document.getElementById('footer').style.top=document.getElementById('sidemenu').clientHeight+110;
  }
  function resetHgt2()
  {
	 document.getElementById('sidebar').style.height=document.getElementById('contentarea').clientHeight+70;
  }
  function popWin()
  {
	email = document.forms['form1'].email.value;
	firstname = document.forms['form1'].firstname.value;
	lastname = document.forms['form1'].lastname.value;
	window.open('newsjoin.asp?email=' + email + '&firstname=' + firstname + '&lastname=' + lastname,'newsjoin' + parseInt(Math.random() * 1000000),'directories=0,toolbar=0,menubar=0,personalbar=0,location=0,scrollbars=1,status=0,resizable=0,height=450,width=500,screenX=20,screenY=20,left=20,top=20');
  }
  function popNews(popVar)
  {
	  if (popVar == 'True'){
	  	 url1 = "newsjoin.asp";
      	 width1 = 550;
      	 height1 = 420;
	  	 winname1 = "newsletter";
      	 delaya = 20;
	  	 timer = setTimeout("Start(url1, width1, winname1, height1)", delaya*1000);
	  }
  }
  function popFaxWin(url)
  {
	window.open(url,'faxorder' + parseInt(Math.random() * 1000000),'directories=0,toolbar=0,menubar=0,personalbar=0,location=0,scrollbars=1,status=0,resizable=0,height=500,width=450,screenX=20,screenY=20,left=20,top=20');
  }
  function popInfoWin(url)
  {
	window.open('copy.asp?id='+url,'faxorder' + parseInt(Math.random() * 1000000),'directories=0,toolbar=0,menubar=0,personalbar=0,location=0,scrollbars=1,status=0,resizable=0,height=500,width=450,screenX=20,screenY=20,left=20,top=20');
  }
  function popSurvey(popVar) {
	if (popVar == 'True'){
	  url = "survey.asp";
      width = 550;
      height = 550;
      delay = 22;
	  winname = "survey";
      timer = setTimeout("Start(url, width, winname, height)", delay*1000);
	}
  }
  function Start(URL, WIDTH, WINNAME, HEIGHT) {
  	   windowprops = "directories=0,toolbar=0,menubar=0,personalbar=0,location=0,scrollbars=1,status=0,resizable=1,screenX=30,screenY=30,left=30,top=30,height=" + HEIGHT + ",width=" + WIDTH;
  	   preview = window.open(URL, WINNAME, windowprops);
  	   preview.blur();preview.location=URL;preview.blur();
  	   if (closetime) setTimeout("preview.close();", closetime*1000);
  }
  function swapAmounts(prodid,currencycode,prodname,amount) {
      window.document.forms["purchaseForm"].MC_prodid.value=prodid;
	  window.document.forms["purchaseForm"].currency.value=currencycode;
	  window.document.forms["purchaseForm"].cartId.value=prodname;
	  window.document.forms["purchaseForm"].amount.value=amount;
  }
  function selectFuture(newValue, normalAmount, startDate) {
  		if (newValue == 1) {
		   window.document.forms["purchaseForm"].futurePayType.value='regular';
		   window.document.forms["purchaseForm"].noOfPayments.value=3;
		   window.document.forms["purchaseForm"].intervalMult.value=1;
		   window.document.forms["purchaseForm"].intervalUnit.value=3;
		   window.document.forms["purchaseForm"].normalAmount.value=normalAmount;
		   window.document.forms["purchaseForm"].startDate.value=startDate;
		}else{
		   window.document.forms["purchaseForm"].futurePayType.value='';
		   window.document.forms["purchaseForm"].noOfPayments.value='';
		   window.document.forms["purchaseForm"].intervalMult.value='';
		   window.document.forms["purchaseForm"].intervalUnit.value='';
		   window.document.forms["purchaseForm"].normalAmount.value='';
		   window.document.forms["purchaseForm"].startDate.value='';
		}
  }
  
  function updateAmount(newAmount) {
	  curAmount = window.document.forms["purchaseForm"].amount.value;
	  optionids = window.document.forms["purchaseForm"].optionids.value;
	  newNum = Number(curAmount)+Number(newAmount);
	  window.document.forms["purchaseForm"].amount.value = newNum;
  }
  function resizeIframe() {
	  newHeight = Number(document.getElementById('iFrameContents').clientHeight)+40;
	  newWidth = Number(document.getElementById('iFrameContents').clientWidth)+10;
	  if (newHeight != 0) {
	  	 if (navigator.appName == "Microsoft Internet Explorer" && navigator.platform != "MacPPC") {
		 	window.resizeTo(newWidth,newHeight);
		 }else{
		 }
	  }
  }
  function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		preloadFlag = true;
	}
}
function resizePopUp() {
	  newWidth = Number(document.getElementById('contents').clientWidth)+40;
	  if (newWidth != 0 && newWidth >= 444) {
	  	 window.resizeTo(newWidth,550);
	  }
}
function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}
function updatePrice(price,formName,defaultPrice) {
		newPrice = Number(price) + Number(defaultPrice);
		if (price <= 0) {
		   document.forms[formName].prodprice.value = defaultPrice;
		} else {
		  document.forms[formName].prodprice.value = newPrice;
		}
}
function updatePrice2() {
		
		var formFields = document.forms.purchaseForm.elements ;
		var newPrice = new Number();
		var newName;
		var prodId;
		var optionIds = new String();
		var initialAmount = new Number();
		//alert(hasChild);
for (var i = 0; i < formFields.length ; i++) { 
        if (formFields[i].type == 'radio' && formFields[i].name == 'packChoice' && formFields[i].checked) {
    	    var curVal = formFields[i].value;
            splitVal = curVal.split("|");
            prodId = splitVal[0] + ',';
            newPrice = Number(splitVal[1]);
            newName = splitVal[2];
			optionIds = splitVal[3].split(",");
			initialAmount = Number(splitVal[4]);
			futurePayVal = Number(splitVal[5]);
    	}
		//alert(optionIds.length);
    if (optionIds.length != 0) {
        lastVal = 0;
		for (var y = 0; y < optionIds.length; y++) {
    		
			if (optionIds[y].length != 0 && Number(optionIds[y]) != lastVal) {
    			fieldName = "MC_option_"+optionIds[y];
				//alert(fieldName);
				if (formFields[i].type == 'radio' && formFields[i].name == fieldName && formFields[i].checked) {
    			curVal = formFields[i].value;
                //alert(curVal);
    			splitVal = curVal.split("|");
    			//prodId = prodId + splitVal[0] + ',';
                //alert(splitVal[1]);
				newPrice = newPrice + Number(splitVal[1]);
				if (initialAmount !=0) {
				   initialAmount = initialAmount + Number(splitVal[1]);
				}
                newName = newName + ' ' + splitVal[2];
    			lastVal = Number(optionIds[y]);
				//alert('lastVal = ' + lastVal);
				}
			}
		}
    } 
}
		if (newPrice != 0) {
		  if (initialAmount !=0) {
		  	 document.forms.purchaseForm.amount.value = initialAmount;
			 document.forms.payPalForm.amount.value = newPrice;
		  }else{
		  	 document.forms.purchaseForm.amount.value = newPrice;
			 document.forms.payPalForm.amount.value = newPrice;
		  }
		  document.forms.purchaseForm.displayAmount.value = newPrice;
		  document.forms.purchaseForm.cartId.value = newName;
		  document.forms.payPalForm.item_name.value = newName;
		  document.forms.purchaseForm.MC_prodid.value = prodId;
		  document.forms.payPalForm.item_number.value = prodId;
		}
		if (futurePayVal == 0) {
		   window.document.forms["purchaseForm"].futurePayType.value='';
		   window.document.forms["purchaseForm"].noOfPayments.value='';
		   window.document.forms["purchaseForm"].intervalMult.value='';
		   window.document.forms["purchaseForm"].intervalUnit.value='';
		   window.document.forms["purchaseForm"].normalAmount.value='';
		   window.document.forms["purchaseForm"].startDate.value='';
		}
}