/////////////////////////////////////////////////////////
// Contact Window

function popContact()
{
	new_window = window.open(
		'contact.php', 
		'contact_window', 
		'width=400,height=450,location=no,scrollbars=no,toolbars=no,resizable=no');
	new_window.focus();
}

function popLoc(theLoc)
{
	new_window = window.open(
		theLoc, 
		'locWindow');
	new_window.focus();
}

function parseXML(text)
{

	try //Internet Explorer
  	{
  		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  		xmlDoc.async = "false";
  		xmlDoc.loadXML(text);
  	}
	catch(e)
  	{
  		try //Firefox, Mozilla, Opera, etc.
    		{
    			parser = new DOMParser();
    			xmlDoc = parser.parseFromString(text,"text/xml");
    		}
  		catch(e) {alert(e.message)}
  	}

	return xmlDoc;
}

/////////////////////////////////////////////////////////
// Water Temp

function requestWaterTemp(county) 
{
	var oOptions = 
	{
		method: "get",
		parameters: "type=wtemp&lval=" + county,
		onSuccess: function (oXHR, oJson) 
		{
			displayWaterTemp(oXHR.responseText);
		},
		onFailure: function (oXHR, oJson) 
		{
			displayWaterTemp("Error");
		}
	};
	var oRequest = new Ajax.Request("api_county.php", oOptions);
}
				
function displayWaterTemp(text)
{
	var xmlDoc = parseXML(text);
	
	var f = xmlDoc.getElementsByTagName('FAHRENHEIT').item(0).firstChild.nodeValue;
	//alert(f);
	document.getElementById("wtemp").innerHTML = f + "&deg;F";
	var w = xmlDoc.getElementsByTagName('WETSUIT').item(0).firstChild.nodeValue;
	//alert(w);
	document.getElementById("wsuit").innerHTML = "" + w + "";	
}		


