
function incqty(txtquantity)
{
	var q = parseInt(txtquantity.value);
	q = q + 1;
	if(q > 20)
		q = 20;
	txtquantity.value=q;
}
function calcship(selbox,orderform,supval,pos)
{
	orderform.action='shipcalendar.asp?calc=yes';
	orderform.supid.value=supval;
	orderform.position.value=pos;
	orderform.submit();
}
function showcal(pos)
{
	document.getElementById("divcal"+pos).style.visibility='visible';
}
function opencal(orderdate,shipdate,deliverydate,w,h,prodtitle,shiptype)
{
	window.open("/calendar.asp?orderdate="+orderdate+"&shipdate="+shipdate+"&deliverydate="+deliverydate+"&prodtitle="+prodtitle+"&shiptype="+shiptype+"", 'ShipCalendar','scrollbars=yes,status=no,width='+w+',height='+h+'');
}
function uploadcustomdesign(idcart,changetype)
{
    window.open("/upload-design.aspx?idcr="+idcart+"&ctype="+changetype, 'Uploadesign','scrollbars=yes,status=no,width=400,height=200');
}
function viewdesign(idcart)
{
    window.open("/view-design-image.aspx?idcr="+idcart, 'viewdesign','scrollbars=yes,status=no,width=400,height=200');
}
function viewsizechart(idprod)
{
	window.open("/sizechart.asp?idprod="+idprod+"", 'SizeChart','scrollbars=yes,status=no,width=300,height=300');
}
function hidecal(pos)
{
	document.getElementById("divcal"+pos).style.visibility='hidden';
}
function validateNumeric(field) 
{
	var valid = "0123456789."
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) 
	{
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") 
			ok = "no";
	}
	if (ok == "no") 
	{
		alert("Please enter a numeric value");
		field.value = 1;
		field.focus();
		field.select();
		return false;
	}
}

function showlocdiv(divname)
{
	if(divname == "zip")
	{
		document.getElementById(""+divname).style.visibility='visible';
		document.getElementById(""+divname).style.position='static';
		document.getElementById("citystate").style.visibility='hidden';
		document.getElementById("citystate").style.position='absolute';
	}
	if(divname == "citystate")
	{
		document.getElementById(""+divname).style.visibility='visible';
		document.getElementById(""+divname).style.position='static';
		document.getElementById("zip").style.visibility='hidden';
		document.getElementById("zip").style.position='absolute';
	}
	if(divname == "all")
	{
		document.getElementById("citystate").style.visibility='visible';
		document.getElementById("citystate").style.position='static';
		document.getElementById("zip").style.visibility='visible';
		document.getElementById("zip").style.position='static';
	}
}

function checklocsearch(frm)
{
	if(frm.searchtype[0].checked)
	{
		if(frm.zipcode.value == "")
		{
			window.alert("Enter the zip code");
			frm.zipcode.focus();
			return false;
		}
	}
	else if(frm.searchtype[1].checked)
	{
		if(frm.city.value == "" && frm.stateCode.value == "")
		{
			window.alert("Enter the city Or state");
			frm.city.focus();
			return false;
		}
	}
	return true;
}
	function showdiv(divname)
	{
	
		
		document.getElementById(divname).style.visibility="visible";
	}
	
	 function hidediv(divname)
	{
		document.getElementById(divname).style.visibility="hidden";
	}
function validsearch(searchfm)
{
	if(searchfm.searchfield.value=='')
	{
		window.alert('Please type a keyword');
		searchfm.searchfield.focus();
		return false;
	}
	return true;
}
function validques(searchfm)
{
	if(searchfm.searchtext.value=='')
	{
		window.alert('Please type a keyword');
		searchfm.searchtext.focus();
		return false;
	}
	return true;
}

function validnews(newsfm)
{
	if(newsfm.txtname.value=='')
	{
		window.alert('You missed name');
		newsfm.txtname.focus();
		return false;
	}
	if(newsfm.txtemail.value=='')
	{
		window.alert('You missed email');
		newsfm.txtemail.focus();
		return false;
	}
	else
	{
		if(!checkEmail(newsfm.txtemail))
			return false;
	}
}
function decqty(txtquantity)
{
	var q = parseInt(txtquantity.value);
	q = q - 1;
	if(q < 1)
		q = 1;
	txtquantity.value=q;
}
function validateqty(txtquantity)
{
	if(txtquantity.value == "" || txtquantity.value == 0)
	{
		window.alert("Sorry! Quantity can not be 0.")
		txtquantity.focus();
		return false;
	}
	validateNumeric(txtquantity);
}
function addtocart(idProd,txtqty,prodcolor,e)
{	
	if(e != 0)
	{
		var i = prodcolor.selectedIndex;
		if(i==0)
		{
			window.alert('Please select color');
			prodcolor.focus();
		}
		else
		{
		var s = prodcolor.options[i].value;
		window.location.href = '/addtocart.asp?idProduct='+idProd+'&txtquantity='+txtqty.value+'&productcolor='+s;
		}
	}
	else
	{
	window.location.href = '/addtocart.asp?idProduct='+idProd+'&txtquantity='+txtqty.value;
	}
}

function buygiftcard(idGift,GiftFrom,GiftTo)
{	
	if(GiftFrom.value=="")
	{
		window.alert("You missed From name");
		GiftFrom.focus();
		return false;
	}
	if(GiftTo.value=="")
	{
		window.alert("You missed To name");
		GiftTo.focus();
		return false;
	}
	return true;
}

function detailsgiftcard(idGift)
{
	window.location.href = '/buygiftcard.asp?idGift='+idGift;
}

function updateqty(idCart,txtqty)
{

	if(txtqty.value == "" || txtqty.value == 0)
	{
		window.alert("Sorry! Quantity can not be 0.");
		txtqty.focus();
	}
	else
	window.location.href ='/update-cart.aspx?idCustomProd='+idCart+'&txtqty='+txtqty.value;
}
function setshipprice(shiplist)
{
window.location.href='shopping-cart.asp?shipment='+shiplist;
}
function checkaccept(cartdet,path)
{


	var saved=0;
	if(! document.cartdet.accept.checked)
 	{
   		alert("Please read & accept the return policy");
		document.cartdet.accept.focus();
		return false;
  	}
/*	else
	{
		if(document.cartdet.chkchangeship1.value=="yes")
		{
			if(! document.cartdet.chkchangeship.checked)
			{
				if(confirm("You are using saved address info for you order"))
					window.location.href=path+"/checkout.asp";  
				else
				{
					document.cartdet.chkchangeship.focus();
					return false;
				}
			}
			else
				saved=1;
		}
	}
	*/
	document.cartdet.action=path+"/checkout.aspx?saved="+saved; 
	return true;
	//window.location.href=path+"/checkout.asp?saved="+saved; 
}


function checkaccepts(https_Site_root)
{
	var saved=0;
	if(window.document.cartdet.touploaddesign.value > 0)
	{
	    alert("Please upload all your custom design to continue");
		window.document.cartdet.touploaddesign.focus();
		return false;
	}
	if(! window.document.cartdet.accept.checked)
 	{
   		alert("Please read & accept the return policy");
		window.document.cartdet.accept.focus();
		return false;
  	}
//alert(https_Site_root)
	window.document.cartdet.action = https_Site_root +"/precheckout.aspx?saved="+saved; 
	window.document.cartdet.submit();
	return true;
	//window.location.href=path+"/checkout.asp?saved="+saved; 
}















function clearcart(idcart,saveorder,cartitems)
{
	if (cartitems >= 1 && saveorder!= "" )
	{
		if(confirm("This action may delete your saved information of order "+ saveorder))
			window.location.href ='/shopping-cart.asp?clearcart=yes&idCart='+idcart+'&ido='+saveorder;
		else
			return false;
	}
	else
		window.location.href ='/shopping-cart.asp?clearcart=yes&idCart='+idcart;
}
function cancelorder(pval,ido)
{
	if(confirm("This action may delete your saved information of order "+ ido))
		window.location.href='cancelationoforder.asp?pval=yes&ido='+ido+'';
	else
		return false;
}
function  restvalues(custlog)
{
custlog.reset();

}
function checknews(newsfm)
{
	/*if(newsfm.txtfname.value =="")
	{
		window.alert("You missed first name");
		newsfm.txtfname.focus();
		return false;
	}*/
	if(newsfm.txtname.value =="")
	{
		window.alert("You missed email");
		newsfm.txtname.focus();
		return false;
	}
	/*if (newsfm.txtemail.value =="")
	{
		window.alert("You missed email address");
		newsfm.txtemail.focus();
		return false;
	}*/
	else
	{
		if(!checkEmail(newsfm.txtname))
			return false;
	}
	return true;
}
function checkusr(custlog)
{

	if(custlog.txtemail)
	{
	//alert("f" + custlog.txtemail.value);
		if (custlog.txtemail.value =="")
		{
			window.alert("You missed email address");
			custlog.txtemail.focus();
			return false;
		}
		else
		{
			if(!checkEmail(custlog.txtemail))
				return false;
		}
	}
	else
	{
		if (custlog.username.value =="")
		{
			window.alert("You missed email address");
			custlog.username.focus();
			return false;
		}
		else
		{
			if(!checkEmail(custlog.username))
				return false;
		}
	}
		
		if (custlog.txtPassword.value =="")
		{
			window.alert("You missed  password");
			custlog.txtPassword.focus();
			return false;
		}
		return true;
}

