// JavaScript Document
function get_shipping_value(no,desc) {
	var ship_price = document.getElementById("ship_"+no).value;
	var sub_total 	= document.getElementById("sub_total").value;
	var total 	= (ship_price-1+1) + (sub_total-1+1);
	document.getElementById("shipping_option_id").innerHTML = desc;
	document.getElementById("ship_price_id").innerHTML = '$'+ship_price;
	document.getElementById("total_price_id").innerHTML = '$'+total;
	document.getElementById("shipping2").value = parseFloat(ship_price);
}

window.onload = init;
function init(){
	document.getElementById("shipping2").value = parseFloat(document.getElementById("ship_1").value);
}
function SubmitForm(){
		var qt_flag=0;
		var qt_count = document.getElementById("qt_count").value;
		for(var i=1;i<=qt_count;i++) {
			if(document.getElementById("qt_id_"+i).value >0) {
				qt_flag =1;
				break;
			}
		}
		if(qt_flag == 0) {
			alert("Please enter at least one product quantity");
			return false;
		}		

	CountryIndex = document.getElementById("Country").selectedIndex;
	MyCountry = document.getElementById("Country").options[CountryIndex].text;

	if (MyCountry == "United States" || MyCountry == "Canada") {
		StateIndex = document.getElementById("State").selectedIndex;
		MyState = document.getElementById("State").options[StateIndex].text;
	} 

	if (MyCountry == "United States") {
		if (MyState == "select") {
			alert("Please select the state.");
			return false;
		}
		if (document.getElementById("Zip").value == "") {
			alert("Please enter the zip code");
			return false;
		}
	}
	if (MyCountry == "Canada") {
		if (MyState == "select") {
			alert("Please select the state.");
			return false;
		}
		if (document.getElementById("Zip").value == "") {
			alert("Please enter the postal code.");
			return false;
		}
	}
	return true;
}

