	var m_cookieName = "NRAPanel";
	var m_panelCookie = getPanelCookieValue(m_cookieName);

	function jsInstr(str){
		if(str.match(/[\!\@\#\$\%\^\&\*]/))
			return false;
		return true;
	}
	function getCurrentPage() {	
		var thePage=unescape(location.href)
		thePage=thePage.substr(thePage.lastIndexOf('/')+1)
		//thePage=thePage.substr(0,thePage.indexOf('.')-1)
		return thePage;
	}
	function change(id,src) {
		if(!document.all[id])
			return;
		var o = document.all[id].style;
		if(o.display=='none') {
			o.display = '';
			if(src)
			updatePanelCookie(id,true);
		}
		else {
			o.display = 'none';
			if(src)
			updatePanelCookie(id,false);
		}
		var i = document.all(id + '_img');
		if(i) {		
			if(i.src.indexOf('Expanded') == -1) 
				i.src = i.src.replace(".gif","Expanded.gif");
			else
				i.src = i.src.replace('Expanded','') 
		}				
	}
		
	function openLink(id,href) {
		location.href = href;
	}
	
	function updatePanelCookie(name,visible){
		if(visible) 
			m_panelCookie+=name+'|';
		else
			m_panelCookie = m_panelCookie.replace(name+'|','');
		document.cookie = m_cookieName+"="+m_panelCookie+"; path=/";

	}

	function getPanelCookieValue(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++)
		{	var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return '';
	}
	
	function restorePanelCookies() {
		var panels = m_panelCookie.split('|');
		for(var p=0;p < panels.length;p++)
		{	if(panels[p]!='') {
				change(panels[p],null);
			}
		}
	}

	nraPanelBar = function(id) {
		var re = /:/g;
		this.obj = document.all[ id.replace(re,'_') ];
		this.id  = id;			
	}

	nraPanelBar.prototype.addItems = function (ids) {
		this.items = ids.split(',');
		var url = getCurrentPage();
		for(x=0;x<this.items.length;x++) {
			var o = document.all[this.items[x]];
			if(o && o.onclick) {
				var links = o.onclick.toString().split("'");
				var link = links[1];
				if(location.href.indexOf(link)>0) {
//					var pid = o.id.substring(0,o.id.lastIndexOf('_'))
//					var pobj = document.all[pid];
//					if(pobj.style.display=='none') {
//						alert(pobj.style.display)
//						change(pid,pobj);
//					}
					//o.style.color='red';
					//o.style.textDecoration='underline';
					//alert(o.background )
					o.background = '/images/navBar/whiteBg.gif';
					//o.style.backgroundColir='white';
					break;			
				}
			}
		}		
	}