function checkordfrm(tagname,orderform,idcust,checkoutfirst)
{
	/*if (orderform.nametitle.selectedIndex == 0)
	{
		window.alert("You missed title ");
		orderform.nametitle.focus();
		return false;
	}*/
	//alert(tagname);
//alert(orderform.tagname+"$"+fname.value);

	if (orderform.tagname+fname.value =="")
	{
	window.alert("You missed name ");
	orderform.name.focus();
	return false;
	}
	if (orderform.lastname.value =="")
	{
	window.alert("You missed last name");
	orderform.lastname.focus();
	return false;
	}
	if (orderform.phone.value =="")
	{
	//window.alert("You missed phone");
	//orderform.phone.focus();
	//return false;
	}
	if (orderform.email.value =="")
	{
	window.alert("You missed email");
	orderform.email.focus();
	return false;
	}
	else
	{
		if(!checkEmail(orderform.email))
			return false;
	}
	if(idcust == 0)
	{
		if (orderform.password.value =="")
		{
			window.alert("You missed password");
			orderform.password.focus();
			return false;
		}
		else
		{
			h = orderform.password.value.length;
			x = orderform.password.value;
	
			for( i=0;i<h;i++)
			{
			 
				if (  h < 6 )
				{
								alert(" Password can't be less than 6" + " characters");
								orderform.password.focus();
								orderform.password.select();
								return false;
				}
				var valid = "0123456789"
				var okn = "yes";
				var temp;
				for (var i=0; i<orderform.password.value.length; i++) 
				{
					temp = "" + orderform.password.value.substring(i, i+1);
					if(temp=="\'" || temp=="\"")
					{	
						okn = "no";
						alert("The character \',\" is not allowed in password");
						orderform.password.focus();
						orderform.password.select();
						return false;
					}
					if (valid.indexOf(temp) == "-1") 
						okn = "no";
				}
				var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
				var oka = "num";
				var temp;
				for (var i=0; i<orderform.password.value.length; i++) 
				{
					temp = "" + orderform.password.value.substring(i, i+1);
					if (valid.indexOf(temp) == "-1") 
						oka = "alp";
				}
			}
			if(okn=="yes" || oka == "num")
			{
				alert("Password should be Aplphanumeric");
				orderform.password.focus();
				orderform.password.select();
				return false;
			}
		}
		if (orderform.cpassword.value =="")
		{
		window.alert("You missed confirm password");
		orderform.cpassword.focus();
		return false;
		}
		if (orderform.cpassword.value !=orderform.password.value)
		{
		window.alert("Confirm password and password should be same");
		orderform.cpassword.value="";
		orderform.password.value="";
		orderform.password.focus();
		return false;
		}
	}
	if(checkoutfirst == 0 )
	{
		if (orderform.address1.value =="")
		{
		window.alert("You missed address1");
		orderform.address1.focus();
		return false;
		}
		if (orderform.city.value =="")
		{
		window.alert("You missed city");
		orderform.city.focus();
		return false;
		}
		if ( orderform.stateCode.value == "" )
		{
		window.alert("You missed state");
		//orderform.state.value =""
		orderform.stateCode.value=""
		orderform.stateCode.focus();
		return false;
		}
		if (orderform.countryCode.value =="")
		{
		window.alert("You missed country code");
		orderform.countryCode.focus();
		return false;
		}
		
		if (orderform.zip.value =="")
		{
		//window.alert("You missed zip");
		//orderform.zip.focus();
		//return false;
		}
		if (orderform.shipname.value =="")
		{
		window.alert("You missed ship name");
		orderform.shipname.focus();
		return false;
		}
		if (orderform.shiplastname.value =="")
		{
		window.alert("You missed ship last name");
		orderform.shiplastname.focus();
		return false;
		}
		if (orderform.shpAddress1.value =="")
		{
		window.alert("You missed shipping address1");
		orderform.shpAddress1.focus();
		return false;
		}
		
		if (orderform.shpCity.value =="")
		{
		window.alert("You missed shipping  city");
		orderform.shpCity.focus();
		return false;
		}
		if (document.orderform.shpStateCode.value == "" )
		{
		window.alert("You missed state");
		//orderform.shpState.value =""
		orderform.shpStateCode.value=""
		orderform.shpStateCode.focus();
		return false;
		}
		if (orderform.shpCountryCode.value =="")
		{
		window.alert("You missed shipping  country code");
		orderform.shpCountryCode.focus();
		return false;
		}
		if (orderform.shpZip.value =="")
		{
		window.alert("You missed shipping  zip");
		orderform.shpZip.focus();
		return false;
		}
	}
	return true;
}
function checkordfrmgift(orderform,idcust,checkoutfirst)
{
	if (orderform.nametitle.selectedIndex == 0)
	{
		window.alert("You missed title ");
		orderform.nametitle.focus();
		return false;
	}
	if (orderform.name.value =="")
	{
	window.alert("You missed name ");
	orderform.name.focus();
	return false;
	}
	if (orderform.lastname.value =="")
	{
	window.alert("You missed last name");
	orderform.lastname.focus();
	return false;
	}
	
	if (document.orderform.email.value =="")
	{
	window.alert("You missed email");
	orderform.email.focus();
	return false;
	}
	else
	{
		if(!checkEmail(orderform.email))
			return false;
	}
	if(idcust == 0)
	{
		if (orderform.password.value =="")
		{
			window.alert("You missed password");
			orderform.password.focus();
			return false;
		}
		else
		{
			h = orderform.password.value.length;
			x = orderform.password.value;
	
			for( i=0;i<h;i++)
			{
			 
				if (  h < 6 )
				{
								alert(" Password can't be less than 6" + " characters");
								orderform.password.focus();
								orderform.password.select();
								return false;
				}
				var valid = "0123456789"
				var okn = "yes";
				var temp;
				for (var i=0; i<orderform.password.value.length; i++) 
				{
					temp = "" + orderform.password.value.substring(i, i+1);
					if(temp=="\'" || temp=="\"")
					{	
						okn = "no";
						alert("The character \',\" is not allowed in password");
						orderform.password.focus();
						orderform.password.select();
						return false;
					}
					if (valid.indexOf(temp) == "-1") 
						okn = "no";
				}
				var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
				var oka = "num";
				var temp;
				for (var i=0; i<orderform.password.value.length; i++) 
				{
					temp = "" + orderform.password.value.substring(i, i+1);
					if (valid.indexOf(temp) == "-1") 
						oka = "alp";
				}
			}
			if(okn=="yes" || oka == "num")
			{
				alert("Password should be Aplphanumeric");
				orderform.password.focus();
				orderform.password.select();
				return false;
			}
		}
		if (orderform.cpassword.value =="")
		{
		window.alert("You missed confirm password");
		orderform.cpassword.focus();
		return false;
		}
		if (orderform.cpassword.value !=orderform.password.value)
		{
		window.alert("Confirm password and password should be same");
		orderform.cpassword.value="";
		orderform.password.value="";
		orderform.password.focus();
		return false;
		}
	}
	if(checkoutfirst == 0)
	{
	//window.alert(orderform.state.value);
	
		if (orderform.address1.value =="")
		{
		window.alert("You missed address1");
		orderform.address1.focus();
		return false;
		}
		if (orderform.city.value =="")
		{
		window.alert("You missed city");
		orderform.city.focus();
		return false;
		}
		if (orderform.state.value != "" & orderform.stateCode.value != "" )
		{
		window.alert("No need to enter both state and state code");
		orderform.state.value =""
		orderform.stateCode.value=""
		orderform.state.focus();
		return false;
		}
		if (orderform.countryCode.value =="")
		{
		window.alert("You missed country code");
		orderform.countryCode.focus();
		return false;
		}
		
		if (orderform.zip.value =="")
		{
		window.alert("You missed zip");
		orderform.zip.focus();
		return false;
		}
		if (orderform.shipname.value =="")
		{
		window.alert("You missed ship name");
		orderform.shipname.focus();
		return false;
		}
		if (orderform.shiplastname.value =="")
		{
		window.alert("You missed ship last name");
		orderform.shiplastname.focus();
		return false;
		}
		if (orderform.shpAddress1.value =="")
		{
		window.alert("You missed shipping address1");
		orderform.shpAddress1.focus();
		return false;
		}
		
		if (orderform.shpCity.value =="")
		{
		window.alert("You missed shipping  city");
		orderform.shpCity.focus();
		return false;
		}
		if (orderform.shpState.value != "" & document.orderform.shpStateCode.value != "" )
		{
		window.alert("No need to enter both shipping state and state code");
		orderform.shpState.value =""
		orderform.shpStateCode.value=""
		orderform.shpState.focus();
		return false;
		}
		if (orderform.shpCountryCode.value =="")
		{
		window.alert("You missed shipping  country code");
		orderform.shpCountryCode.focus();
		return false;
		}
		
		
		
		if (orderform.shpZip.value =="")
		{
		window.alert("You missed shipping  zip");
		orderform.shpZip.focus();
		return false;
		}
	}
	return true;
}




 function assign_values(orderform,idcust,subscriber)
      {
     
       
      if(document.orderform.separateShipping.checked)
	   {
	    orderform.separateShipping.checked=true;
	    orderform.ucCustData$txtShipName.value=document.orderform.ucCustData$txtfirstname.value;
		orderform.ucCustData$txtShiplastname.value=document.orderform.ucCustData$txtlastname.value;
	    orderform.ucCustData$txtShipAddress1.value=document.orderform.ucCustData$txtaddress1.value;
		orderform.ucCustData$txtShipAddress2.value=document.orderform.ucCustData$txtaddress2.value;
		orderform.ucCustData$txtShipCity.value=document.orderform.ucCustData$txtcity.value;
		orderform.ucCustData$txtShipZip.value=document.orderform.ucCustData$txtzip.value;
		orderform.ucCustData$drpShipState.value=document.orderform.ucCustData$cmbState.value;
		orderform.ucCustData$txtOtherShipState.value=document.orderform.ucCustData$txtOtherState.value;
		orderform.ucCustData$drpShipCountry.value=document.orderform.ucCustData$cmbcountry.value;
		
		// if FOREIGN select
		if(document.orderform.ucCustData$chkCountry[1].checked) 
		{
		    orderform.ucCustData$chkCountry2[1].checked=true;
		    orderform.ucCustData$drpShipState.disabled = true;
		 
		     orderform.ucCustData$txtOtherShipState.disabled=false;
		     orderform.ucCustData$drpShipCountry.disabled=false;
		   //  orderform.RequiredFieldValidator12.disabled = true;
		   document.getElementById("ucCustData_RequiredFieldValidator12").disabled = true;
		   orderform.submit()
		   
		}
		if(document.orderform.ucCustData$chkCountry[0].checked)
		{
		    orderform.ucCustData$chkCountry2[0].checked=true;
		    orderform.ucCustData$drpShipState.disabled = false;
		    
		    orderform.ucCustData$txtOtherShipState.disabled=true;
		    //orderform.submit()
		}
		//var ss=document.getElementsByName("chkCountry");
		//alert(ss.);
		
		if(idcust != 0)
	  	{
	 
	  
			orderform.ucCustData$addresslist.selectedIndex=0;
			orderform.addresstype.checked=false;
			document.getElementById("addressbook").style.visibility='hidden';
			document.getElementById("addressbook").style.position='absolute';
	  	}
	  }
	  else
	  {
	      orderform.separateShipping.checked=false;
		  orderform.ucCustData$txtShipName.value="";
		  orderform.ucCustData$txtShiplastname.value="";
		  orderform.ucCustData$txtShipAddress1.value="";
		  orderform.ucCustData$txtShipAddress2.value="";
		  orderform.ucCustData$txtShipCity.value="";
		 // orderform.shpState.value="";
		  orderform.ucCustData$txtShipZip.value="";
		  orderform.ucCustData$drpShipState.value="";
		  orderform.ucCustData$drpShipCountry.value="US";
		  orderform.ucCustData$txtOtherShipState.value="";
	  }
	
	 
    }
	
	
	
	
	function assign_regvalues(registryform)
      {
      if(document.registryform.separateShipping.checked)
	   {
	    registryform.shpAddress1.value=document.registryform.address1.value;
		registryform.shpAddress2.value=document.registryform.address2.value;
		registryform.shpCity.value=document.registryform.city.value;
		//registryform.shpState.value=document.registryform.state.value;
		registryform.shpZip.value=document.registryform.zip.value;
		registryform.shpStateCode.value=document.registryform.stateCode.value;
		registryform.shpCountryCode.value=document.registryform.countryCode.value;
		
		
	  }
	  else
	  {
	  registryform.shpAddress1.value="";
	  registryform.shpAddress2.value="";
	  registryform.shpCity.value="";
	 // registryform.shpState.value="";
	  registryform.shpZip.value="";
	  registryform.shpStateCode.value="";
	  registryform.shpCountryCode.value="US";
	  	  
	  }
    }
	
	function checkregistryfrm(orderform)
	{
		if (orderform.regreason.selectedIndex == 0)
		{
			window.alert("You missed Reason for registry ");
			orderform.regreason.focus();
			return false;
		}
		if (orderform.regMonth.selectedIndex == 0 || orderform.regDay.selectedIndex == 0 || orderform.regYear.selectedIndex == 0 )
		{
			window.alert("You missed Date of occasion ");
			orderform.regMonth.focus();
			return false;
		}
		
		if (orderform.name.value =="")
		{
			window.alert("You missed name ");
			orderform.name.focus();
			return false;
		}
		if (orderform.lastname.value =="")
		{
			window.alert("You missed last name");
			orderform.lastname.focus();
			return false;
		}
		if (orderform.regpassword.value =="")
		{
		window.alert("You missed registry access password");
		orderform.regpassword.focus();
		return false;
		}
		if (orderform.address1.value =="")
		{
		window.alert("You missed address1");
		orderform.address1.focus();
		return false;
		}
		if (orderform.city.value =="")
		{
		window.alert("You missed city");
		orderform.city.focus();
		return false;
		}
		if (orderform.state.value != "" & orderform.stateCode.value != "" )
		{
		window.alert("No need to enter both state and state code");
		orderform.state.value =""
		orderform.stateCode.value=""
		orderform.state.focus();
		return false;
		}
		if (orderform.zip.value =="")
		{
		window.alert("You missed zip");
		orderform.zip.focus();
		return false;
		}
		
		if (orderform.countryCode.value =="")
		{
		window.alert("You missed country code");
		orderform.countryCode.focus();
		return false;
		}
		
		
		if (orderform.shpAddress1.value =="")
		{
		window.alert("You missed shipping address1");
		orderform.shpAddress1.focus();
		return false;
		}
		
		if (orderform.shpCity.value =="")
		{
		window.alert("You missed shipping  city");
		orderform.shpCity.focus();
		return false;
		}
		if (orderform.shpState.value != "" & document.orderform.shpStateCode.value != "" )
		{
		window.alert("No need to enter both shipping state and state code");
		orderform.shpState.value =""
		orderform.shpStateCode.value=""
		orderform.shpState.focus();
		return false;
		}
		if (orderform.shpZip.value =="")
		{
		window.alert("You missed shipping  zip");
		orderform.shpZip.focus();
		return false;
		}
		if (orderform.shpCountryCode.value =="")
		{
		window.alert("You missed shipping  country code");
		orderform.shpCountryCode.focus();
		return false;
		}
		return true;
	}

