// DROPDOWN MENU

$(document).ready(function(){
	
// Remove right column if empty
 
$("#flyOutMenu li").hover(
	function(){ $("ul", this).fadeIn("normal"); }, 
	function() { } 
);
if (document.all) {
		$("#flyOutMenu li").hoverClass ("sfHover");
	}
});

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};	

/*
--------------------------------------------------------
Search
--------------------------------------------------------
*/


function makeSearch(searchStr){
	// clean up spaces around string 
	var searchStr = trimString(searchStr);
	if(searchStr){
		var url = "/sog.aspx?search="+searchStr;
		window.location.href = url;
	}
}

function trapSearchEnter(e, enterFunction){
     if (!e) e = window.event;
     if (e.keyCode == 13){
          e.cancelBubble = true;
          if (e.returnValue) e.returnValue = false;
          if (e.stopPropagation) e.stopPropagation();
          if (enterFunction) eval(enterFunction);
          document.getElementById("searchButton").click();
          return false;
     } else {
 
          return true;
     }     
}

function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}


/* Search - ÆØÅ works from user search text.*/

function postSearch(searchStr){
	
	if(searchStr != ""){
		location = "/sog.aspx?search=" + encodeURI(searchStr) + "&page=1";
	}
	else{
		return false;
	}
}

/*
--------------------------------------------------------
openMap
--------------------------------------------------------
*/


function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { 
    if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
    }
    window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
    }