largura_total = screen.width;
altura_total = screen.height;
largura_TD = ((largura_total - 780)/2);



if (largura_total==800){
endereco_lateral = largura_TD + 152;
endereco_altura = altura_total - 220;
} else {
endereco_lateral = largura_TD + 150;
endereco_altura = altura_total - 205;
}


ns = (document.layers)? true:false
ie = (document.all)? true:false


if (largura_total == 800) {
	fundo_lateral = "";
	fundo_lateral_int = "";
} else {
	fundo_lateral = "<td width=\""+largura_TD+"\" background=\"images/home/h_topo_fundo.gif\"><img src=\"images/space.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>";
	fundo_lateral_int = "<td width=\""+largura_TD+"\" height=\"59\"background=\"images/internas/int_resto_sup.gif\"><img src=\"images/space.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>";
}

function changeImage(dir,imgName,img) {
	document.images[imgName].src = "images/" + dir + "/" +imgName + img + ".gif";	
}

function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}

//home
function ajustamenu() {

	if (ie) { window_w = window.document.body.clientWidth; }
	else { window_w = window.innerWidth; } 
	
	if (window_w > 780 ) { 
		menu_0 = ((window_w - 780)/2)+1; 
		menu_1 = menu_0 + 155;
		menu_2 = menu_1 + 155;
	} else {
		menu_0 = 0; 
		menu_1 = 157;
		menu_2 = 312;
	}	
}

function ajustamenu_int() {

	if (ie) { window_w = window.document.body.clientWidth; }
	else { window_w = window.innerWidth; } 
	
	if (window_w > 784 ) { 
		
		menu_0 = ((window_w - 784)/2) + 220; 
		menu_1 = menu_0 + 83;
		menu_2 = menu_1 + 97;
	} else {
		menu_0 = 220; 
		menu_1 = menu_0 + 83;
		menu_2 = menu_1 + 97;
	}	
}

function Abrefoto(I,nome,x) {
	var opened = 0;
	if (opened == 1) {
		nome.close();
        opened=0; 
	}
	
	preload('foto',I);
    
	if (opened == 0) {
		if (x == "dentro") {
			aux1 = window.open("","aux1","width="+foto.width+",height="+foto.height+",toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no");
            aux1.document.open();
            aux1.document.write("<HTML><HEAD><TITLE>KL AV Systems</TITLE></HEAD>");
            aux1.document.write("<BODY marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\" leftmargin=\"0\" bgcolor=\"#FFFFFF\">\r");
            aux1.document.write("<a href='#' onClick='self.close();'><img name=\"foto\" src=\" " + I + "\" border=0 alt=\"Clique para fechar\"></a>\r");
            aux1.document.write("</BODY></HTML>\r");
            aux1.document.close();
		} else {
			nome = window.open(I,nome,'scrollbars=yes');
            opened=1; 
		}
	}
} 


// função auxiliar para focar o prompt no campo que o usuário tem que corrigir
function validaPrompt (Ctrl, string)
{
	alert(string)        // manda mensagem definida em string
    Ctrl.focus()         // e coloca o foco para o campo que contem erro
	Ctrl.select()
    return;
}