function checkcredit(saveorder)
{
	if (saveorder.cardNumber.value =="")
	{
		window.alert("You missed credit card number ");
		saveorder.cardNumber.focus();
		return false;
	}
		
		
	return true;
}
function validgiftpurchase(cardform,psaved,pidorder)
{
	if(psaved==1)
		cardform.action = 'orderfinalization_saved.asp?saved='+psaved+'&idOrder='+pidorder+'';
	if (cardform.cardNumber.value =="")
	{
		window.alert("You missed credit card number ");
		cardform.cardNumber.focus();
		return false;
	}
	//return checkcardcode(cardform);
	
	if(checkcardcode(cardform))
	{
		return checkbilladdr(cardform);
	}
	else
	return false;
	
	
	
}

function checkoutreg(cutR,custid,stat)
{

	if (cutR.nametitle.selectedIndex == 0)
	{
		window.alert("You missed title ");
		cutR.nametitle.focus();
		return false;
	}
	if (cutR.firstname.value =="")
	{
	window.alert("You missed first name ");
	cutR.firstname.focus();
	return false;
	}
	if (cutR.lastname.value =="")
	{
	window.alert("You missed last name");
	cutR.lastname.focus();
	return false;
	}
	
	if(custid == 0 )
	{
		if (cutR.email.value =="")
		{
		window.alert("You missed email");
		cutR.email.focus();
		return false;
		}
		else
		{
			if(!checkEmail(cutR.email))
				return false;
		}
		
		if (cutR.password.value == "")
		{
		window.alert("You missed password");
		cutR.password.focus();
		return false;
		}
		else
		{
			h = cutR.password.value.length;
			x = cutR.password.value;
	
			for( i=0;i<h;i++)
			{
			 
				if (  h < 6 )
				{
								alert(" Password can't be less than 6" + " characters");
								cutR.password.focus();
								cutR.password.select();
								return false;
				}
				var valid = "0123456789"
				var okn = "yes";
				var temp;
				for (var i=0; i<cutR.password.value.length; i++) 
				{
					temp = "" + cutR.password.value.substring(i, i+1);
					if(temp=="\'" || temp=="\"")
					{	
						okn = "no";
						alert("The character \',\" is not allowed in password");
						cutR.password.focus();
						cutR.password.select();
						return false;
					}
					if (valid.indexOf(temp) == "-1") 
						okn = "no";
				}
				var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
				var oka = "num";
				var temp;
				for (var i=0; i<cutR.password.value.length; i++) 
				{
					temp = "" + cutR.password.value.substring(i, i+1);
					if (valid.indexOf(temp) == "-1") 
						oka = "alp";
				}
			}
			if(okn=="yes" || oka == "num")
			{
				alert("Password should be Aplphanumeric");
				cutR.password.focus();
				cutR.password.select();
				return false;
			}
		}
		if (cutR.cpassword.value =="")
		{
		window.alert("You missed confirm password");
		cutR.cpassword.focus();
		return false;
		}
		if (cutR.cpassword.value !=cutR.password.value)
		{
		window.alert("Confirm password and password should be same");
		cutR.cpassword.value="";
		cutR.password.value="";
		cutR.password.focus();
		return false;
		}
	}
	if(stat == 1)
	{
		if (cutR.address1.value =="")
		{
		window.alert("You missed address1");
		cutR.address1.focus();
		return false;
		}
		if (cutR.city.value =="")
		{
		window.alert("You missed city");
		cutR.city.focus();
		return false;
		}
		if (cutR.stateCode.value == "" )
		{
		window.alert("You missed  state ");
	
		cutR.stateCode.focus();
		return false;
		}
		if (cutR.CountryCode.value =="")
		{
		window.alert("You missed country ");
		cutR.CountryCode.focus();
		return false;
		}
		
		if (cutR.zip.value =="")
		{
		window.alert("You missed zip");
		cutR.zip.focus();
		return false;
		}
	}
	return true;
}	

function checkreg(cutR,custid,stat)
{


	if (cutR.nametitle.selectedIndex == 0)
	{
		window.alert("You missed title ");
		cutR.nametitle.focus();
		return false;
	}
	if (cutR.firstname.value =="")
	{
	window.alert("You missed first name ");
	cutR.firstname.focus();
	return false;
	}
	if (cutR.lastname.value =="")
	{
	window.alert("You missed last name");
	cutR.lastname.focus();
	return false;
	}
	if (cutR.phone.value =="")
	{
	window.alert("You missed phone");
	cutR.phone.focus();
	return false;
	}
	
	
	if(custid == 0 )
	{
		if (cutR.email.value =="")
		{
		window.alert("You missed email");
		cutR.email.focus();
		return false;
		}
		else
		{
			if(!checkEmail(cutR.email))
				return false;
		}
		
		/*if (cutR.password.value == "")
		{
		window.alert("You missed password");
		cutR.password.focus();
		return false;
		}
		else
		{
			h = cutR.password.value.length;
			x = cutR.password.value;
	
			for( i=0;i<h;i++)
			{
			 
				if (  h < 6 )
				{
								alert(" Password can't be less than 6" + " characters");
								cutR.password.focus();
								cutR.password.select();
								return false;
				}
				var valid = "0123456789"
				var okn = "yes";
				var temp;
				for (var i=0; i<cutR.password.value.length; i++) 
				{
					temp = "" + cutR.password.value.substring(i, i+1);
					if(temp=="\'" || temp=="\"")
					{	
						okn = "no";
						alert("The character \',\" is not allowed in password");
						cutR.password.focus();
						cutR.password.select();
						return false;
					}
					if (valid.indexOf(temp) == "-1") 
						okn = "no";
				}
				var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
				var oka = "num";
				var temp;
				for (var i=0; i<cutR.password.value.length; i++) 
				{
					temp = "" + cutR.password.value.substring(i, i+1);
					if (valid.indexOf(temp) == "-1") 
						oka = "alp";
				}
			}
			if(okn=="yes" || oka == "num")
			{
				alert("Password should be Aplphanumeric");
				cutR.password.focus();
				cutR.password.select();
				return false;
			}
		}
		if (cutR.cpassword.value =="")
		{
		window.alert("You missed confirm password");
		cutR.cpassword.focus();
		return false;
		}
		if (cutR.cpassword.value !=cutR.password.value)
		{
		window.alert("Confirm password and password should be same");
		cutR.cpassword.value="";
		cutR.password.value="";
		cutR.password.focus();
		return false;
		}*/
	}
	if(stat == 1)
	{
		if (cutR.address1.value =="")
		{
		window.alert("You missed address1");
		cutR.address1.focus();
		return false;
		}
		if (cutR.city.value =="")
		{
		window.alert("You missed city");
		cutR.city.focus();
		return false;
		}
		if (cutR.stateCode.value == "" )
		{
		window.alert("You missed  state ");
	
		cutR.stateCode.focus();
		return false;
		}
		if (cutR.CountryCode.value =="")
		{
		window.alert("You missed country ");
		cutR.CountryCode.focus();
		return false;
		}
		
		if (cutR.zip.value =="")
		{
		window.alert("You missed zip");
		cutR.zip.focus();
		return false;
		}
	}
	return true;
}	






function checkaffi(cutR,custid,stat)
{

	
	if (cutR.firstname.value =="")
	{
	window.alert("You missed first name ");
	cutR.firstname.focus();
	return false;
	}
	if (cutR.lastname.value =="")
	{
	window.alert("You missed last name");
	cutR.lastname.focus();
	return false;
	}
	
	if(custid == 0 )
	{
		if (cutR.email.value =="")
		{
		window.alert("You missed email");
		cutR.email.focus();
		return false;
		}
		else
		{
			if(!checkEmail(cutR.email))
				return false;
		}
		
	}
	
	if (cutR.username.value =="")
	{
	window.alert("You missed user name");
	cutR.username.focus();
	return false;
	}
	
	if(stat == 1)
	{
		if (cutR.address1.value =="")
		{
		window.alert("You missed address1");
		cutR.address1.focus();
		return false;
		}
		if (cutR.city.value =="")
		{
		window.alert("You missed city");
		cutR.city.focus();
		return false;
		}
		if (cutR.stateCode.value == "" )
		{
		window.alert("You missed  state ");
	
		cutR.stateCode.focus();
		return false;
		}
		if (cutR.CountryCode.value =="")
		{
		window.alert("You missed country ");
		cutR.CountryCode.focus();
		return false;
		}
		
		if (cutR.zip.value =="")
		{
		window.alert("You missed zip");
		cutR.zip.focus();
		return false;
		}
	}
	return true;
}	


