// JavaScript Document

function setPrice_bkp(){
		alert(price);
		price = 0.00;
		radio3D = 0.00;
		radioLogo = 0.00;
		radioProof = 0.00;
		price = 0.00;
		t2 = 0.00;
		var selPrice = document.getElementById("selPrice").value;
		//alert(selPrice);
		
		var PriceArray = selPrice.split("@");
		var qtyMain = parseInt(PriceArray[0]);
		var qtyPrice = PriceArray[1];
		//alert(qtyMain);
		//var qty = qtyMain / 100;
		//qty1 = qty.toFixed(2);
		alert(qtyMain+" ** "+qtyPrice);
		//alert(qty1);
		//var Netprice = eval(PriceArray[1]) * eval(qty1);
		var Netprice = eval(PriceArray[0]) * eval(PriceArray[1]);
		//alert(Netprice);
		
		
		
		
		/*var radio3D = document.form.radio3D.value;
	 	if (document.form.radio3D.checked==true)
         {
            radio3D =eval(document.form.radio3D.value);
			alert(radio3D);
         }
		 else{
		 	radio3D =0.00;
		 }*/

			for (i=0; i<document.form.radio3D.length; i++) 
      {
         if (document.form.radio3D[i].checked==true)
         {
			//alert(i);
            var radio3D = eval(document.form.radio3D[i].value);
			document.getElementById("txtRadio3D").value = i;
			//alert(radio3D);
         }
	  }
		
		for (i=0; i<document.form.radioLogo.length; i++) 
      {
         if (document.form.radioLogo[i].checked==true)
         {
            radioLogo =eval(document.form.radioLogo[i].value);
			document.getElementById("txtRadioLogo").value = i;
			//alert(radioLogo);
         }
	  }
		//var radioLogo = document.form.radioLogo.value;
		
		for (i=0; i<document.form.radioProof.length; i++) 
      {
         if (document.form.radioProof[i].checked==true)
         {
            radioProof =eval(document.form.radioProof[i].value);
			document.getElementById("txtRadioProof").value = i;
			//alert(radioProof);
         }
	}
		//var radioProof = document.form.radioProof.value;
		//alert(radioProof);
		//price = parseInt(price);
		var to = Netprice + radio3D + radioLogo + radioProof ;
		
		var tax = document.getElementById("selState").value;
		if (tax == "NY" ){
			var t1 = to / 100;
			//alert(t1);
			var t2 = t1 * 8.5;
			//alert(t2);
			var TotalPtax = to +  t2;
			//alert(TotalPtax);
		}
		else{
			TotalPtax = to;
			}
		alert(TotalPtax);
		//alert(to);
			document.getElementById("Price").innerHTML = Netprice.toFixed(2);
			document.getElementById("txtPrice").value = Netprice.toFixed(2);
			
			document.getElementById("Tax").innerHTML = t2.toFixed(2);
			document.getElementById("txtTax").value = t2.toFixed(2);
						
			document.getElementById("3dRushPrice").innerHTML = radio3D.toFixed(2);
			document.getElementById("txt3dRushPrice").value = radio3D.toFixed(2);
			
			document.getElementById("Logo").innerHTML = radioLogo.toFixed(2);
			document.getElementById("txtLogo").value = radioLogo.toFixed(2);
			
			document.getElementById("Proof").innerHTML = radioProof.toFixed(2);
			document.getElementById("txtProof").value = radioProof.toFixed(2);
			
			document.getElementById("txtNetTotal").value = to.toFixed(2);
			document.getElementById("txtTotalPrice").value = TotalPtax.toFixed(2);
			document.getElementById("TotalPrice").innerHTML = TotalPtax.toFixed(2);
		return false;
		if(to == "0"){
			document.getElementById("to").value = "";
		}
		else{
			//var val = document.getelementbyId("selPrice").value;
			//var total = selPrice+ "+" +radio3D+ "+" +radioLogo+ "+" +radioProof;
			
		}	
	}
	
