function displayNewFeature(cms)
{
	window.open("/show-info.asp?cms="+cms+"",'Learnmore','scrollbars=yes,status=no,width=700,height=600');
}

function newWindowPrint(idprd)
{
	window.open("/viewproductdetails.asp?idProd="+idprd+"", 'newpage','scrollbars=yes,status=no,width=690,height=600');
}

function clearNewCart(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 updateNewQty(idCart,txtqty)
{
	if(txtqty.value == "" || txtqty.value == 0)
	{
		window.alert("Sorry! Quantity can not be 0.");
		txtqty.focus();
	}
	else
	
	window.location.href ='/shopping-cart.asp?idCartRow='+idCart+'&txtqty='+txtqty.value;
}


function updateNewQty1(idCart,txtqty,txtcarton)
{
	if(txtqty.value == "" || txtqty.value == 0)
	{
		window.alert("Sorry! Quantity can not be 0.");
		txtqty.focus();
	}
	else
	if(txtcarton.value == "" || txtcarton.value == 0)
	{}
	else
	{
	window.location.href ='/shopping-cart.asp?idCartRow='+idCart+'&txtqty='+txtqty.value+'&txtcarton='+txtcarton.value;
	}
}




function updateNewQtyAdmin(idCart,txtqty,txtUnitPrice)
{
	if(txtUnitPrice.value == "" || txtUnitPrice.value == 0)
	{
		window.alert("Sorry! Unit Price can not be 0 or empty.");
		txtqty.focus();
		return false;
	}

	if(txtqty.value == "" || txtqty.value == 0)
	{
		window.alert("Sorry! Quantity can not be 0.");
		txtqty.focus();
	}
	else
		window.location.href ='/shopping-cart.asp?idCartRow='+idCart+'&txtqty='+txtqty.value+'&txtUnitPrice='+txtUnitPrice.value;
}


function updateNewQty1Admin(idCart,txtqty,txtcarton, txtUnitPrice)
{
	if(txtUnitPrice.value == "" || txtUnitPrice.value == 0)
	{
		window.alert("Sorry! Unit Price can not be 0 or empty.");
		txtqty.focus();
		return false;
	}

	if(txtqty.value == "" || txtqty.value == 0)
	{
		window.alert("Sorry! Quantity can not be 0.");
		txtqty.focus();
	}
	else
		if(txtcarton.value == "" || txtcarton.value == 0)
		{}
		else
		{
			window.location.href ='/shopping-cart.asp?idCartRow='+idCart+'&txtqty='+txtqty.value+'&txtcarton='+txtcarton.value+'&txtUnitPrice='+txtUnitPrice.value;
		}
}



function displayfeature(cms)
{
	window.open("/show-info.asp?cms="+cms+"",'Learnmore','scrollbars=yes,status=no,width=700,height=600');
}
function calcCartonCart(carton,pIdCartRow)
 {
	var fld=window.document.getElementById('CartRow' + pIdCartRow);
	var cartonfld=window.document.getElementById('txtcarton' + pIdCartRow);
	
	
	if (carton != 0)
	{
		if (Math.round(fld.value) < carton)
		{
		 alert("You can't enter a quantity less than Carton Size");
		 fld.value=carton;
		 cartonfld.value=1;
		}
		//cartonfld.value=Math.ceil(parseInt(fld.value)/parseInt(carton));
		
		else if (Math.round(fld.value) >= carton)
		{
			var remain = ((Math.round(fld.value)) % carton);
			CartonNo   = parseInt(Math.round(fld.value) / carton)
			//alert (remain);
			if (remain!=0)
				cartonfld.value=parseInt(CartonNo+1) ;
			else
				cartonfld.value=parseInt(CartonNo);
		}
	}
	fld.value=roundNumber(fld.value,2);

 }
 
function calcCarton(carton)
 {
	 document.addtocartfm.txtquantity.value=roundNumber(document.addtocartfm.txtquantity.value,2);
	
	 if(document.addtocartfm.txtquantity.value == "" || document.addtocartfm.txtquantity.value ==0)
		document.addtocartfm.txtcarton.value=0;
	 else
	 	 if (document.addtocartfm.txtquantity.value <= carton)
		 {
			 if (document.addtocartfm.txtquantity.value != carton)
			 {
		 	alert("You can't enter a quantity less than Carton Size");
			 }
		 document.addtocartfm.txtquantity.value=carton;
		 document.addtocartfm.txtcarton.value=1;
		 }
		// else if (document.addtocartfm.txtquantity.value = carton)
		 //{
		 //document.addtocartfm.txtcarton.value=1;
		 //}
		 // document.addtocartfm.txtcarton.value=Math.ceil(parseInt(document.addtocartfm.txtquantity.value)/parseInt(carton));
		 else if (document.addtocartfm.txtquantity.value > carton)
		{
			var remain = document.addtocartfm.txtquantity.value % carton;
			CartonNo   = parseFloat(document.addtocartfm.txtquantity.value) / parseFloat(carton)
			if (remain!=0)
				document.addtocartfm.txtcarton.value=parseInt(CartonNo+1) ;
			else
				document.addtocartfm.txtcarton.value=parseInt(CartonNo);
		}
		  
 }
 function roundNumber(num, dec) 
 {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
 }
 
 function calcQty(carton)
 {
	 if(document.addtocartfm.txtcarton.value == "" || document.addtocartfm.txtcarton.value ==0)
		document.addtocartfm.txtcarton.value=0;
	 else
		 document.addtocartfm.txtquantity.value=roundNumber(parseFloat(document.addtocartfm.txtcarton.value)*parseFloat(carton),2);
 }
 function calcQtyCart(carton,pIdCartRow)
 {
	var fld=window.document.getElementById('CartRow' + pIdCartRow);
	var cartonfld=window.document.getElementById('txtcarton' + pIdCartRow);

	 if(cartonfld.value == "" || cartonfld.value ==0)
		cartonfld.value=0;
	 else
		fld.value=roundNumber(parseFloat(cartonfld.value)*parseFloat(carton),2);
 }


function showlastproddetaildiv(idp)
{
    var spns=document.getElementById('tdid' + idp);
	spns.onmouseover=function()
    {
        var img=document.getElementById('div' + idp);
        img.style.left=(zxcPos(this)[0]-205)+'px';
        img.style.top=(zxcPos(this)[1]-50)+'px';
        img.style.visibility='visible';
		img.style.width=200+'px';
    }
}


function showproddetaildiv(idp)
{
    var spns=document.getElementById('tdid' + idp);
    spns.onmouseover=function()
    {
        var img=document.getElementById('div' + idp);
        img.style.left=(zxcPos(this)[0]+75)+'px';
        img.style.top=(zxcPos(this)[1]-50)+'px';
        img.style.visibility='visible';
		img.style.width=200+'px';
    }
}
function hideproddetaildiv(idp)
{
	spns=document.getElementById('tdid' + idp);
	
    spns.onmouseout=function()
    {
    document.getElementById('div'+idp).style.visibility='hidden';
	document.getElementById('div'+idp).style.width=0+'px';
	}
}
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];
}

