/*****************************************************************************
* Site: homeFunc.js
******************************************************************************
* - GetCookie(sName)			: Chack if there is a Cookie and return true/false
* - imgOnOff(img,on)			: for mouseOver and mouseOut
* - nz(param,val)									: if the param is null or 0 return val or "" if val not sopplied
* - openWindow(fName)			: open Window with the specific location
* - SetCookie(sName, sValue)	: update a user coocie 
* - trim(str)					: trim string
*****************************************************************************/
//Chack If there is a Cookie
function GetCookie(sName){
	// cookies are separated by semicolons
	var aCookie = document.cookie.split(";");
	for (var i=0; i < aCookie.length; i++){
		// a name/value pair (a crumb) is separated by an equal sign
		var aCrumb = aCookie[i].split("=");
		if (sName == trim(aCrumb[0]))return unescape(aCrumb[1]);
	}
	return null;// a cookie with the requested name does not exist
}
function imgOnOff(img,on){
imgSrc=img.src
imgSrc = imgSrc.toLowerCase( )
	if(on){
		imageOn=imgSrc.substring(0,imgSrc.indexOf("off.gif")) + "on.gif"
		document.images[img.name].src =imageOn
	}
	else{
		imageOff=imgSrc.substring(0,imgSrc.indexOf("on.gif")) + "off.gif"
		document.images[img.name].src =imageOff
	}
}
function nz(param,val){
	//if the param is null or 0 return val or "" if val not sopplied
	return(
		isnull(param)? ((!isnull(val)) ? val : "") : param
	)
}

function openWindow(url,param,wName){
	wName = nz(wName,"defWin")
	//if(isnull(param)) param = "scrollbars=yes,toolbar=no,resizable=0,left=100,top=100,width=420,height=420"
	if(isnull(param)) param = "scrollbars=no,toolbar=no,resizable=0,left=0,top=0,width=550,height=450"
	var win = window.open(url, wName ,param);
	win.focus();
}
function SetCookie(sName, sValue){
	document.cookie = sName + "=" + escape(sValue) + ";expires=Mon, 31 Dec 2099 23:59:59 UTC;path=/"
}
function trim(str){
	try {
		return str.replace(/^\s+|\s+$/g,'');
	}
	catch (e) {return str;}
}
