// JavaScript Document

function BillingShippingValidateForm()
{
	var todoStatus = trim(document.getElementById('todo').value);
	
	
	var Country = document.getElementById("Country").options[document.getElementById("Country").selectedIndex].value;
	if(Country=='')
	{
		alert('Please Select A Country');
		document.getElementById("Country").focus();
		return false;
	}
	
	var State = document.getElementById("State").options[document.getElementById("State").selectedIndex].value;
	if(State=='')
	{
		alert('Please Select A State');
		document.getElementById("State").focus();
		return false;
	}

	var City = document.getElementById("City").options[document.getElementById("City").selectedIndex].value;
	if(City=='')
	{
		alert('Please Select A City');
		document.getElementById("City").focus();
		return false;
	}

	document.getElementById("CountryID").value = Country;
	document.getElementById("StateID").value = State;
	document.getElementById("CityID").value = City;
	
	var ContactInfo = document.getElementById("ContactInfo").value;
	if(AllTrim(ContactInfo)=='')
	{
		alert('Please Enter ContactInfo');
		document.getElementById("ContactInfo").focus();
		return false;
	}
	
	var Address = document.getElementById("Address").value;
	if(AllTrim(Address)=='')
	{
		alert('Please Enter Address');
		document.getElementById("Address").focus();
		return false;
	}
	
	

	
	var ShippingCountry = document.getElementById("ShippingCountry").options[document.getElementById("ShippingCountry").selectedIndex].value;
	if(ShippingCountry=='')
	{
		alert('Please Select A Country');
		document.getElementById("ShippingCountry").focus();
		return false;
	}
	
	var ShippingState = document.getElementById("ShippingState").options[document.getElementById("ShippingState").selectedIndex].value;
	if(ShippingState=='')
	{
		alert('Please Select A State');
		document.getElementById("ShippingState").focus();
		return false;
	}

	var ShippingCity = document.getElementById("ShippingCity").options[document.getElementById("ShippingCity").selectedIndex].value;
	if(ShippingCity=='')
	{
		alert('Please Select A City');
		document.getElementById("ShippingCity").focus();
		return false;
	}

	document.getElementById("ShippingCountryID").value = ShippingCountry;
	document.getElementById("ShippingStateID").value = ShippingState;
	document.getElementById("ShippingCityID").value = ShippingCity;
	
	var ShippingContactInfo = document.getElementById("ShippingContactInfo").value;
	if(AllTrim(ShippingContactInfo)=='')
	{
		alert('Please Enter ContactInfo');
		document.getElementById("ShippingContactInfo").focus();
		return false;
	}
	
	var ShippingAddress = document.getElementById("ShippingAddress").value;
	if(AllTrim(ShippingAddress)=='')
	{
		alert('Please Enter Address');
		document.getElementById("ShippingAddress").focus();
		return false;
	}
	
}

function SameAsBilling(Obj)
{
	
	var Country = document.getElementById("Country").options[document.getElementById("Country").selectedIndex].value;
	
	var CountryIndexNo = document.getElementById("Country").options[document.getElementById("Country").selectedIndex].index;
//		document.getElementById('ShippingCountry').options[CountryIndexNo].selected = true;
//	alert(CountryIndexNo);
//	return false;
	
	var State = document.getElementById("State").options[document.getElementById("State").selectedIndex].value;
	var City = document.getElementById("City").options[document.getElementById("City").selectedIndex].value;

	document.getElementById("CountryID").value = Country;
	document.getElementById("StateID").value = State;
	document.getElementById("CityID").value = City;
	var ContactInfo = document.getElementById("ContactInfo").value;
	var Address = document.getElementById("Address").value;
	
	if(Obj.checked)
	{
		//alert('ChkOK');
		document.getElementById("ShippingContactInfo").value = ContactInfo;
		document.getElementById("ShippingAddress").value = Address;
		
		document.getElementById('ShippingCountry').options[CountryIndexNo].selected = true;
		OnChangeCountryCopy(Country,'ShippingCountry','DivShippingState','UserSection',State);
		OnChangeCountryCopy(State,'ShippingState','DivShippingCity','UserSection',City);
	}
	else
	{
		//alert('No');
		document.getElementById("ShippingContactInfo").value = '';
		document.getElementById("ShippingAddress").value = '';

		document.getElementById('ShippingCountry').options[0].selected = true;
		OnChangeCountryCopy(0,'ShippingCountry','DivShippingState','UserSection',0);
		OnChangeCountryCopy(0,'ShippingState','DivShippingCity','UserSection',0);
	}
	


}



