  if (navigator.appName == "Microsoft Internet Explorer") {         
   document.onkeydown = doKey;
   }else{
   document.onkeypress = doKey;
   }	
  function doKey(e) {	    
	var val;
	    if (navigator.appName == "Microsoft Internet Explorer") {									
			if(event.srcElement.name == "txtZip"){			
				if (event.keyCode==13) {						
				  	 val = document.getElementById("txtZip").value; 											  	 
					if (/^\d{5}?$/.test(val)){ 
				 		//document.getElementById("hidjump").value = "jump";
						document.forms["frmWeather"].action = "default.aspx";										
						document.forms["frmWeather"].submit();						
					}else{								
						return false;
					} 
				}							
			}
		}else{						
			if (e.target.name == "txtZip"){ 						
				if (e.keyCode==13) {						
					 val = document.getElementById("txtZip").value; 							
					if (/^\d{5}?$/.test(val)){ 	
						//document.getElementById("hidjump").value = "jump";				
						document.forms["frmWeather"].action = "default.aspx";						
						document.forms["frmWeather"].submit();						
					}else{								
						return false;
					} 
				}
			}
		}		
	}  

function RegionChange(frm, field){  
	document.forms[frm].txtZip.value = "";
	document.forms[frm].action = "/default.aspx";	
	document.forms[frm].hidField.value = field;			
	document.forms[frm].submit();		
}

function StateChange(frm, objState){ 
	var selectedItem = objState.selectedIndex;
	var selectedValue = objState.options[selectedItem].value;

	var town_IL = new String(document.forms[frm].hidTowns_IL.value);
	var town_IN = new String(document.forms[frm].hidTowns_IN.value);
	var town_KY = new String(document.forms[frm].hidTowns_KY.value);
	var town_OH = new String(document.forms[frm].hidTowns_OH.value);

	if (selectedValue == "IL") SetTownOptions(frm, town_IL.split(','));
	if (selectedValue == "IN") SetTownOptions(frm, town_IN.split(','));
	if (selectedValue == "KY") SetTownOptions(frm, town_KY.split(','));
	if (selectedValue == "OH") SetTownOptions(frm, town_OH.split(','));

}

function SetTownOptions(frm, arTowns) {
	var townLength = document.forms[frm].lstLocalTown.options.length;
	var i, arOption, strTown;
		//Clear the options
		for(i=1; i < townLength; i++) document.forms[frm].lstLocalTown.options[i] = null;
		//Add towns
		for(i=0; i < arTowns.length; i++) {
			strTown = arTowns[i];
			arOption = strTown.split('|');
			if (arOption != null && arOption.length == 2) {
				document.forms[frm].lstLocalTown.options[i+1] = new Option(arOption[1], arOption[0], false, false);
			}
			else {
				alert('Invalid town option format found!!');
			}
		}
}

function TownChange(frm){  
	if (document.forms[frm].txtZip != null)
		document.forms[frm].txtZip.value = "";
		
	if (document.forms[frm].txtZipWeather != null)
		document.forms[frm].txtZipWeather.value = "";

//	document.forms[frm].action = "/default.aspx";	
//	document.forms[frm].hidField.value = frm;			
//	document.forms[frm].submit();		
}