function valid_error()
{
	
	
	
	if(document.getElementById("f_name").value=="")
	{
		alert("Please enter your First Name");
		document.getElementById("f_name").focus();
		return false;
	}
	if(document.getElementById("l_name").value=="")
	{
		alert("Please enter your Last Name");
		document.getElementById("l_name").focus();
		return false;
	}	
	
	if(document.getElementById("email").value=="")
	{
		alert("Please enter your  Email Address");
		document.getElementById("email").focus();
		return false;
	}else
	{
		   var emailStr=document.form1.email.value;   
			var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!(!reg1.test(emailStr) && reg2.test(emailStr))) 
			{
			 alert("Please check your email address.");
			document.getElementById("email").focus();
			 return false;
	}
	}
	if(document.getElementById("address1").value=="")
	{
		alert("Please enter your Address");
		document.getElementById("address1").focus();
		return false;
	}	
	if(document.getElementById("city").value=="")
	{
		alert("Please enter your City");
		document.getElementById("city").focus();
		return false;
	}		
	
	if(document.getElementById("country").value !='US')
	{
	if(document.getElementById("State").value=="")
	{
		alert("Please enter your State");
		document.getElementById("State").focus();
		return false;
	}
	}else
	{
		if(document.getElementById("stateus").value=="")
		{
		alert("Please enter your State");
		document.getElementById("stateus").focus();
		return false;
		}
	}
	if(document.getElementById("zipcode").value=="")
	{
		alert("Please enter your Zipcode");
		document.getElementById("zipcode").focus();
		return false;
	}		
	if(document.getElementById("country").value=="")
	{
		alert("Please select your country from the dropdown");
		document.getElementById("country").focus();
		return false;
	}	
	
		if(document.getElementById("country").value!="US"){
			
			var j=0;
				for (var i=0; i<document.form1.shipping_charge.length; i++)  
				{ 
      		  if (document.form1.shipping_charge[i].checked)  
			 	 {
     	   			 var found_ship = document.form1.shipping_charge[i].value;
					 
				} 
				}
				if(found_ship!=12.95)
				{
					alert("Plese select International shipping amount for country other than US");
					return false;
				}
 				  
		}
		
		if(document.getElementById("country").value=="US"){
			var k=0;
				for (var i=0; i<document.form1.shipping_charge.length; i++)  
				{ 
      		  if (document.form1.shipping_charge[i].checked)  
			 	 {
     	   			 var found_ship2 = document.form1.shipping_charge[i].value;
					 
				} 
				}
				if(found_ship2==12.95)
				{
					alert("Invalid Shipping amount selected for US! Please select any Shipping charge other than International Shipping.");
					return false;
				}
		}
		/*else
		{
			if(document.getElementByName("shipping_charge").value==12.95)
			alert("International shipping amount cannot be selected US");
			return false;			
		}*/
	
	var m=0;
	
        if (document.form1.pay.checked)  {
        return true;
		}else{
       alert("Please select the Payment mode");
		return false;
  }	
	
}