function changerevdiv(pIdSubCat)
{
    horozontaldiv = window.document.getElementById("reviewdivshort"+pIdSubCat)
    verticaldiv = window.document.getElementById("reviewdivexpand"+pIdSubCat)
    revimg = window.document.getElementById("revimg"+pIdSubCat)

	
    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.jpg';
		horozontaldiv.style.width=0+'px';
		verticaldiv.style.width=305+'px';
    }
    else
    {
        horozontaldiv.style.visibility = 'visible';
        horozontaldiv.style.position = 'static';
        verticaldiv.style.visibility = 'hidden';
        verticaldiv.style.position = 'absolute';
        revimg.src = '/images/plus.jpg';
		verticaldiv.style.width=0+'px';
		horozontaldiv.style.width=305+'px';
    }
}
function makenumber(key,textval,maxlen)
{
	if ((key==46) ||(key==8))
		{
			return true;
		}
 	else if ( ((key>47&&key<58)||(key>95&&key<106)) && textval.length<maxlen )
	{
		if(key>95&&key<106)
		{
			key=key-48;
		}
       return true;
	}
	else
		return false;
}
/*function incqty(txtquantity)
{
	var q = parseInt(txtquantity.value);
	q = q + 1;
	if(q > 20)
		q = 20;
	txtquantity.value=q;
}
*/
function add2cart(cartfm)
{
	window.document.addtocartfm.addtocart.value='yes';
	//window.document.addtocartfm.submit();
	addtocartfn(cartfm);

}

