var pel = "";

////////////////////////////////////////////////////////
// Abre ou fecha um elemento do menu
////////////////////////////////////////////////////////
function SwapMenu(el){
	if (document.getElementById(el).style.display=="none") 
	{
		document.getElementById(el).style.display="inline";
		if (pel=="") 
			pel = el;
		else 
			document.getElementById(pel).style.display="none";
		pel = el;
	}
	else 
	{
		document.getElementById(el).style.display="none";
		pel= "";
	}
}
		
////////////////////////////////////////////////////////
// Funcao para validar no evento OnKeyUp um valor numerico
////////////////////////////////////////////////////////
function ValidaNumerico(sInput) 
	{
	var Input = eval('document.all.' + sInput + '.value')

	if(((event.keyCode < 33) || (event.keyCode > 58)) 
	     && ((event.keyCode < 8) || (event.keyCode > 9)) 
	     && (event.keyCode != 16) 
	     && (event.keyCode != 144) 
	     && ((event.keyCode < 96) || (event.keyCode > 105))){
						
		if(!event.ctrlKey && !event.altKey) 
			{
			event.returnValue=false;
			}
		}	
	}	

////////////////////////////////////////////////////////
// Valida se a string é composta apenas por digitos
////////////////////////////////////////////////////////
function IsNumber(s) 
	{
	var i; 
	for (i = 0; i < s.length ; i++) { 
		var c = s.charAt(i); 
		if (! ((c >= "0") && (c <= "9"))) { 
 			return false;
			} 
		} 
	return true; 
	} 

////////////////////////////////////////////////////////
// Abre uma janela com um determinado URL com a opção
// de Full-Screen.
////////////////////////////////////////////////////////
function PopUpWindow(sURL,bFullScreen, width, height)
{
	var w=screen.width*0.9;
	var h=screen.height*0.9;
	var x=screen.width*0.05;
	var y=screen.height*0.025;

    if (IsNumber(width))
        w = width;
        
    if (IsNumber(height))
        h = height;

	window.open(sURL, "antram", "location=no,menubar=no,resizable=yes,status=no,toolbar=no,scrollbars=yes,left="+x+",top="+y+",width="+w+",height="+h);
}

////////////////////////////////////////////////////////
// Se o backspace for pressionado seleciona o indice 0
// da combo
////////////////////////////////////////////////////////
function CheckBackspace(el) {
	if(event.keyCode == 8) {
		el.selectedIndex = 0;
		event.returnValue=false;
		}	
}

////////////////////////////////////////////////////////
// Redireciona para a página de detalhe do objecto
////////////////////////////////////////////////////////
function ilink(obj) {
    document.location.href='details.aspx?ido=' + obj;
}

////////////////////////////////////////////////////////
// Redireciona para a página de listagem da classe
////////////////////////////////////////////////////////
function iclasslink(cls) {
    document.location.href='list.aspx?idc=' + cls;
}

function Log(pageName) {
    var c = 0;
    if (navigator.appName != "Netscape") 
        c = screen.colorDepth;
    else 
        c = screen.pixelDepth;
        
    document.write ("<img src='log.aspx?pageName=" + pageName + "&r=" + screen.width + "&c=" + c + "' width='0'>");
}

function LogBanner(bannerName) {
    document.write ("<img src='log.aspx?bannerName=" + bannerName + "&action=View' width='0'>");
}

function aLogBannerClick(bannerName) {
    document.write ("<img src='log.aspx?bannerName=" + bannerName + "&action=Click' width='0'>");
}

function LogClass(classId) {
    var c = 0;
    if (navigator.appName != "Netscape") 
        c = screen.colorDepth;
    else 
        c = screen.pixelDepth;
        
    document.write ("<img border=0 width=1 height=1 src='log.aspx?classIds=" + classId + "' width='0'>");
}

function LogObject(objectId) {
    var c = 0;
    if (navigator.appName != "Netscape") 
        c = screen.colorDepth;
    else 
        c = screen.pixelDepth;
        
    document.write ("<img border=0 width=1 height=1 src='log.aspx?objectIds=" + objectId + "' width='0'>");
}