function checkmodify(modCust)
{
	/*if (modCust.nametitle.selectedIndex ==0)
	{
		window.alert("You missed title ");
		modCust.nametitle.focus();
		return false;
	}*/
	if (modCust.firstname.value =="")
	{
	window.alert("You missed first name ");
	modCust.firstname.focus();
	return false;
	}
	if (modCust.lastname.value =="")
	{
	window.alert("You missed last name");
	modCust.lastname.focus();
	return false;
	}
			
	
	if (modCust.password.value =="")
	{
	window.alert("You missed password");
	modCust.password.focus();
	return false;
	}
	else
	{
		h = modCust.password.value.length;
			x = modCust.password.value;
	
			for( i=0;i<h;i++)
			{
			 
				if (  h < 6 )
				{
								alert(" Password can't be less than 6" + " characters");
								modCust.password.focus();
								modCust.password.select();
								return false;
				}
				var valid = "0123456789"
				var okn = "yes";
				var temp;
				for (var i=0; i<modCust.password.value.length; i++) 
				{
					temp = "" + modCust.password.value.substring(i, i+1);
					if(temp=="\'" || temp=="\"")
					{	
						okn = "no";
						alert("The character \',\" is not allowed in password");
						modCust.password.focus();
						modCust.password.select();
						return false;
					}
					if (valid.indexOf(temp) == "-1") 
						okn = "no";
				}
				var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
				var oka = "num";
				var temp;
				for (var i=0; i<modCust.password.value.length; i++) 
				{
					temp = "" + modCust.password.value.substring(i, i+1);
					if (valid.indexOf(temp) == "-1") 
						oka = "alp";
				}
			}
			if(okn=="yes" || oka == "num")
			{
				alert("Password should be Aplphanumeric");
				modCust.password.focus();
				modCust.password.select();
				return false;
			}
	}
	if (modCust.cpassword.value =="")
	{
	window.alert("You missed confirm password");
	modCust.cpassword.focus();
	return false;
	}
	if (modCust.cpassword.value !=modCust.password.value)
	{
	window.alert("Confirm password and password should be same");
	modCust.cpassword.value="";
	modCust.password.value="";
	modCust.password.focus();
	return false;
	}
	if (modCust.address1.value =="")
	{
	window.alert("You missed address1");
	modCust.address1.focus();
	return false;
	}
	if (modCust.city.value =="")
	{
	window.alert("You missed city");
	modCust.city.focus();
	return false;
	}
	if (modCust.stateCode.value == "" )
	{
	window.alert("You missed state");
	modCust.stateCode.focus();
	return false;
	}
	
	if (modCust.CountryCode.value =="")
	{
	window.alert("You missed country ");
	modCust.CountryCode.focus();
	return false;
	}
	
	if (modCust.zip.value =="")
	{
	window.alert("You missed zip");
	modCust.zip.focus();
	return false;
	}

	return true;
}	
function checksaveorder(saveorder,otype)
{ 
	if(otype == 0)
	{
		var strva="";
	  	var res;
		if (saveorder.ShoppingType.value == 1)
		{
			strva="Do you want to proceed with checkout";
			res=confirm(strva);	
			if (!res)
				return false;
			if(saveorder.idPayment.value=="10")
			{	saveorder.action='giftcardpurchase.asp';
			}
		}
	  	if (saveorder.ShoppingType.value==2)
		{
			strva="Do you want to save your order";	
			res=confirm(strva);	
			if(!res){return false;}
		}
		return true;
	}
	else
	{
		if(saveorder.idPayment.value=="10")
		{	saveorder.action='save_giftcardpurchase.asp';
		}
	}
}

