// PROTOTYPE SCRIPTS

// JavaScript Document
	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}
	
	function popupUC(pg,nome,w,h,s){//popUp Unico Central
		var x; 	var y;
		x = (screen.width-w)/2;	y = (screen.height-h)/2;	
		//window.+nome+.resizeTo(x, y);
		window.open(pg,nome,'scrollbars='+s+',toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width='+w+',height='+h+',left='+x+',top='+y+',window.focus( )');	
	}

	function e_data(str) { // valida data
		var strArr = str.split("/");
		var ret
		return (strArr.length == 3
			&& !isNaN(strArr[0])
			&& Number(strArr[0]) >= 1
			&& Number(strArr[0]) <= 31
			&& !isNaN(strArr[1])
			&& Number(strArr[1]) >= 1
			&& Number(strArr[1]) <= 12
			&& !isNaN(strArr[2])
			&& Number(strArr[2]) >= 1900
			&& Number(strArr[2]) <= 2020 //mudar em 2020
		);
	}

	function e_hora(str) { // valida hora
		var strArr = str.split(":");
		var ret
		return (strArr.length == 2
			&& !isNaN(strArr[0])
			&& Number(strArr[0]) >= 0
			&& Number(strArr[0]) < 24
			&& !isNaN(strArr[1])
			&& Number(strArr[1]) >= 0
			&& Number(strArr[1]) < 60 );
	}
	
	function checkMail(mail) {
		return (mail != "" 
			&& mail.indexOf("@") == mail.lastIndexOf("@")
			&& mail.indexOf("@") > 0
			&& mail.lastIndexOf(".") > mail.indexOf("@")
			&& mail.lastIndexOf(" ") == -1
		);
	}
	
	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_changeProp(objName,x,theProp,theValue) { //v6.0
	  var obj = MM_findObj(objName);
	  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
		if (theValue == true || theValue == false)
		  eval("obj."+theProp+"="+theValue);
		else eval("obj."+theProp+"='"+theValue+"'");
	  }
	}

	function validaSenha(f) {
		var erro="";
		var senha = f.senha.value;
		if (senha != f.senha2.value) erro += "A senha não confere com a confirmação.\n";
		if (senha.length < 5) erro += "A senha deve ter no mínimo 5 caracteres.\n";
		if (senha.length > 15) erro += "A senha deve ter no máximo 15 caracteres.\n";
		return erro;
	}

	function showHideDiv(divId,show) {
		MM_changeProp(divId,'','style.display',(show) ? 'inline' : 'none' ,'DIV');
	}
	
	function MM_setTextOfLayer(objId,x,newText) { //v9.0
	  with (document) if (getElementById && ((obj=getElementById(objId))!=null))
		with (obj) innerHTML = unescape(newText);
	}
