/* Top Menu */
function showOver( obj ) {
	obj.className = "TopLinkRightHigh";
	if (obj.parentElement) obj.parentElement.className = "TopLinkLeft";
	else if ( obj.parentNode) obj.parentNode.className = "TopLinkLeft";
}

function showOut( obj ) {
	obj.className='TopLinkRight';
	if (obj.parentElement) obj.parentElement.className = "";
	else if ( obj.parentNode) obj.parentNode.className = "";
}


/* Menu */
function ChangeMenu( idx, hl ) {
	var img = "/static-media/images/";
	document.getElementById("MITL"+idx).className = (hl)?"TLMenuItemSel":"MenuItem";
	document.getElementById("MITR"+idx).className = (hl)?"TRMenuItemSel":"";
	document.getElementById("MIBL"+idx).className = (hl)?"BLMenuItemSel":"";
	document.getElementById("MIBR"+idx).className = (hl)?"BRMenuItemSel":"";
	document.getElementById("MIMG"+idx).src = (hl)?img+"menu_arrow2.gif":img+"menu_arrow.gif";
}

function ChangeMenuSocial( idx, hl ) {
	var img = "/static-media/social/";
	document.getElementById("MITL"+idx).className = (hl)?"TLMenuItemSel":"MenuItem";
	document.getElementById("MITR"+idx).className = (hl)?"TRMenuItemSel":"";
	document.getElementById("MIBL"+idx).className = (hl)?"BLMenuItemSel":"";
	document.getElementById("MIBR"+idx).className = (hl)?"BRMenuItemSel":"";
	document.getElementById("MIMG"+idx).src = (hl)?img+"menu_arrow2.gif":img+"menu_arrow.gif";
}


function Popup( url, w, h ){ 
   window.open( url,"popup","width="+w+",height="+h+",scrollbars=YES");
} 


function redirect( url ) {
	window.location.href=url;
}


function hideShow( hide, show ) {
	hide = document.getElementById(hide);
	show = document.getElementById(show);
	if ( hide == null || hide == undefined || show == null || show == undefined ) return false;
	hide.style.display = "none";
	show.style.display = "block";
}


function portalSearch()
{
	var obj = document.getElementById('searchBox');
	if (!obj) alert("Invalid search field");
	
	var dest = "http://www.google.pt/search?q=site%3Avidigueira.zeroaz.com+";
	
	dest += obj.value.replace(" ","+");
	window.open (dest,"mywindow");
	
	/*
	alert("A pesquisa encontra-se inactiva.\nPor favor tente mais tarde");
	return false;
	
	var obj = document.getElementById('portalsearch');
	obj.submit();
	*/
}

function portalSearchKey( e )
{
	var key=e.keyCode || e.which;
	if (key==13)
		portalSearch();
}