// JavaScript Document
	//var strSiteLink="http://www.treathim.com";
	//var strSiteLink="http://localhost/treathim";
	var strSiteLink="http://www.treathim.com";
	var xmlHttp,result,vSKU;
	var productI,productP,productAPrice,productDiscount,productWeight,productVarietyID
	result=false;
	messageObj = new DHTML_modalMessage();	// We only create one object of this class
	messageObj.setShadowOffset(0);	// Large shadow
	function displayTerms(url)
	{
	
		messageObj.setSource(url);
		messageObj.setCssClassMessageBox('termsdivscroll');
		messageObj.setSize(650,500);
		messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
		messageObj.display();
	}
function displayIpointsBox(url)
	{
		//alert(url);
		messageObj.setHtmlContent("");
		messageObj.setSource(url);
		messageObj.setCssClassMessageBox(false);
		messageObj.setSize(400,285);
		messageObj.setShadowDivVisible(false);	// Enable shadow for these boxes
		messageObj.display();
	}
	function displayReviewBox(url)
	{
		//alert(url);
		
		messageObj.setHtmlContent("");
		messageObj.setSource(url);
		messageObj.setCssClassMessageBox('termsdivscroll');
		messageObj.setSize(650,500);
		messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
		messageObj.display();
	}
	function registerIPointsUser()
	{
		Ajax("divIPointsResponse",strSiteLink + "/tools/registeripointuser.asp?rand=" + Math.random() + "&txtEmail=" + document.getElementById("txtEmail").value + "&txtPassword=" + document.getElementById("txtPassword").value + "&txtFirstName=" + document.getElementById("txtFirstName").value + "&txtLastName=" + document.getElementById("txtLastName").value + "&txtAddress=" + document.getElementById("txtAddress").value + "&txtPostCode=" + document.getElementById("txtPostCode").value + "&isRegister=1" );
		//startCheckingForIPointRegistrationStatus();
	}
	
