<!--
// desabilita F5
//if(event.keyCode == 116){event.keyCode = 8;}

var browsName=navigator.appName;
var browsVersion=parseInt(navigator.appVersion);

if (browsName=="Microsoft Internet Explorer" && browsVersion>=4){
	var BrowsTipo = "1";
}
else if(browsName=="Netscape" && browsVersion>=4){
	var BrowsTipo = "2";
}
else{
	document.write('Seu navegador não dá suporte a todos os recursos desta página!');
}

if(BrowsTipo=='1'){var tpDocumento = document.all;}
if(BrowsTipo=='2'){var tpDocumento = document.layers;}

function TransLayer(nome,position,visibility,top,left,width,height,bkground){
	if(nome!=null){

		if(position!=null){  document.getElementById(nome).style.position=""+position+"";}
		if(visibility!=null){document.getElementById(nome).style.visibility=""+visibility+"";}
		if(top!=null){       document.getElementById(nome).style.top=""+top+"";}
		if(left!=null){      document.getElementById(nome).style.left=""+left+"";}
		if(width!=null){     document.getElementById(nome).style.width=""+width+"";}
		if(height!=null){    document.getElementById(nome).style.height=""+height+"";}
		if(bkground!=null){  document.getElementById(nome).style.background="url("+bkground+")";}
	}
}

tms=new Array()
function over(n){
	if(typeof(tms[n])!="undefined")clearTimeout(tms[n])
	document.getElementById("s"+n).style.background="#F5F5F5";
}
function out(n){
	tms[n]=document.getElementById("s"+n).style.background="#FFFFFF";
}

// I MARCA/DESMARCA - CHECKBOX //

function FindInput() {
	if (document.getElementsByTagName) {
		return document.getElementsByTagName('input');
	} else if (document.all) {
		return document.all.tags('input');
	}
	return false;
}

function CheckColumn(form,SN) {
	var Obj, Type, Name, Chk;
	var Controls = FindInput(); if (!Controls) { return; }
	var valor = document.forms[form].valor_chk.value;

	if ((valor == "") || (valor == "false")) {
		Chk = true;
	} else {
		Chk = "";
	}
	document.forms[form].select_all.checked = document.forms[form].valor_chk.value = Chk;

	// Regexp to find name of controls
	var re = new RegExp('^' + SN);

	Chk = Chk ? true : false;

	for (var i = 0; i < Controls.length; i++) {
		Obj = Controls[i];
		Type = Obj.type ? Obj.type : false;
		Name = Obj.name ? Obj.name : false;
		if (!Type || !Name) { continue; }

		if (Type == "checkbox" && re.exec(Name)) {
			Obj.checked = Chk;
		}
	}
}

function CheckMark(form,SN){
	var Obj, Type, Name, Chk;
	var Controls = FindInput();
	if (!Controls){
		return;
	}

	// Regexp to find name of controls
	var re = new RegExp('^' + SN);
	var num = 0;
	for (var i = 0; i < Controls.length; i++){
		Obj = Controls[i];
		if (Obj.checked == true) {
			num ++;
		}
	}
	return num;
}

// F MARCA/DESMARCA - CHECKBOX //


function sel_reg(form,id_reg){
	with(document.forms[form]){
		id_registro.value = id_reg;
	}
}
function sel_update(form,acao_page_l){
	with(document.forms[form]){
		if(id_registro.value){
			acao_page.value = acao_page_l;
			acao_form.value = 'update';
			submit();
		}else{
			alert('Selecione uma pesquisa na lista ou informe o seu código');
		}
	}
}
function sel_delete(form,acao_page_l){
	with(document.forms[form]){
		if(id_registro.value){
			confirma=confirm('Deseja realmente excluir essa pesquisa?');
			if(confirma==true){
				acao_page.value = acao_page_l;
				gravar.value = 'sql';
				acao_form.value = 'delete'
				submit();
			}
		}else{
			alert('Selecione um registro na lista ou informe o seu código');
		}
	}
}

// conta caracteres
var NUMERO_CARACTERES = 0;
var quant_chars = 0;

function contaChar(form,campo,divs){
	with(document.forms[form]) {
		quant_chars = (NUMERO_CARACTERES - campo.value.length);
		if(quant_chars>=0){
			document.getElementById(divs).innerHTML =  "Ainda restam <b>"+quant_chars+"</b> caracteres.";
			return true;
		}
		else{
			if (campo.type == 'select-one'){
				campo.selectedIndex = 0;
			}else{
				campo.value = campo.value.substring(0,campo.value.length+quant_chars);
				return false;
			}
		}
		if(quant_chars<=0){
			if(event.keyCode!=8){
				campo.value = "123";
			}
		}
	}
}

