<!--
//ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª//
//ªªªªªªªªªªªªª      IMG Preload + IMG Swap      ªªªªªªªªªªªªªªªªªªªªª//
//ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª//
function swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function findObj(n, d) { //v4.01
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function swapImage() { //v3.0
    var i,j=0,x,a=swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function bookmarksite(title, url){
    if (document.all)
    window.external.AddFavorite(url, title);
    else if (window.sidebar)
    window.sidebar.addPanel(title, url, "")
}
//ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª//
//ªªªªªªªªªªªªªªªªª            TABS           ªªªªªªªªªªªªªªªªªªªªªªªª//
//ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª//
	function mostra(elemento) {
	   styleObj=document.getElementById(elemento).style;
	   styleObj.display="block";
	   styleObj.visibility="visible";
	}
	
	function MostraDiv(opt,div,n){
	    LimpaeEscondeObj(n)	  
	    styleObj=document.getElementById(div).style;
	    styleObj.display="block";
	    styleObj.visibility="visible";	
	    styleObj=document.getElementById(opt).style;
	    styleObj.backgroundColor="#f5f5f5"
	}
	
	function LimpaeEscondeObj(n){
	   for (i=1; i<=n; i++){
	        styleObj=document.getElementById('DivSubOpt'+i).style;	        
	        styleObj.display="none";
	        styleObj.visibility="hidden";
	   }
	   for (i=1; i<=n; i++){
	        styleObj=document.getElementById('subOpt'+i).style;	        
	        styleObj.backgroundColor="#ffffff"
	   }
	}
	
	
	
	function esconde(elemento) {
	   styleObj=document.getElementById(elemento).style;
	   styleObj.display="none";
	   styleObj.visibility="hidden";
	}
/************************/
var initialtab=[1, "sc1"]

function cascadedstyle(el, cssproperty, csspropertyNS){
    if (el.currentStyle)
        return el.currentStyle[cssproperty]
    else if (window.getComputedStyle){
        var elstyle=window.getComputedStyle(el, "")
        return elstyle.getPropertyValue(csspropertyNS)
        }
}
var previoustab=""
function expandcontent(cid, aobject){
    if (document.getElementById){
    highlighttab(aobject)
    detectSourceindex(aobject)
    if (previoustab!="")
    document.getElementById(previoustab).style.display="none"
    document.getElementById(cid).style.display="block"
    previoustab=cid
    if (aobject.blur)
    aobject.blur()
    return false
    }
    else
    return true
}

function highlighttab(aobject){
    if (typeof tabobjlinks=="undefined")
        collecttablinks()
        for (i=0; i<tabobjlinks.length; i++){
        tabobjlinks[i].style.backgroundColor="#ffffff"
        
       }
        var themecolor=aobject.getAttribute("theme")? aobject.getAttribute("theme") : initTabpostcolor
        aobject.style.backgroundColor="#f5f5f5"        
}

function collecttablinks(){
    var tabobj=document.getElementById("vertTabList")
    tabobjlinks=tabobj.getElementsByTagName("LI")
}

function detectSourceindex(aobject){
    for (i=0; i<tabobjlinks.length; i++){
        if (aobject==tabobjlinks[i]){
            tabsourceindex=i 
            break
        }
    }
}

function do_onload(){
    if(document.getElementById("sc1")!=null){
        var cookiename=(typeof persisttype!="undefined" && persisttype=="sitewide")? "tabcontent" : window.location.pathname
        var cookiecheck=window.get_cookie && get_cookie(cookiename).indexOf("|")!=-1
        collecttablinks()
        initTabcolor=cascadedstyle(tabobjlinks[1], "backgroundColor", "background-color")
        initTabpostcolor=cascadedstyle(tabobjlinks[0], "backgroundColor", "background-color")
        if (typeof enablepersistence!="undefined" && enablepersistence && cookiecheck){
            var cookieparse=get_cookie(cookiename).split("|")
            var whichtab=cookieparse[0]
            var tabcontentid=cookieparse[1]
            expandcontent(tabcontentid, tabobjlinks[whichtab])
        }
        else
            expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
    }
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

var enablepersistence=true 
var persisttype="local"

function get_cookie(Name) { 
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search)
        if (offset != -1) { 
            offset += search.length
            end = document.cookie.indexOf(";", offset);
            if (end == -1) end = document.cookie.length;
                returnvalue=unescape(document.cookie.substring(offset, end))
        }
    }
    return returnvalue;
}

function savetabstate(){
    var cookiename=(persisttype=="sitewide")? "tabcontent" : window.location.pathname
    var cookievalue=(persisttype=="sitewide")? tabsourceindex+"|"+previoustab+";path=/" : tabsourceindex+"|"+previoustab
    document.cookie=cookiename+"="+cookievalue
}

window.onunload=savetabstate


//ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª//
//ªªªªªªªªªªªªªªªªª    NEW WINDOW / POP UP    ªªªªªªªªªªªªªªªªªªªªªªªª//
//ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª//

	var win = null;
	function NewWindow(mypage,myname,w,h,scroll){
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/4 : 0;
		settings =
		'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
		win = window.open(mypage,myname,settings)
	}

//ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª//
//ªª FUNCOES PARA  POSICIONAR O CONTROLO CANLENDAR do mês "escolhido" ªª//
//ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª//

function VerificaData(obj){
    var framesetQuery = "";
    if ( window.parent.location.search != 0 ) {
        framesetQuery = window.top.location.search;
    } else {
        framesetQuery = "?OpenFrameset";
    }
    var data = getParameter ( framesetQuery, 'data' );
    /*
    if(data){
    document.getElementById('frameCalend').src='Calendario.aspx?data='+data;
    }
    */
    //    obj.src='Calendario.aspx?data='+data;
    //document.getElementById('frameCalend').src='Calendario.aspx?data='+data;
}

function getParameter ( queryString, parameterName ) {    
    var parameterName = parameterName + "=";
    if ( queryString.length > 0 ) {
        begin = queryString.indexOf ( parameterName );    
        if ( begin != -1 ) {    
            begin += parameterName.length;    
            end = queryString.indexOf ( "&" , begin );
            if ( end == -1 ) {
                end = queryString.length
            }    
            return unescape ( queryString.substring ( begin, end ) );
        }
        return "null";
    }
}




/***************** "usr info" ******************************
* pop up com info sobre os utilizadores
***********************************************/

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobj){
if (document.getElementById){
var subobj=document.getElementById(subobj)
subobj.style.left=getposOffset(curobj, "left")+"px"
subobj.style.top=getposOffset(curobj, "top")+"px"
subobj.style.display="block"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}


//-->
