// POP UP
function popup(theURL, width, height, features) { 
	//"location=no,menubar=no,resiable=no,toolbar=no,scroollbars=yes"
	if(window.screen){
		per_ancho=(width/screen.width)*100;
		per_alto=(height/width)*100;
		win_ancho=(screen.width*per_ancho)/100;
		win_alto=(win_ancho*per_alto)/100;
		x=(screen.width-win_ancho)/2;
		y=(screen.height-win_alto)/2;
	}else{
		x=0;
		y=0;
		win_ancho=w;
		win_alto=y;
	}
	winfeatures=("top="+y+",left="+x+",width="+win_ancho+",height="+win_alto+","+features);
	window.open(theURL, 'popup', winfeatures);
}

function nada() {
   return;
}
//FLASH
function flash(versao, largura, altura, nome, modo, cor)
{
	/*
	versao = 8 .................. <- Versão do player
	largura = 200px ............. <- Largura do SWF
	altura = 200px .............. <- Altura do SWF
	id = nome ................... <- ID do arquivo
	nome = arquivo.swf .......... <- Caminho do SWF, essa opção não pode ser vazia
	modo = transparent/opaque ... <- Flash transparente ou opaco / pode ser vazia
	cor = #ffffff ............... <- Cor de fundo
	*/
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="'+versao+',0,0,0" width="'+largura+'" height="'+altura+'">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="'+nome+'" />\n');
	document.write('<param name="wmode" value="'+modo+'" />\n');
	document.write('<param name="bgcolor" value="'+cor+'" />\n');
	document.write('<embed src="'+nome+'" wmode="'+modo+'" bgcolor="'+cor+'" width="'+largura+'" height="'+altura+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	document.write('</object>\n');
}
// DATA - ÍNICIO
function data(){

	mdata      = new Date()
	mhora      = mdata.getHours()
	mminuto    = mdata.getMinutes()
	msegundos  = mdata.getSeconds()
	mdia       = mdata.getDate()
	mdiasemana = mdata.getDay()
	mmes       = mdata.getMonth()
	mano       = mdata.getFullYear()

if(mdiasemana == 0)
	document.write("'Domingo, ");
		else if(mdiasemana == 1)
			document.write("Segunda Feira, ");
		else if(mdiasemana == 2)
			document.write("Ter&ccedil;a Feira, ");
		else if(mdiasemana == 3)
			document.write("Quarta Feira, ");
		else if(mdiasemana == 4)
			document.write("Quinta Feira, ");
		else if(mdiasemana == 5)
			document.write("Sexta Feira, ");
		else if(mdiasemana == 6)
			document.write("S&aacute;bado, ");

			document.write(+mdia+' de ');
if(mmes == 0)
	document.write("Janeiro de ");
		else if(mmes == 1)
			document.write("Fevereiro de ");
		else if(mmes == 2)
			document.write("Mar&ccedil;o de ");
		else if(mmes == 3)
			document.write("Abril de ");
		else if(mmes == 4)
			document.write("Maio de ");
		else if(mmes == 5)
			document.write("Junho de ");
		else if(mmes == 6)
			document.write("Julho de ");
		else if(mmes == 7)
			document.write("Agosto de ");
		else if(mmes == 8)
			document.write("Setembro de ");
		else if(mmes == 9)
			 document.write("Outubro de ");
		else if(mmes == 10)
			 document.write("Novembro de ");
		else if(mmes == 11)
			 document.write("Dezembro de ");
			 document.write(mano);
}
// DATA - FIM
// IS NUMERIC
//onKeyPress="return(IsNumeric(this,event))"
function IsNumeric(fld, e) 
{
	var strCheck = '0123456789';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	key = String.fromCharCode(whichCode);
	if (strCheck.indexOf(key) == -1) return false;
}
//LAYER
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 MM_showHideLayers() { //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3){
		if ((obj=MM_findObj(args[i]))!=null){
			v=args[i+2];
			if (obj.style){
				obj=obj.style;
				v=(v=='show')?'visible':(v=='hide')?'hidden':v;
			}
			if (obj.visibility=='hidden'){
				obj.visibility='visible';
			}
			else{
				obj.visibility='hidden';
			}
			
		}
	}
}
//
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//
function mask(fld, e) 
{
	if(fld.value.length == 2){
		fld.value = fld.value + "/";
	}
	if(fld.value.length == 5 ){
		fld.value = fld.value + "/";
	}
	var strCheck = '0123456789';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	key = String.fromCharCode(whichCode);
	if (strCheck.indexOf(key) == -1) return false;
}

function check_form()
{
	frm=document.form1;
	if (frm.nome.value.length==0){
		alert('Preencha o campo Nome !!');
		frm.nome.focus();
		frm.nome.select();
		return false;
	}
	
	if (frm.endereco.value.length==0){
		alert('Preencha o campo Endereço!!');
		frm.endereco.focus();
		frm.endereco.select();
		return false;
	}	
	if (frm.bairro.value.length==0){
		alert('Preencha o campo Bairro!!');
		frm.bairro.focus();
		frm.bairro.select();
		return false;
	}
	if (frm.cidade.value.length==0){
		alert('Preencha o campo Cidade!!');
		frm.cidade.focus();
		frm.cidade.select();
		return false;
	}
	if (frm.uf.value==0){
		alert('Preencha o campo Estado!!');
		frm.uf.focus();
		return false;
	}
	if (frm.cep.value.length==0){
		alert('Preencha o campo Cep!!');
		frm.cep.focus();
		frm.cep.select();
		return false;
	}	

	if (frm.ddd.value.length==0){
		alert('Preencha o campo DDD!!');
		frm.ddd.focus();
		frm.ddd.select();
		return false;
	}
	
	if (frm.tel.value.length==0){
		alert('Preencha o campo Telefone!!');
		frm.tel.focus();
		frm.tel.select();
		return false;
	}
	if (frm.email.value.length==0){
		alert('Preencha o campo E-mail!!');
		frm.email.focus();
		frm.email.select();
		return false;
	}	
	return true;
}
//
function show(obj){
	if (obj.style.display == "none"){
		obj.style.display = "";	
	}
	else {
		obj.style.display = "none";
	}
}
