try{
	var listColl = document.getElementsByTagName('div');
	var theNode;
	for(i=0;i<listColl.length;i++){
		 theNode = listColl[i];
		if((theNode.getAttribute('class') == ('menu')) || (theNode.getAttribute('className') == ('menu'))
						&& theNode.getAttribute('id') != 'exempt') {
				theNode.parentNode.onmouseover = showChildMenu;
				theNode.parentNode.onmouseout =  hideChildMenu;
        }
	}

}catch(e){}
function toggleSavedSearch(id){
	var obj = $get(id);
	obj.style.position = "absolute";
	obj.style.zIndex = 10000000;	
	
	if(obj.style.display == "block")
		obj.style.display = "none";
	else
		obj.style.display = "block";
}
function showChildMenu(obj){
	if($get("saveSearch"))
		$get("saveSearch").style.display = "none";

	if(obj && obj.type != "mouseover")
		var menudivs = obj.getElementsByTagName('div');
	else
		var menudivs = this.getElementsByTagName("div");
		
	for(i=0; i< menudivs.length; i++){
		var menu = menudivs[i];
		if(menu.className == 'subMenu' || menu.className == 'subMenuLeft'){
			menu.style.visibility = 'visible';
		}
	}
}

function hideChildMenu(obj){

//this.style.backgroundPosition ="0px 0px";
if(obj && obj.type != "mouseout")
	var menudivs = obj.getElementsByTagName('div');
else
	var menudivs = this.getElementsByTagName("div");
	
for(i=0; i< menudivs.length; i++){
	var menu = menudivs[i];
	if(menu.className == 'subMenu' || menu.className == 'subMenuLeft'){
		menu.style.visibility = 'hidden';
}
}
if (window.navigator.appName.indexOf("Internet Explorer")>0)
	if(document.getElementById("consRow"))
		showSelects(document.getElementById("consRow"));
}
function showLink () {
	var obj = $get("outlookLink");
	if (window.navigator.appVersion.indexOf("Windows NT 6.0")>0){
		obj.style.display = "none";
	}
	else if (window.navigator.appName.indexOf("Internet Explorer")>0){
		obj.style.display = "inline";
	}else{
		obj.style.display = "none";
	}
}
function showInfoSide(p_obj, id){
	if((accountType == "31" || accountType == "106") && pointsAvail < 6){
		var obj = $get(id);
		var position = findPos(p_obj);
		obj.style.position = "absolute";
		obj.style.top = position[1] + 11 + "px";
		obj.style.display = "block";
		obj.style.left = position[0] - obj.offsetWidth + "px";
	}else{
		return false;
	}
}
try {
	window.onload = showLink();
} catch (e) {}
jsHover = function() {
	if(document.getElementById("headerMenu")){
		var jsEls = document.getElementById("headerMenu").getElementsByTagName("div");
		for (var i=0; i<jsEls.length; i++) {
			if(jsEls[i].className.match("menuOn")){
				jsEls[i].onmouseover=function() {
					showChildMenu(this);
					this.className+=" jshover";
				}
				jsEls[i].onmouseout=function() {
					hideChildMenu(this);
					this.className=this.className.replace(new RegExp(" jshover\\b"), "");
				}
			}
			if(jsEls[i].className.match("about")){
				jsEls[i].onmouseover=function() {
					showChildMenu(this)
					this.className+=" jshoverabout";
				}
				jsEls[i].onmouseout=function() {
					hideChildMenu(this);
					this.className=this.className.replace(new RegExp(" jshoverabout\\b"), "");
				}
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", jsHover);
var rowIndex = -1;
/* Ajax Free Text Search Code */
function adjustTableHover(listbtnId, id){
	var obj = $get(id);
	obj.style.display = "block";
}
function getFreeTextResults(obj){
	rowIndex = -1;
	FreeTextSearchAPI.getFreeTextSearchSuggestion(obj.value, displayFreeTextResults);
}
function displayFreeTextResults(AjaxResult){
	var result = AjaxResult.result;
	var table = $get('suggestTable');
	var oldtbody = table.getElementsByTagName("tbody");
	oldtbody[0].parentNode.removeChild(oldtbody[0]);
	var tbody = document.createElement("tbody");
	for(var i = 0; i < result.list.length; i++){
		var tr = document.createElement("tr");
		// Adding Data Cells
		var td = document.createElement("td");
		
		if(result.list[i].companySearch){
			td.className = "companySuggest cursor";
			tr.searchType = "company";
		}else{
			td.className = "contactSuggest cursor";
			tr.searchType = "contact";
		}
		td.innerHTML = "&nbsp;";
		tr.appendChild(td);
		
		var td = document.createElement("td");
		td.className = "suggestText cursor";
		td.innerHTML = fixLength(result.list[i].suggestedText,25);
		tr.title = result.list[i].suggestedText;
		tr.rowNum = i;
		tr.onclick = function(){ 
			$get("freeTextInput").value = this.title; 
			
			if(this.searchType == "contact")
				getForm("freeTextForm").action = "/FreeTextSearchAcrossCompanies.xhtml";
			
			if(this.searchType == "company")
				getForm("freeTextForm").action = "/FreeTextSearchCompany.xhtml";
				
			subForm('freeTextForm');
		};
		tr.onmouseover = function() { this.className = "suggestOver"; if(this.rowNum != rowIndex){deselectSBSRow(rowIndex);} };
		tr.onmouseout = function() { this.className = "suggestOut"; deselectSBSRow(rowIndex);};
		tr.appendChild(td);
		tbody.appendChild(tr);
	}
	table.appendChild(tbody);
	if(result.hits > 0){
		table.style.visibility = "visible";
		adjustTableHover("freeTextInput", "suggestTable");
	}else{
		table.style.visibility = "hidden";
		table.style.display="none";
	}
}
function detect_keycode(event){
	var character = (document.all) ? event.keyCode: event.which;
	return character;	
}
function doLogin(frmName){
	_hbPageView('Member Cookied Home Page');
	subForm(frmName);
}
function handleLoginEvent(keycode){
	if(keycode == 13 ) {
	    doLogin('LoginForm');
        try {
           if (window.event)  window.event.cancelBubble = true;
        } catch(ex) {}
    }
}
function handleKeyCodeEvent(keycode){
	var autoSuggested = getFormElement("freeTextForm", "autoSuggested");
	var input = $get('freeTextInput');
	if(keycode == 38){
		deselectSBSRow(rowIndex);
		rowIndex = rowIndex - 1;
		autoSuggested.value = true;
		
		if(rowIndex < 0)
			rowIndex = 0;
			
		selectSBSRow(rowIndex);
	}else if(keycode == 40){
		autoSuggested.value = true;
		
		deselectSBSRow(rowIndex);
		rowIndex = rowIndex + 1;
		selectSBSRow(rowIndex);		
	}else{
		if(input.value.trim().length > 0)
			autoSuggested.value = true;
		else
			autoSuggested.value = false;
			
		getFreeTextResults(input);
	}
    if(keycode == 13 ) {
    	form = $get('freeTextInput').form;
        form.submit();
        try {
           if (window.event)  window.event.cancelBubble = true;
        } catch(ex) {}
    }
}
function deselectSBSRow(index){
	var table = $get('suggestTable');
	var tbody = table.getElementsByTagName("tbody");
	
	try{
		var tr = tbody[0].getElementsByTagName("tr");
		if(index >= tr.length)
			index = tr.length - 1;
		if(tr.length == 0)
			return false;
		else{
			tr[index].className = "suggestOut";
		}
	}catch(e){
		return false;
	}
}
function selectSBSRow(index){
	var table = $get('suggestTable');
	var tbody = table.getElementsByTagName("tbody");
	
	try{
		var tr = tbody[0].getElementsByTagName("tr");
		if(index >= tr.length)
			index = tr.length - 1;
		if(tr.length == 0)
			return false;
		else{
			tr[index].className = "suggestOver";
			$get('freeTextInput').value = tr[index].title;
		}
	}catch(e){
		return false;
	}
}
function submitOnEnter (event) {
	var keycode = (document.all) ? event.keyCode: event.which;
    if(keycode == 13 ) {
        form.submit();
        try {
           if (window.event)  window.event.cancelBubble = true;
        } catch(ex) {}
    }

}