function setPrice(){
	var radioLogoV = document.getElementById('radioLogo3');
	var radioLogo = document.getElementById('radioLogo4');
	var VectorlogoFile = document.getElementById('VectorlogoFile').value;
	var logoFile = document.getElementById('logoFile').value;
	//alert(radioLogo);
	
	if(document.form.selQty.value == "0"){
		alert("Select Quantity");
		return false;
		}
	else if(radioLogoV.checked == true && VectorlogoFile == ""){
			alert("Select Vector Logo File");
			return false;
			}	
	else if(radioLogo.checked == true && logoFile == ""){
			alert("Select Logo File");
			return false;
			}
	
	else if((logoFile != "")&&(logoFile.indexOf(".jpg") == -1)&&(logoFile.indexOf(".jpeg") == -1)&&(logoFile.indexOf(".bmp") == -1)&&(logoFile.indexOf(".gif") == -1)){
			
			alert("Invalid File Format Selected");
			return false;

		}
	else{
		//alert("done");
		document.form.method = "post";
		document.form.enctype="multipart/form-data";
		document.form.action = "Calculation.php";
		document.form.submit();
		return true;	
	}
}

function setPriceU(){
	var radioLogo = document.getElementById('radioLogo4');
	var logoFile = document.getElementById('logoFile').value;
	var logoFileName = document.getElementById('logoFileName').value;
	alert(logoFileName);
	
	if(document.form.selQty.value == "0"){
		alert("Select Quantity");
		return false;
		}
	/*else if(radioLogo.checked == true){
			//alert("Select logoFile");
			if(logoFile == "" && logoFileName == "" ){
				alert("Select logoFile");
				return false;
			}
		}*/
	else{
		//alert("done");
		document.form.method = "post";
		document.form.enctype="multipart/form-data";
		document.form.action = "Calculation.php";
		document.form.submit();
		return true;	
	}
}
	
	
/*-----------------  For image Change   -----------------------*/

	 function SetVariantDetailImg(varMedImgName)
	{
		//alert(varMedImgName);
		var myArray = new String(varMedImgName);
		var myArray = myArray.split(", ");
		
		document.getElementById("txtVariantLrgImgName").value=myArray[0]
		document.getElementById("txtVariantLrgColorName").value=myArray[1]
		var imgName = document.getElementById("txtVariantLrgImgName").value; 
		document.getElementById("imgProdImg").src="images/ProductImages/"+imgName
	}
	
    function SetVariantImg(varMedImgName)
	{
		//alert(varMedImgName);
		var myArray = new String(varMedImgName);
		var myArray = myArray.split(", ");
		
		document.getElementById("txtVariantLrgImgName").value=myArray[0]
		document.getElementById("txtVariantLrgColorName").value=myArray[1]
		var imgName = document.getElementById("txtVariantLrgImgName").value; 
		var imgImpColor = document.getElementById("imgImpColor").value;
		document.getElementById("imgProdImg").src="images/ProductImages/imprintImg/"+imgImpColor+"_"+imgName
	}
	
	 function SetImprintImg(varImpImgName)
	{
		var imgName = document.getElementById("txtVariantLrgImgName").value;
		var imgColor = document.getElementById("txtVariantLrgColorName").value;
		var imgImpColor = document.getElementById("imgImpColor").value;
		//alert(varImpImgName+"_"+imgName);
		document.getElementById("imgProdImg").src="images/ProductImages/imprintImg/"+varImpImgName+"_"+imgName
	}


/*-----------------  Function for register model hieght function   -----------------------*/
          	function SelHeight(){
					var FtVlaue = document.getElementById("selHeight").value;
						if(FtVlaue != ""){
								document.getElementById("selHeightCm").value = FtVlaue;
								return false;
							}
						}
			function SelHeightCm(){	
						FtCmVlaue = document.getElementById("selHeightCm").value;
						if(FtCmVlaue != ""){
								document.getElementById("selHeight").value = FtCmVlaue;
								return false;
							}
						}
			
/*-----------------  Function for register model Weight function   -----------------------*/
          	function SelWeight(){
					var KgVlaue = document.getElementById("selWeight").value;
					//alert(KgVlaue);
						if(KgVlaue != ""){
								document.getElementById("selWeightCm").value = KgVlaue;
								return false;
							}
						}
			function SelWeightCm(){	
						KgLbsVlaue = document.getElementById("selWeightCm").value;
						if(KgLbsVlaue != ""){
								document.getElementById("selWeight").value = KgLbsVlaue;
								return false;
							}
						}			

/*-----------------  Function for register model Chest/Bust function   -----------------------*/
          	function SelChestInc(){
					var IncVlaue = document.getElementById("selChestInc").value;
						if(IncVlaue != ""){
								document.getElementById("selChestCm").value = IncVlaue;
								return false;
							}
						}
			function SelChestCm(){	
						IncCmVlaue = document.getElementById("selChestCm").value;
						if(IncCmVlaue != ""){
								document.getElementById("selChestInc").value = IncCmVlaue;
								return false;
							}
						}			