function calculate()
{
	//##########################################
	//###### Change these prices to change #####
	//###### shipping and CD fees          #####
	//##########################################
	var cdPrice = 0;
	var regularGroundPrice = 5.95;
	var twoDayGroundPrice = 9.95;
	var overNightPrice = 15.95;
	var internationalPrice = 12.95;
	//#########################################
	//##### END PRCIES TO CHANGE ##############
	//#########################################
	
	var shippingPrice = 0;
	var total_ship = 0;
	var shipQuant = 0;
	
	Number.prototype.isFloat =
      function() {
        return /\./.test(this.toString());
      };
	var tot_quantity = document.getElementById("quantity").value;
	var tot=(tot_quantity * cdPrice);
	tot = Math.round(tot*100)/100;
	//alert(tot);total_q order_total
	document.getElementById("total_q_temp").value= '$ '+tot;
	document.getElementById("total_q_temp2").value= '$ '+tot;
	document.getElementById("total_q").value= tot;
	for (var i=0; i<document.form1.shipping_charge.length; i++)
	{
		if (document.form1.shipping_charge[i].checked)  {
		var found_it = document.form1.shipping_charge[i].value
		}
	}
	
	function getShipQuant(quant) {
		quant = quant/3;
		if(quant.isFloat()==true)
		{
			quant = parseInt(quant)+1;
		}
		return quant;
	}
	
	switch(found_it) {
		case "regularGround":
			shippingPrice = regularGroundPrice;
			shipQuant = tot_quantity;
			document.getElementById("ship_type").value="Regular Ground";
			break;
		case "twoDayGround":
			shippingPrice = twoDayGroundPrice;
			//shipQuant = getShipQuant(tot_quantity);
			shipQuant = tot_quantity;
			document.getElementById("ship_type").value="2 Day Ground";
			break;
		case "overnight":
			shippingPrice = overNightPrice;
			//shipQuant = getShipQuant(tot_quantity);
			shipQuant = tot_quantity;
			document.getElementById("ship_type").value="Overnight";
			break;
		case "international":
			shippingPrice = internationalPrice;
			shipQuant = tot_quantity;
			document.getElementById("ship_type").value="International";	
			break;
		default:
			shippingPrice = regularGroundPrice;
			shipQuant = tot_quantity;
			document.getElementById("ship_type").value="Regular Ground";
			break;
	}
	
	total_ship = shippingPrice * shipQuant;
	total_ship = Math.round(total_ship*100)/100
	total_ship = total_ship.toFixed(2);
	
	/*if(found_it == 1.99)
	{
		var total_ship= found_it * tot_quantity;
		document.getElementById("ship_type").value="Regular Ground";	
		//alert(total_ship);
	}else if(found_it == 6.95 || found_it == 15.95)
	{
		if(found_it == 6.95)
		{
			document.getElementById("ship_type").value="2 Day Ground";	
		}else
		{
			document.getElementById("ship_type").value="Overnight";	
		}
		var total_ship= tot_quantity/3
		if(total_ship.isFloat()==true)
		{
		total_ship = parseInt(total_ship)+1;
		}
		total_ship = total_ship * found_it;
		//alert(total_ship);
	}else {
		total_ship = found_it;
		document.getElementById("ship_type").value="International";		
	}*/
	
	var ship_charge= tot + parseFloat(total_ship);
	ship_charge*=100;
	ship_charge=Math.round(ship_charge);
	ship_charge/=100;
	ship_charge = ship_charge.toFixed(2);
	//alert(ship_charge);
	//alert()


	
	document.getElementById("order_total").value = '$ '+ship_charge;
	document.getElementById("order_total_pas").value = ship_charge;
	document.getElementById("total_shipping").value = total_ship;
	document.getElementById("total_shipping_show").value ='$ '+total_ship;	
}
function img_flash()
{
	document.getElementById("flash").style.display="none";
	document.getElementById("flash_show").style.display="";
	
}
function state_func()
{
	
	if(document.getElementById("country").value !='US')
	{

			document.getElementById("us_states").style.display="none";
			document.getElementById("non_us").style.display="";
		document.getElementById("stateus").value="";			
		
	}else
	{
			document.getElementById("us_states").style.display="";
			document.getElementById("non_us").style.display="none";	
			document.getElementById("State").value="";				

	}
}
function check_count()
{
	//alert(document.form2.elements["player[]"][3].checked);
	//var d = document.form2;
	//var count=d.elements["player[]"].length;
    var count=0;
	var c=0;
	for(i=0; i < document.form2.elements["player[]"].length; i++)
		{ 	    
		    if(document.form2.elements["player[]"][i].checked==true)
			{
            c=c+1;
                } 
			count++;// if(d.player[i].checked)
			  // c=c+1;
		 }	
		 
	if(c!=10)
	{ 
		alert("Kindly choose 10 interviews from the list");
	document.getElementById("cd_no").value="Nil";	
	document.getElementById("cd_amt").value="Nil";			
		return false;		
	}else{
	document.getElementById("cd_no").value=10;	
	document.getElementById("cd_amt").value=1.99;
	document.getElementById("selected_yes").value="true";		
	
	return true;		
	}
}