/*	function modifyShortcut(iItemID, iCategoryID, strAction) {
		var strPath = window.location.href;
		var x;
		
		if (!iCategoryID) {
			iCategoryID = 0;
		}
		if ((x = strPath.indexOf(".asp/")) != -1) {
			x = strPath.lastIndexOf("&", x);
			strPath = strPath.substring(0, x) + strPath.substring(strPath.indexOf("&", x + 1));
		}
		strPath = strPath.replace(/\?|\&/g, "/");
		window.location = "../admin_pages/add_shortcut.asp?" + (strAction ? "action=" + strAction + "&" : "") + "id=" + iItemID + "&category=" + iCategoryID + "&adeptive_redirect=" + strPath;
	}
	function deleteShortcut(iItemID, iCategoryID) {
		modifyShortcut(iItemID, iCategoryID, "delete");
	}
	function hideShortcut(iItemID, iCategoryID) {
		modifyShortcut(iItemID, iCategoryID, "hide");
	}
	function unhideShortcut(iItemID, iCategoryID) {
		modifyShortcut(iItemID, iCategoryID, "unhide");
	}
*/
	// Heinle's function for retrieving a cookie.
	function getCookie(name){
		var cname = name + "=";               
		var dc = document.cookie;    
		         
		if (dc.length > 0) {              
			begin = dc.indexOf(cname);       
			if (begin != -1) {           
			begin += cname.length;       
			end = dc.indexOf(";", begin);
			if (end == -1) end = dc.length;
				return unescape(dc.substring(begin, end));
			} 
		}
		return null;
	}
	// An adaptation of Dorcht's function for setting a cookie.
	function setCookie(name, value, expires, path, domain, secure) {
		var dateNextYear = new Date();
		
		dateNextYear.setYear(dateNextYear.getFullYear() + 1);
		document.cookie = name + "=" + escape(value) + 
			((expires == null) ? "" : "; expires=" + dateNextYear.toGMTString()) +
			((path == null) ? "" : "; path=" + path) +
			((domain == null) ? "" : "; domain=" + domain) +
			((secure == null) ? "" : "; secure");
	}
	
// Trim
function trim(str) {
	return Trim(str);
}
function Trim(TRIM_VALUE)
{
	if(TRIM_VALUE.length < 1)
	{
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	
	if(TRIM_VALUE=="")
	{
	return "";
	}
	else {
		return TRIM_VALUE;
	}
}//End Function

// Right Trim
function RTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	
	if(v_length < 0)
	{
		return"";
	}
	
	var iTemp = v_length -1;
	
	while(iTemp > -1)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{
			// nothing
		}
		else
		{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;
	} //End While
	
	return strTemp;

} //End Function


// Left Trim
function LTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	
	if(v_length < 1)
	{
		return"";
	}
	
	var v_length = VALUE.length;
	var strTemp = "";
	
	var iTemp = 0;
	
	while(iTemp < v_length)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{
			//nothing
		}
		else
		{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
	
	return strTemp;
	
} //End Function

// 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';
}
// end Show/Hide 

// returns the value of the given param, empty string if it doesn't exist in the URL
function getUrlParam(strName) {
	var strParams = window.location.search;
	var strParam = "";
	var iPosStart = -1, iPosEnd = -1;
	
	if((iPosStart = strParams.indexOf("?" + strName + "=")) != -1) {
		iPosStart += strName.length + 2;
		iPosEnd = strParams.indexOf("&", iPosStart);
		if(iPosEnd == -1) iPosEnd = strParams.length;
		strParam = strParams.substring(iPosStart, iPosEnd);
	} else if((iPosStart = strParams.indexOf("&" + strName + "=")) != -1) {
		iPosStart += strName.length + 2;
		iPosEnd = strParams.indexOf("&", iPosStart);
		if(iPosEnd == -1) iPosEnd = strParams.length;
		strParam = strParams.substring(iPosStart, iPosEnd);
	}
	return strParam;
}

if (typeof addEvent != 'function')
{
 var addEvent = function(o, t, f, l)
 {
  var d = 'addEventListener', n = 'on' + t, rO = o, rT = t, rF = f, rL = l;
  if (o[d] && !l) return o[d](t, f, false);
  if (!o._evts) o._evts = {};
  if (!o._evts[t])
  {
   o._evts[t] = o[n] ? { b: o[n] } : {};
   o[n] = new Function('e',
    'var r = true, o = this, a = o._evts["' + t + '"], i; for (i in a) {' +
     'o._f = a[i]; r = o._f(e||window.event) != false && r; o._f = null;' +
     '} return r');
   if (t != 'unload') addEvent(window, 'unload', function() {
    removeEvent(rO, rT, rF, rL);
   });
  }
  if (!f._i) f._i = addEvent._i++;
  o._evts[t][f._i] = f;
 };
 addEvent._i = 1;
 var removeEvent = function(o, t, f, l)
 {
  var d = 'removeEventListener';
  if (o[d] && !l) return o[d](t, f, false);
  if (o._evts && o._evts[t] && f._i) delete o._evts[t][f._i];
 };
}

	
/*** keep alive ***/
document.write("<script type=\"text/javascript\" src=\"Ajax.js\"></script>");
var oAjax = null;
function keepAlive() {
	var strUrl = "";

	//strUrl = window.location.protocol + "//" + window.location.host + "/webservices/keep_alive.asmx/Ping";
	strUrl = window.location.href.substr(0, window.location.href.lastIndexOf("/")) + "/webservices/keep_alive.asmx/Ping";
	oAjax = new Ajax();
	oAjax.postRequest(strUrl, "", onKeepAliveResponse);
}
function onKeepAliveResponse() {
	if(oAjax.checkReadyState("keepAlive", "ping.", "ping..", "ping...") == "OK") {
		if(document.getElementById("keepAlive")) {
			var response = oAjax.request.responseXML.documentElement;
			document.getElementById("keepAlive").innerText = "sid=" + getText(response.firstChild);
		}
		setTimeout("keepAlive()", 1000*60);
	}
}

addEvent(window, 'load', keepAlive);

	
