	function setCookie(sName, sValue) {
  		var strCookie = sName + "=" + escape(sValue) + ";"; // + "expires=Mon, 31 Dec 2012 23:59:59 UTC;"
  		document.cookie = strCookie;
	}

	function getCookie(sName) {
  		var aCookie = document.cookie.split(";");
  		for (var i=0; i < aCookie.length; i++) {
    			var aCrumb = aCookie[i].split("=");
    			while(aCrumb[0].indexOf(" ")==0) aCrumb[0]=aCrumb[0].substr(1);
    			if (sName == aCrumb[0])
      			return unescape(aCrumb[1]);
  		}
  		return null;
	}
	

	function toggle(obj,name) {
  		if (obj.style.display=="none") {
    			obj.style.display="inline";
  		} else {
			obj.style.display="none";
  		}
  		
  		if (getCookie(name)=="1") setCookie(name,"0"); else setCookie(name,"1");
	}
	
	function initSubMenu(obj,name){
		if (getCookie(name)=="1"){
    			obj.style.display="inline";
  		} else {
			obj.style.display="none";
  		}
  	}


/*******************************************************************
		GENERIC CROSS-BROWSER POP-UP WINDOW SCRIPT
		attention to the parameters
*******************************************************************/
function openWindow(url,w,h,tb,stb,l,mb,sb,rs,x,y)
{
/*
	url - The URL of the page to open. Example: "http://scriptasylum.com". 
	w - The width of the window in pixels. 
	h - The height of the window in pixels (doesn't include menubars). 
	tb - Toolbar visible? 1 = yes, 0 = no. 
	stb - Status bar visible? 1 = yes, 0 = no. 
	L - Linkbar visible? 1 = yes, 0 = no. 
	mb - Menubar visible? 1 = yes, 0 = no. 
	sb - Scrollbars visible? 1 = yes, 0 = no. 
	rs - Resizable window? 1 = yes, 0 = no. 
	x - The horizontal position of the window from the left of the screen. 
	y - The vertical position of the window from the top of the screen. 
*/
	var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y; 
	//A LITTLE CROSS-BROWSER CODE FOR WINDOW POSITIONING
	tb=(tb)?'yes':'no';
	stb=(stb)?'yes':'no'; 
	l=(l)?'yes':'no'; 
	mb=(mb)?'yes':'no'; 
	sb=(sb)?'yes':'no'; 
	rs=(rs)?'yes':'no';
	var x=window.open(url, 'newWin'+new Date().getTime(), 'scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
	x.focus();
}


/*******************************************************************
		FOR DISABLING GOOGLE BAR'S YELLOW AUTOFILL STYLE
		call the setListeners method in the onLoad method
*******************************************************************/

function setListeners(){
	// FOR DISABLING GOOGLE BAR'S YELLOW AUTOFILL STYLE
  inputList = document.getElementsByTagName("INPUT");
  for(i=0;i<inputList.length;i++){
    inputList[i].attachEvent("onpropertychange",restoreStyles);
    inputList[i].style.backgroundColor = "";
  }
  selectList = document.getElementsByTagName("SELECT");
  for(i=0;i<selectList.length;i++){
    selectList[i].attachEvent("onpropertychange",restoreStyles);
    selectList[i].style.backgroundColor = "";
  }
}

function restoreStyles(){
  if(event.srcElement.style.backgroundColor != "")
    event.srcElement.style.backgroundColor = "";
}

/*******************************************************************
		GENERIC CROSS-BROWSER SHOW/HIDE SCRIPT
		the item is given with only object name
		Ex: showItem('txtMyTextBox', 1);
*******************************************************************/

function showItem(szDivID, iState) // 1 visible, 0 hidden
{

    if(document.layers)	   //NN4+
    {
//       document.layers[szDivID].visibility = iState ? "show" : "hide";
       document.layers[szDivID].display = iState ? "inline" : "none";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
	   var obj = document.getElementById(szDivID);
	   if (obj != null)
	   {
//	       obj.style.visibility = iState ? "visible" : "hidden";
		   obj.style.display = iState ? "inline" : "none";
		}
    }
    else if(document.all)	// IE 4
    {
//        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
        document.all[szDivID].style.display = iState ? "inline" : "none";
    }
}

/*******************************************************************
		GENERIC CROSS-BROWSER ADD TO FAVORITES SCRIPT		
		Ex: bookmarksite('My Page', 'http://www.mypage.com');
*******************************************************************/
function bookmarksite(title, url)
{
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}

/*******************************************************************
		GENERIC CROSS-BROWSER ADD TO FAVORITES SCRIPT		
		Usage: into <HEAD></HEAD> of your HTML 
		<SCRIPT TYPE="text/javascript">
		<!-- 
			disableSelectText()
		// -->
		</SCRIPT>
	
visit http://www.rainbow.arch.scriptmania.com/scripts/
*******************************************************************/
function disableselect(e){
	return false
}
function reEnable(){
	return true
}

function disableSelectText()
{
	//if IE4+
	document.onselectstart=new Function("return false")
	//if NS6
	if (window.sidebar){
	document.onmousedown=disableselect
	document.onclick=reEnable
	}
}