/*-----------------  Function for register model Hips function   -----------------------*/
          	function SelHipsInc(){
					var HIncVlaue = document.getElementById("selHipsInc").value;
						if(HIncVlaue != ""){
								document.getElementById("selHipsCm").value = HIncVlaue;
								return false;
							}
						}
			function SelHipsCm(){	
						HIncCmVlaue = document.getElementById("selHipsCm").value;
						if(HIncCmVlaue != ""){
								document.getElementById("selHipsInc").value = HIncCmVlaue;
								return false;
							}
						}			
			
/*-----------------  Function for register model Waist function   -----------------------*/
          	function SelWaistInc(){
					var WIncVlaue = document.getElementById("selWaistInc").value;
						if(WIncVlaue != ""){
								document.getElementById("selWaistCm").value = WIncVlaue;
								return false;
							}
						}
			function SelWaistCm(){	
						WIncCmVlaue = document.getElementById("selWaistCm").value;
						if(WIncCmVlaue != ""){
								document.getElementById("selWaistInc").value = WIncCmVlaue;
								return false;
							}
						}	
						
/*-----------------  Add to cart cart page   -----------------------*/			
			function AddToShopping(){
				//alert("ProductDetails.php?id="+PId);
				if (document.getElementById("TotalPrice").innerHTML==""){
					alert("First Calculate the price");
					return false;
					}
				else{
				document.form.method = "post"
				document.form.action = "Order.php?act=Add"
				document.form.submit();
				return true;
				}
			}

/*-----------------  Update cart item to cart cart page   -----------------------*/	
			function UpdateOrderToShopping(id){
				//alert("ProductDetails.php?id="+PId);
				document.form.method = "post"
				document.form.action = "Update_Order.php?act=Update&CartId="+id
				document.form.submit();
			}
			
/*-----------------  Continue Shopping Function   -----------------------*/	
			function continueShopping(){
				//alert("ProductDetails.php?id="+PId);
				document.frmCart.method = "post"
				document.frmCart.action = "ListingM_T.php?Gender=F&MorT=M";
				document.frmCart.submit();
			}		
			
/*-----------------  Chk Email Function   -----------------------*/				
			function chkEmail(id){
				//alert(id);
				iframe = document.getElementById('chkEmailIframe');
				iframe.src = "chkEmail.php?email="+id
			}	
			
			 function resetForm(){ 
			 	document.fomRegister.reset(); 
			 } 


/*-----------------  Checkout Function   -----------------------*/
			function Checkout(){ 
				//alert("HI");
				document.frmCart.action="Checkout.php";
			 	document.frmCart.submit(); 
			 } 
			 
			 function CheckoutLogin(){ 
						if(document.getElementById("emailL").value == ""){
						alert("Email Required");
							 return false;
							}	
						else if(document.getElementById("passwordL").value == ""){
						alert("Password Required");
							 return false;
							}	
						else{
							//alert("done");
							document.fomRegister.method = "post";
							//document.form.enctype="multipart/form-data";
							document.fomRegister.action = "Checkout.php?Act=ChkLogin";
							document.fomRegister.submit();
							return true;	
						} 
			 }
			 
			 function LoginPage(){ 
						if(document.getElementById("emailL").value == ""){
						alert("Email Required");
							 return false;
							}	
						else if(document.getElementById("passwordL").value == ""){
						alert("Password Required");
							 return false;
							}	
						else{
							//alert("done");
							document.fomRegister.method = "post";
							//document.form.enctype="multipart/form-data";
							document.fomRegister.action = "Login.php?Act=ChkLogin";
							document.fomRegister.submit();
							return true;	
						} 
			 }
/*-----------------  Save cart items Function   -----------------------*/			 
			 function Save(){ 
			 	//alert("Hello");
				document.frmCart.action="Shopping_Cart.php?Act=Save";
			 	document.frmCart.submit(); 
			 }
			

			function open_win(url_add)
			   {
				//alert(url_add);
			   window.open(url_add,'TermsAndCondition','width=500,height=500,scrollbars=yes');
			   }
			   

