// JavaScript Document
	function SearchZip(e)
	{
		
		var keynum
		var keychar
		var numcheck
		
		if(window.event) // IE
		{
		keynum = e.keyCode
		}
		else if(e.which) // Netscape/Firefox/Opera
		{
		keynum = e.which
		}
		keychar = String.fromCharCode(keynum)
		if(keynum == 13)
		{
			if(document.getElementById("ZipcodeSEarch").value!="" && document.getElementById("ZipcodeSEarch").value!="ENTER ZIP CODE")
			{
				ga_trackEvent("wl_main_nav", "click", "Find_a_Practioner_Search");
				//window.location = "map.html?val=" + document.getElementById("ZipcodeSEarch").value;
				window.location = "/locator.shtml?val=" + document.getElementById("ZipcodeSEarch").value;
			//	loadResponsePage(document.getElementById("ZipcodeSEarch").value)
			}
			else
			{
				alert("You must enter a ZIP code!");
			}
		}
		numcheck = /\d/

	
	}
	
	function Searcharrow()
	{
		if(document.getElementById("ZipcodeSEarch").value!="" && document.getElementById("ZipcodeSEarch").value!="ENTER ZIP CODE")
		{
			ga_trackEvent("wl_main_nav", "click", "Find_a_Practioner_Search");
			//window.location = "map.html?val=" + document.getElementById("ZipcodeSEarch").value;
			window.location = "/locator.shtml?val=" + document.getElementById("ZipcodeSEarch").value;
		//	loadResponsePage(document.getElementById("ZipcodeSEarch").value)
		}
		else
		{
			alert("You must enter a ZIP code!");
		}
	}
	function Searcharrowv2()
	{
		if(document.getElementById("searchAgaingMap").value!="" && document.getElementById("searchAgaingMap").value!="ENTER ZIP CODE")
		{
			ga_trackEvent("wl_main_nav", "click", "Find_a_Practioner_Search");
			window.location = "/locator.shtml?val=" + document.getElementById("searchAgaingMap").value;
		}
		else
		{
			alert("You must enter a ZIP code!");
		}
		
	}	
	function SearchZipv2(e)
	{
		
		var keynum
		var keychar
		var numcheck
		
		if(window.event) // IE
		{
		keynum = e.keyCode
		}
		else if(e.which) // Netscape/Firefox/Opera
		{
		keynum = e.which
		}
		keychar = String.fromCharCode(keynum)
		if(keynum == 13)
		{
			if(document.getElementById("searchAgaingMap").value!="" && document.getElementById("searchAgaingMap").value!="ENTER ZIP CODE")
			{
				ga_trackEvent("wl_main_nav", "click", "Find_a_Practioner_Search");
				//window.location = "map.html?val=" + document.getElementById("ZipcodeSEarch").value;
				window.location = "/locator.shtml?val=" + document.getElementById("searchAgaingMap").value;
			//	loadResponsePage(document.getElementById("ZipcodeSEarch").value)
			}
			else
			{
				alert("You must enter a ZIP code!");
			}	
		}
		numcheck = /\d/

	
	}	
	
	
	
	
	function isValidZip(val)
	{
  		return (/^\d{5}([- ]?\d{4})?$/.test(val));
	}
	
	
	function loadResponsePage() {
	var queryString = window.location.search.substring(1);
	val = getParameterValue(queryString, "val");
	document.getElementById('ZipcodeSEarch').value = val;	
	document.getElementById('searchAgaingMap').value = val;	
	if(!val || val==''){
		document.getElementById('ZipcodeSEarch').value = "";
		document.getElementById('searchAgaingMap').value = "";	
	}

	//var postalCd = "";
	var postalCd = document.getElementById('searchAgaingMap').value;
	if(isValidZip(val)){
		postalCd = val;
	}
	
	var brandSite = "y";
	var brandSiteURL = "www.airoptix.com";
	var country = "GBR";
	var product = "";
	
	var url = "http://www.get.cibavision.com/index.shtml?brandSite=" + brandSite + "&brandSiteURL=" + brandSiteURL + "&country=" + country + "&product=" + product +"&postalCd="+postalCd;	
	document.getElementById('drLocatorFrame').src = url;
	document.getElementById('drLocatorFrame').style.display="block";
	}


function getParameterValue(queryString,parameterName){
	var paramName = parameterName + "=";
	var begin;
	var end;
	if(queryString.length > 0){
		begin = queryString.indexOf(paramName);
		if(begin != -1){
			begin = begin + paramName.length;
			end = queryString.indexOf("&",begin);
			if(end == -1)
				end = queryString.length;
			return queryString.substring(begin,end);
		}
	}
	return null;
}


function SearchFunction()
{
	if(document.getElementById("searchkey").value!="")
	{
		ga_trackEvent("wl_main_nav", "click", "Find_a_Practioner_Search");
		window.location = "/search.shtml?q=" + document.getElementById("searchkey").value;
	}
	else
	{
		alert("You must enter a Search Term!");
	}
}


function SearchKey(e)
	{
		
		var keynum
		var keychar
		var numcheck
		
		if(window.event) // IE
		{
		keynum = e.keyCode
		}
		else if(e.which) // Netscape/Firefox/Opera
		{
		keynum = e.which
		}
		keychar = String.fromCharCode(keynum)
		if(keynum == 13)
		{
			if(document.getElementById("searchkey").value!="")
			{
				ga_trackEvent("wl_main_nav", "click", "Find_a_Practioner_Search");
				window.location = "search.shtml?q=" + document.getElementById("searchkey").value;
			}
			else
			{
				alert("You must enter a Search Term!");
			}
		}
		numcheck = /\d/

	
	}