function windowprint(idprd)
{
window.open("/viewproductdetails.asp?idProd="+idprd+"", 'newpage','scrollbars=yes,status=no,width=690,height=600');

}
function checkemailfm(emailfm)
{
    if (emailfm.firstName.value =="")
	{
	window.alert("You missed  name ");
	emailfm.firstName.focus();
	return false;
	}
	
	 if (emailfm.email.value =="")
	{
	window.alert("You missed from email ");
	emailfm.email.focus();
	return false;
	}
	else
	{
		if(!checkEmail(emailfm.email))
			return false;
	}
	 if (emailfm.toemail.value =="")
	{
	window.alert("You missed to email ");
	emailfm.toemail.focus();
	return false;
	}
    else
	{
		if(!checkEmail(emailfm.toemail))
			return false;
	}

	
	return true;
}
function deleteproduct(idWish,currentPage)
{

   var res;	
   res=confirm("Do you want to delete this product from wishlist " );	
	if (res)
	{
	window.location.href="customerwishlist.asp?delete=yes&idWish="+idWish+"&curPage="+currentPage;
	}
}
  function windowopen1(idprd,imgw,imgh)
	{
	var imgwidth,imgheight;
	imgwidth=parseInt(imgw)+100;
	imgheight=parseInt(imgh)+150;
	//imgcolor = document.getElementById('enlarge').value
	//ext		 = document.getElementById('ext').value
	//window.open("/viewproductimage.asp?idProd="+idprd+"&color="+imgcolor+"&ext="+ext, 'newpage1','scrollbars=yes,status=no,width='+imgwidth+',height='+imgheight+'');
	window.open("/viewproductimage.asp?idProd="+idprd+"&color=&ext=", 'newpage1','scrollbars=yes,status=no,width='+imgwidth+',height='+imgheight+'');
	}
	function windowopenGIFT(idprd,imgw,imgh)
	{
	var imgwidth,imgheight;
	imgwidth=parseInt(imgw)+100;
	imgheight=parseInt(imgh)+100;
	if (parseInt(imgwidth) < 250 )
	{
	imgwidth=250;
	}
	
	window.open("/viewgiftimage.asp?idProd="+idprd+"", 'newpage1','scrollbars=no,status=no,width='+imgwidth+',height='+imgheight+'');
	
	}
	
	/*function showcouponNo(ptype,couponNo)
	{
		var i = ptype.selectedIndex;
		var v = ptype.options[i].value;
		if(v=="10")
			alert("Please do not put your Gift Certificate number on the coupon box underneath.  We will provide your area to supply Gift Certificate number on the next page!");
	}*/
	function showcouponNo(frm,subscribe)
	{
	    var pIdPayment = document.getElementById("incpayments_idPayment").value;
	    window.document.getElementById("incpayments_giftflag").value = 0;
	    
	    //wirediscount check
	    //make all wirediscount related values to 0 and cut off wire discount bak from total
	    var WireDiscount;
		if(document.getElementById("cartdetails_txtwiretransferdiscount"))
		{
		   WireDiscount = document.getElementById("cartdetails_txtwiretransferdiscount").value;
		}
		WireDiscount=WireDiscount.replace("$","");
		if(WireDiscount == "") WireDiscount = 0;
		
		var DTTotal = document.getElementById("txtOrdGdTotal").value;
		DTTotal=DTTotal.replace("$","")
		//alert(document.getElementById("txtOrdGdTotal").value + ' ' + WireDiscount)
		var newDTTotal = parseFloat(DTTotal) + parseFloat(WireDiscount);
		document.getElementById("txtOrdGdTotal").value=newDTTotal;
		document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newDTTotal);
	    //wirediscoutn portion end here
	    
			 
	    if(pIdPayment == 9) //Credit Card payment
	    {
	        frm.incpayments_cardType.disabled=false;
			frm.incpayments_cardNumber.disabled=false;
			frm.incpayments_cardcode.disabled=false;
			frm.incpayments_expMonth.disabled=false;
			frm.incpayments_ExpYear.disabled=false;
			frm.incpayments_txtgiftcardNumber.value='';
			frm.incpayments_txtgiftcardNumber.disabled=true;
			
			frm.incpayments_expMonth.value=document.getElementById("currentMonth").value;
			frm.incpayments_ExpYear.value=document.getElementById("currentYear").value;
			
			if(frm.txtVIPPoints)
			{
			    document.getElementById("divOffer").style.visibility='hidden';
			    document.getElementById("divOffer").style.position = 'absolute';
			}
			
			if(subscribe == 1)
			{
				document.getElementById("subscribe").style.position = 'static';
				document.getElementById("subscribe").style.visibility = 'visible';
			}
			frm.incpayments_cardType.focus();
			
			document.getElementById("cartdetails_txtwiretransferdiscount").value='';
			document.getElementById("divWireAmount").style.visibility='hidden';
			document.getElementById("divWireAmount").style.position = 'absolute';
			document.getElementById("divWireAmount").innerHTML=''
			
	    }
	    else if(pIdPayment=="10")//gift certificate
		{
		    frm.incpayments_txtgiftcardNumber.disabled=false;
		    frm.incpayments_txtgiftcardNumber.focus();
		    frm.incpayments_cardType.disabled=true;
			frm.incpayments_cardNumber.disabled=true;
			frm.incpayments_cardcode.disabled=true;
			frm.incpayments_expMonth.disabled=true;
			frm.incpayments_ExpYear.disabled=true;
			
			frm.incpayments_cardType.value='';
			frm.incpayments_cardNumber.value='';
			frm.incpayments_cardcode.value='';
			frm.incpayments_expMonth.value=document.getElementById("currentMonth").value;
			frm.incpayments_ExpYear.value=document.getElementById("currentYear").value;
			
			document.getElementById("cartdetails_txtwiretransferdiscount").value=''
			document.getElementById("divWireAmount").style.visibility='hidden';
			document.getElementById("divWireAmount").style.position = 'absolute';
			document.getElementById("divWireAmount").innerHTML=''
		}
		else if(pIdPayment=="12")//Wire Transfer
		{
		    frm.incpayments_cardType.disabled=true;
			frm.incpayments_cardNumber.disabled=true;
			frm.incpayments_cardcode.disabled=true;
			frm.incpayments_expMonth.disabled=true;
			frm.incpayments_ExpYear.disabled=true;
			
			frm.incpayments_cardType.value='';
			frm.incpayments_cardNumber.value='';
			frm.incpayments_cardcode.value='';
			frm.incpayments_expMonth.value=document.getElementById("currentMonth").value;
			frm.incpayments_ExpYear.value=document.getElementById("currentYear").value;
			
			frm.incpayments_txtgiftcardNumber.value='';
			frm.incpayments_txtgiftcardNumber.disabled=true;
			
			
			var pSubTotal=document.getElementById("pidsubtotal").value;
			var wirediscpercentage = document.getElementById("cartdetails_wirediscpercentage").value;
			if (wirediscpercentage == "") wirediscpercentage = 0;
			var pwiretransferdiscount = (pSubTotal / 100 * wirediscpercentage)
			
			//frm.icartdetails_txtwiretransferdiscount.value=pwiretransferdiscount;
			document.getElementById("cartdetails_txtwiretransferdiscount").value=formatCurrency(pwiretransferdiscount);
			document.getElementById("divWireAmount").style.visibility='visible';
			document.getElementById("divWireAmount").style.position = 'static';
			var wirestring="<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td ><b>Discount through Wire Transfer</b></td><td align=right><b>"+formatCurrency(pwiretransferdiscount)+"</b></td></tr></table>" 
						
			document.getElementById("divWireAmount").innerHTML=wirestring;
			DTTotal = document.getElementById("txtOrdGdTotal").value;
			DTTotal=DTTotal.replace("$","")
			newDTTotal = DTTotal - pwiretransferdiscount;
			document.getElementById("txtOrdGdTotal").value=newDTTotal;
			document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newDTTotal);	
		}
		else if(pIdPayment == "8") //VIP Points
		{
		    var VIPAmount = frm.incpayments_txtVIPAmount.value;
		    var intOrdtotal=document.getElementById("divShipGDTotal").innerHTML;
            intOrdtotal=intOrdtotal.replace("$","");
            
            frm.incpayments_cardType.value='';
			frm.incpayments_cardNumber.value='';
			frm.incpayments_cardcode.value='';
			frm.incpayments_expMonth.value=document.getElementById("currentMonth").value;
			frm.incpayments_ExpYear.value=document.getElementById("currentYear").value;
			
            if(parseFloat(VIPAmount) < parseFloat(intOrdtotal))
            {
                var balamt = parseFloat(intOrdtotal) - parseFloat(VIPAmount);                
            
                alert("Please enter your credit card information for "+ formatCurrency(balamt) +" to process order.")
            
                document.getElementById("incpayments_CCamt").value = balamt;
            
                frm.incpayments_cardType.disabled=false;
			    frm.incpayments_cardNumber.disabled=false;
			    frm.incpayments_cardcode.disabled=false;
			    frm.incpayments_expMonth.disabled=false;
			    frm.incpayments_ExpYear.disabled=false;
			    
			    document.getElementById("incpayments_giftflag").value = 2;
			    frm.incpayments_cardType.focus();
            }
            else
            {
                frm.incpayments_cardType.disabled=true;
			    frm.incpayments_cardNumber.disabled=true;
			    frm.incpayments_cardcode.disabled=true;
			    frm.incpayments_expMonth.disabled=true;
			    frm.incpayments_ExpYear.disabled=true;
            }
            frm.incpayments_txtgiftcardNumber.value='';
			frm.incpayments_txtgiftcardNumber.disabled=true;
		}
	}
	function showcouponNo_old(frm,subscribe)
	{
	
	//alert(frm.name);
	//frm=eval(frm.name);
		var i = document.getElementById("incpayments_idPayment").value;
			
		if(i=="10" || i=="8")
		{//alert(frm.name);
			frm.cardType.disabled=true;
			frm.cardNumber.disabled=true;
			frm.cardcode.disabled=true;
			frm.expMonth.disabled=true;
			frm.ExpYear.disabled=true;
			if(i=="10")
			{
			    frm.txtgiftcardNumber.disabled=false;
			    frm.txtgiftcardNumber.focus();
			    if(frm.txtVIPPoints)
			    {
			        document.getElementById("divOffer").style.visibility='hidden';
			        document.getElementById("divOffer").style.position = 'absolute';
			    }
			}
			else if(i == "8")
			{
			
			    if(frm.txtVIPPoints)
			    {
			        document.getElementById("divOffer").style.visibility='visible';
			        document.getElementById("divOffer").style.position = 'static';
			    }
			    frm.txtgiftcardNumber.disabled=true;
			    frm.txtgiftcardNumber.value='';
			}
			frm.cardNumber.value='';
			frm.cardcode.value='';
			frm.expMonth.selectedIndex=0;
			frm.ExpYear.selectedIndex=0;
			if(subscribe == 1)
			{
				document.getElementById("subscribe").style.visibility = 'hidden';
				document.getElementById("subscribe").style.position = 'absolute';
			}
			
			frm.txtbillname.disabled=true;
			frm.txtbillmiddlename.disabled=true;
			frm.txtbilllastname.disabled=true;
			frm.txtbillAddress1.disabled=true;
			frm.txtbillAddress2.disabled=true;
			frm.txtbillCity.disabled=true;
			frm.txtbillStatecode.disabled=true;
			frm.txtbillZip.disabled=true;
			frm.txtbillCountrycode.disabled=true;
			
			
			
			//frm.giftcardmessage.disabled=false;
			//frm.specialinstruction.disabled=true;
		}			
		else if(i == "12")
		{//frm=eval(frm.name);
	
			frm.cardType.disabled=true;
			frm.cardNumber.disabled=true;
			frm.cardcode.disabled=true;
			frm.expMonth.disabled=true;
			frm.ExpYear.disabled=true;
			frm.txtgiftcardNumber.disabled=true;
			frm.txtgiftcardNumber.value='';
			
			if(frm.txtVIPPoints)
			{
			    document.getElementById("divOffer").style.visibility='hidden';
			    document.getElementById("divOffer").style.position = 'absolute';
			}
			frm.txtbillname.disabled=false;
			frm.txtbillmiddlename.disabled=false;
			frm.txtbilllastname.disabled=false;
			frm.txtbillAddress1.disabled=false;
			frm.txtbillAddress2.disabled=false;
			frm.txtbillCity.disabled=false;
			frm.txtbillStatecode.disabled=false;
			frm.txtbillZip.disabled=false;
			frm.txtbillCountrycode.disabled=false;
			if(subscribe == 1)
			{
				document.getElementById("subscribe").style.position = 'static';
				document.getElementById("subscribe").style.visibility = 'visible';
			}
			frm.cardType.focus();
			//frm.giftcardmessage.disabled=true;
			//frm.specialinstruction.disabled=false;
		}
		
		else 
		{//frm=eval(frm.name);
	
			frm.incpayments_cardType.disabled=false;
			frm.incpayments_cardNumber.disabled=false;
			frm.incpayments_cardcode.disabled=false;
			frm.incpayments_expMonth.disabled=false;
			frm.incpayments_ExpYear.disabled=false;
			frm.incpayments_txtgiftcardNumber.disabled=true;
			frm.incpayments_txtgiftcardNumber.value='';
			
			if(frm.txtVIPPoints)
			{
			    document.getElementById("divOffer").style.visibility='hidden';
			    document.getElementById("divOffer").style.position = 'absolute';
			}
			
			if(subscribe == 1)
			{
				document.getElementById("subscribe").style.position = 'static';
				document.getElementById("subscribe").style.visibility = 'visible';
			}
			frm.incpayments_cardType.focus();
			//frm.giftcardmessage.disabled=true;
			//frm.specialinstruction.disabled=false;
		}
	}
	function checkpayment(payment,otype,subscribe)
	{ 

	
	    payment=eval(payment.name);
			if(payment.idPayment.value=="10")
		{	//saveorder.action='save_giftcardpurchase.asp';
			if (payment.txtgiftcardNumber.value =="")
			{
				window.alert("You missed gift certificate number ");
				payment.txtgiftcardNumber.focus();
				return false;
			}
			
			if (payment.txtgiftcardNumber.value.length !=15)
			{
				window.alert("Your gift certificate number is wrong!! ");
				payment.txtgiftcardNumber.focus();
				payment.txtgiftcardNumber.select();
				return false;
			}
		}
		else if(payment.idPayment.value=="9")
		{
			if (payment.cardNumber.value =="")
			{
				window.alert("You missed credit card number ");
				payment.cardNumber.focus();
				return false;
			}
			//return checkcardcode(payment);
			if(checkcardcode(payment))
			{
				return checkbilladdr(payment);
			}
			else
			return false;
			
		}
		/*if(subscribe == 1)
		{
			var level=0
			if(payment.level1.checked) level = level + 1
			if(payment.level2.checked) level = level + 1
			if(payment.level3.checked) level = level + 1
			if(payment.level4.checked) level = level + 1
			if(level > 1)
			{
					window.alert("You can not subscribe multiple levels");
					payment.level1.focus();
					return false;
					
			}
		}*/
	}
	
	
//payment form checking, otype=0 from payments page, 2 from paymetnverificationpage	
	function checkpayments(payment,otype)
	{ 
	//alert("Reach here");
        if(otype == 0)
        {
    	    if(window.payment.idPayment.value=="10")
		    {	
			    if (window.payment.txtgiftcardNumber.value =="")
			    {
				    window.alert("You missed gift certificate number ");
				    window.payment.txtgiftcardNumber.focus();
				    return false;
			    }
    			
			    if (window.payment.txtgiftcardNumber.value.length !=15)
			    {
				    window.alert("Your gift certificate number is wrong!! ");
				    window.payment.txtgiftcardNumber.focus();
				    window.payment.txtgiftcardNumber.select();
				    return false;
			    }
    			
		    }
		    else if(window.payment.idPayment.value=="9")
		    {
			    if (window.payment.cardNumber.value =="")
			    {
				    window.alert("You missed credit card number ");
				    window.payment.cardNumber.focus();
				    return false;
			    }
			    //return checkcardcode(payment);
			    if(checkcardcode(payment))
			    {
				    return checkbilladdr(payment);
			    }
			    else
			    return false;
    			
		    }
		}
		else if(otype==2) //from paymentverification, wrote 2 function as no need to check paymetn type
		{
		    if (window.document.payment.cardNumber.value =="")
		    {
			    window.alert("You missed credit card number ");
			    window.document.payment.cardNumber.focus();
			    return false;
		    }
		    if(checkcardcode(payment))
		    {
			    return checkbilladdr(payment);
		    }
		    else
		    return false;
		}
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	function checkpaymentgift(payment,otype)
	{ 
			if (paymentgift.cardNumber.value =="")
			{
				window.alert("You missed credit card number ");
				paymentgift.cardNumber.focus();
				return false;
			}
			//return checkcardcode(payment);
			if(checkcardcode(paymentgift))
			{
				return checkbilladdr(paymentgift);
			}
			else
				return false;
			
	}
	function checkEmail(emailAddr)
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailAddr.value))
		{
			return (true)
		}
		alert("Invalid E-mail Address! Please re-enter.")
		emailAddr.focus();
		emailAddr.select();
		return false;
	}
	
	
	
	
	/*for event registration*/
	function checkregEvent(cutR)
	{
	if (cutR.nametitle.selectedIndex == 0)
	{
		window.alert("You missed title ");
		cutR.nametitle.focus();
		return false;
	}
	if (cutR.firstname.value =="")
	{
	window.alert("You missed first name ");
	cutR.firstname.focus();
	return false;
	}
	if (cutR.lastname.value =="")
	{
	window.alert("You missed last name");
	cutR.lastname.focus();
	return false;
	}
	
	
	if (cutR.email.value =="")
	{
	window.alert("You missed email");
	cutR.email.focus();
	return false;
	}
	else
	{
		if(!checkEmail(cutR.email))
			return false;
	}
	
	if (cutR.address1.value =="")
	{
	window.alert("You missed address1");
	cutR.address1.focus();
	return false;
	}
	if (cutR.city.value =="")
	{
	window.alert("You missed city");
	cutR.city.focus();
	return false;
	}
	if (cutR.state.value == "" && cutR.stateCode.value == "" )
	{
		window.alert("You missed state");
		cutR.stateCode.focus();
		return false;
	}
	if (cutR.state.value != "" && cutR.stateCode.value != "" )
	{
	window.alert("No need to enter both state and other state ");
	cutR.state.value =""
	cutR.stateCode.value=""
	cutR.state.focus();
	return false;
	}
	if (cutR.CountryCode.value =="")
	{
	window.alert("You missed country ");
	cutR.CountryCode.focus();
	return false;
	}
	
	if (cutR.zip.value =="")
	{
	window.alert("You missed zip");
	cutR.zip.focus();
	return false;
	}
	
		if (cutR.occasion.value =="")
	{
	window.alert("You missed occasion");
	cutR.occasion.focus();
	return false;
	}
		if (cutR.occasiondate.value =="")
	{
	window.alert("You missed occasiondate");
	cutR.occasiondate.focus();
	return false;
	}
			
	
	
	return true;
}	


