	var xmlHttp;
	var tempstr;
	var TargetDivId;
	var ActionID;
	function ShowHint(AID,url,TargetId){
		ActionID=AID;
		TargetDivId=TargetId;
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null){
			alert ("Browser does not support HTTP Request");
			return;
		}
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	
	function stateChanged(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
			tempstr=xmlHttp.responseText;
			if(ActionID==6){//signin case
				if(tempstr=="true"){
					window.location="myorders.htm";
				}
				else
					document.getElementById(TargetDivId).innerHTML="Invalid signin information";
			}
			else{
				document.getElementById(TargetDivId).innerHTML="";
				document.getElementById(TargetDivId).innerHTML=tempstr;
			}
		}
		/*else if(ActionID==1)
			document.getElementById(TargetDivId).innerHTML="updating cart";
		else if(ActionID==2)
			document.getElementById(TargetDivId).innerHTML="updating mini cart";
		else if(ActionID==3)
			document.getElementById(TargetDivId).innerHTML="Getting related designations";
		else if(ActionID==4)
			document.getElementById(TargetDivId).innerHTML="Checking login email existance";
		else if(ActionID==5)
			document.getElementById(TargetDivId).innerHTML="Processing signup";
		else if(ActionID==6)
			document.getElementById(TargetDivId).innerHTML="Processing signin";
		*/
	}
	
	function GetXmlHttpObject(){
		var objXMLHttp=null;
		if (window.XMLHttpRequest){
			objXMLHttp=new XMLHttpRequest();
		}
		else if (window.ActiveXObject){
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		return objXMLHttp;
	}
	
	function UpdateCart(form,TID){
		var CBoxSrNo="";
		var Qty="";
		var OldQty="";
		var SrNo="";
		var DoAction=false;
		var TargetURL="updatecart.asp?Cart=Update&";
		if(form.TotalItems.value==1){
			if(form.ChkBoxSrNo.checked){
				CBoxSrNo = form.ChkBoxSrNo.value;
				TargetURL=TargetURL+"ChkBoxSrNo="+CBoxSrNo+"&";
			}
			Qty = "Qty="+form.Qty.value;
			OldQty = "OldQty="+form.OldQty.value;
			SrNo = "SrNo="+form.SrNo.value;
			DoAction=true;
		}
		else{
			for(var i=0;i<form.ChkBoxSrNo.length;i++){			
				if(form.ChkBoxSrNo[i].checked)
					CBoxSrNo = CBoxSrNo + form.ChkBoxSrNo[i].value+",";
			}
			
			if(CBoxSrNo!=""){
				DoAction=true;
				TargetURL=TargetURL+"ChkBoxSrNo="+Left(CBoxSrNo,CBoxSrNo.length-1)+"&";
			}
			
			for(var i=0;i<form.Qty.length;i++){
				if(form.Qty[i].value!=form.OldQty[i].value)
					DoAction=true;
				Qty = Qty + "Qty=" +form.Qty[i].value+"&";
				OldQty = OldQty + "OldQty=" +form.OldQty[i].value+"&";
				SrNo = SrNo + "SrNo=" +form.SrNo[i].value+"&";
			}
			Qty=Left(Qty,Qty.length-1);
			OldQty=Left(OldQty,OldQty.length-1);
			SrNo=Left(SrNo,SrNo.length-1);
		}
		
		TargetURL=TargetURL+Qty+"&";
		TargetURL=TargetURL+OldQty+"&";
		TargetURL=TargetURL+SrNo;
		
		if(DoAction){
			document.getElementById(TID).innerHTML="updating cart";
			ShowHint(1,TargetURL,TID);
			alert("Cart Updated.");
			document.getElementById("minishowcart").innerHTML='updating cart <img src="images/processing.gif">';
			ShowHint(2,"minishowcart.asp","minishowcart");
			//parent.minishowcartiframe.location.reload(true);			
			//setTimeout(ShowHint("minishowcart.asp","minishowcart"),10000);
		}
		else
			alert("No changes applied in cart to update.");
	}
	
	function GetDesignations(form){
		var IndustryID=form.Industry.value;
		var TargetURL="getdesignation.asp?IndustryID="+IndustryID;
		document.getElementById("designation").innerHTML='Getting related designations <img src="images/processing.gif">';
		ShowHint(3,TargetURL,"designation");
	}
	
	function CheckEmail(){
		var LoginEmail=document.frmsignup.LoginEmail.value;
		var TargetURL="checkemail.asp?LoginEmail="+LoginEmail;
		document.getElementById("emailstatus").innerHTML='Checking login email existance <img src="images/processing.gif">';
		ShowHint(4,TargetURL,"emailstatus");
	}
	
	function DoSignup(){
		var TargetURL="dosignup.asp?";
		TargetURL=TargetURL+"LoginEmail="+document.frmsignup.LoginEmail.value;
		TargetURL=TargetURL+"&Password="+document.frmsignup.Password.value;
		TargetURL=TargetURL+"&FirstName="+document.frmsignup.FirstName.value;
		TargetURL=TargetURL+"&LastName="+document.frmsignup.LastName.value;
		TargetURL=TargetURL+"&Gender="+document.frmsignup.Gender.value;
		TargetURL=TargetURL+"&DOB="+document.frmsignup.optMonth.value+"/"+document.frmsignup.optDay.value+"/"+document.frmsignup.optYear.value;
		TargetURL=TargetURL+"&AlternateEmail="+document.frmsignup.AlternateEmail.value;
		TargetURL=TargetURL+"&Address="+document.frmsignup.Address.value;
		TargetURL=TargetURL+"&Country="+document.frmsignup.Country.value;
		TargetURL=TargetURL+"&Province="+document.frmsignup.Province.value;
		TargetURL=TargetURL+"&City="+document.frmsignup.City.value;
		TargetURL=TargetURL+"&ZipCode="+document.frmsignup.ZipCode.value;
		TargetURL=TargetURL+"&PhoneNo="+document.frmsignup.PhoneNo.value;
		TargetURL=TargetURL+"&Industry="+document.frmsignup.Industry.value;
		TargetURL=TargetURL+"&Designation="+document.frmsignup.Designation.value;
		document.getElementById("signup").innerHTML='Processing signup <img src="images/processing.gif">';
		ShowHint(5,TargetURL,"signup");
	}
	
	function DoSignIn(){
		var TargetURL="dosignin.asp?";
		TargetURL=TargetURL+"LoginEmail="+document.frmsignin.LoginEmail.value;
		TargetURL=TargetURL+"&Password="+document.frmsignin.Password.value;
		TargetURL=TargetURL+"&RememberMe="+document.frmsignin.RememberMe.checked;
		document.getElementById("signin").innerHTML='Processing signin <img src="images/processing.gif">';
		ShowHint(6,TargetURL,"signin");
	}
	
	function DoForgotPassword(){
		var TargetURL="doforgotpassword.asp?";
		TargetURL=TargetURL+"LoginEmail="+document.frmforgot.LoginEmail.value;
		ShowHint(7,TargetURL,"forgotpassword");
	}
	
	function DoProfile(){
		var TargetURL="doprofile.asp?";
		TargetURL=TargetURL+"CustID="+document.frmprofile.CustID.value;
		TargetURL=TargetURL+"&LoginEmail="+document.frmprofile.LoginEmail.value;
		TargetURL=TargetURL+"&Password="+document.frmprofile.Password.value;
		TargetURL=TargetURL+"&FirstName="+document.frmprofile.FirstName.value;
		TargetURL=TargetURL+"&LastName="+document.frmprofile.LastName.value;
		TargetURL=TargetURL+"&Gender="+document.frmprofile.Gender.value;
		TargetURL=TargetURL+"&DOB="+document.frmprofile.optMonth.value+"/"+document.frmprofile.optDay.value+"/"+document.frmprofile.optYear.value;
		TargetURL=TargetURL+"&AlternateEmail="+document.frmprofile.AlternateEmail.value;
		TargetURL=TargetURL+"&Address="+document.frmprofile.Address.value;
		TargetURL=TargetURL+"&Country="+document.frmprofile.Country.value;
		TargetURL=TargetURL+"&Province="+document.frmprofile.Province.value;
		TargetURL=TargetURL+"&City="+document.frmprofile.City.value;
		TargetURL=TargetURL+"&ZipCode="+document.frmprofile.ZipCode.value;
		TargetURL=TargetURL+"&PhoneNo="+document.frmprofile.PhoneNo.value;
		TargetURL=TargetURL+"&Industry="+document.frmprofile.Industry.value;
		TargetURL=TargetURL+"&Designation="+document.frmprofile.Designation.value;
		ShowHint(8,TargetURL,"profile");
	}
	
	function DoPostComment(){
		var TargetURL="doposttestimonials.asp?";
		TargetURL=TargetURL+"SubScriptionTypeId="+frmComments.SubScriptionTypeId.value+"&";
		TargetURL=TargetURL+"Title="+frmComments.Title.value+"&";
		TargetURL=TargetURL+"Comments="+frmComments.Comments.value;
		ShowHint(9,TargetURL,"comments");
	}
	
	function DoShowSamples(ProductTypeID){
		var TargetURL="doshowsamples.asp?";
		TargetURL=TargetURL+"ProductTypeID="+ProductTypeID;
		document.getElementById("samples").innerHTML='Processing to show samples <img src="images/processing.gif">';
		ShowHint(10,TargetURL,"samples");
	}
	
	function DoContactUs(){
		var TargetURL="docontactus.asp?";
		TargetURL=TargetURL+"FullName="+frmContactUs.FirstName.value+frmContactUs.LastName.value+"&";
		TargetURL=TargetURL+"Email="+frmContactUs.Email.value+"&";
		TargetURL=TargetURL+"PhoneNo="+frmContactUs.PhoneNo.value+"&";
		TargetURL=TargetURL+"OrderID="+frmContactUs.OrderID.value+"&";
		TargetURL=TargetURL+"Subject="+frmContactUs.Subject.value+"&";
		TargetURL=TargetURL+"Message="+frmContactUs.Message.value+"&";
		TargetURL=TargetURL+"Priority="+frmContactUs.Priority.value;
		document.getElementById("contactus").innerHTML='Message is sending... <img src="images/processing.gif">';
		ShowHint(11,TargetURL,"contactus");
	}

	function GetPortalContents(){
		var TargetURL="frmgetportalcontents.asp?";
		TargetURL=TargetURL+"SiteID="+FrmPortalContents.SiteID.value;
		document.getElementById("PortalContents").innerHTML='Loading Contents... Please wait <img src="images/processing.gif">';
		ShowHint(12,TargetURL,"PortalContents");
	}
	
	function GetFeaturedProduct(Action){
		var TargetURL="showonefeaturedproduct.asp?";
		TargetURL=TargetURL+"Action="+Action;
		document.getElementById("featuredproduct").innerHTML='Loading Featured Product... Please wait <img src="images/processing.gif">';
		ShowHint(13,TargetURL,"featuredproduct");
	}
	
	function PostTestimonial(Form){
		var TargetURL="frmposttestimonials.asp?";
		TargetURL=TargetURL+"CustId="+Form.CustId.value+"&";
		TargetURL=TargetURL+"SubScriptionTypeId="+Form.SubScriptionTypeId.value+"&";
		TargetURL=TargetURL+"Title="+Form.Title.value+"&";
		TargetURL=TargetURL+"Description="+Form.Description.value;
		document.getElementById("posttestimonial").innerHTML='Posting Testimonial... Please wait <img src="images/processing.gif">';
		ShowHint(14,TargetURL,"posttestimonial");
		Form.reset();
	}
	
	function DoRaffleSignup(){
		var TargetURL="dosignup.asp?UserType=Raffle";
		TargetURL=TargetURL+"&LoginEmail="+document.frmrafflesignup.LoginEmail.value;
		TargetURL=TargetURL+"&Password="+document.frmrafflesignup.Pass.value;
		TargetURL=TargetURL+"&FirstName="+document.frmrafflesignup.FirstName.value;
		TargetURL=TargetURL+"&LastName="+document.frmrafflesignup.LastName.value;
		document.getElementById("rafflesignup").innerHTML = '';
		document.getElementById("rafflesignup").innerHTML='<center><b>Processing raffle signup <img src="images/processing.gif"></b></center>';
		ShowHint(15,TargetURL,"rafflesignup");
	}
	
	function GetPortalProductTypeContents(){
		var TargetURL="frmgetportalproducttypecontents.asp?";
		TargetURL=TargetURL+"SiteID="+FrmPortalContents.SiteID.value+"&";
		TargetURL=TargetURL+"ProductTypeId="+FrmPortalContents.ProductTypeId.value;
		document.getElementById("PortalContents").innerHTML='Loading Contents... Please wait <img src="images/processing.gif">';
		ShowHint(16,TargetURL,"PortalContents");
	}
	
	function CheckQty(form){
		if(form.TotalItems.value==1){
			if(isNaN(form.Qty.value))
				form.Qty.value=form.OldQty.value;
			else if(form.Qty.value<1)
				form.Qty.value=form.OldQty.value;
		}
		else{
			for(var i=0;i<form.TotalItems.value;i++){
				if(isNaN(form.Qty[i].value))
					form.Qty[i].value=form.OldQty[i].value;
				else if(form.Qty[i].value<1)
					form.Qty[i].value=form.OldQty[i].value;
			}
		}
	}

	function CheckSelectedItems(form){
		if(form.TotalItems.value==1){
			if(!form.SubScriptionIndex.checked){
				alert("No product selected to Add To Cart.");
				return false;
			}
		}
		else{
			for(var i=0;i<form.TotalItems.value;i++){
				if(form.SubScriptionIndex[i].checked)
					return true;
			}
			alert("No product selected to Add To Cart.");
			return false;
		}
	}
	
	function Left(str, n){
		if (n <= 0)
			return "";
		else if (n > String(str).length)
			return str;
		else
			return String(str).substring(0,n);
	}
	
	function Right(str, n){
		if (n <= 0)
		   return "";
		else if (n > String(str).length)
		   return str;
		else {
		   var iLen = String(str).length;
		   return String(str).substring(iLen, iLen - n);
		}
	}
	
	function Calculate(Discount){
		var GrossAmount,NetAmount,SubScriptionPrice;
		GrossAmount=0;
		for(var i=0;i<frmSavingPack.SubScriptions.length;i++){
			SubScriptionPrice=Right(frmSavingPack.SubScriptions[i].value,2);
			GrossAmount=parseInt(GrossAmount)+parseInt(SubScriptionPrice);
		}
		Discount=parseFloat(GrossAmount*(Discount/100));
		NetAmount=parseFloat(GrossAmount)-parseFloat(Discount);
		
		GrossAmount=GrossAmount.toFixed(2);
		NetAmount=NetAmount.toFixed(2);
		Discount=Discount.toFixed(2);
		
		frmSavingPack.GrossPrice.value=GrossAmount;
		frmSavingPack.NetPrice.value=NetAmount;
		
		document.getElementById("GrossAmount").innerHTML="<b>$"+GrossAmount+"</b>";
		document.getElementById("Discount").innerHTML="<b>$"+Discount+"</b>";
		document.getElementById("NetAmount").innerHTML="<b>$"+NetAmount+"</b>";
	}
	
	function colorRow(el)
	{
	  if (document.getElementById)
		{
		  var therow = document.getElementById(el);
		  for(i=1;i<therow.rows.length;i++)
			{
			  if (!(i%2))
				{
				  therow.rows[i].style.backgroundColor="#DDDDDD";
				}
			}
		  }
	}
	
	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;
	}