
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function abre_jan(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
 //close layer
var d = document;

function divabre() {
	clearTimeout(tid);
	divclipTo(110);
}

function divfecha() {
	tid = setTimeout("tiddivfecha()",100);
	// divclipTo(65);
}

function tiddivfecha() {
	divclipTo(120);
}	

var tid = 0;

function divclipTo(num) {
	objDiv = divgetObj('divBarratop');
	objDiv.clip='rect(0,132,'+num+',0)';
}
function divgetObj(str) {
	if (d.layers){
		return d.layers[str];
	} else if (d.all && !d.getElementById) {
		return d.all[str].style;
	} else {
		return d.getElementById(str).style;
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function divSecreto(divN){
	var elem = document.getElementById(divN);
	if (screen.width>800)
	{
		elem.style.display = "";
	}
	else
	{
		elem.style.display = "none";
	}
}

self.name='main';

function MM_showHideLayers() { //v3.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; }
    obj.visibility=v; }
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function go()
{
var a = window. open('','','scrollbars=yes,width=300,height=300');
a.document.open("text/html");
a.document.write('<html><head><link rel="stylesheet" href="css/style.css" /><style type="text/css">#frame{background-image:none;background-color:#FFFFFF;}</style></head><body style="padding-left:20px;background-image:none;background-color:#FFFFFF;">');
a.document.write(document.getElementById('palavra').innerHTML);
a.document.write('</body></html>');
a.document.close();
a.print();
a.window.close()
}

var ieBlink = (document.all)?true:false;
function doBlink(){
	if(ieBlink){
		obj = document.getElementsByTagName('BLINK');
		for(i=0;i<obj.length;i++){
			tag=obj[i];
			tag.style.visibility=(tag.style.visibility=='hidden')?'visible':'hidden';
		}
	}
}

function checkRequired(forma)
	{
		var frm = document.getElementById(forma);
		var num_patt = /^[0-9]{1,9}$/;
		var mail_patt = /^[A-Za-z][\w-\.]*\@[A-Za-z0-9]+(\.[\w-]+)*\.[A-Za-z]{2,3}$/;

		var fields = ['nome', 'distrito', 'email'];

		for(var i=0; i<fields.length; i++)
		{
			if (frm[fields[i]].value == '')
			{
				alert ('Todos os campos com * devem ser preenchidos');
				frm[fields[i]].focus();
				return false;
			}
		}

		if (!mail_patt.test(frm['email'].value)) {
				alert ('E-mail inválido');
				frm['email'].focus();
				return false;
		}


		return true;
	}