/*---------- User form Validation -----------*/
				function UserFormValidation(){
						var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  						var address = document.fomChkRegister.Semail.value;
						var address1 = document.fomChkRegister.Bemail.value;
						if(document.fomChkRegister.Sfirstname.value == ""){
							alert("Firstname Required");
							return false;
							}
						else if(document.fomChkRegister.Slastname.value == ""){
							alert("Lastname Required");
							return false;
							}
						else if(reg.test(address) == false) {
								  alert('Invalid Email Address');
								  return false;
							   }	
						else if(document.fomChkRegister.SPhone.value == ""){
							alert("Phone Number Required");
							return false;
							}
						else if(isNaN(document.fomChkRegister.SPhone.value)){
							alert("Phone Number - Insert Numric Value");
							return false;
							}
						else if(isNaN(document.fomChkRegister.SFax.value)){
							alert("Fax - Insert Numric Value");
							return false;
							}	
						else if(document.fomChkRegister.SAddress.value == ""){
							alert("Address Required");
							return false;
							}
						else if(document.fomChkRegister.SCity.value == ""){
							alert("City Required");
							return false;
							}
						/*else if((document.fomChkRegister.SselState.value == "")&&(document.fomChkRegister.SotherState.value == "")){
							alert("State Required");
							return false;
							}*/
						else if(document.fomChkRegister.SotherState.value == ""){
							alert("State Required");
							return false;
							}	
						else if(document.fomChkRegister.SPinCode.value == ""){
							alert("Zip Code Required");
							return false;
							}	
						else if(document.fomChkRegister.RadioCondition.checked != true){
								alert("Select Terms and Conditions");
								return false;
							}
						else if((document.getElementById("diffShipAdd").checked) && (reg.test(address1) == false)) {
								  alert('Invalid Billing Email Address');
								  return false;
							   }	
						else if((document.getElementById("diffShipAdd").checked) && (document.fomChkRegister.BCity.value == "")){
									alert("Billing City Required");
									return false;
								}
						else if((document.getElementById("diffShipAdd").checked) && (document.fomChkRegister.BselState.value == "")&&(document.fomChkRegister.BotherState.value == "")){
										alert("Billing State Required");
										return false;
										}
						else if((document.getElementById("diffShipAdd").checked) && (document.fomChkRegister.BselCountry.value == "")){
										alert("Billing Country Required");
										return false;
										}				
						else if((document.getElementById("diffShipAdd").checked) && (document.fomChkRegister.BPinCode.value == "")){
									alert("Billing Zip Code Required");
									return false;
							}	
						/*else{
							//alert("done");
							document.fomChkRegister.method = "post";
							//document.form.enctype="multipart/form-data";
							document.fomChkRegister.action = "Ship_PayMethod.php";
							document.fomChkRegister.submit();
							return true;	
						}*/
					}
				
