<!--

function redirect_banner()
{
	window.location.href('<%=GLOBAIS_LAYOUT_LINK_HOME%>homesite/redirect_banner.asp?idbanner=<%=idbanner%>');
}

function editor(campo,diretorio) {
	var strValue = window.open('../../editor/default.asp?campo='+campo+'&diretorio='+diretorio,'editor',"height=430,width=550,scroll=no")
}

function editor_alterar(campo,tabela,campotabela,cod,diretorio) {
	var strValue = window.open('../../editor/default_altera.asp?campo='+campo+'&tabela='+tabela+'&cod='+cod+'&campotabela='+campotabela+'&diretorio='+diretorio,'editor',"height=430,width=550,scroll=no")
}


function escolhe_imagem(campo) {
	window.open('../imagens/default.asp?campo='+ campo,'enviar_imagem','width=350,height=350,top=100,left=100')
}

function imagem(campo,diretorio) {
window.open('../../editor/insere_imagem.asp?campo='+campo+'&diretorio='+diretorio,'insere_imagens','height=230,width=275','status=yes');
}


function confirm_excluir(arq,acao) {
	if (confirm('Deseja realmente Excluir esta Categoria ? \n \n Atenção ! Esta ação não terá retorno.'))
		{
			window.open(''+arq+''+acao,'_top');
		} 
/*		else
			{
				window.open('categorias.asp','_top');
			}
*/
}


function select_box(url_link,opcao) {
    var url = opcao.options[opcao.selectedIndex].value;
    if (url) {
        location.href = url_link + url;
    }
}


function imprimir(url) {
	var strValue = window.open(url,'Janela','scrollbars=yes,status=no,location=no,toolbar=no,menubar=no,resizable=yes,height=600,width=800');
}

function indica(url) {
	var strValue = window.open(url,'Janela','scrollbars=yes,status=yes,location=yes,toolbar=yes,menubar=yes,resizable=yes,height=800,width=1030');
}

function abre_janela(url) {
	var strValue = window.open(''+url+'','Janela','scrollbars=yes,status=no,location=no,toolbar=no,menubar=no,resizable=yes');
}

function abre_creditos(url) {
	var strValue = window.open(''+url+'','Janela','scrollbars=no,status=yes,location=no,toolbar=no,menubar=no,resizable=no,height=340,width=500');
}

function abre_enquete(url) {
	var strValue = window.open(''+url+'','Janela','scrollbars=yes,status=no,location=no,toolbar=no,menubar=no,resizable=yes,height=230,width=250');
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function valida_form() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=valida_form.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
	if (val) { nm=val.name; if ((val=val.value)!="") {
	  if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
		if (p<1 || p==(val.length-1)) errors+='O campo '+nm+' precisa ser um e-mail válido.\n';
	  } else if (test!='R') { num = parseFloat(val);
		if (isNaN(val)) errors+='O campo '+nm+' precisa ser um número.\n';
		if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
		  min=test.substring(8,p); max=test.substring(p+1);
		  if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
	} } } else if (test.charAt(0) == 'R') errors += 'O campo '+nm+' é obrigatório.\n'; }
  } if (errors) alert('O(s) seguinte(s) erro(s) ocorreu(ram):\n\n'+errors);
  document.VF_returnValue = (errors == '');
}

function janela_imagem(arquivo,id) {
	var strValue = window.open(''+arquivo+'?id_midia='+id,'Imagem','scrollbars=no,status=no,location=no,toolbar=no,menubar=no,resizable=yes,height=10,width=10');
}

// função de redimencionar as janelas
function redirWindow(){

	ladoTela = (screen.width-document.images['foto'].width+10)/2;
	cimaTela = (screen.height-document.images['foto'].height)/2-50;

	window.resizeTo (document.images['foto'].width + 40, document.images['foto'].height + 125);
	window.moveTo(ladoTela,cimaTela);

}

function redimImagem(){

	var win_w = document.body.offsetWidth;
	var win_h = document.body.offsetHeight;
	var img_w = document.images['foto'].width + 10;
	var img_h = document.images['foto'].height + 125;

	document.images['foto'].width = (win_w - 5);
	document.images['foto'].height = (win_h - 100);

}
//-->