function deleteevent(idWish,currentPage)
{
   var res;	
   res=confirm("Do you want to delete this person " );	
	if (res)
	{
	window.location.href="viewevents.asp?delete=yes&idWish="+idWish+"&curPage="+currentPage;
	}
}
function loadAddress(orderform)
{
	orderform.action='';
	orderform.submit();
	
}

function setcolorimg(i,ext,imgcolor,fileexists)
{
	if(ext != "m")
		if (fileexists == "True" )
		{
			window.opener.document.addtocartfm.productcolor.value=i;//+"~"+ext;
			window.close();
		}
		else
		{
			document.addtocartfm.productcolor.value=i;
		}
	else
		window.opener.document.addtocartfm.productcolor.value=i;
}
function showaddress(ptype)
{
	if (ptype == "a")
	{
		document.getElementById("addressbook").style.visibility='visible';
		document.getElementById("addressbook").style.position='static';
		document.orderform.separateShipping.checked = false;
	}

}
function openccinfo()
{
	window.open('/cc-info.asp','Learnmore','scrollbars=yes,status=no,width=700,height=600');
}
function checkcardcode(frm)
{
	if(frm.incpayments_cardType.value != "Discover")
	{
	if (frm.incpayments_cardcode.value =="" )
	{
		window.alert("You missed security code");
		frm.incpayments_cardcode.focus();
		return false;
	}
	}
	if(frm.incpayments_cardType.value == "A" && frm.incpayments_cardcode.value.length != 4 )
	{
		window.alert("CC security code should be 4 digit");
		frm.incpayments_cardcode.focus();
		return false;
	}
	if(frm.incpayments_cardType.value == "M" && frm.incpayments_cardcode.value.length != 3 )
	{
		window.alert("CC security code should be 3 digit");
		frm.incpayments_cardcode.focus();
		return false;
	}
	if(frm.incpayments_cardType.value == "V" && frm.incpayments_cardcode.value.length != 3 )
	{
		window.alert("CC security code should be 3 digit");
		frm.incpayments_cardcode.focus();
		return false;
	}
	return true;
}

function loginforum()
{
	document.frmForum.submit();
}
function windowopenphoto(imagename,imgw,imgh,id)
{
var imgwidth,imgheight;
imgwidth=parseInt(imgw)+50;
imgheight=parseInt(imgh)+110;
window.open("viewphoto.asp?id="+id+"&filename="+imagename+"&width="+imgwidth+"&height="+imgheight+"", 'newpage1','scrollbars=yes,status=no,width='+imgwidth+',height='+imgheight+'');
}
function checkaffusr(custlog)
{
	if (custlog.username.value =="")
	{
		window.alert("You missed user name");
		custlog.username.focus();
		return false;
	}
	if (custlog.password.value =="")
	{
		window.alert("You missed  password");
		custlog.password.focus();
		return false;
	}
	return true;
}
function windowopen12(pagename,idprd,imgw,imgh)
{
	var imgwidth,imgheight;
	imgwidth=parseInt(imgw)+100;
	imgheight=parseInt(imgh)+180;
	if (parseInt(imgwidth) < 250 )
	{
	imgwidth=350;
	}
	
	window.open(pagename, 'newpage1','resizable=yes,scrollbars=no,status=no,width='+imgwidth+',height='+imgheight+'');
	
}


function checkbilladdr(orderform)
{

	if(!window.document.getElementById("ucCustData_chkSkipBilling").checked)
	{
	    if (window.document.getElementById("ucCustData_txtfirstname").value == "" )
	    {
	    window.alert("You missed name ");
	    window.document.getElementById("ucCustData_txtfirstname").focus();
	    return false;
	    }
	    if (window.document.getElementById("ucCustData_txtlastname").value =="")
	    {
	    window.alert("You missed last name");
	    window.document.getElementById("ucCustData_txtlastname").focus();
	    return false;
	    }
	    if(window.document.getElementById("ucCustData_txtNewEmail"))
	    {
	        if (window.document.getElementById("ucCustData_txtNewEmail").value =="")
	        {
	        window.alert("You missed email");
	        window.document.getElementById("ucCustData_txtNewEmail").focus();
	        return false;
	        }
	    }
	    if (window.document.getElementById("ucCustData_txtaddress1").value =="")
	    {
	    window.alert("You missed address1");
	    window.document.getElementById("ucCustData_txtaddress1").focus();
	    return false;
	    }
	    
	    
	    if (window.document.getElementById("ucCustData_txtcity").value =="")
	    {
	    window.alert("You missed city");
	    window.document.getElementById("ucCustData_txtcity").focus();
	    return false;
	    }
	    
	    if (window.document.getElementById("ucCustData_txtphone").value =="")
	    {
	    window.alert("You missed Phone");
	    window.document.getElementById("ucCustData_txtphone").focus();
	    return false;
	    }
	    
	    
	    
	    if(window.document.getElementById("ucCustData_chkCountry_0").checked)
	    {
	        if (window.document.getElementById("ucCustData_cmbState").value == "")
	        {
	        window.alert("You missed state");
	        window.document.getElementById("ucCustData_cmbState").focus();
	        return false;
	        }
	    }
	    else
	    {
	        if (window.document.getElementById("ucCustData_txtOtherState").value == "")
	        {
	        window.alert("You missed state");
	        window.document.getElementById("ucCustData_txtOtherState").focus();
	        return false;
	        }
	    }
	    if (window.document.getElementById("ucCustData_txtzip").value == "" )
	    {
	    window.alert("You missed zip code");
	    window.document.getElementById("ucCustData_txtzip").focus();
	    return false;
	    }
	    if (window.document.getElementById("ucCustData_cmbcountry").value =="")
	    {
	    window.alert("You missed country code");
	    window.document.getElementById("ucCustData_cmbcountry").focus();
	    return false;
	    }
	}
	return true
}

//********************function to check ship address
function checkshipaddress(orderform)
{

	if (window.document.getElementById("ucCustData_txtShipName").value == "" )
	{
	window.alert("You missed shipping name ");
	window.document.getElementById("ucCustData_txtShipName").focus();
	return false;
	}
	if (window.document.getElementById("ucCustData_txtShiplastname").value =="")
	{
	window.alert("You missed shipping last name");
	window.document.getElementById("ucCustData_txtShiplastname").focus();
	return false;
	}
	if (window.document.getElementById("ucCustData_txtShipAddress1").value =="")
	{
	window.alert("You missed shipping address1");
	window.document.getElementById("ucCustData_txtShipAddress1").focus();
	return false;
	}
	
	
	if (window.document.getElementById("ucCustData_txtShipCity").value =="")
	{
	window.alert("You missed shipping city");
	window.document.getElementById("ucCustData_txtShipCity").focus();
	return false;
	}
	
	if (window.document.getElementById("ucCustData_txtShipphone").value =="")
	{
	window.alert("You missed shipping phone");
	window.document.getElementById("ucCustData_txtShipphone").focus();
	return false;
	}
	
	
	
	if(window.document.getElementById("ucCustData_chkCountry2_0").checked)
	{
	    if (window.document.getElementById("ucCustData_drpShipState").value == "")
	    {
	    window.alert("You missed shipping state");
	    window.document.getElementById("ucCustData_drpShipState").focus();
	    return false;
	    }
	}
	else
	{
	    if (window.document.getElementById("ucCustData_txtOtherShipState").value == "")
	    {
	    window.alert("You missed shipping state");
	    window.document.getElementById("ucCustData_txtOtherShipState").focus();
	    return false;
	    }
	}
	if (window.document.getElementById("ucCustData_txtShipZip").value == "" )
	{
	window.alert("You missed shipping zip code");
	window.document.getElementById("ucCustData_txtShipZip").focus();
	return false;
	}
	if (window.document.getElementById("ucCustData_drpShipCountry").value =="")
	{
	window.alert("You missed shipping country code");
	window.document.getElementById("ucCustData_drpShipCountry").focus();
	return false;
	}
	return true
}
//************************
function  viewgiftcard(idGiftTrans,curpage,searchfrom,searchto)
{
window.open("giftcertificate.asp?idTrans="+idGiftTrans+"",'newpage','scrollbars=no,status=no,width=925,height=500');
}

function  viewgiftcardnew(idGiftTrans)
{
window.open("view-giftcertificate.aspx?idTrans="+idGiftTrans+"",'newpage','scrollbars=no,status=no,width=925,height=500');
}

function checknorequest()
{
    if (document.requestfm.firstName.value =="")
	{
	window.alert("You missed First Name ");
	document.requestfm.firstName.focus();
	return false;
	}
	if (document.requestfm.lastName.value =="")
	{
	window.alert("You missed Last Name ");
	document.requestfm.lastName.focus();
	return false;
	}
	 if (document.requestfm.email.value =="")
	{
	window.alert("You missed Email ");
	document.requestfm.email.focus();
	return false;
	}
	else
	{
		if(!checkEmail(document.requestfm.email))
			return false;
	}
	if (document.requestfm.details.value =="")
	{
	window.alert("You missed Details ");
	document.requestfm.details.focus();
	return false;
	}

	
	return true;
}
function windowimage(imageurl,color)
{
	//var win = window.open("/viewcolorimg.asp?imgurl="+imageurl+"&color="+color+"", 'newpage1','scrollbars=yes,status=yes,width=400,height=400');
	window.open("/viewcolorimg.asp?imgurl="+imageurl+"&color="+color+"", 'newpage1','scrollbars=yes,status=yes,width=400,height=400');
}


function viewPackFile(idProduct)
{
	window.open("/viewproductpackage.asp?idProd="+idProduct+"", 'newpage1','scrollbars=yes,status=yes');
}

function Image3_onclick(idprd)
 {
window.open("/printproductdetails.aspx?idProd="+idprd+"", 'newpage','scrollbars=yes,status=no,width=690,height=600');
}
function Image2_onclick(idprd) 
{
window.location.href="/addtowishlist.aspx?Productno=" + idprd + "";
}

function Image1_onclick(idprd)
{
 window.location.href="/emailtoafriend.aspx?Productno=" + idprd + "";
}
 
