var url	=	'http://198.104.187.233';
function countryShipCharge(countryid){
	
		var countryid	=	countryid;
		
		document.checkform.submit();
	
}


function checkterm(){
	if(document.getElementById("terms").checked==false){
		alert("Please agree to the Terms and Conditions");
		return false;
	}else{
		
		return true;	
	}
	
}


function shoppingConfirm(suburl){
	if(document.getElementById("ShoppingCartSubTotal").value=="" && document.getElementById("ShoppingCartShipping").value=="" && document.getElementById("ShoppingCartTax").value=="" && document.getElementById("ShoppingCartInsurance").value=="" && document.getElementById("ShoppingCartGrandTotal").value==""){
		var conf	=	confirm("Some data are lost. Are you sure to recover them?");
		if(conf==true){
			
			window.location=url+suburl;
			
			return false;
		
		}else{
			
			return false;
		}
		
	}else{
		
		return true;
	}
	
	
}
function backConfirm(suburl){
	var conf	=	confirm("Are you sure you would like to go back?");
	
	if(conf==true){
		
		window.location=url+suburl;
		
		return false;
	
	}else{
		
		return false;
	}
	
}
function shopConfirm(suburl){
	var conf	=	confirm("Are you sure to go for shopping again?");
	
	if(conf==true){
		window.location=url+suburl;
		return false;
	
	}else{
		
		return false;
	}
	
}
function searchBlank(sid){
	document.getElementById(sid).value	=	"";
	return true;
}




function framedShipping(){
	
		document.framed_form.submit();
	
}


function checkShippingDetails(){
	if(document.getElementById("ShoppingCartFirstName").value==''){
		alert("Please enter first name");
		document.getElementById("ShoppingCartFirstName").focus();
		return false;
	}
	if(document.getElementById("ShoppingCartLastName").value==''){
		alert("Please enter last name");
		document.getElementById("ShoppingCartLastName").focus();
		return false;
	}
	if(document.getElementById("ShoppingCartEmail").value==''){
		alert("Please enter email id");
		document.getElementById("ShoppingCartEmail").focus();
		return false;
	}else{
		if(validateEmailv2(document.getElementById("ShoppingCartEmail").value)==false){
			alert("Please enter a valid email id");
			document.getElementById("ShoppingCartEmail").value = '';
			document.getElementById("ShoppingCartEmail").focus();
			return false;
		}
	}
	if(document.getElementById("ShoppingCartPhone").value==''){
		alert("Please enter phone no");
		document.getElementById("ShoppingCartPhone").focus();
		return false;
	}else{
			if(isNaN(document.getElementById("ShoppingCartPhone").value) && document.getElementById("ShoppingCartPhone").value!=''){
				alert("Phone no must be numeric");
				document.getElementById("ShoppingCartPhone").value='';
				document.getElementById("ShoppingCartPhone").focus();
				return false;
			}
		
	}
	
	if(isNaN(document.getElementById("ShoppingCartMobile").value) && document.getElementById("ShoppingCartMobile").value!=''){
			alert("Mobile no must be numeric");
			document.getElementById("ShoppingCartMobile").value='';
			document.getElementById("ShoppingCartMobile").focus();
			return false;
	}
		
	if(document.getElementById("ShoppingCartAddressLine1").value==''){
		alert("Please enter first line of address");
		document.getElementById("ShoppingCartAddressLine1").focus();
		return false;
	}
	if(document.getElementById("ShoppingCartCity").value==''){
		alert("Please enter city name");
		document.getElementById("ShoppingCartCity").focus();
		return false;
	}
	if(document.getElementById("ShoppingCartState").value==''){
		alert("Please enter state name");
		document.getElementById("ShoppingCartState").focus();
		return false;
	}
	if(document.getElementById("ShoppingCartPostalCode").value==''){
		alert("Please enter postal code");
		document.getElementById("ShoppingCartPostalCode").focus();
		return false;
	}else{
			if(isNaN(document.getElementById("ShoppingCartPostalCode").value) && document.getElementById("ShoppingCartPostalCode").value!=''){
				alert("Postal Code must be numeric");
				document.getElementById("ShoppingCartPostalCode").value='';
				document.getElementById("ShoppingCartPostalCode").focus();
				return false;
			}
		
	}
return true;	
}


function checkMailingDetails(){
	if(document.getElementById("MailingListFirstName").value==''){
		alert("Please enter first name");
		document.getElementById("MailingListFirstName").focus();
		return false;
	}
	if(document.getElementById("MailingListLastName").value==''){
		alert("Please enter last name");
		document.getElementById("MailingListLastName").focus();
		return false;
	}
	if(document.getElementById("MailingListEmail").value==''){
		alert("Please enter email id");
		document.getElementById("MailingListEmail").focus();
		return false;
	}else{
		
		if(validateEmailv2(document.getElementById("MailingListEmail").value)==false){
			alert("Please enter a valid email id");
			document.getElementById("MailingListEmail").value = '';
			document.getElementById("MailingListEmail").focus();
			return false;
		}
		
	}
	

	if(isNaN(document.getElementById("MailingListPhone").value) && document.getElementById("MailingListPhone").value!=''){
		alert("Phone no must be numeric");
		document.getElementById("MailingListPhone").value='';
		document.getElementById("MailingListPhone").focus();
		return false;
	}
		
	
	if(isNaN(document.getElementById("MailingListMobile").value) && document.getElementById("MailingListMobile").value!=''){
			alert("Mobile no must be numeric");
			document.getElementById("MailingListMobile").value='';
			document.getElementById("MailingListMobile").focus();
			return false;
	}
		
	if(isNaN(document.getElementById("MailingListPostalCode").value) && document.getElementById("MailingListPostalCode").value!=''){
				alert("Postal Code must be numeric");
				document.getElementById("MailingListPostalCode").value='';
				document.getElementById("MailingListPostalCode").focus();
				return false;
	}
	
return true;	
}

function goBAck(suburl){
	
	window.location=url+suburl;
	
	return false;
	
}


function validateEmailv2(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}