//	function loginIPoints()
//	{
//		Ajax("divIPointsResponse",strSiteLink + "/tools/loginipointsuser.asp?rand=" + Math.random() + "&txtEmail=" + document.getElementById("txtEmail").value + "&txtPassword=" + document.getElementById("txtPassword").value );
//		//startCheckingForIPointRegistrationStatus();
//	}
//	
	function loginIPoints()
	{
		Ajax("divIPointsResponse",strSiteLink + "/tools/registeripointuser.asp?rand=" + Math.random() + "&txtEmail=" + document.getElementById("txtEmail").value + "&txtPassword=" + document.getElementById("txtPassword").value + "&isRegister=0" );
		//startCheckingForIPointRegistrationStatus();
	}
	
	function startCheckingForIPointRegistrationStatus()
	{
		if(document.getElementById("divIPointsResponse").innerHTML.indexOf("successfully") > 0)
		{
			alert("change button");
			return;
		}
		else
		{
			startCheckingForIPointRegistrationStatus();
		}
	}
	function validateIPointsLoginForm()
	{
		if(document.getElementById("txtEmail").value == "")
		{
			alert("Please enter email");
			return;
		}
		if(emailCheck(document.getElementById("txtEmail").value) == false)
		{
			alert("Please enter valid email");
			return;
		}
		if(document.getElementById("txtPassword").value == "")
		{
			alert("Please enter password");
			return;
		}
		loginIPoints();
	}
	function validateIPointsForm()
	{
		if(document.getElementById("txtEmail").value == "")
		{
			alert("Please enter email");
			return;
		}
		if(emailCheck(document.getElementById("txtEmail").value) == false)
		{
			alert("Please enter valid email");
			return;
		}
		if(document.getElementById("txtPassword").value == "")
		{
			alert("Please enter password");
			return;
		}
		if(document.getElementById("txtConfirmPassword").value == "")
		{
			alert("Please enter confirm password");
			return;
		}
		if(document.getElementById("txtPassword").value !=  document.getElementById("txtConfirmPassword").value)
		{
			alert("Passwords are not matching");
			return;
		}
		if(document.getElementById("txtPassword").value.length < 6)
		{
			alert("Password should be atleast 6 characters");
			return;
		}
		if(document.getElementById("txtFirstName").value == "")
		{
			alert("Please enter first name");
			return;
		}
		if(document.getElementById("txtLastName").value == "")
		{
			alert("Please enter last name");
			return;
		}
		registerIPointsUser();
	}
	function GetXmlHttpObject()
	{ 
		var objXMLHttp=null
		if (window.XMLHttpRequest)
		{
		objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		return objXMLHttp
	} 


	function UpdateAllGiftSection()
	{
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request");
			return;
		} 
		var url= "allgifts.asp"
		url=url+"?sid="+Math.random();
		xmlHttp.onreadystatechange=show_gifts ;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		return false;
	} 


	function show_gifts() 
	{ 
	
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			display_values=xmlHttp.responseText;		
			document.getElementById("all_gifts_division").innerHTML="<div class=\"RedTextTitleC\">Want to see it all?  No problem! <br />Below you can find the entire selection of great gift ideas currently available on Treat Her…<br /><br /></div>"+display_values;
		} 
		else{
			document.getElementById("all_gifts_division").innerHTML="<div class=\"RedTextTitleC\">Want to see it all?  No problem! <br />Below you can find the entire selection of great gift ideas currently available on Treat Her…<br /><br />(Please be patient, it may take a couple of seconds to load up…)</div>";
		}
	} 
	
	
	
	function adjustIFrameSize (iframeWindow,val) {
//	  if (iframeWindow.document.height) {
//		var iframeElement = document.getElementById(iframeWindow.name);
//		alert(iframeWindow)
//		iframeElement.style.height = iframeWindow.document.height + 'px';
//	   // iframeElement.style.width = iframeWindow.document.width + 'px';
//	  }
//	  else if (document.all) {
//		var iframeElement = document.all[iframeWindow.name];
//		if (iframeWindow.document.compatMode &&
//			iframeWindow.document.compatMode != 'BackCompat') 
//		{
//		  iframeElement.style.height = 
//	iframeWindow.document.documentElement.scrollHeight + 5 + 'px';
//		//  iframeElement.style.width = 
//	//iframeWindow.document.documentElement.scrollWidth + 5 + 'px';
//		}
//		else {
//		
//		if( iframeElement.style.height=="")
//		{
//			 iframeElement.style.height=val;
//		}
//		else
//		{
//		  iframeElement.style.height = 
//	iframeWindow.document.body.scrollHeight;
//		}	
//	   //   iframeElement.style.width = 
//	//iframeWindow.document.body.scrollWidth + 5 + 'px';
//		}
//	  }
	}


	function addbookmark()
	{
		bookmarkurl="http://www.treathim.com/"
		bookmarktitle="Treat him - Exquisite, affordable, hassle-free gift ideas for men"
		if (document.all)
		window.external.AddFavorite(bookmarkurl,bookmarktitle)
	}
	

	function Show_Category(ShowVal,ShowValCat)
	{
		window.location=strSiteLink + "/"+ShowValCat+"/"+ShowVal;
	}
	
	function Show_Price(ShowVal)
	{
		window.location=strSiteLink + "/price/"+ShowVal;
	}
	
	
	
	function CartVarietyFunctionFootball(ProductI,ProductP,ProductAPrice,ProductDiscount,ProductWeight,ProductVarietyID)
	{	
	    productI=ProductI;productP=ProductP;productAPrice=ProductAPrice;productDiscount=ProductDiscount;productWeight=ProductWeight;productVarietyID=ProductVarietyID;
        BAFHGetProInfo();
	}
	
	function CartVarietyFunction(ProductI,ProductP,ProductAPrice,ProductDiscount,ProductWeight,ProductVarietyID)
	{
			document.ProductFrm.ProductID.value=ProductI;
			document.ProductFrm.ProductQuantity.value=1;
			document.ProductFrm.ProductPrice.value=ProductP;	
			document.ProductFrm.ProductActualPrice.value=ProductAPrice;
			document.ProductFrm.ProductDiscount.value=ProductDiscount;			
			document.ProductFrm.ProductWeight.value=ProductWeight;		
			document.ProductFrm.ProductVarietyID.value=ProductVarietyID;					
			document.ProductFrm.action=strSiteLink + "/tools/AddCart.asp";
			document.ProductFrm.submit();
	}
	function CartFunction(ProductI,ProductP,ProductAPrice,ProductDiscount,ProductWeight)
	{
			document.ProductFrm.ProductID.value=ProductI;
			document.ProductFrm.ProductQuantity.value=1;
			document.ProductFrm.ProductPrice.value=ProductP;	
			document.ProductFrm.ProductActualPrice.value=ProductAPrice;
			document.ProductFrm.ProductDiscount.value=ProductDiscount;			
			document.ProductFrm.ProductWeight.value=ProductWeight;		
			document.ProductFrm.action=strSiteLink + "/tools/AddCart.asp";
			document.ProductFrm.submit();
	}
	function AddToWishlist(ProductI,ProductP,ProductVarietyID)
	{
			document.ProductFrm.ProductID.value=ProductI;
			document.ProductFrm.ProductQuantity.value=1;
			document.ProductFrm.ProductPrice.value=ProductP;	
			document.ProductFrm.ProductVarietyID.value=ProductVarietyID;			
			document.ProductFrm.action=strSiteLink + "/tools/AddToWishList.asp";
			document.ProductFrm.submit();
	}
	function EmailFunction(PName)
	{
			document.EmailFrm.ProductName.value=PName;
			document.EmailFrm.action=strSiteLink + "/EMailToFriend.asp";
			document.EmailFrm.submit();
	}
	
	
	
	function ShowFilter(pagingurl,filter_crit)
	{
			window.location=pagingurl + "?site=treathim&PageFilter="+filter_crit;
	}	
	
