CORPO_MIN_HEIGHT = 650;

show = function(element){
    document.getElementById(element).style.display = 'block'
    if(document.getElementById(element+'Link')) document.getElementById(element+'Link').className = 'detalheMenuLinkOver'
}
hide = function(element){
    document.getElementById(element).style.display = 'none'
    if(document.getElementById(element+'Link')) document.getElementById(element+'Link').className = 'detalheMenuLink'
}
defaultPage = ''
openPage = function(page){
    if(defaultPage!='') hide(defaultPage)
    show(page)
    pageToScroll = page
    defaultPage = page
    p2s = document.getElementById(pageToScroll)
    if(parseInt(p2s.offsetHeight) < 230){
        document.getElementById('scrolling').style.display='none'
    } else{
        document.getElementById('scrolling').style.display='block'
    }
    
}

ajustaRodape = function(){
	
    var ajustSuperior;
	
	
	window.setTimeout(function(){alturaConteudo = document.getElementById('conteudoPagina').scrollHeight;document.getElementById('conteudoPrincipal').style.height = alturaConteudo},500)
	
	alturaCorpo = document.getElementById('corpo').scrollHeight
	ajusteSuperior = (alturaCorpo>CORPO_MIN_HEIGHT)?alturaCorpo:CORPO_MIN_HEIGHT
	larguraPagina = parseInt(document.body.clientWidth)
    ajusteLateral = (larguraPagina>960)?(((larguraPagina)-960)/2):0
	
	


}

function ismaxlength(obj,max){
    var mlength
    if(obj.getAttribute){
         mlength = parseInt(obj.getAttribute("tamanhomaximo"))
     }
     else {
        mlength = 0
     }
    if ((obj.getAttribute || max!=null) && obj.value.length>mlength)
    obj.value=obj.value.substring(0,mlength)
    remain = (mlength-obj.value.length)
    if(document.getElementById('contadorCaracteres')) document.getElementById('contadorCaracteres').innerHTML = " ("+remain+")"
}

function ftbMaxLength(ftb,mlength,contador){
    var content = ftb.GetHtml()
    
    if (content.length>mlength){
        content = content.substring(0,mlength)
        ftb.SetHtml(content)
        ftb.CopyHtmlToIframe(ftb.designEditor)
    }
    
    remain = (mlength-content.length)
    if(contador==null) contador = 'contadorCaracteres'
    if(document.getElementById(contador)) document.getElementById(contador).innerHTML = " ("+remain+")"
}
window.onresize = ajustaRodape


function get_url_param(name)
{ 
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 
    var regexS = "[\\?&]"+name+"=([^&#]*)"; 
    var regex = new RegExp( regexS ); 
    var results = regex.exec( window.location.href ); 
    if( results == null )    return ""; 
    else return results[1];
}
