// JavaScript Document
function RodarFlash(path,variaveis,_width,_height)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+_width+'" height="'+_height+'">')
		document.write('<param name="movie" value="'+path+'?'+variaveis+'">')
		document.write('<param name="quality" value="high">')
		document.write('<param name="wmode" value="transparent">')
		document.write('<embed src="'+path+'?'+variaveis+'" width="'+_width+'" height="'+_height+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>')
	document.write('</object>')
}


//function fWindowOpen(pagina,nome,largura,altura,scroll)
//	{
//		window.open(pagina,nome,'toolbar=no,scrollbars='+scroll+',resizable=no,location=no,directories=no,status=no,menubar=no,width='+largura+',height='+altura+',left=0,top=0');
//	}
	
function FechaJanela()
	{
		window.close()
	}
/*******************************************************************************
* function warnInvalid
* Gera um alert para o usuário e volta o foco para o campo que está com problema
* Input: theField - campo do formulário com problema
*        warnText - texto a ser mostrado no alert
*        temSelect - indica se deve aplicar select()
********************************************************************************/
function warnInvalid (theField, warnText, temSelect) {   
	theField.focus();
    if (temSelect) {
		theField.select();
	}
    alert(warnText);
    return false;
}
/************************************************
* function isEmpty
* Verifica se um campo está vazio
* Input: s - campo a ser verificado
************************************************/    
function isEmpty(s) {
	return ((s == null) || (s.length == 0));
}

/************************************************
* function verificaEmail
* Verifica se um email é válido
* Input: email a ser verificado
************************************************/
function verificaEmail(email) {
   var s = new String(email);

	// { } ( ) < > [ ] | \ /
    if ((s.indexOf("{")>=0) || (s.indexOf("}")>=0) || (s.indexOf("(")>=0) || (s.indexOf(")")>=0) || (s.indexOf("<")>=0) || (s.indexOf(">")>=0) || (s.indexOf("[")>=0) || (s.indexOf("]")>=0) || (s.indexOf("|")>=0) || (s.indexOf("\"")>=0) || (s.indexOf("/")>=0) )
    	return false;

	// Verifica se existe alguma vogal acentuada
	ls = s.toLowerCase();
	if ((ls.indexOf("á")>=0) || (ls.indexOf("à")>=0) || (ls.indexOf("ã")>=0) || (ls.indexOf("â")>=0) || (ls.indexOf("é")>=0) || (ls.indexOf("í")>=0) || (ls.indexOf("ó")>=0) || (ls.indexOf("õ")>=0) || (ls.indexOf("ô")>=0) || (ls.indexOf("ú")>=0) || (ls.indexOf("ü")>=0))
		return false;
		
	// & * $ % ? ! ^ ~ ` ' " espaço em branco
	if ((s.indexOf("&")>=0) || (s.indexOf("*")>=0) || (s.indexOf("$")>=0) || (s.indexOf("%")>=0) || (s.indexOf("?")>=0) || (s.indexOf("!")>=0) || (s.indexOf("^")>=0) || (s.indexOf("~")>=0) || (s.indexOf("`")>=0) || (s.indexOf("'")>=0) || (s.indexOf(" ")>=0) )
		return false;
        
	// , ; : = #
	if ((s.indexOf(",")>=0) || (s.indexOf(";")>=0) || (s.indexOf(":")>=0) || (s.indexOf("=")>=0) || (s.indexOf("#")>=0) )
		return false;
        
	// procura se existe apenas um @
	if ( (s.indexOf("@") < 0) || (s.indexOf("@") != s.lastIndexOf("@")) )
		return false;
        
	// verifica se tem pelo menos um ponto após o @
	if (s.lastIndexOf(".") < s.indexOf("@"))
		return false;
    
	// verifica se não tem "@" seguido de "."
	if (s.indexOf("@.") >= 0)
		return false;
        
	return true;
}