// ********************************
// application-specific functions *
// ********************************

//display shortcut dropdown values from the quicklinks.js files
function outputShortcuts()
{
  // modified by Alex Ling on Mar 20, 05
  // Removed hyper link of "shortcut to..."
  for ( var i = 1 ; i <= 1 ; i++ )
  {				
	document.write( "<span class=\"TOPNAVDROPDOWN\">" + HM_Array1[i][0] + "</span><br>\n");
  }
  for ( var i = 2 ; i < HM_Array1.length ; i++ )
  {				
	document.write( "<a href=\"" + HM_Array1[i][1] + "\" class=\"TOPNAVDROPDOWN\">" + HM_Array1[i][0] + "</a><br>\n");
  }
}
			
<!--- Emul drop down --->

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
		styleObject.visibility = newVisibility;
		if (newVisibility == "visible") {
			styleObject.display = "block";
		} else {
			styleObject.display = "none";
		}
		return true;
    } else {
		// we couldn't find the object, so we can't change its visibility
		return false;
    }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject

// ********************************
// application-specific functions *
// ********************************

function showMenu(menuNumber, eventObj) {
    //    alert(eventObj);
    hideAllMenus();
    var menuId = 'menu' + menuNumber;
    if(changeObjectVisibility(menuId, 'visible')) {
	var menuTitle = getStyleObject('menuTitle' + menuNumber);
	menuTitle.backgroundColor = '#ff9900';
	eventObj.cancelBubble = true;
	return true;
    } else {
	return false;
    }
}

var numMenus = 4;

function hideAllMenus() {
    for(counter = 1; counter <= numMenus; counter++) {
	changeObjectVisibility('menu' + counter, 'hidden');
	var menuTitle = getStyleObject('menuTitle' + counter);
	menuTitle.backgroundColor = '#000000';
    }
}

document.onclick = hideAllMenus;

function getDivSize(menuName, menuSize)
	{
		a = document.getElementById(menuName);
		if(a != null)
		{
			if (a.offsetHeight > menuSize)
			{
				a.style.height = menuSize;
				a.style.overflow = "auto";
			}
		}
	}

 //function for search results textonly shortcut dropdowns
function getlink(loc)
{
	var sLocation = loc;
   
   	if (sLocation != "-1")
  	{
  		window.location=sLocation;
  	}

}	
/*
-The following functions are now seperate and are in the /library/js/searchbox_header.js
-as this shortcut_search.js file is also called by the /search/default-*.aspx files
-The replaceCharacter() function ncreated issues in the utf-8 /search/default pages
-ks
function doSearch() 
{
	var searchterm = document.searchForm.Query.value.toLowerCase();
	alert("original document.searchForm.searchstring.value: " + searchterm);
 
	//do not submit if the initial Search textbox value is "Search" or empty
	if (searchterm != 'search' && searchterm != 'recherche' && searchterm != '')
	{
    
    //encodedQuery = replaceCharacter(searchterm);
    //alert("encodedQuery: " + encodedQuery);
    //document.searchForm.Query.value = encodedQuery;
    document.searchForm.submit();
	}
}	

//added to for search text box to convert iso-8859-1 characters to utf-8
//2006/03/22 - ks
function replaceCharacter(aQuery)
{
		var plaintext = aQuery;
		plaintext = plaintext.replace(/Ä/g, "%C3%84");
		plaintext = plaintext.replace(/Å/g, "%C3%85");
		plaintext = plaintext.replace(/Ç/g, "%C3%87");
		plaintext = plaintext.replace(/É/g, "%C3%89");
		plaintext = plaintext.replace(/Ñ/g, "%C3%91");
		plaintext = plaintext.replace(/Ö/g, "%C3%96");
		plaintext = plaintext.replace(/Ü/g, "%C3%9C");
		plaintext = plaintext.replace(/á/g, "%C3%A1");
		plaintext = plaintext.replace(/à/g, "%C3%A0");
		plaintext = plaintext.replace(/â/g, "%C3%A2");
		plaintext = plaintext.replace(/ä/g, "%C3%A4");
		plaintext = plaintext.replace(/ã/g, "%C3%A3");  
		plaintext = plaintext.replace(/å/g, "%C3%A5");  
		plaintext = plaintext.replace(/ç/g, "%C3%A7");  
		plaintext = plaintext.replace(/é/g, "%C3%A9"); 
		plaintext = plaintext.replace(/è/g, "%C3%A8"); 
		plaintext = plaintext.replace(/ê/g, "%C3%AA");  
		plaintext = plaintext.replace(/ë/g, "%C3%AB");  
		plaintext = plaintext.replace(/í/g, "%C3%AD");  
		plaintext = plaintext.replace(/ì/g, "%C3%AC");  
		plaintext = plaintext.replace(/î/g, "%C3%AE");  
		plaintext = plaintext.replace(/ï/g, "%C3%AF");
		plaintext = plaintext.replace(/ñ/g, "%C3%B1"); 
		plaintext = plaintext.replace(/ó/g, "%C3%B3"); 
		plaintext = plaintext.replace(/ò/g, "%C3%B2"); 
		plaintext = plaintext.replace(/ô/g, "%C3%B4"); 
		plaintext = plaintext.replace(/ö/g, "%C3%B6"); 
		plaintext = plaintext.replace(/õ/g, "%C3%B5"); 
		plaintext = plaintext.replace(/ú/g, "%C3%BA"); 
		plaintext = plaintext.replace(/ù/g, "%C3%B9"); 
		plaintext = plaintext.replace(/û/g, "%C3%BB"); 
		plaintext = plaintext.replace(/ü/g, "%C3%BC");
		plaintext = plaintext.replace(/ß/g, "%C3%9F"); 
		plaintext = plaintext.replace(/Æ/g, "%C3%86"); 
		plaintext = plaintext.replace(/Ø/g, "%C3%98"); 
		plaintext = plaintext.replace(/æ/g, "%C3%A6"); 
		plaintext = plaintext.replace(/ø/g, "%C3%B8");    
							
		var aPlaintext = unescape(plaintext);
		return aPlaintext;		
}
*/
