// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

//Nao avalia a versao dos navegadores pois eh do conhecimento
//do usuario os Navegadores e versoes que sao homologados.
function TDS_consisteNavegador() { //v1.0 - Alexandre Giordani
  var userAgent=navigator.userAgent;
  if (userAgent.indexOf('Netscape') != -1) {
	return "1"; //Netscape
  } else if (userAgent.indexOf('MSIE') != -1) {
	return "2"; //Internet Explorer
  } else{
  	//Se nao for nenhum dos dois, retorna como se fosse Netscape, pois ha mais probab. de funcionar.
  	return "1";
  }
}

function ale_getWidth(pWidth){
	return (screen.width/2)-(pWidth/2+10);
}

function ale_getHeight(pHeight){
	return (screen.height/2)-(pHeight/2+20);
}

function mOvr(src,clrOver) {
	    src.style.cursor = 'hand';
		src.style.backgroundColor = clrOver;
 }
 function mOut(src,clrIn) {
	    src.style.cursor = 'default';
		src.style.backgroundColor = clrIn;
 }
 function mClk(src,cLink,iTarget) {
     window.parent.frames[iTarget].location = cLink;
}

function numerico(e)
{
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
		if (tecla > 47 && tecla < 58) // numeros de 0 a 9
			return true;
		else
			{
				if (tecla != 8) // backspace
					event.keyCode = 0;
					//return false;
				else
					return true;
			}
}

function decimal(e){
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
		
	if (tecla > 47 && tecla < 58) // numeros de 0 a 9
		return true;
	else{
		if (tecla != 8 && tecla != 44) // backspace e virgula
			event.keyCode = 0;
			//return false;
		else
			return true;
	}
}

function isValidMail(sMail){
	var retorno = true;
	if (sMail.indexOf("@",0) == -1) retorno = false;
	if (sMail.indexOf(".",0) == -1) retorno = false;
	if (sMail.indexOf("@.",0) != -1) retorno = false;			
	if (sMail.length < 5) retorno = false;
	
	return retorno;	
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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; }
    obj.visibility=v; }
}

//Funcao basica para validacao do email:
//	- testa se tem @
//	- testa se tem .
//	- testa se eh maior ou igual a 5.
function isValidMail(sMail){
	var retorno = true;
	if (sMail.indexOf("@",0) == -1) retorno = false;
	if (sMail.indexOf(".",0) == -1) retorno = false;
	if (sMail.indexOf("@.",0) != -1) retorno = false;			
	if (sMail.length < 5) retorno = false;
	
	return retorno;	
}
