//Browser Support Code
function postnummerSok()
{
	//$.validationEngine.closePrompt("#popup");
	var xmlhttp;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		xmlhttp = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Du måste uppdatera din webläsare för att kunna rösta!");
				return false;
			}
		}
	}
	
	// Create a function that will receive data sent from the server
	xmlhttp.onreadystatechange = function()
	{
		if(xmlhttp.readyState == 4)
		{	
			if (xmlhttp.responseText == 'goteborg') { window.location = "http://www.moderatvg.se/lokalt/goteborg"; }
			else if (xmlhttp.responseText == 'bohuslan') { window.location = "http://www.moderatvg.se/lokalt/bohuslan"; }
			else if (xmlhttp.responseText == 'norra-alvsborg') { window.location = "http://www.moderatvg.se/lokalt/norra-alvsborg"; }
			else if (xmlhttp.responseText == 'sodra-alvsborg') { window.location = "http://www.moderatvg.se/lokalt/sodra-alvsborg"; }
			else if (xmlhttp.responseText == 'skaraborg') { window.location = "http://www.moderatvg.se/lokalt/skaraborg"; }
			else { $.validationEngine.buildPrompt("#postnummer", xmlhttp.responseText,"error"); }
		}
	}
	//document.getElementById('voteField').innerHTML='<p>Var god dr&ouml;j <img src="http://www.moderatvg.se/wordpress/wp-content/themes/val2010/images/indicator.gif" /></p>';
	//$.validationEngine.intercept = true;
	$.validationEngine.buildPrompt("#postnummer","Var god dr&ouml;j","pass");
	//$.validationEngine.closePrompt("#popup");
	var postnr = document.getElementById('postnummer').value;
	var queryString = "?postnummer=" + postnr;
	xmlhttp.open("GET", "http://www.moderatvg.se/wordpress/wp-content/themes/val2010/postnummersok/skicka_vidare.php" + queryString, true);
	xmlhttp.send(null); 
}
