function XprintPage() { 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
		sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 
   var sWinHTML = document.getElementById('col1').innerHTML; 
   var winprint=window.open("","",sOption); 
		winprint.document.open(); 
		winprint.document.write('<html><link href=/print.css rel=Stylesheet><body><div id=col1><h1 class="small">Community Health Services Department / Child Health & Dental Services Department</h1>');
		winprint.document.write(sWinHTML);
		winprint.document.write('</div></body></html>');
		winprint.document.close(); 
		winprint.focus(); 
}

// support function for querystring(key) 
function PageQuery(q) {
	if (q.length > 1) {
		this.q = q.substring(1, q.length);
	}
	else {
		this.q = null;
	}
	this.keyValuePairs = new Array();
	if (q) {
		for (var i = 0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for (var j = 0; j < this.keyValuePairs.length; j++) {
			if (this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for (var j = 0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }
}

var weatherVisible = true;
function toggleWeather() {
	
	if (weatherVisible) {
		jQuery("#weather").animate({ marginTop: "-110px" }, 1000);
		//document.getElementById("weather").style.top = '-110px';
		weatherVisible = false;
	} else {
		jQuery("#weather").animate({ marginTop: "0px" }, 1000);
		//document.getElementById("weather").style.top = '0px';
		weatherVisible = true;
	}
}

var showWeatherBox = false;


function initWeatherBox() {
	if (WeatherBoxCookie == true) 
	{
		showWeatherBox = true;
		jQuery("#weather").css("marginTop", "0px");
		jQuery("#weatherButton").attr("title", "Hide Weather Conditions");
	}
	else if (WeatherBoxCookie == false) 
	{
		showWeatherBox = false;
		jQuery("#weather").css("marginTop", "-110px");
		jQuery("#weatherButton").attr("title", "Show Weather Conditions");
	}
	else 
	{
		showWeatherBox = true;
		jQuery("#weather").css("marginTop", "0px");
		jQuery("#weatherButton").attr("title", "Hide Weather Conditions");
	}
	var dataString = "showWeatherBox=" + showWeatherBox;
	jQuery.ajax({
		type: "POST",
		url: "/weathercookie.asp",
		data: dataString,
		success: function() {
		}
	});
	
	
}

function toggleWeatherBox() {
	document.getElementById("weatherButton").title = "New Title";
	if (WeatherBoxCookie == true) {
		showWeatherBox = false;
		WeatherBoxCookie = false;
		jQuery("#weather").animate({ marginTop: "-110px" }, 1000);
		jQuery("#weatherButton").attr("title", "Show Weather Conditions");
	}
	else if (WeatherBoxCookie == false) 
	{
		showWeatherBox = true;
		WeatherBoxCookie = true;
		jQuery("#weather").animate({ marginTop: "0px" }, 1000);
		jQuery("#weatherButton").attr("title", "Hide Weather Conditions");
	}
	else
	{ // The cookie is empty
		showWeatherBox = true;
		WeatherBoxCookie = true;
		jQuery("#weather").css("marginTop", "0px");
		jQuery("#weatherButton").attr("title", "Hide Weather Conditions");
	}
	var dataString = "showWeatherBox=" + showWeatherBox;
	jQuery.ajax({
		type: "POST",
		url: "/weathercookie.asp",
		data: dataString,
		success: function() {
		
		}
	});
}


/*
function initWeatherBox() {
if (getCookie("showWeatherBox") == "true") {
showWeatherBox = true;
jQuery("#weather").css("marginTop", "0px");

}
else if (getCookie("showWeatherBox") == "false") {
showWeatherBox = false;
jQuery("#weather").css("marginTop", "-110px");
}
else {
showWeatherBox = true;
var expDate = new Date();
}
var dataString = "showWeatherBox=" + showWeatherBox;
jQuery.ajax({
type: "POST",
url: "weathercookie.asp",
data: dataString,
success: function() {
}
});
jQuery("#weather").css("marginTop", "0px");
}

function toggleWeatherBox() {
if (getCookie("showWeatherBox") == "true") {
showWeatherBox = false;
jQuery("#weather").animate({ marginTop: "-110px" }, 1000);

}
else if (getCookie("showWeatherBox") == "false") {
showWeatherBox = true;
jQuery("#weather").animate({ marginTop: "0px" }, 1000);
}
else { // The cookie is empty
showWeatherBox = true;
jQuery("#weather").css("marginTop", "0px");
}
var dataString = "showWeatherBox=" + showWeatherBox;
jQuery.ajax({
type: "POST",
url: "weathercookie.asp",
data: dataString,
success: function() {

}
});
}*/



function queryString(key) {
	// requires PageQuery(q) function
	// returns the querystring value
	var page = new PageQuery(window.location.search);
	return unescape(page.getValue(key));
}

function popUp(whichURL, whichWindow, Xsize, Ysize) {
	whichWindow = whichWindow.replace(' ', '_');
	if (!window.focus) {
		return true;
	} else {
		if (typeof (whichURL) == 'string') {
			whichURL = whichURL;
		} else {
			whichURL = whichURL.href;
		}
		window.open(whichURL, whichWindow, 'width=' + Xsize + ',height=' + Ysize + ',scrollbars=no,resize=yes,status=no,toolbar=no');
		return false;
	}
}

// Before submitting make sure valid keywords have been added 
function Search() {
	if (document.forms['search'].keywords.value == '') {
		alert('Please enter a keyword to search for!');
		return false;
	} else if (document.forms['search'].keywords.value == 'Search') {
		return false;
	} else {
		return true;
	}
}
/*

function setCookie(name, value, expires, path, domain, secure) {
expDate.setMonth( parseInt(expDate.getMonth()) + expires); 
document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expDate : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else {
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}
function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
}
function getElementsByClass(searchClass,node,tag) {
var classElements = new Array();
if ( node == null )
node = document;
if ( tag == null )
tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
*/