function aba(OBJ,IMG){
	if(OBJ != '[object]'){
		OBJ = pmain.document.getElementById(OBJ);
	}
	if(OBJ.style.display=='none' || OBJ.style.display==''){
		IMG.src = 'img/seta_up.gif';
		OBJ.style.display = 'block';
	}
	else{
		IMG.src = 'img/seta_dn.gif';
		OBJ.style.display = 'none';
	}
}

//-->

function abreImagem(img,tam) {
	w = tam;
	t = (w < (screen.width-100)) ? w : (screen.width-100);
	document.write("<img src=\"imagem.php?arquivo="+img+"&width="+(t)+"\" border=\"0\">");
}


function submitonce(theform){
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById){
		//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++){
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="image"||tempobj.type.toLowerCase()=="reset")
			//disable em
			tempobj.disabled=true
		}
	}
}

function seleciona(f,c) {
	s = c.length;
	with(f) {
		for(i=0;i<elements.length;i++) {
			thiselm = elements[i];
			p = thiselm.name.substring(0,s);
			if(p == c) {
				if(thiselm.checked == false) {
					thiselm.checked = true;
				} else {
					thiselm.checked = false;
				}
			}
		}
	}
}

function FullscreenLoad(arquivo){
	if (window.screen){
		var hori=screen.availWidth;
		var verti=screen.availHeight;
		window.open(arquivo,'janelao', 'width='+hori+',height='+verti+',fullscreen=1, scrollbars=1,left='+(0)+',top='+(0));
	}
}


function layerRoll(dist) {
	var altura = screen.availHeight - dist;
	document.write("<style type=\"text/css\">#div_textos { position:relative; top:0; width:100%; height: "+altura+"; padding:0px 30px 30px 30px; text-align:justify; font-size: 11px; color: 333333; line-height:20px; overflow: auto;	}</style>");
}

function jurado_vota(voto) {
	switch(voto) {
		case "s" :
		c = confirm("Confirma voto como SIM?");
		if(c) {
			document.getElementById("btsim").style.display = 'none';
			document.getElementById("btnao").style.display = 'none';
			document.votacao.voto.value = "s";
			document.votacao.submit();
		}
		break;
		case "n" :
		c = confirm("Confirma voto como NAO?");
		if(c) {
			document.getElementById("btsim").style.display = 'none';
			document.getElementById("btnao").style.display = 'none';
			document.votacao.voto.value = "n";
			document.votacao.submit();
		}
		break;
	}
}

function sapes_valida(voto,categoria) {
	switch(voto) {
		case "s" :
		c = confirm("Aprovar a peça selecionada?");
		if(c) {
			document.votacao.voto.value = "s";
			document.votacao.submit();
		}
		break;
		case "n" :
		if(eval("document.votacao.motivo"+categoria+".value") == "motivo da alteração ou cancelamento...") {
			alert ("Você deve informar um motivo!");
		} else {
			c = confirm("Cancelar a peça selecionada?");
			if(c) {
				document.votacao.voto.value = "n";
				document.votacao.submit();
			}
		}
		break;
	}
}

function sapes_troca(categoria, motivo) {
	if(categoria != "" && motivo != "motivo da alteração ou cancelamento...") {
		c = confirm("Você deseja alterar a categoria desta peça?");
		if(c) {
			document.votacao.submit();
		}
	} else {
		alert("Você deve especificar a categoria e um motivo!");
	}
}

function AbrePagina(perfil, tamx, tamy, yn) {
	window.open(perfil,"","resizable=no,toolbar=no,status=no,menubar=no,top=10,left=10,scrollbars=" + yn + ",width=" + tamx + ",height=" + tamy);
}

function troca_video(definicao) {
	switch(definicao) {
		case "alta" :
		document.getElementById("alta").style.display = 'block';
		document.getElementById("baixa").style.display = 'none';
		break;
		case "baixa" :
		document.getElementById("alta").style.display = 'none';
		document.getElementById("baixa").style.display = 'block';
		break;
	}
}


function abreFoto(id,pasta)
{
alert(pasta);
	var imagem;

	if(id<10)
	id = "0"+id;

	var imagem = new Image(); imagem.src = id;

	var content = "<html><head><title>Prêmio Colibri 2007 - Vencedores</title></head><body bottommargin=\"0\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" rightmargin=\"0\" topmargin=\"0\"><img id='img' src='"+imagem.src+"'></body></html>";

	imagem.onload = function()
	{
		var janela = window.open("","img","resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no");
		janela.document.write(content);

		var width = this.width;
		var height = this.height;

		var browser=navigator.appName;

		switch(browser){
			case "Netscape":
			janela.resizeTo(imagem.width+7, imagem.height+50);
			break;

			case "Microsoft Internet Explorer":
			janela.resizeTo(imagem.width+10, imagem.height+30);
			break;
		}
		janela.focus();
		janela.document.close();
	}
}