var ShippingAddress = "";
var ShippingCity = "";
var ShippingState = "";
var ShippingZip = "";
var ShippingCountry = "";

function InitSaveVariables(form) {
	ShippingAddress = form.ShippingAddress.value;
	ShippingCity = form.ShippingCity.value;
	ShippingState = form.ShippingState.value;
	ShippingZip = form.ShippingZip.value;
	ShippingCountry = form.ShippingCountry.value;
}

function CopyHomeAddress(form) {
if (form.ChkSameAddress.checked) {
	InitSaveVariables(form);
	form.ShippingAddress.value = form.HomeAddress.value;
	form.ShippingCity.value = form.HomeCity.value;
	form.ShippingState.value = form.HomeState.value;       
	form.ShippingZip.value = form.HomeZip.value;
	form.ShippingCountry.value = form.HomeCountry.value;
}
else {
	form.ShippingAddress.value = ShippingAddress;
	form.ShippingCity.value = ShippingCity;
	form.ShippingState.value = ShippingState;       
	form.ShippingZip.value = ShippingZip;
	form.ShippingCountry.value = ShippingCountry;
   }
}


// -- function to get the string of a URL
function GetUrlString(QueryValue) {
	QueryString = window.location.search.substring(1);
	UrlString = QueryString.split("&");
	
	for (i = 0; i < UrlString.length; i++) {
		FindValue = UrlString[i].split("=");
		
		if (FindValue[0] == QueryValue) {
			return FindValue[1];
		}
	}
}

// -- this is the multi-use input field if-empty binder
function autoset(cont, def) {
	if(cont.value == def)
		cont.value = '';
}

function unautoset(cont, def) {
	if(cont.value == '')
		cont.value = def;
}

function ShowDate() {
	var currentTime = new Date()
	var weekday = currentTime.getDay()
	var month = currentTime.getMonth()
	var day = currentTime.getDate()
	var year = currentTime.getFullYear()
	
	switch(weekday) {
		case 0: weekday = "Sunday"; break;
		case 1: weekday = "Monday"; break;
		case 2: weekday = "Tuesday"; break;
		case 3: weekday = "Wednesday"; break;
		case 4: weekday = "Thursday"; break;
		case 5: weekday = "Friday"; break;
		case 6: weekday = "Saturday"; break;
		default: weekday = ""; break;
	}
	
	switch(month) {
		case 0: month = "January"; break;
		case 1: month = "February"; break;
		case 2: month = "March"; break;
		case 3: month = "April"; break;
		case 4: month = "May"; break;
		case 5: month = "June"; break;
		case 6: month = "July"; break;
		case 7: month = "August"; break;
		case 8: month = "September"; break;
		case 9: month = "October"; break;
		case 10: month = "November"; break;
		case 11: month = "December"; break;
		default: month = ""; break;
	}
	
	document.write(weekday + ", " + month + " " + day + ", " + year)
}