﻿// JScript File

function AbreImg(ID)
{
    esquerda = (screen.width / 2) - (200 / 2);
	emcima = (screen.height / 2) - (200 / 2);
	window.open('Images.Aspx?id='+ ID +',Images,width=200,height=200,left='+esquerda+', top='+emcima+', toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=1, resizable=no, titlebar=no');
}
function AbrirJanela(path,nome,largura,altura)
{	
	esquerda = (screen.width / 2) - (largura / 2);
	emcima = (screen.height / 2) - (altura / 2);
	window.open(path,nome,'width='+largura+',height='+altura+',left='+esquerda+', top='+emcima+', toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=1, resizable=no, titlebar=no');
}

function JsExcluir(a)
{
    if (a==null)
    {
        if(confirm("Confirma a Exclusão?"))
        {
            return true;
        }
        else
        {
            return false;
        }
        return true;
    }
    if(a==1)
    {
        if(confirm("Confirma a Exclusão?\nEsta ação excluirá todos os dados relacionados"))
        {
            return true;
        }
        else
        {
            return false;
        }
        return true;
    }
}
function JsAlerta(msg,a)
{

    AlturaMenus();
    alert(msg);
}


function AlturaMenus()
{
    if(document.getElementById("Centro")!=null)
    {
        centro = document.getElementById("Centro");
        esquerda = document.getElementById("Esquerda");
        direita = document.getElementById("Direita");
        
        altura = new Array(3);
            
            altura[0] = direita.offsetHeight;
            altura[1] = esquerda.offsetHeight;
            altura[2] = centro.offsetHeight;
            
            altura.sort(comparar);
            if(altura[2]<500){altura[2]=500;}else{altura[2]+=40;}
        
         
        direita.style.height=altura[2]+"px";
        esquerda.style.height=altura[2]+"px";
        centro.style.height=altura[2]+"px";  
    }        
}
function comparar(a, b){
     return a - b;
}


