﻿// JScript File
// DESABILITAR MOUSE
function disableselect(e) {
    return false;
} 
  
function reEnable() {
    return true;
} 
  
//if IE4+
document.onselectstart=new Function ("return false") 
  
//if NS6
if (window.sidebar){
    document.onmousedown=disableselect;
    document.onclick=reEnable;
}
function clickIE() {
    if (document.all) {
	    (message);
	    return false;
    }
}

function clickNS(e) {
    if (document.layers||(document.getElementById&&!document.all)) {
	    if (e.which==2 || e.which==3) {
		    (message);
		    return false;
	    }
    }
}
if (document.layers) {
    document.captureEvents(Event.mousedown);
    document.onmousedown=clickNS;
}
else {
    document.onmouseup=clickNS;
    document.oncontextmenu=clickIE;
}

function clickiee() {
    if (event.button == 2) {
	    alert('ação desativada');
	    return false;
    }
}

document.oncontextmenu=new Function("return false")
document.onmousedown=clickiee;

function Imagem() {
    if (document.getElementById) {
        var cadaimagem = new Array();
        cadaimagem = document.getElementsByTagName("img");
        for (var i = 0; i < cadaimagem.length; i++) {
            if (cadaimagem[i].id != "portal") {
                Resize1(cadaimagem[i],340,1000);
            }
        }
    }
}

Resize1 = function(i,largura,altura)
{
	var	w = largura;
	var h = altura;
    var img = i;
	img.style.display = '';
	var	iw = img.width;
	var	ih = img.height;
	
    if(iw > w || ih > h) {
		var nim = iw / w;
		if (ih / nim > h) {
		    nim = ih / h;
		}
		w = Math.round(iw / nim);
		h = Math.round(ih / nim);
		
		img.setAttribute('width',w);
		img.setAttribute('height',h);
	}
	else {
	    img.setAttribute('width',iw);
		img.setAttribute('height',ih);
	}
}

Resize = function(i,largura,altura)
{
	var	w = largura;
	var h = altura;
    var img = i;
	img.style.display = '';
	var	iw = document.getElementById("imgPrincipal1").width;
	var	ih = document.getElementById("imgPrincipal1").height;
	
    if(iw > w || ih > h) {
		var nim = iw / w;
		if (ih / nim > h) {
		    nim = ih / h;
		}
		w = Math.round(iw / nim);
		h = Math.round(ih / nim);
		
		img.setAttribute('width',w);
		img.setAttribute('height',h);
	}
	else {
	    img.setAttribute('width',iw);
		img.setAttribute('height',ih);
	}
}

var ie =(((navigator.userAgent.indexOf("MSIE")>-1)||(navigator.userAgent.indexOf("Mozilla/5.0")>-1))&&navigator.userAgent.indexOf("Opera")==-1?true:false);
var ns =(navigator.userAgent.indexOf("Netscape")>-1&&navigator.userAgent.indexOf("Opera")==-1?true:false);
function ajustar_data(input, evento) {
    var tecla = (evento.keyCode ? evento.keyCode: evento.which ? evento.which : evento.charCode);
    if (tecla == 8 || tecla == 46 || tecla == 39 || tecla == 37 || tecla == 36 || tecla == 35 || tecla == 9) {
        return true;
    }
    if (tecla < 48 || tecla > 57) {
        evento.returnValue = false;
        return false;
    }
    else {
        if (input.value.length == 2 || input.value.length == 5) {
            input.value += "/";
        }
    }
    return true;
}

function init(numero, opcao) {
    var vCookie = getCookie("MenuPanel" + numero);
    oLayer = document.getElementById("MenuPanel" + numero);
    
    if (vCookie == null) {
        if (opcao == "0") {
            oLayer.style.display = "none";
            setCookie('MenuPanel' + numero, 'none');
        }
        else {
            setCookie('MenuPanel' + numero, '');
            oLayer.style.display = "";
        }
    }
    else {
        if (vCookie == "none") {
	        oLayer.style.display = "none";
		    setCookie('MenuPanel' + numero, 'none');
		}
		else {
		    setCookie('MenuPanel' + numero, '');
		    oLayer.style.display = "";
		}
    }
}

function ShowMenuLateral(number) {
	oLayer = document.getElementById("MenuPanel" + number);
	if (oLayer.style.display == "") {
		setCookie('MenuPanel' + number, 'none');
		oLayer.style.display = "none";
	} else {
		setCookie('MenuPanel' + number, '');
		oLayer.style.display = "";
	}
}

function setCookie(nome,valor) {
    document.cookie = nome + "=" + escape(valor);
}

function getCookie(nome) {
    var dc = document.cookie;
    var prefix = nome + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function StartShowHide(Name) {
	var vCookie = getCookie("ShowHide" + Name);
	oObject  = document.getElementById(Name);
	
	if (vCookie != null) {
		if (vCookie == "") {
			oObject.style.display = "";
		}
		else {
			oObject.style.display = "none";
		}
	}
	else
	{
		oObject.style.display = "none";
		setCookie('ShowHide' + Name, 'none');
	}
}

function ShowHide(Name) {
	var vCookie = getCookie("ShowHide" + Name);
	oObject  = document.getElementById(Name);
	if (oObject.style.display == "") {
		setCookie('ShowHide' + Name, 'none');
		oObject.style.display = "none";
	}
	else {
		setCookie('ShowHide' + Name, '');
		oObject.style.display = "";
	}
}

function popup() {
    var now = new Date();	
	var dia = now.getDay();
	var mes = now.getMonth();
	var ano = now.getFullYear();
	var hora = now.getHours();
	var mintuto = now.getMinutes();
	var segundo = now.getSeconds();
	var data = ano+""+mes+""+dia+""+hora;
	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="300" height="350">');
    document.write('<param name="movie" value="Arquivos/Popup/popup.swf?ieSux='+ data +'" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="wmode" value="transparent" />');
    document.write('<embed wmode="transparent" menu="false" src="Arquivos/Popup/popup.swf?ieSux='+ data +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="300" height="350"></embed>');
    document.write('</object>');
}

function pop() {
    window.open('ucPopup.aspx','Popup','width=300,height=350');
}

function montaSWF(arquivo,largura,altura,action){
	var now = new Date();	
	var dia = now.getDay();
	var mes = now.getMonth();
	var ano = now.getFullYear();
	var hora = now.getHours();
	var mintuto = now.getMinutes();
	var segundo = now.getSeconds();
	var data = ano+""+mes+""+dia+""+hora;
	
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + largura + '" height="' + altura + '">');
	document.write('<param name="movie" value="swf/'+ arquivo +'.swf?ieSux='+ data +'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="FlashVars" value="'+ action +'&clearCache='+ data +'" />');
	document.write('<embed FlashVars="'+ action +'&clearCache='+ data +'" wmode="transparent" menu="false" src="swf/'+ arquivo +'.swf?ieSux='+ data +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + largura + '" height="' + altura + '"></embed>');
	document.write('</object>');
}