// Opens coverage calculator
function submitCoverageCalForm() {
	formRef=document.getElementById('CoverageCalculator');
	formRef.target="_none";
	OpenWindow=window.open("",formRef.target, "height=600, width=550, toolbar=no, scrollbars=yes, menubar=no");
	formRef.submit();
}

// Submits shop form
function submitShopForm(homepage) {
	if(homepage && document.getElementById("moto").checked==true) {
		document.getElementById("shopForm").action="https://motorcycle.geico.com/powersports?s=01032";
	} else {
		document.getElementById('shopForm').method = "get";
		document.getElementById("shopForm").action="https://sales2.geico.com/internetsales/index.jsp";
	}
	if(checkZip(document.getElementById('zip').value)) {
		document.getElementById("shopForm").submit();
	}
	document.getElementById('shopForm').method = "post";
	document.getElementById("shopForm").action="javascript:submitShopForm("+homepage+")";
}

// Validates ZIP codes
function checkZip(zipString) {
	var errorMessage="Por favor, someta un código postal de 5 dígitos.";
	for(i=0; i<zipString.length; i++) {
		ch = zipString.substring(i, i+1);
		if(ch < "0" || ch > "9") {
			alert(errorMessage);
			return false;
		}
	}
	if(zipString.length < 5) {
		alert(errorMessage);
		return false;
	}
	return true;
}

// For launching in a new window
function newWindow(url,name) {
	switch (name) {
		case "phs":
			features='width=580,height=600,top=0,screeny=0,left=0,screenx=0,location=no,toolbar=yes,scrollbars=yes,status=yes,copyhistory=no,menubar=yes,status=yes,resizable=yes';
			break;
		case "verisign":
			features='width=550,height=450,toolbar=yes,scrollbars=yes,location=1';
		 	break;
		case "calc":
			features='height=600, width=500, toolbar=no, scrollbars=yes, menubar=no';
			break;
		default:
			features='';
			name="external";
	}
	window.open(url,name,features);
}

// $Revision: 1.14 $
// $Name: cycleurl2011 $