function Image4_onclick(idprd)
{
 window.location.href="/add-product-to-occasion.aspx?pno=" + idprd + "";
}
function windowopen1(idprd,imgw,imgh)
{
	var imgwidth,imgheight;
	imgwidth=parseInt(imgw)+100;
	imgheight=parseInt(imgh)+150;
	window.open("/viewproductimage.aspx?idProd="+idprd+"&color=&ext=", 'newpage1','scrollbars=yes,status=no,width='+imgwidth+',height='+imgheight+'');
}
function windowhelp(filename)
{
window.open("/"+ filename +"?color=&ext=", 'newpage1','scrollbars=yes,status=no,width=400,height=500');
}
//function albox(clk)
//{
//    var f=window.document.cartdet;
//	var e = f.elements;
//    var l = ( typeof(e.length) == "undefined") ? 0 : e.length;
//    var iCount = 0;
//    for(i=0;i<l;i++)
//    {
//        if(e[i].type == "checkbox" && e[i].name.indexOf("chkdel") !=-1)
//		{
//		    if(clk.checked==true)
//			{
//				e[i].checked=true;
//			}
//			else
//			{
//				e[i].checked=false;
//			}
//        }
//	} 
//}
function albox(clk)
{
    var f=window.document.cartdet;
	var e = f.chkdel;
    var l = ( typeof(e.length) == "undefined") ? 0 : e.length;
    var iCount = 0;
    if(l == 0)
    {
        if(clk.checked==true)
		{
			e.checked=true;
		}
		else
		{
			e.checked=false;
		}
    }
    for(i=0;i<l;i++)
    {
	    if(clk.checked==true)
		{
			e[i].checked=true;
		}
		else
		{
			e[i].checked=false;
		}
	} 
}
//function albox1(clk)
//{
//    var f=window.document.cartdet;
//	var e = f.elements;
//    var l = ( typeof(e.length) == "undefined") ? 0 : e.length;
//    var iCount = 0;
//    for(i=0;i<l;i++)
//    {
//        if(e[i].type == "checkbox" && e[i].name.indexOf("chkgiftwrap") !=-1)
//		{
//		    if(clk.checked==true)
//			{
//				e[i].checked=true;
//			}
//			else
//			{
//				e[i].checked=false;
//			}
//        }
//	} 
//}
function albox1(clk)
{
    var f=window.document.cartdet;
	var e = f.chkgiftwrap;
    var l = ( typeof(e.length) == "undefined") ? 0 : e.length;
    var iCount = 0;
    if(l == 0)
    {
        if(clk.checked==true)
		{
			e.checked=true;
		}
		else
		{
			e.checked=false;
		}
    }
    for(i=0;i<l;i++)
    {
	    if(clk.checked==true)
		{
			e[i].checked=true;
		}
		else
		{
			e[i].checked=false;
		}
	} 
}

function albox2(clk)
		
		{
		
			var f=window.document.wishlist;
			 var e = f.elements;
var l = ( typeof(e.length) == "undefined") ? 0 : e.length;
var iCount = 0;

for(i=0;i<l;i++)
    {
   
    if(e[i].type == "checkbox" && e[i].name.indexOf("chkdel") !=-1)
		  {
			if(clk.checked==true)
				{
					e[i].checked=true;
				}
			else
				{
					e[i].checked=false;
				}
			 	
		  }
		  } 
		  
     }




function deletecustomer()
{
  
	var elemsval,elemsval1,bidelem
		bidelem=""
			var f=window.document.cartdet;
			 var e = f.elements;
var l = ( typeof(e.length) == "undefined") ? 0 : e.length;
var iCount = 0;
var j=2
var m=0
for(i=0;i<l;i++)
    {//alert(e[i].type);
      
    if(e[i].type == "checkbox")
		  {
			 if(e[i].checked)  
				{
					
					iCount++;
					//alert(f.elements[i].name.indexOf("chk"));
					
		  } 
		  
     }
     } 
if(iCount == 0 )
  {
  //alert("Please select items to delete!");
  return false;
  }
 else 
	{
		
		return confirm("You have selected to delete shipaddress(s) . Please click Ok to confirm.");
    }

}

function visible1()
{
    if (window.document.getElementById("btnplus").value=='+')
    {
        window.document.getElementById("divproduct").style.visibility='hidden';
        window.document.getElementById("btnplus").value="-";
    }
    else if (window.document.getElementById("btnplus").value=='-')
    {
        window.document.getElementById("divproduct").style.visibility='visible';
        window.document.getElementById("btnplus").value="+";
    }
}
function checkqty(chkSize)
{
    if (document.viewproduct.txtquantity.value == "")
    {
        alert("Missed Quantity");
        document.viewproduct.txtquantity.focus();
        document.viewproduct.txtquantity.select();
        return false;
    }
     if (document.viewproduct.txtquantity.value == "0")
    {
        alert("Quantity Should be greater than zero");
        document.viewproduct.txtquantity.focus();
        document.viewproduct.txtquantity.select();
        return false;
    }
    if (isNaN(document.viewproduct.txtquantity.value))
    {
        alert("Quantity should be numeric");
        document.viewproduct.txtquantity.focus();
        document.viewproduct.txtquantity.select();
        return false;
    } 
    if(chkSize==1)
    {
    
         if (document.viewproduct.drpRingSize.value == "")
         {
            alert("Missed Size");
            document.viewproduct.drpRingSize.focus();
            return false;
         }
    
    }
    
    
    
}

function showcartdiv()
{
    window.document.getElementById("cartdiv").style.visibility='visible';
    //window.document.getElementById("cartdiv").style.position='static';
}
function hidecartdiv()
{
    if(window.document.getElementById("cartdiv"))
    {
        window.document.getElementById("cartdiv").style.visibility='hidden';
        window.document.getElementById("cartdiv").style.position='absolute';
    }
}


function checkcustomcart(frm,nsize)
{
    if(nsize == 1)
    {
        if(frm.drpSize.value="")
        {
            alert("You missed size");
            frm.drpSize.focus();
            return false;
        }
    }
}

function changeshipdiv()
{
    shipdiv = window.document.getElementById("shipinfo")
    shipimg = window.document.getElementById("shipimg")
    
    if(shipdiv.style.visibility == 'visible')
    {
        shipdiv.style.visibility = 'hidden';
        shipimg.src = '/images/plus.gif';
    }
    else
    {
        shipdiv.style.visibility = 'visible';
        shipimg.src = '/images/minus.gif';
    }
}

function changeproddiv()
{
    proddiv = window.document.getElementById("proddetailsdiv")
    prodimg = window.document.getElementById("proddetimg")
    
    if(proddiv.style.visibility == 'visible')
    {
        proddiv.style.visibility = 'hidden';
        proddiv.style.position = 'absolute';
        prodimg.src = '/images/plus.gif';
    }
    else
    {
        proddiv.style.visibility = 'visible';
        proddiv.style.position = 'static';
        prodimg.src = '/images/minus.gif';
    }
}
function changerepdiv()
{
    repdiv = window.document.getElementById("prodrepdiv")
    repimg = window.document.getElementById("repimg")
    
    if(repdiv.style.visibility == 'visible')
    {
        repdiv.style.visibility = 'hidden';
        repdiv.style.position = 'absolute';
        repimg.src = '/images/plus.gif';
    }
    else
    {
        repdiv.style.visibility = 'visible';
        repdiv.style.position = 'static';
        repimg.src = '/images/minus.gif';
    }
}
function changereldiv()
{
    horozontaldiv = window.document.getElementById("relatedprodhor")
    verticaldiv = window.document.getElementById("relatedprodver")
    relimg = window.document.getElementById("relimg")
    
    if(horozontaldiv.style.visibility == 'visible')
    {
        horozontaldiv.style.visibility = 'hidden';
        horozontaldiv.style.position = 'absolute';
        verticaldiv.style.visibility = 'visible';
        verticaldiv.style.position = 'static';
        relimg.src = '/images/minus.gif';
    }
    else
    {
        horozontaldiv.style.visibility = 'visible';
        horozontaldiv.style.position = 'static';
        verticaldiv.style.visibility = 'hidden';
        verticaldiv.style.position = 'absolute';
        relimg.src = '/images/plus.gif';
    }
}
////
function changetextdiv()
{
    horozontaldiv = window.document.getElementById("textInforhor")
    verticaldiv = window.document.getElementById("textInforver")
    relimg = window.document.getElementById("caltextimg")
    
    if(horozontaldiv.style.visibility == 'visible')
    {
        horozontaldiv.style.visibility = 'hidden';
        horozontaldiv.style.position = 'absolute';
        verticaldiv.style.visibility = 'visible';
        verticaldiv.style.position = 'static';
        relimg.src = '/images/minus.gif';
    }
    else
    {
        horozontaldiv.style.visibility = 'visible';
        horozontaldiv.style.position = 'static';
        verticaldiv.style.visibility = 'hidden';
        verticaldiv.style.position = 'absolute';
        relimg.src = '/images/plus.gif';
    }
}
//////



function changerevdiv()
{
    horozontaldiv = window.document.getElementById("reviewdivshort")
    verticaldiv = window.document.getElementById("reviewdivexpand")
    revimg = window.document.getElementById("revimg")
    
    if(horozontaldiv.style.visibility == 'visible')
    {
        horozontaldiv.style.visibility = 'hidden';
        horozontaldiv.style.position = 'absolute';
        verticaldiv.style.visibility = 'visible';
        verticaldiv.style.position = 'static';
        revimg.src = '/images/minus.gif';
    }
    else
    {
        horozontaldiv.style.visibility = 'visible';
        horozontaldiv.style.position = 'static';
        verticaldiv.style.visibility = 'hidden';
        verticaldiv.style.position = 'absolute';
        revimg.src = '/images/plus.gif';
    }
}
function showdetail(idpr)
{   window.document.getElementById("idproduct").value = idpr;
    var arrayPageSize = getPageSize();
	Element.setHeight('overlay', arrayPageSize[1]);
	//new Effect.Appear("overlay", { duration: 0.2, from: 0.0, to: 0.8 });
    window.document.getElementById("detailsdiv"+idpr).style.visibility = 'visible';
    iwidth = window.document.getElementById("img"+idpr).width;
    iheight = window.document.getElementById("img"+idpr).height;
    window.document.getElementById("detailstab"+idpr).style.width = iwidth + 50;
    window.document.getElementById("detailstab"+idpr).style.height = iheight + 50;
    window.document.getElementById("detailsdiv"+idpr).style.width = iwidth + 50;
    window.document.getElementById("detailsdiv"+idpr).style.height = iheight + 50;
    var arrayPageSize = getPageSize();
    var arrayPageScroll = getPageScroll();
    var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 4) ;
    Element.setTop("detailsdiv"+idpr, lightboxTop);
    var lpos = arrayPageSize[0]/2 - ((iwidth)/2)
    window.document.getElementById("detailsdiv"+idpr).style.left = lpos + "px"
    //pagewidth
    //alert(arrayPageSize[0])
    //windowwidth
    //alert(arrayPageSize[2])
	Element.show("detailsdiv"+idpr);
	new Effect.Appear("detailsdiv"+idpr, { duration: 0.5, queue: 'end', afterFinish: function(){	 } });
}

