/*FUNCOES AJUDA*/
function ShowStatusAg(){
	var posy = event.y
	var posX = event.x
	var over = document.getElementById("OverStatusAg");
	
	over.style.display = "inline";
	over.style.left = event.x + "px";
	over.style.top = event.y + 14 + "px";
}

function HideStatusAg(){
	var over = document.getElementById("OverStatusAg");
	
	over.style.display = "none";
}

function showAjuda(){
	var ajuda = document.getElementById("popAjuda");
	
	if (ajuda.style.display != "inline"){
		ajuda.style.display = "inline";
		document.getElementById("select1").style.display = "none";
		document.getElementById("select2").style.display = "none";
		document.getElementById("select3").style.display = "none";
	}else{
		ajuda.style.display = "none";
		document.getElementById("select1").style.display = "inline";
		document.getElementById("select2").style.display = "inline";
		document.getElementById("select3").style.display = "inline";
	}
	
}

/*MENU HEADER - OVERS*/
function MenuOver(eItemMenu){
	eItemMenu.DefaultClass = eItemMenu.className;
	eItemMenu.className = "mnOn";
}
function MenuOut(eItemMenu){
	eItemMenu.className = eItemMenu.DefaultClass;
}

function gotourl(x) {
  window.location = x;
}

/*TEMPO OVERS*/
var menuIntervalo = "";

function fechaMenu(objMenu){
	var fechaMenu = "fecharMenu('"+objMenu+"')";
	menuIntervalo = window.setInterval(fechaMenu,1000);
}


function abreMenu(objMenu){
	document.getElementById("mn1").style.display = 'none';
	document.getElementById("mn2").style.display = 'none';
	document.getElementById("mn3").style.display = 'none';
	document.getElementById("mn4").style.display = 'none';
	
	document.getElementById(objMenu).style.display = 'inline';
	window.clearInterval(menuIntervalo);
}

function fecharMenu(objMenu){
	document.getElementById(objMenu).style.display = 'none';
	showCombo();
}

function openPrint(){
	window.open('/Intranet/PecaNumero/Biblioteca/imprimir.aspx','popup','width=500,height=600,left=1,top=1, toolbars=0, resize=0, scrollbars=0')
}

function hideCombo(){
	if (document.getElementById("comboEventos") != null && document.getElementById("comboEventos2") != null){
		document.getElementById("comboEventos").style.display = 'none';
		document.getElementById("comboEventos2").style.display = 'none';
	}
}

function showCombo(){
	if (document.getElementById("comboEventos") != null && document.getElementById("comboEventos2") != null){
		if (document.getElementById("comboEventos").style.display == 'none' && document.getElementById("comboEventos2").style.display == 'none'){
			document.getElementById("comboEventos").style.display = 'inline';
			document.getElementById("comboEventos2").style.display = 'inline';
		}
	}else{
		
	}
}

var iLeft = 0;
var oTimer;

/*FUNCOES MENU ROLL*/
function moveL() {
	if (document.getElementById("contentMenu").style.left >= scrollL + "px"){
		clearInterval(oTimer);
	}else{
		iLeft += 2;
		document.getElementById("contentMenu").style.left = (iLeft++) + "px";	
	}
	
	document.getElementById("teste").innerHTML = document.getElementById("contentMenu").style.left;
}

function moveR() {
	if (document.getElementById("contentMenu").style.left == scrollR + "px"){
		clearInterval(oTimer);
	}else{
		iLeft -= 2;
		document.getElementById("contentMenu").style.left = (iLeft--) + "px";
	}
	
	document.getElementById("teste").innerHTML = document.getElementById("contentMenu").style.left;
}

function f_startL()
{
	oTimer = window.setInterval("moveL()", 1);
}

function f_startR()
{
	oTimer = window.setInterval("moveR()", 1);
}


function f_stopL()
{
	clearInterval(oTimer);
}

function f_stopR()
{
	clearInterval(oTimer);
}


function alteraform (StrId)
{
	var objElement = document.getElementById(StrId);
	objElement.className = 'formEditarPerfilAlt';
}

function mantemform (StrId)
{
	var objElement = document.getElementById(StrId);
	objElement.className = 'formEditarPerfil';
}	

/*********POP CRÉDITOS ********/
function mostraPop(strIdElement)
{
	var objDiv=document.getElementById(strIdElement);
	if(objDiv.style.display=='' || objDiv.style.display=='none')
	{
		objDiv.style.display="block";
	}
	else
	{
			objDiv.style.display="none";
	}
}

function escondePop(strIdElement)
{
	var objDiv=document.getElementById(strIdElement);
	objDiv.style.display="none";
	
}


function Formatar(src, mask) {
 if (src.value.length > mask.length) {
  src.value = src.value.substring(0,mask.length);
  return false;
 }
 var i = src.value.length;
 var saida = mask.substring(0,1);
 var texto = mask.substring(i)
 if (texto.substring(0,1) != saida) 
  src.value += texto.substring(0,1);
}

function SC_numero(e) { // mais uma SC
var key = '';
var len = len2 = 0;
var strCheck = '0123456789';
var codigo = (window.Event) ? e.which : e.keyCode;
if (codigo == 13) return true;  // Tecla Enter
key = String.fromCharCode(codigo);  // Pega o valor de "key"
if (strCheck.indexOf(key) == -1) return false;  // Nao eh uma tecla valida
}


function aplicaFlash(swf, width, height, wmode, cache) {
	var noCache = "";
	if (cache == undefined || cache == '') {var noCache = "?" + new Date();}
	if (wmode != "opaque" && wmode != "transparent") {wmode = "transparent";}
	var monta_swf = "";
	monta_swf += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+ width +"' height='"+ height +"' title=''>";
	monta_swf += "<param name='movie' value='"+ swf + noCache +"'>";
	monta_swf += "<param name='quality' value='high'>";
	monta_swf += "<param name='menu' value='0'>";
	monta_swf += "<param name='wmode' value='"+ wmode +"'>";
	monta_swf += "<embed src='"+ swf + noCache +"' quality='high' wmode='"+ wmode +"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ width +"' height='"+ height +"'></embed>";
	monta_swf += "</object>";
	document.write(monta_swf);
}