document.write("<script type=\"text/javascript\" src=\"assets/scripts/EdeptiveAjax.js\"></script>");
// Search site
function checkSearchFields(objForm) {	
		if(trim(objForm.keywords.value) == "") {
			alert("Please enter your keyword(s)");
			objForm.keywords.focus();
			return false;
		}
		else {
			return true;
		}
}
// pass 'active' CF to donation page
function gotoSingleDonation() {
	var sUrl = "redirect.aspx?id=0:37822";
	var x = -1;
	
	if ((x = window.location.search.indexOf("consortium=")) != -1) {
		sUrl += "&" + window.location.search.substring(x);
	}
	window.location = sUrl;
}
function gotoRegularDonation() {
	var sUrl = "redirect.aspx?id=0:37969";
	var x = -1;
	
	if ((x = window.location.search.indexOf("consortium=")) != -1) {
		sUrl += "&" + window.location.search.substring(x);
	}
	window.location = sUrl;
}

// Suckerfish JavaScript menu
sfHover = function() {
	if (document.getElementById || document.getElementById("nav") != null) {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}

//ie 6 nav fix
if (window.attachEvent) window.attachEvent("onload", sfHover); 

// Show & Hide
function show(c) {
	if (document.getElementById && document.getElementById(c)!= null) 
		node = document.getElementById(c).style.display='block'; 
	else if (document.layers && document.layers[c]!= null) 
		document.layers[c].display = 'block'; 
	else if (document.all && document.all(c)!= null) 
		document.all[c].style.display = 'block';
} 

function hide(c) {	
	if (document.getElementById && document.getElementById(c)!= null)
		node = document.getElementById(c).style.display='none';
	else if (document.layers && document.layers[c]!= null) 
		document.layers[c].display = 'none';
	else if (document.all && document.all(c)!= null) 
		document.all[c].style.display = 'none';
}

// Print web page
function printpage() {
	window.print();
}

// Check to see if in text only mode
if (GetCookie("textonly")) {
	textOnly(true);	
}

function graphicVersion() {
	DeleteCookie("textonly");
	window.location.reload(true);
}

// Set to text only version
function textOnly(mode) {
	  // Set & Delete cookie
	  if (mode) {
	  	SetCookie("textonly","1");
		disableStyle();
		disableInlineStyles();
	  }
	  else {
		DeleteCookie("textonly");
	   }
}

//Trim string
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}
//End Function

//Right Trim string
function rtrim(str)
{
	return str.replace(/\s*$/, ""); 
}
//End Function

//Left Trim string
function ltrim(str)
{
	return str.replace(/^\s*/, ""); 
}
//End Function

// Cookie functions
function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
	var j = i + alen;    
	if (document.cookie.substring(i, j) == arg)      
	return getCookieVal (j);    
	i = document.cookie.indexOf(" ", i) + 1;    
	if (i == 0) break;   
	}  
	return null;
}
function SetCookie (name, value) {  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
// End Cookie functions

/*** keep alive ***/
var gsDomain = window.location.protocol + "//" + window.location.host;
var gfUsingIP = (((window.location.host.substring(0, 1) >= "0") && (window.location.host.substring(0, 1) <= "9")) || (window.location.host == "localhost"));
var gsFolder = "/";
if(gfUsingIP) {
	gsFolder = "/" + window.location.pathname.substring(1, window.location.pathname.indexOf("/", 1)) + "/";
}
gsDomain += gsFolder;
var goAjax = null;
function keepAlive() {
	var strUrl = "";
	var sTiming = document.lastChild.lastChild.innerHTML;
	var sParams = "";

	sTiming = sTiming.substring(sTiming.lastIndexOf("<!--"));
	sTiming = sTiming.substring(5, sTiming.indexOf("-->"));
	strUrl = gsDomain + "/webservices/keep_alive.asmx/PingWithTiming";
	sParams = "Timing=" + sTiming;
	try {
		goAjax = new EdeptiveAjax();
		goAjax.postRequest(strUrl, sParams, onKeepAliveResponse);
	} catch(e) {
		setTimeout("keepAlive()", 1000*1);
	}
}
function onKeepAliveResponse() {
	if(goAjax.checkReadyState("keepAlive", "ping.", "ping..", "ping...") == "OK") {
		if(document.getElementById("keepAlive")) {
			var response = goAjax.request.responseXML.documentElement;
			document.getElementById("keepAlive").innerText = "sid=" + getText(response.firstChild);
		}
		setTimeout("keepAlive()", 1000*60);
	}
}
setTimeout("keepAlive()", 1000*2);

function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
	var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
	var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
	if (!isIE || !isWin){  
	  var flashVer = -1;
	  if (plugins && plugins.length > 0){
		var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
		desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
		if (desc == "") flashVer = -1;
		else{
		  var descArr = desc.split(" ");
		  var tempArrMajor = descArr[2].split(".");
		  var verMajor = tempArrMajor[0];
		  var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
		  var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
		  flashVer =  parseFloat(verMajor + "." + verMinor);
		}
	  }
	  // WebTV has Flash Player 4 or lower -- too low for video
	  else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

	  var verArr = reqVerStr.split(",");
	  var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
	  if (flashVer < reqVer){
		if (confirm(msg))
		  window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
	  }
	}
  } 
}