function MM_preloadImages() { //v3.0
	var d=document;
	if(d.images) {
		if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
		for(i=0; i<a.length; i++)
    		if (a[i].indexOf("#")!=0) {
				d.MM_p[j]=new Image;
				d.MM_p[j++].src=a[i];
				}
			}
		}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
		x.src=x.oSrc;
	}

function MM_findObj(n, d) { //v4.01
	var p,i,x;
	if(!d) d=document;
		if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document;
			n=n.substring(0,p);
			}
	if(!(x=d[n])&&d.all) x=d.all[n];
		for (i=0;!x&&i<d.forms.length;i++)
			x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById)
		x=d.getElementById(n);
	return x;
	}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null) {
			document.MM_sr[j++]=x;
			if(!x.oSrc)
				x.oSrc=x.src;
			x.src=a[i+2];
			}
	}

function check_ship(form) {
	var same_addr = document.getElementById("same_addr");
	if (same_addr.checked) {
		//Shipping and Billing Address are the same
		form.ship_name.value = form.bill_name.value;
		form.ship_add1.value = form.bill_add1.value;
		form.ship_add2.value = form.bill_add2.value;
		form.ship_city.value = form.bill_city.value;
		form.ship_state.value = form.bill_state.value;
		form.ship_other.value = form.bill_other.value;
		form.ship_zip.value = form.bill_zip.value;
		form.ship_tel.value = form.bill_tel.value;
		form.ship_email.value = form.bill_email.value;
		form.ship_country.value = form.bill_country.value;
		}
	var bill_state = document.getElementById('bill_state');
	var ship_state = document.getElementById('ship_state');
	var ship_other = document.getElementById('ship_other');
	if (bill_state.style.display=='none') {
		ship_state.style.display='none';
		ship_other.style.display='block';
		}
	else {
		ship_state.style.display='block';
		ship_other.style.display='none';
		}
	}

function check_state(form, address, newform) {
	if (address=="" && newform=="yes") {
		var bill_other_state = document.getElementById('bill_other');
		var ship_other_state = document.getElementById('ship_other');
		bill_other_state.style.display='none';
		ship_other_state.style.display='none';
		}
	else if (address=="" && newform=="no") {
		var bill_other_state = document.getElementById('bill_other');
		var bill_state = document.getElementById('bill_state');
		var ship_other_state = document.getElementById('ship_other');
		var ship_state = document.getElementById('ship_state');
		if (bill_other_state.value=="") {
			bill_other_state.style.display='none';
			bill_state.style.display='block';
			}
		else {
			bill_other_state.style.display='block';
			bill_state.style.display='none';
			}
			
		if (ship_other_state.value=="") {
			ship_other_state.style.display='none';
			ship_state.style.display='block';
			}
		else {
			ship_other_state.style.display='block';
			ship_state.style.display='none';
			}
		}
	else {
		var state = document.getElementById(address+'_state');
		var country = document.getElementById(address+'_country');
		var other_state = document.getElementById(address+'_other');
		if (state.value=='other') {
			state.style.display='none';
			other_state.style.display='block';
			state.value='';
			country.value='';
			}
		else if (country.value!='US') {
			state.style.display='none';
			other_state.style.display='block';
			state.value='';
			}
		else {
			state.style.display='block';
			other_state.style.display='none';
			other_state.value='';
			}
		}
	}


function popupWindow(loc, w, h) {
	lftVal = (screen.width-w) / 2;
	topVal = (screen.height-h) / 2;

	newwindow = window.open (loc, 'newwindow', 'width='+w+', height='+h+', left='+lftVal+', top='+topVal+', status=0, toolbar=0, location=0, menubar=0, resizable=0, scrollbars=1');

	if (window.focus) {newwindow.focus()}
        return false;
	}