function hidedetail(idpr)
{
    window.document.getElementById("detailsdiv"+idpr).style.visibility = 'hidden';
    
}
function changeimg(imgsrc,text,orgimg,path)
 {
    if(window.document.getElementById("mainimg").src != path + imgsrc)
    {
        window.document.getElementById("mainimg").src = imgsrc;
        window.document.getElementById("imgtext").innerHTML=text;
    }
    else
    {
        window.document.getElementById("mainimg").src = orgimg;
        window.document.getElementById("imgtext").innerHTML=text;
    }
 }
 function changesettingimg(imgsrc,text,no,orgimg,path)
 {
    if(window.document.getElementById("mainimg").src != path + imgsrc )
    {
        window.document.getElementById("mainimg").src = imgsrc;
        //window.document.getElementById("imgtext").style.visibility='hidden';
    }
    else
    {
        window.document.getElementById("mainimg").src = orgimg;
        //window.document.getElementById("imgtext").style.visibility='visible';
    }
 }
 function showactualimg(orgimg)
 {
    window.document.getElementById("mainimg").src = orgimg;
    window.document.getElementById("imgtext").style.visibility='visible';
 }
 
 function hidealldivs()
 {
    if(window.document.getElementById("idproduct"))
    {
        idpr = window.document.getElementById("idproduct").value;
        var divarray = window.document.getElementsByTagName('div');
        for (var i=0; i<divarray.length; i++)
        {
            var iddiv = "" + divarray[i].getAttribute('id');
            if(iddiv.indexOf('detailsdiv')>-1 && iddiv != 'detailsdiv'+idpr)
            {
                divarray[i].style.visibility='hidden';
            }
        }
        window.document.getElementById("idproduct").value='';
    }
 }
 
//function showdetaildiv(idp)
//{
//    var arrayPageSize = getPageSize();
//    document.getElementById('div'+idp).style.visibility='visible';
//    var pleft = arrayPageSize[0];
//    document.getElementById('div'+idp).style.left=(pleft-910) + 'px';
//    var arrayPageScroll = getPageScroll();
//    var ptop;
//    var scrolltop = arrayPageScroll[1];
//    
//    if(!e && window.event)
//    {
//        var e = window.event;
//        ptop = doSomething(e) - 80;
//    }
//    else
//    {
//        //var position = new Object;
//        position = document.getElementById('div'+idp).offsetTop;
//        ptop = position -80;
//    }
//    if(scrolltop=0)ptop = ptop ;
//    document.getElementById('div'+idp).style.top = ptop ;
//}
function showdetaildiv(idp)
{

    var spns=document.getElementById('tdid' + idp);
   
    spns.onmouseover=function()
    {
        var img=document.getElementById('div' + idp);
       //  alert(img);
        img.style.left=(zxcPos(this)[0]-200)+'px';
        img.style.top=(zxcPos(this)[1]-50)+'px';
        img.style.visibility='visible';
        
    }

}
function hidedetaildiv(idp)
{
    document.getElementById('div'+idp).style.visibility='hidden';
}
//get positions
function zxcPos(zxcobj)
{
    zxclft=zxcobj.offsetLeft;
    zxctop=zxcobj.offsetTop;
    while(zxcobj.offsetParent!=null)
    {
        zxcpar=zxcobj.offsetParent;
        zxclft+=zxcpar.offsetLeft;
        zxctop+=zxcpar.offsetTop;
        zxcobj=zxcpar;
    }
    return [zxclft,zxctop];
}

//get Mouse positions on IE

function doSomething(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	return posy;
	// posx and posy contain the mouse position relative to the document
	// Do something with this information
}
function showproddetaildiv(idp)
{
    var spns=document.getElementById('tdid' + idp);
   
    spns.onmousemove=function()
    {
        var img=document.getElementById('div' + idp);
       //  alert(img);
        img.style.left=(zxcPos(this)[0]-200)+'px';
        img.style.top=(zxcPos(this)[1]-50)+'px';
        img.style.visibility='visible';
        
    }

}
function hideproddetaildiv(idp)
{
//alert(idp);
    document.getElementById('div'+idp).style.visibility='hidden';
}




function checkstate(sender, args)
  {
  
  
    var stname = args.Value;    
 
      if (stname=="" && document.newsletter.cmbCountry.value=="US") 
      {
  
         args.IsValid = false;
         return;
         
      }
      else
      {
      args.IsValid = true;
      }
  }    
  function checkstatevalue(sender, args)
  {
    var stname = args.Value;
  // alert(document.custlog.cmbCountry.value);
    if(document.custlog.cmbCountry.value=="US")
    {
          if (stname=="0"  ) 
          {
             
             args.IsValid = false;            
             return;
             
          }
    }
    else
    {
        if(document.getElementById("txtOtherState").value=="" && document.custlog.cmbCountry.value!="" )
          {
          alert("You missed other state");
          document.getElementById("cmbState").selectedIndex=0
		  document.getElementById("txtOtherState").focus();
          document.getElementById("CustomValidator1").innerHTML = ""
          //args.IsValid = false;
          return false;
          }
    }
    if(document.getElementById("cmbState").value!="0" && document.getElementById("txtOtherState").value!="")
    {
     
     alert("No need to select State and Other state");
     document.getElementById("cmbState").selectedIndex=0
     document.getElementById("txtOtherState").value="";
     document.getElementById("cmbState").value==""
     return false;
    }
    return true;
  }    
  
  function skipbilling(orderfrm)
  {
    if(orderfrm.chkSkipBilling.checked==true)
    {
        orderfrm.txtfirstname.disabled = true;
		orderfrm.txtlastname.disabled = true;
	    orderfrm.txtaddress1.disabled = true;
		orderfrm.txtaddress2.disabled = true;
		orderfrm.txtcity.disabled = true;
		orderfrm.txtzip.disabled = true;
		orderfrm.cmbState.disabled = true;
		orderfrm.cmbcountry.disabled = true;
//		//document.getElementById("RequiredFieldValidator3").innerHTML = ""
//		document.getElementById("RequiredFieldValidator3").disabled=true;
//		//document.getElementById("RequiredFieldValidator4").innerHTML = ""
//		document.getElementById("RequiredFieldValidator4").disabled=true;
//		//document.getElementById("RequiredFieldValidator5").innerHTML = ""
//		document.getElementById("RequiredFieldValidator5").disabled=true;
//		//document.getElementById("RequiredFieldValidator6").innerHTML = ""
//		document.getElementById("RequiredFieldValidator6").disabled=true;
//		//document.getElementById("RequiredFieldValidator7").innerHTML = ""
//		document.getElementById("RequiredFieldValidator7").disabled=true;
	
		
    }
    else
    {
        orderfrm.txtfirstname.disabled = false;
		orderfrm.txtlastname.disabled = false;
	    orderfrm.txtaddress1.disabled = false;
		orderfrm.txtaddress2.disabled = false;
		orderfrm.txtcity.disabled = false;
		orderfrm.txtzip.disabled = false;
		orderfrm.cmbState.disabled = false;
		orderfrm.cmbcountry.disabled = false;
//		//document.getElementById("RequiredFieldValidator3").innerHTML = ""
//		document.getElementById("RequiredFieldValidator3").disabled=false;
//		//document.getElementById("RequiredFieldValidator4").innerHTML = ""
//		document.getElementById("RequiredFieldValidator4").disabled=false;
//		//document.getElementById("RequiredFieldValidator5").innerHTML = ""
//		document.getElementById("RequiredFieldValidator5").disabled=false;
//		//document.getElementById("RequiredFieldValidator6").innerHTML = ""
//		document.getElementById("RequiredFieldValidator6").disabled=false;
//		//document.getElementById("RequiredFieldValidator7").innerHTML = ""
//		document.getElementById("RequiredFieldValidator7").disabled=false;
    }
  } 
  
function Checkbillfields(sender, args)
{
//    if(!window.document.orderfrm.chkSkipBilling.checked)
//    {
        var curamt = args;
        alert(curamt.length);
        if(args.value == "")
        {
            document.getElementById("CustomValidator1").innerHTML = "You missed Address1"
            args.IsValid = false;
            return;
        }
        else
        args.IsValid = true;

//    }
//    else
//    document.getElementById("CustomValidator1").innerHTML = "";
}
//check size on quickview
//product1$show$DataGrid1$ctl00$drpRingSize
//product1$DataGrid1$ctl00$drpRingSize
function addTocartquick(idprd,chksize,idx,pageName)
{
    var grdName;
    var ctrName;
    //alert(idx)
    if (pageName=="listing" )
        grdName=idx.substring(29,-(idx.length));
    else
        grdName=idx.substring(24,-(idx.length));
    ctrName=grdName+"_drpRingSize";
    //alert(ctrName)
    if(chksize==1)
    {
        if (document.getElementById(""+ctrName+"").value=="" )
        {
            alert("Please select size");
            document.getElementById(""+ctrName+"").focus();
            showdetail(idprd);
            return false;
        }
        else
        {
            var ssize;
            ssize=document.getElementById(""+ctrName+"").value;
            window.document.location.href="/addtocart.aspx?idProduct="+ idprd +"&srsize="+ ssize;
            return false;
        }
    }
    else
    {
        window.document.location.href="/addtocart.aspx?idProduct="+idprd;
        return false;
    }
}

function gotopage(no)
{
    var frm = window.document.forms[2];
    frm.pageno.value = no;
    frm.hidNext.value='';
    frm.hidPrev.value='';
    frm.submit();
}
function ShowNext(pageNum)
{
  
    var frm = window.document.forms[2];
    frm.hidNext.value = parseInt(pageNum)+1;
    frm.hidPrev.value='';
    frm.submit();
}
function ShowPrev(pageNum)
{

    var frm = window.document.forms[2];
    if(pageNum <=0)
    {
        frm.hidPrev.value=0;
       
    }    
    else
        frm.hidPrev.value = parseInt(pageNum)-1;
    frm.hidNext.value='';
    
    frm.submit();
}

function checkSearch()
{
    if(document.getElementById("idstones").value == '' && document.getElementById("pricefrom").value == '' && document.getElementById("priceto").value == '')
    {
        alert("Please select at least 1 search criteria");
        return false;
    }
}

/*This function is using in diamond-options.aspx*/
function fnsRetDiaNav(frmpage)
{
  //  alert(frmpage);
    if(frmpage=="yes")
    {
     window.document.location.href="/diamond-search.aspx?frmpage=frm"; 
    }
    else
    {
     window.document.location.href="/diamond-search.aspx"; 
    }
    
}


/*End of the fucntions*/

/*This function is using in ring-selecting-options.aspx*/
function fnsOurInvt()
{
     window.document.location.href="/search-setting.aspx";   
}
function fnsGfsearchpage()
{
     window.document.location.href="/gfsearchpage.aspx";   
}


/*End of the fucntions*/