/*---------- User form Validation -----------*/				
				/*function RUserFormValidationLI(){
						alert("done")
						if(document.fomChkRegister.RadioCondition.checked != true){
								alert("Select Terms and Conditions 2");
								return false;
							}
						else{
							alert("done");
							//document.fomChkRegister.method = "post";
							//document.form.enctype="multipart/form-data";
							document.fomChkRegister.action = "Ship_PayMethod.php";
							document.fomChkRegister.submit();
							return true;	
							}	
						}*/
					
				function chkRegisterForm(Page){
					//alert("I am here!!");
						var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  						var address = document.fomRegister.email.value;
						if(document.fomRegister.firstname.value == ""){
							alert("Firstname Required");
							return false;
							}
						else if(document.fomRegister.lastname.value == ""){
							alert("Lastname Required");
							return false;
							}
						else if(reg.test(address) == false) {
								  alert("Invalid Email Address");
								  return false;
							   }
						else if(document.fomRegister.password.value == ""){
							alert("Password Required");
							return false;
							}
						else if(document.fomRegister.password.value.length < 6 ){
							alert("Password more then 6 charecters");
							return false;
							}	
						else if(document.fomRegister.password.value.length > 20 ){
							alert("Password less then 20 charecters");
							return false;
							}
						else if(document.fomRegister.confirm_password.value == ""){
							alert("Confirm Password Required");
							return false;
							}
						else if(document.fomRegister.confirm_password.value != document.fomRegister.password.value){
							alert("Confirm Password Not Match");
							return false;
							}							
						else if(document.fomRegister.Phone.value == ""){
							alert("Phone Number Required");
							return false;
							}
						else if(isNaN(document.fomRegister.Phone.value)){
							alert("Phone Number - Insert Numric Value");
							return false;
							}
						else if(isNaN(document.fomRegister.Fax.value)){
							alert("Fax - Insert Numric Value");
							return false;
							}	
						else if(document.fomRegister.Address.value == ""){
							alert("Address Required");
							return false;
							}
						else if(document.fomRegister.City.value == ""){
							alert("City Required");
							return false;
							}
						else if(document.fomRegister.PinCode.value == ""){
							alert("Zip Code Required");
							return false;
							}	
						else {
							document.fomRegister.action=Page+".php?Act=Register";
							document.fomRegister.submit();
							return true;
							}
					
					}	
					
				function chkAccSetingForm(){
						var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  						var address = document.fomRegister.email.value;
						if(document.fomRegister.firstname.value == ""){
							alert("Firstname Required");
							return false;
							}
						else if(document.fomRegister.lastname.value == ""){
							alert("Lastname Required");
							return false;
							}
						/*else if(reg.test(address) == false) {
								  alert('Invalid Email Address');
								  return false;
							   }
						else if(document.fomRegister.password.value == ""){
							alert("Password Required");
							return false;
							}
						else if(document.fomRegister.password.value.length < 6 ){
							alert("Password more then 6 charecters");
							return false;
							}	
						else if(document.fomRegister.password.value.length > 20 ){
							alert("Password less then 20 charecters");
							return false;
							}
						else if(document.fomRegister.confirm_password.value == ""){
							alert("Confirm Password Required");
							return false;
							}
						else if(document.fomRegister.confirm_password.value != document.fomRegister.password.value){
							alert("Confirm Password Not Match");
							return false;
							}	*/						
						else if(document.fomRegister.Phone.value == ""){
							alert("Phone Number Required");
							return false;
							}
						else if(isNaN(document.fomRegister.Phone.value)){
							alert("Phone Number - Insert Numric Value");
							return false;
							}
						else if(isNaN(document.fomRegister.Fax.value)){
							alert("Fax - Insert Numric Value");
							return false;
							}	
						else if(document.fomRegister.Address.value == ""){
							alert("Address Required");
							return false;
							}
						else if(document.fomRegister.City.value == ""){
							alert("City Required");
							return false;
							}
						else if((document.fomRegister.SselState.value == "")&&(document.fomRegister.State.value == "")){
							alert("State Required");
							return false;
							}
						else if(document.fomRegister.PinCode.value == ""){
							alert("Zip Code Required");
							return false;
							}	
						/*else {
							reurn true;
							}*/
					
					}	
					
					function chkForgetPwd(){
						var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  						var address = document.fomRegister.email.value;
						if(reg.test(address) == false) {
								  alert("Invalid EmailId, Please include a proper Email Address as your EmailId.");
								  return false;
							   }
							   else{
								   	document.fomRegister.action ="ForgotPwd.php?act=sendPwd";
								document.fomRegister.submit();
								return true;
								   }
						}
					
					/**/
					function chkRacial(){
						var Selid = document.getElementById("selRacial").value;
						if(Selid!=""){
								alert(Selid);
								document.getElementById(Selid).style.visibility = "visible";
								document.getElementById(Selid).style.position = "absolute";
							}
						else{
								document.getElementById("ShippDetail").style.visibility = "hidden";	
							}
						}
						
					function OrderFinal(ship, shipPrice){
							//alert(ship);
							//alert(shipPrice);
							var CartItemDetails=document.getElementById("CartItemDetails").innerHTML;
							//alert(CartItemDetails);
							document.fomChkPayInfo.CartItemData.value = CartItemDetails;
							if(document.fomChkPayInfo.CartItemData.value != ""){
								document.fomChkPayInfo.method = "post";
								document.fomChkPayInfo.action = "PayInfo.php?act=finalOrder&Secu=hajkfadfhafhdfjkahsdfjkafhjkfhjkfhafhfhuifuufnufhafhasiohfuihadfuiahfauifhuaifhafasdiofahiofasd&shipId="+ship+"&shipPrice="+shipPrice+"&temp=ahdfhasfasdjkhfkasfhksdfhdjkasfhasjkfhsdjfhaskfasdfhasjkhfkashfka";
								document.fomChkPayInfo.submit();
								return true;
							}
						}
						
/*--------- search result function ----------*/
	function sercresult(){
			if(document.getElementById('Searchtxt').value==""){
					alert("Insert serching text");
				}
			else{
					window.location = "SearchResults.php?Searchtxt="+document.getElementById('Searchtxt').value
				}	
		}
		
/*----- Add event date------*/
				function chkAddEventDate(){
						if(document.getElementById("radioEvn2").checked){
								document.getElementById("selectEvent").style.visibility = "visible";
							}
						else{
								document.getElementById("selectEvent").style.visibility = "hidden";	
							}
						}
