// expanding-contracting left-hand navigation
function showhide(what){     
	elmnt = document.getElementById(what);
	if (elmnt.style.display == 'none'){
		elmnt.style.display = 'block';
	}
	else{ 
		elmnt.style.display = 'none';
	}
}

// opens pop-up print window
function openPrintWindow(url,winName,features){
	if (url.indexOf("?") == -1){
		window.open(url + "?style=print","newPrint",'scrollbars=yes,width=680,height=700,screenx=10,screeny=10,top=10,left=10')
	}
	else{
		window.open(url + "&style=print","newPrint",'scrollbars=yes,width=680,height=700,screenx=10,screeny=10,top=10,left=10')
	}
}

// bookmarks page in IE and FF
function addBookmark(title,url){
	if (window.sidebar){
		window.sidebar.addPanel(title, url,"");
	}
	else if( document.all ){
		window.external.AddFavorite( url, title);
	}
}

popupWins = new Array();
function windowOpener(url, name, args) {
	if ( typeof( popupWins[name] ) != "object" ) {
		popupWins[name] = window.open(url,name,args);
	} else {
		if (!popupWins[name].closed){
			popupWins[name].location.href = url;
		} else {
			popupWins[name] = window.open(url, name,args);
		}
	}
	popupWins[name].focus();
}

function gotoPage(u) { 
	if(top.opener!=null) { 
		top.opener.location.href = u; 
	}
}

//SEARCH

function searchString(languageCode, site, client, output, serverName) {
	var q = document.getElementById("searchValue").value;
	var replacedstring1;
	var replacedstring2;
	var replacedstring3;
	replacedstring1 = q.replace(/ /g, "+");
	replacedstring2 = replacedstring1.replace(/%/g, "%25");
	replacedstring3 = replacedstring2.replace(/&/g, "%26");
	q = replacedstring3;
	
	window.location.href = "http://"+serverName+"/"+languageCode+"/utils/search.shtml?q="+q+"&site="+site+"&client="+client+"&output="+output;
} 
	 
function searchValue(value) {
	var value1 = value;
	var value2;
	var value3;
	if (value1 != null && value1 != '') {
		value2 = value1.replace(/&amp;#39;/g, "'");
		value3 = value2.replace(/&amp;/g, "&");
		document.getElementById("searchValue").value=value3;
	} else {
		document.getElementById("searchValue").value="Search";
	}  
}
    
function searchTxt(q) {
	var value1 = q;
	var value2;
	var value3;
	var value4;  
	q=q.replace(/&amp;/g, '&');    
	k=q.search(/&#39.+/);
	value2 = value1.replace(/&amp;#39;/g, "'");
	value3 = value2.replace(/&amp;/g, "&");
	if(k!=-1) {      
		q = encodeURI(q);     
	}     
	document.getElementById("searchTxtLayer").innerHTML = q;  
}