function checkshipaddress(shipaddform)
{
    if (shipaddform.catdesc.value == "" )
    {
    window.alert("You missed title ");
    shipaddform.catdesc.focus();
    return false;
    }
    if (shipaddform.shipname.value == "" )
    {
    window.alert("You missed name ");
    shipaddform.shipname.focus();
    return false;
    }
    if (shipaddform.shiplastname.value =="")
    {
    window.alert("You missed last name");
    shipaddform.shiplastname.focus();
    return false;
    }
    if (shipaddform.shpAddress1.value =="")
    {
    window.alert("You missed address1");
    shipaddform.shpAddress1.focus();
    return false;
    }
    if (shipaddform.shpCity.value =="")
    {
    window.alert("You missed city");
    shipaddform.shpCity.focus();
    return false;
    }
   
    if (shipaddform.shpZip.value == "" )
    {
    window.alert("You missed zip code");
    shipaddform.shpZip.focus();
    return false;
    }
    if (shipaddform.shpCountryCode.value =="")
    {
    window.alert("You missed country code");
    shipaddform.shpCountryCode.focus();
    return false;
    }
	if (shipaddform.shpCountryCode.value == "US" )
	{
		 if (shipaddform.shpStateCode.value == "" )
		{
		window.alert("You missed state");
		shipaddform.shpStateCode.focus();
		return false;
		}
		return validateZip(shipaddform.shpZip);
	}

}
function validate4cart(frm,strsize)
{
	//if(strsize!= '')
	//{
		//if(frm.sizechart.value == -1)
		//{
			//alert("You have missed size");
			//frm.sizechart.focus();
			//return false;
		//}
	//}
	
	if(frm.metaltype)
	{
	    if(frm.metaltype.value == "")
	    {
	        window.alert('Please select metal type');
		    frm.metaltype.focus();
		    return false;
	    }
	}
	if(frm.sizetype)
	{
	    if(frm.sizetype.value == "")
	    {
	        window.alert('Please select size');
		    frm.sizetype.focus();
		    return false;
	    }
	}
	if(frm.txtquantity.value=='' || frm.txtquantity.value=='0')
	{
		window.alert('Quantity can not be empty/Zero');
		frm.txtquantity.focus();
		return false;
	}
	if(frm.productcolor)
	{
	    if(frm.productcolor.value == "" || frm.productcolor.value == -1)
	    {
	        window.alert('Please select color');
		    frm.productcolor.focus();
		    return false;
	    }
	}
}
function gotoAddtocart(idprd)
{
   if (window.document.getElementById("strProductColor"+idprd).value != "")
   {
	   if (window.document.getElementById("productcolor"+idprd).value == "" )
	   {
		   window.alert("You missed color");
		   return(false);
		   
	   }
   }
   
    if (window.document.getElementById("strSizechart"+idprd).value != "")
   {
	   if (window.document.getElementById("sizechart"+idprd).value == "")
	   {
		   window.alert("You missed size");
		   return(false);
		   
	   }
   }
  // window.alert('/addtocart.asp?idProduct=' + window.document.getElementById("intIdProduct"+idprd).value +'&productcolor='+ window.document.getElementById("productcolor"+idprd).value+'&sizechart=' + window.document.getElementById("sizechart"+idprd).value);
   window.document.location.href='/addtocart.asp?idProduct=' + window.document.getElementById("intIdProduct"+idprd).value +'&productcolor='+ window.document.getElementById("productcolor"+idprd).value+'&sizechart=' + window.document.getElementById("sizechart"+idprd).value
   
}
function hidealldivs()
 {
    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 showdetail(idpr) 
{   
	idpr1 = window.document.getElementById("idproduct").value;
	if(idpr1 != "")
		window.document.getElementById("detailsdiv"+idpr1).style.visibility = 'hidden';
	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 + 150;
    window.document.getElementById("detailstab"+idpr).style.height = iheight + 150;
    window.document.getElementById("detailsdiv"+idpr).style.width = iwidth + 150;
    window.document.getElementById("detailsdiv"+idpr).style.height = window.document.getElementById("detailstab"+idpr).style.height ;
    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 setdefimg(img)
{
	document.getElementById('detimage').src = "/uploadimages/" + img;
	document.getElementById('ext').value = "";
}

function windowopenimage(idprd,imgw,imgh,ino)
{
	var imgwidth,imgheight;
	imgwidth=parseInt(imgw)+100;
	imgheight=parseInt(imgh)+150;
	window.open("/viewproductimage.asp?idProd="+idprd+"&color=&ext=&ino="+ino+"", 'newpage1','scrollbars=yes,status=no,width='+imgwidth+',height='+imgheight+'');
}

function incqty()
{
	var q = parseInt(window.document.getElementById("txtquantity").value);
	q = q + 1;
	//if(q > 20)
		//q = 20;
		
	window.document.getElementById("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 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 validateDecimal(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 validateZipCode(field) 
{
	var valid = "0123456789"
	var ok = "yes";
	var temp;
	if (field.value.length>5)
	{
	    ok = "no";
	}
	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") 
	{
		//window.alert("Please enter Valid Zipcode");
		//field.value = 1;
		//field.focus();
		//field.select();
		return false;
	}
	else
	{
		return true;
	}
	//return ok;
}
function validateZip(field) 
{
	var valid = "0123456789"
	var ok = "yes";
	var temp;
	if (field.value.length != 5)
	{
	    ok = "no";
	}
	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") 
	{
		window.alert("Please enter Valid Zipcode");
		//field.value = 1;
		//field.focus();
		//field.select();
		return false;
	}
	else
	{
		return true;
	}
}
function validateText(field) 
{
	var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
	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 Letters Only");
		field.value = 1;
		field.focus();
		field.select();
		return false;
	}
}


	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=='' || searchfm.searchfield.value=='   Type a keyword' )
	{
		window.alert('Please type a keyword');
		searchfm.searchfield.select();
		searchfm.searchfield.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 decqty()
{
	var q = parseInt(window.document.getElementById("txtquantity").value);
	q = q - 1;
	if(q < 1)
		q = 1;
	window.document.getElementById("txtquantity").value=q;
}

function validateqty(txtquantity)
{
	if(txtquantity.value == "" || txtquantity.value == 0)
	{
		window.alert("Sorry! Quantity can not be 0.")
		txtquantity.focus();
		return false;
	}
	validateDecimal(txtquantity);
}
//function addtocart(idProd,txtqty,prodcolor,e)
function windowimage1(imageurl,orgimg,color)
{
	window.document.addtocartfm.productcolor.value = color;
	//window.document.getElementById("mainimg").src= "uploadimages/" + imageurl;
	//window.document.getElementById("mainimghref").href="uploadimages/OriginalProductImages/" + orgimg;
	//window.open("/viewcolorimg.asp?imgurl="+imageurl+"&color="+color+"", 'newpage1','scrollbars=yes,status=yes,width=400,height=400');
}


function addtocartfn(addtocartfm)
{
//if (document.addtocartfm.unitprice.value=="" || document.addtocartfm.unitprice.value==0)

if (document.addtocartfm.pricetype.value=="3" )
{
  if (document.addtocartfm.selsize.value=="")
  {
    alert("Please Select Price");
	//document.addtocartfm.selradio.focus();
	return(false);
  }
}

 if ((document.addtocartfm.txtquantity.value=="" && document.addtocartfm.txtcarton.value=="")||(document.addtocartfm.txtquantity.value==0 && document.addtocartfm.txtcarton.value==0)||(document.addtocartfm.txtquantity.value=="" && document.addtocartfm.txtcarton.value==0)||(document.addtocartfm.txtquantity.value==0 && document.addtocartfm.txtcarton.value=="") ||(document.addtocartfm.txtquantity.value==0) ||(document.addtocartfm.txtcarton.value==0))
  {
    alert("Please Enter Quantity/Carton Size");
	document.addtocartfm.txtquantity.focus();
	return(false);
  }
   /*if (document.addtocartfm.txtquantity.value >=1 && document.addtocartfm.txtcarton.value >= 1 )
  {
    alert("No need to Enter both Quantity and Carton Size");
	document.addtocartfm.txtquantity.focus();
	return(false);
  }*/
  
   //if ((parseFloat(document.addtocartfm.txtquantity.value) < parseFloat(document.addtocartfm.minQuantity.value)) || (parseFloat(document.addtocartfm.txtquantity.value) > parseFloat(document.addtocartfm.maxQuantity.value)))
   if  (parseFloat(document.addtocartfm.txtquantity.value) > parseFloat(document.addtocartfm.maxQuantity.value))
  {
    alert("Please Enter valid Quantity");
	document.addtocartfm.txtquantity.focus();
	return(false);
  }
  
if(document.addtocartfm.productcolor!=null && document.addtocartfm.productcolor!="undefined")
	{
 	   if (document.addtocartfm.productcolor.value==-1 || document.addtocartfm.productcolor.value=="")
 		 {
  			  alert("Please Select color");
				document.addtocartfm.productcolor .focus();
				return(false);
  		}
   }
   
   txt  = document.addtocartfm.addtocart.value;
   if(txt=="no")
   {
      return(true);
      
   }
   else 
   {
      window.document.addtocartfm.submit();
   }
}

/*{	
	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 buygiftcardnew(frm)
{
	
	if(frm.amount.value=="")
	{
		window.alert("You missed amount");
		frm.amount.focus();
		return false;
	}
	else if(frm.amount.value < 25 || frm.amount.value > 1500)
	{
		window.alert("Amount should be between 25 & 1500");
		frm.amount.focus();
		return false;
	}
	if(frm.txtquantity.value == "" || frm.txtquantity.value == 0)
	{
		window.alert("Sorry! Quantity can not be 0.")
		frm.txtquantity.focus();
		return false;
	}
	if(frm.GiftFrom.value=="")
	{
		window.alert("You missed From name");
		frm.GiftFrom.focus();
		return false;
	}
	if(frm.GiftTo.value=="")
	{
		window.alert("You missed To name");
		frm.GiftTo.focus();
		return false;
	}
	
	if (frm.GiftToEmail.value =="")
	{
		window.alert("You missed email");
		frm.GiftToEmail.focus();
		return false;
	}
	else
	{
		if(!checkEmail(frm.GiftToEmail))
			return false;
	}
	
	if(frm.amount.value=="" || frm.amount.value==0 )
	{
		window.alert("You missed amount");
		frm.amount.focus();
		return false;
	}
	else if(validateNumeric(frm.amount))
	{
		if (frm.amount.value < 25)
		{
			window.alert("Amount should be greater than $25.00");
			frm.amount.focus();
			return false;
		}
	}
	else
	//return false;
	return true;
}
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 ='/shopping-cart.asp?idCartRow='+idCart+'&txtqty='+txtqty.value;
}
function updateqty1(idCart,txtqty,txtcarton)
{
	if(txtqty.value == "" || txtqty.value == 0)
	{
		window.alert("Sorry! Quantity can not be 0.");
		txtqty.focus();
	}
	else
	if(txtcarton.value == "" || txtcarton.value == 0)
	{}
	else
	{
	window.location.href ='/shopping-cart.asp?idCartRow='+idCart+'&txtqty='+txtqty.value+'&txtcarton='+txtcarton.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;
  	}
	if(document.cartdet.pick.value == 1)
 	{
		if(document.cartdet.pickuplocation.value =="" && document.cartdet.shpStateCode.value =="")
 		{
   		alert("Please select Pickup Location or Shipping State");
		document.cartdet.shpStateCode.focus();
		return false;
		}
  	}
	else
	{
		if( document.cartdet.shpStateCode.value =="")
 		{
		alert("Please select Shipping State");
		document.cartdet.shpStateCode.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+"/pre-checkout.asp";  
				else
				{
					document.cartdet.chkchangeship.focus();
					return false;
				}
			}
			else
				saved=1;
		}
	}
	
	document.cartdet.action=path+"/pre-checkout.asp?saved="+saved; 
	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.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.email)
	{
		if (custlog.email.value =="")
		{
			window.alert("You missed email address");
			custlog.email.focus();
			return false;
		}
		else
		{
			if(!checkEmail(custlog.email))
				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.password.value =="")
		{
			window.alert("You missed  password");
			custlog.password.focus();
			return false;
		}

		return true;
}

function checkordfrm(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 (orderform.phone.value =="")
	//{
	//window.alert("You missed phone");
	//orderform.phone.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(checkoutfirst != 2 )
	{
	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;
		}
	}
}

//alert(checkoutfirst);

	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.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.stateCode.value =="")
		{
		window.alert("You missed state code");
		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 (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.shpStateCode.value =="")
		{
		window.alert("You missed shipping state code");
		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;
}

// script for checking the fields in the contact.asp form

function check(contactform)
{
   
    if (contactform.name.value =="")
	{
	    window.alert("You missed name ");
	    contactform.name.focus();
	}
	else if (contactform.Add1.value =="")
	{
	    window.alert("You missed address1");
	    contactform.Add1.focus();
	}
	else if (contactform.email.value =="")
	{
	    window.alert("You missed email");
	    contactform.email.focus();
	}
	else if(!checkEmail(contactform.email))
		{
			contactform.email.focus();
			//if(!checkEmail(contactform.email))
		}
	else if (contactform.city.value =="")
	{
	    window.alert("You missed city");
	    contactform.city.focus();
	}
	else if (contactform.stateCode.value =="")
	{
	    window.alert("You missed  state code");
	    contactform.stateCode.focus();
	}
	
	else if (contactform.zip.value =="")
	{
	    window.alert("You missed zip");
	    contactform.zip.focus();
	}
	else
	{
		contactform.pback.value="Y";
		alert("Thank you for contacting us.. One of our representatives will get back to you soon.");
		contactform.submit();
	}
}


//New script based on new check out
//used in checkout.asp
function newcheckordfrm(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.cemail.value =="")
	{
	window.alert("You missed email");
	orderform.cemail.focus();
	return false;
	}
	else
	{
		if(!checkEmail(orderform.cemail))
			return false;
	}
		if (orderform.rpassword.value =="")
		{
			window.alert("You missed password");
			orderform.rpassword.focus();
			return false;
		}
		else
		{
			h = orderform.rpassword.value.length;
			x = orderform.rpassword.value;
	
			for( i=0;i<h;i++)
			{
			 
				if (  h < 6 )
				{
								alert(" Password can't be less than 6" + " characters");
								orderform.rpassword.focus();
								orderform.rpassword.select();
								return false;
				}
				var valid = "0123456789"
				var okn = "yes";
				var temp;
				for (var i=0; i<orderform.rpassword.value.length; i++) 
				{
					temp = "" + orderform.rpassword.value.substring(i, i+1);
					if(temp=="\'" || temp=="\"")
					{	
						okn = "no";
						alert("The character \',\" is not allowed in password");
						orderform.rpassword.focus();
						orderform.rpassword.select();
						return false;
					}
					if (valid.indexOf(temp) == "-1") 
						okn = "no";
				}
				var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
				var oka = "num";
				var temp;
				for (var i=0; i<orderform.rpassword.value.length; i++) 
				{
					temp = "" + orderform.rpassword.value.substring(i, i+1);
					if (valid.indexOf(temp) == "-1") 
						oka = "alp";
				}
			}
			
			
			if(okn=="yes" || oka == "num")
			{
				alert("Password should be Aplphanumeric");
				orderform.rpassword.focus();
				orderform.rpassword.select();
				return false;
			}
		}
		
		
		if (orderform.rcpassword.value =="")
		{
		window.alert("You missed confirm password");
		orderform.rcpassword.focus();
		return false;
		}
		if (orderform.rcpassword.value !=orderform.rpassword.value)
		{
		window.alert("Confirm password and password should be same");
		orderform.rcpassword.value="";
		orderform.rpassword.value="";
		orderform.rpassword.focus();
		return false;
		}
		
		if (orderform.recaptcha_response_field.value == "") {
		    window.alert("You missed word verification code");
		    orderform.recaptcha_response_field.focus();
		    return false;
		}
		
}


//End of that function






















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)
	{
		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_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);
}
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(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 (cutR.recaptcha_response_field && cutR.recaptcha_response_field.value == "") {
    window.alert("You missed word verification code");
    cutR.recaptcha_response_field.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.state.value != "" & cutR.stateCode.value != "" )
		if (cutR.stateCode.value == "" )
		{
		//window.alert("No need to enter both state and other state ");
		//cutR.state.value =""
		//cutR.state.focus();
		window.alert("You missed state ");
		cutR.stateCode.value=""
		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.CountryCode.value == "US" )
		{
		return validateZip(cutR.zip);
		}
	}
	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.firstname.value !="")
	//{
	    //alert(modCust.firstname.value);
	    //validateText(modCust.firstname.value);
	//}
	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.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;
	}
	if (modCust.CountryCode.value == "US" )
	{
		if (modCust.stateCode.value =="")
		{
		window.alert("You missed state ");
		modCust.stateCode.focus();
		return false;
		}
		
		return validateZip(modCust.zip);
	}

	//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+'');
	
	}
	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 i = frm.idPayment.value;
		if(i=="10")
		{
			frm.cardTitle.disabled=true;
			frm.cardType.disabled=true;
			frm.cardNumber.disabled=true;
			frm.cardcode.disabled=true;
			frm.expMonth.disabled=true;
			frm.ExpYear.disabled=true;
			frm.giftcardNumber.disabled=false;
			frm.giftcardNumber.focus();
			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.giftcardmessage.disabled=false;
			//frm.specialinstruction.disabled=true;
			 document.getElementById("divGCMessage").innerHTML="";
		}			
		else
		{
			frm.cardTitle.disabled=false;
			frm.cardType.disabled=false;
			frm.cardNumber.disabled=false;
			frm.cardcode.disabled=false;
			frm.expMonth.disabled=false;
			frm.ExpYear.disabled=false;
			frm.giftcardNumber.disabled=true;
			frm.giftcardNumber.value='';
			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;
			 document.getElementById("divGCMessage").innerHTML="";
		}
	}
	function checkpayment(payment,otype,subscribe)
	{ 
		if(payment.idPayment.value=="10")
		{	//saveorder.action='save_giftcardpurchase.asp';
			if (payment.giftcardNumber.value =="")
			{
				window.alert("You missed gift certificate number ");
				payment.giftcardNumber.focus();
				return false;
			}
			
			if (payment.giftcardNumber.value.length !=15)
			{
				window.alert("Your gift certificate number is wrong!! ");
				payment.giftcardNumber.focus();
				payment.giftcardNumber.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;
			}
			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;
					
			}
		}*/
	}
	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 checkpaymentgift(payment,otype)
	{ 
			if (paymentgift.cardNumber.value =="")
			{
				window.alert("You missed credit card number ");
				paymentgift.cardNumber.focus();
				return false;
			}
			if(checkcardcode(payment))
			{
				return checkbilladdr(payment);
			}
			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;
	}
	
	
function checkcardcode(frm)
{
	
	if(frm.cardType.value != "Discover")
	{
	if (frm.cardcode.value =="" )
	{
		window.alert("You missed security code");
		frm.cardcode.focus();
		return false;
	}
	}
	
	/*if(frm.cardType.value == "Discover" && frm.cardcode.value != "" )
	{
		if (frm.cardcode.value.length != 3)
		{
		window.alert("CC security code should be 3 digit");
		frm.cardcode.focus();
		return false;
		}
	}*/
	if(frm.cardType.value == "A" && frm.cardcode.value.length != 4 )
	{
		window.alert("CC security code should be 4 digit");
		frm.cardcode.focus();
		return false;
	}
	if(frm.cardType.value == "M" && frm.cardcode.value.length != 3 )
	{
		window.alert("CC security code should be 3 digit");
		frm.cardcode.focus();
		return false;
	}
	if(frm.cardType.value == "V" && frm.cardcode.value.length != 3 )
	{
		window.alert("CC security code should be 3 digit");
		frm.cardcode.focus();
		return false;
	}
	return true;
}
	
function checkbilladdr(orderform)
{
	if (orderform.billname.value == "" )
	{
	window.alert("You missed name ");
	orderform.billname.focus();
	return false;
	}
	/*if (orderform.middlename.value =="")
	{
	window.alert("You missed middle name");
	orderform.middlename.focus();
	return false;
	}*/
	if (orderform.billlastname.value =="")
	{
	window.alert("You missed last name");
	orderform.billlastname.focus();
	return false;
	}
	if (orderform.billaddress1.value =="")
	{
	window.alert("You missed address1");
	orderform.billaddress1.focus();
	return false;
	}
	if (orderform.billcity.value =="")
	{
	window.alert("You missed city");
	orderform.billcity.focus();
	return false;
	}
	if (orderform.billstateCode.value == "" )
	{
	window.alert("You missed state code");
	orderform.billstateCode.focus();
	return false;
	}
	if (orderform.billzip.value == "" ) 
	{
	window.alert("You missed zip code");
	orderform.billzip.focus();
	return false;
	}
	if (orderform.billcountryCode.value =="")
	{
	window.alert("You missed country code");
	orderform.billcountryCode.focus();
	return false;
	}
	return true
}
	/*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,imgcolororg)
{
		
	if(ext != "m")
		document.addtocartfm.productcolor.value=i+"~"+ext;
	else
		document.addtocartfm.productcolor.value=i;
		
	if (fileexists == "True" )
	{	
		document.getElementById('enlarge').value = i;
		document.getElementById('detimage').src = '/uploadimages/'+imgcolor;
		if(ext != "m")
		document.getElementById('mainimghref').href='/uploadimages/OriginalProductImages/'+imgcolororg;
		else
		document.getElementById('mainimghref').href='/uploadimages/'+imgcolororg;
		//document.getElementById('mainimghref1').href='/uploadimages/OriginalProductImages/'+imgcolororg;
		document.getElementById('ext').value = ext;
	}
	
}
function  viewgiftcard(idGiftTrans,curpage,searchfrom,searchto)
{
window.open("giftcertificate.asp?idTrans="+idGiftTrans+"",'newpage','scrollbars=no,status=no,width=925,height=500');
}

function changeSortup(srchform)
{

document.getElementById("selsortbylo").value=document.getElementById("selsortbyup").value;

srchform.submit();

}
function changeSortlo(srchform)
{
document.getElementById("selsortbyup").value=document.getElementById("selsortbylo").value;
srchform.submit();

}



function clearfield()
{
document.newsfm.txtname.value ="";
}

function openccinfo()
{
	window.open('cc-info.asp','Learnmore','scrollbars=yes,status=no,width=700,height=600');
}


function changePricesrch(sprice,eprice)
{
   document.searchfm.hidStPricesr.value =sprice; 
   document.searchfm.hidEndPricesr.value =eprice; 
   document.searchfm.submit();
}
function changePrice(sprice,eprice)
{
   document.frmshwproducts.hidStPrice.value =sprice; 
   document.frmshwproducts.hidEndPrice.value =eprice; 
   document.frmshwproducts.submit();
   
       

}
function showaddress(ptype)
{
	if (ptype == "a")
	{
		document.getElementById("addressbook").style.visibility='visible';
		document.getElementById("addressbook").style.width=215+'px';
		document.getElementById("addressbook").style.position='static';
		document.frmCustOrder.separateShipping.checked = false;
	}

}

function showcc(ptype)
{
	if (ptype == "a")
	{
		document.getElementById("ccdiv").style.visibility='visible';
		document.getElementById("ccdiv").style.position='static';
		//document.frmCustOrder.separateShipping.checked = false;
	}

}
    
    
function fnSaveOrder()
{
	document.getElementById("ShoppingType").value=2;
	document.frmCustOrder.submit();
}
  
  function checkcreditcard(frmcreditadd)
  {
  
  if(frmcreditadd.ccTitle.value=="")
   {
        alert("You missed creditcard title");
        frmcreditadd.ccTitle.focus();
        return false;
   }
  
    if(frmcreditadd.cardType.value=="")
    {
        alert("You missed creditcard type");
        frmcreditadd.cardType.focus();
        return false;
    }
    if(frmcreditadd.ccnumber.value=="")
    {
        alert("You missed creditcard number");
        frmcreditadd.ccnumber.focus();
        return false;
    }
    /*if(frmcreditadd.cccode.value=="")
    {
        alert("You missed security code");
        frmcreditadd.cccode.focus();
        return false;
    }*/
    if(frmcreditadd.expMonth.value=="")
    {
        alert("You missed exipiry month");
        frmcreditadd.expMonth.focus();
        return false;
    }
     if(frmcreditadd.ExpYear.value=="")
    {
        alert("You missed exipiry year");
        frmcreditadd.expYear.focus();
        return false;
    }
    if(frmcreditadd.cardType.value != "Discover")
	{
	if (frmcreditadd.cccode.value =="" )
	{
		window.alert("You missed security code");
		frmcreditadd.cccode.focus();
		return false;
	}
	}
	if(frmcreditadd.cardType.value == "A" && frmcreditadd.cccode.value.length != 4 )
	{
		window.alert("CC security code should be 4 digit");
		frmcreditadd.cccode.focus();
		return false;
	}
	/*if(frmcreditadd.cardType.value == "Discover" && frmcreditadd.cccode.value.length != 3 )
	{
		window.alert("CC security code should be 3 digit");
		frmcreditadd.cccode.focus();
		return false;
	}
	if(frmcreditadd.cardType.value == "Discover" && frmcreditadd.cccode.value != "" )
	{
		if (frmcreditadd.cccode.value.length != 3)
		{
		window.alert("CC security code should be 3 digit");
		frmcreditadd.cccode.focus();
		return false;
		}
	}*/
	if(frmcreditadd.cardType.value == "M" && frmcreditadd.cccode.value.length != 3 )
	{
		window.alert("CC security code should be 3 digit");
		frmcreditadd.cccode.focus();
		return false;
	}
	if(frmcreditadd.cardType.value == "V" && frmcreditadd.cccode.value.length != 3 )
	{
		window.alert("CC security code should be 3 digit");
		frmcreditadd.cccode.focus();
		return false;
	}
	return true;
    
  }
  
  
  function fnsShowMagnifier(prdid)
  {
    	window.open("/uploadimages/OriginalProductImages/show-magnifier.asp?prdid="+prdid+"",'','scrollbars=yes,status=no,width=700,height=600');

  }

 function opensurveywin() {
     surveywin = window.open('http://www.flooringmarket.com/Survey/Survey.asp', 'survey', 'location=0,status=0,scrollbars=1,width=400,height=400,top=100,left=300');
 }