
//function to copy shipping to billing fields
function copyToShipping(){
	var flag = document.cartform.f_bill_sameasshipping.checked;
	var form = document.cartform;
	var i = 0;
	while(i < copyToShipping.arguments.length) {
	  if(flag){
		if(copyToShipping.arguments[i] == "state")
		  eval("document.cartform.f_bill_"+copyToShipping.arguments[i]+".selectedIndex = document.cartform.f_ship_"+copyToShipping.arguments[i]+".selectedIndex");
		else
		  eval("document.cartform.f_bill_"+copyToShipping.arguments[i]+".value = document.cartform.f_ship_"+copyToShipping.arguments[i]+".value");
		
	  }else{
		if(copyToShipping.arguments[i] == "state")
			eval("document.cartform.f_bill_"+copyToShipping.arguments[i]+".selectedIndex = 0");
		else
			eval("document.cartform.f_bill_"+copyToShipping.arguments[i]+".value = ''");
	  }
	  i++;
	}
}

//navigate through shopping cart process
function stepto(step){
	document.forms['cartform'].action = "checkout.asp"
	document.forms['cartform'].step.value = step;
	document.forms['cartform'].submit();
	return false;
}

//function to submit the final process
var theForm;
var requestSubmitted = false; 

function disableButton(btn,form) {
	if (!requestSubmitted){
		var submitMessage = "  PLEASE WAIT...  ";
		btn.value = submitMessage;
		theForm = form;
		theForm.action = "process_payment.asp"
		btn.disabled = true;
		requestSubmitted = true;
		setTimeout("submitIt()", 250);
	} else {
		return false;
	}
}

//submit the form
function submitIt() {
	theForm.submit();
	return false;
}

function session_win(url) {
	window.open(url,"info_shopping_cart","height=460,width=430,toolbar=no,statusbar=no,scrollbars=yes").focus();
	return false;
}

function cvv_win(url) {
	var thewin = window.open(url,"cvv","height=400,width=500,toolbar=no,statusbar=no,scrollbars=yes");
	thewin.focus();
	return false;
}

function switchPhoto(sImg)
{
	document['dProdImage'].src = sImg;
	return false;
}