function flash(movie,w,h,listaparams){
	
//var listaparams = "wmode=transparent|scale=noscale"
var params = new Array();
params = listaparams.split(",");

document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width="+w+" height="+h+">");
document.writeln("<param name=\"movie\" value="+movie+">");
document.writeln("<param name=\"quality\" value=\"high\">");
document.writeln("<param name=\"menu\" value=\"false\"/>");
for (i = 0; i <= (params.length-1); i++) {
var splitparam = new Array();
splitparam = params[i].split("=")
	if (splitparam[0] == "flashvars") {
		document.writeln("<param name=\"flashvars\" value=\"" + params[i].substring(10).replace("&amp;","&")  + "\">");
	} else {
		document.writeln("<param name=\"" + splitparam[0] + "\" value=\"" + splitparam[1]  + "\">");
	}
}
document.writeln("<embed src=\""+movie+"\" quality=\"high\" menu=\"false\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width="+w+" height="+h+" ")
for (i = 0; i <= (params.length-1); i++) {
var splitparam = new Array();
splitparam = params[i].split("=")
	if (splitparam[0] == "flashvars") {
		document.writeln(" flashvars=\""+ params[i].substring(10).replace("&amp;","&") +"\" ")
	} else {
		document.writeln(" " + splitparam[0] + "=\""+ splitparam[1] +"\" ")
	}
}
document.writeln("></embed></object>");

}

function janpopupedyssomn(url,nome,w,h)
{
   if(window.REC && window.REC.open && !window.REC.closed)
   {
      REC.close();
   }
   REC = window.open(url,nome,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left='+((screen.width/2)-w/2)+',top='+((screen.height/2)-h/2)+',width='+w+',height='+h);
   REC.focus();
}
//-----------------------------------------------------------------------------------------------------
//---  Funo para habilitar campos (enabled)
//-----------------------------------------------------------------------------------------------------
function HabilitaCampos(thisform) 
{ // Inicio Funo HabilitaCampos

	for (var i = 0; i < thisform.elements.length; i++) 
	{
		if(thisform.elements[i].disabled) 
			{ thisform.elements[i].disabled = false;}
	}
	
	return true;
} // Final Funo HabilitaCampos



//-----------------------------------------------------------------------------------------------------
//---  Funo para validar email
//-----------------------------------------------------------------------------------------------------
function validaEmailEmpresa(email) 
{ // Inicio Funo validaEmail
var pos, aux, pos2, dominio, carac, i
email = email.toLowerCase() 

if (email.indexOf("@",0) == -1 || email.length <= 10) return false
pos = email.indexOf("@",0) //no ASP 8, JS 7
aux = email.substring(pos+1) //pop.com.br

if (aux!= "martinluz.com.br") return false

carac = new Array("!","#","$","%","&","*","(",")","+","=","/","\\","|","?","'","\"","{","}","[","]","","",":",",",";","","","<",">")
for(i=0; i<carac.length; i++) if (email.indexOf(carac[i],0) != -1) return false

return true
} // Final Funo validaEmail

// -----------------------------------------------------------------------------------------------------
//---  Funo para validar campos textos
//------------------------------------------------------------------------------------------------------
function ValidaText(thisform) 
{ // Inicio Funo HabilitaCampos
var qtde = 0;
for(var i = 0; i < thisform.elements.length; i++) 
{// Inicio For	
	if (thisform.elements[i].type == "textbox") 
		{// Inicio Verdadeiro IF		
		if (thisform.elements[i].value == null || thisform.elements[i].value  == "" )
			{qtde += 1;}
		
	}// Final Verdadeiro IF
}// Final For
if (qtde >= 1) 
	{return true;}
else
	{return false;}
} // Final Funo HabilitaCampos

/*
Descrio.: formata um campo do formulrio de
acordo com a mscara informada...
Parmetros: - objForm (o Objeto Form)
- strField (string contendo o nome do textbox)

* - sMask (mascara que define o
* formato que o dado ser apresentado,
* usando o algarismo "9" para
* definir nmeros e o smbolo "!" para
* qualquer caracter...
* - evtKeyPress (evento)
* Uso.......: <input type="textbox"
* name="xxx".....
* onkeypress="return txtBoxFormat(document.rcfDownload, 'str_cep', '99999-999', event);">
* Observao: As mscaras podem ser representadas como os exemplos abaixo:
* CEP -> 99.999-999
* CPF -> 999.999.999-99
* CNPJ -> 99.999.999/9999-99
* Data -> 99/99/9999
* Tel Resid -> (99) 999-9999
* Tel Cel -> (99) 9999-9999
* Processo -> 99.999999999/999-99
* C/C -> 999999-!
* E por a vai...
***/

function txtBoxFormat(objForm, strField, sMask, evtKeyPress) 
{
var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

if(document.all) 
	{ // Internet Explorer
    nTecla = evtKeyPress.keyCode;
	}
else if(document.layers) 
		{ // Nestcape
	    nTecla = evtKeyPress.which;
		}
	else
		{
	    nTecla = evtKeyPress.which;
    	if (nTecla == 8) 
			{return true;}
		}

sValue = objForm[strField].value;
// Limpa todos os caracteres de formatao que
// j estiverem no campo.
sValue = sValue.toString().replace(/\-/g, "");
sValue = sValue.toString().replace(/\./g, "");
sValue = sValue.toString().replace(/\//g, "");
sValue = sValue.toString().replace(/\(/g, "");
sValue = sValue.toString().replace(/\)/g, "");
sValue = sValue.toString().replace(/\s/g, "");
fldLen = sValue.length;
mskLen = sMask.length;

i = 0;
nCount = 0;
sCod = "";
mskLen = fldLen;

while (i <= mskLen) {
bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ":") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

if (bolMask) {
    sCod += sMask.charAt(i);
    mskLen++;
} else {
    sCod += sValue.charAt(nCount);
    nCount++;
}
i++;
}

objForm[strField].value = sCod;
if (nTecla != 8) { // backspace
    if (sMask.charAt(i-1) == "9") { // apenas nmeros...
    return ((nTecla > 47) && (nTecla < 58)); } // nmeros de 0 a 9
else { // qualquer caracter...
    return true;
}
} else {
    return true;
}
}

//Fim da Funo Mscaras Gerais

/***
* AUTO TAB - ao prencher o campo, automaticamente manda o foco para o prximo!
***/
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
    var keyCode = (isNN) ? e.which : e.keyCode;
    var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
    if(input.value.length >= len && !containsElement(filter,keyCode)) {
        input.value = input.value.slice(0, len);
        input.form[(getIndex(input)+1) % input.form.length].focus();
    }

function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
	    if(arr[index] == ele)
    	    found = true;
	    else
    	    index++;
        return found;
    }

function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
        if (input.form[i] == input)index = i;
        else i++;
        return index;
    }
    return true;
}
//Fim da Funo AutoTab

// FUNÇÃO DE VALIDAR FORMULÁRIO DO E-MAIL
function validaform(thisform)
{ // Inicio Função validaform

if (thisform.txtNome.value == null || thisform.txtNome.value  == "" )
		{ // Inicio Verdadeiro IF
		alert("Não foi digitado o nome. Favor corrigir.");
		thisform.txtNome.focus();	
		thisform.txtNome.select()	;
		return false;
		} // Final Verdadeiro IF

if (thisform.txtemail.value == null || thisform.txtemail.value  == "" )
		{ // Inicio Verdadeiro IF
		alert("Não foi digitado o e-mail. Favor corrigir.");
		thisform.txtemail.focus();	
		thisform.txtemail.select()	;
		return false;
		} // Final Verdadeiro IF

if (ValidaEmail(thisform.txtemail.value) == false)
	{ // Inicio Verdadeiro IF
	 alert("E-mail cadastrado é inválido");
	 thisform.txtemail.focus();	
	 thisform.txtemail.select()	;
	 return false;
	} // Final Verdadeiro IF

		
if (thisform.txtTelefone.value == null || thisform.txtTelefone.value  == "" )
		{ // Inicio Verdadeiro IF
		alert("O telefone não foi preenchido.");
		thisform.txtTelefone.focus();	
		thisform.txtTelefone.select()	;
		return false;
		} // Final Verdadeiro IF
		
		
if (thisform.txtMensagem.value == null || thisform.txtMensagem.value  == "" )
		{ // Inicio Verdadeiro IF
		alert("Não foi digitado a mensagem. Favor corrigir.");
		thisform.txtMensagem.focus();	
		thisform.txtMensagem.select()	;
		return false;
		} // Final Verdadeiro IF

			
return true;	
} // Final Função validaform

//Função para validar formulario de mais informações
function validaInfos(thisform)
{
	if (thisform.nome.value == null || thisform.nome.value  == "" )
	{ // Inicio Verdadeiro IF
		alert("Não foi digitado o nome. Favor corrigir.");
		thisform.nome.focus();	
		thisform.nome.select()	;
		return false;
	} // Final Verdadeiro IF
	
	if (thisform.email.value == null || thisform.email.value  == "" )
	{ // Inicio Verdadeiro IF
		alert("Não foi digitado o e-mail. Favor corrigir.");
		thisform.email.focus();	
		thisform.email.select()	;
		return false;
	} // Final Verdadeiro IF
	
	if (ValidaEmail(thisform.email.value) == false)
	{ // Inicio Verdadeiro IF
		alert("E-mail cadastrado é inválido");
		thisform.email.focus();	
		thisform.email.select()	;
		return false;
	} // Final Verdadeiro IF
	
			
	if (thisform.tel.value == null || thisform.tel.value  == "" )
	{ // Inicio Verdadeiro IF
		alert("O telefone não foi preenchido.");
		thisform.tel.focus();	
		thisform.tel.select()	;
		return false;
	} // Final Verdadeiro IF
			
			
	if (thisform.info_mensagem.value == null || thisform.info_mensagem.value  == "" )
	{ // Inicio Verdadeiro IF
		alert("Não foi digitado a mensagem. Favor corrigir.");
		thisform.info_mensagem.focus();	
		thisform.info_mensagem.select()	;
		return false;
	} // Final Verdadeiro IF	
				
	return true;	
}
// Fim função para validar formulario de mais informações

//Função para validar formulario de indique p/ amigo
function validaIndique(thisform)
{
	if (thisform.seu_nome.value == null || thisform.seu_nome.value  == "" )
	{ // Inicio Verdadeiro IF
		alert("Não foi digitado o seu nome. Favor corrigir.");
		thisform.seu_nome.focus();	
		thisform.seu_nome.select()	;
		return false;
	} // Final Verdadeiro IF
	
	if (thisform.seu_email.value == null || thisform.seu_email.value  == "" )
	{ // Inicio Verdadeiro IF
		alert("Não foi digitado o seu e-mail. Favor corrigir.");
		thisform.seu_email.focus();	
		thisform.seu_email.select()	;
		return false;
	} // Final Verdadeiro IF
	
	if (ValidaEmail(thisform.seu_email.value) == false)
	{ // Inicio Verdadeiro IF
		alert("E-mail cadastrado é inválido");
		thisform.seu_email.focus();	
		thisform.seu_email.select()	;
		return false;
	} // Final Verdadeiro IF
	
	if (thisform.amigo_nome.value == null || thisform.amigo_nome.value  == "" )
	{ // Inicio Verdadeiro IF
		alert("Não foi digitado o nome do seu amigo. Favor corrigir.");
		thisform.amigo_nome.focus();	
		thisform.amigo_nome.select()	;
		return false;
	} // Final Verdadeiro IF

	if (thisform.amigo_email.value == null || thisform.amigo_email.value  == "" )
	{ // Inicio Verdadeiro IF
		alert("Não foi digitado o do seu amigo e-mail. Favor corrigir.");
		thisform.amigo_email.focus();	
		thisform.amigo_email.select()	;
		return false;
	} // Final Verdadeiro IF
	
	if (ValidaEmail(thisform.amigo_email.value) == false)
	{ // Inicio Verdadeiro IF
		alert("E-mail cadastrado é inválido");
		thisform.amigo_email.focus();	
		thisform.amigo_email.select()	;
		return false;
	} // Final Verdadeiro IF
			
	if (thisform.mensagem.value == null || thisform.mensagem.value  == "" )
	{ // Inicio Verdadeiro IF
		alert("Não foi digitado a mensagem. Favor corrigir.");
		thisform.mensagem.focus();	
		thisform.mensagem.select()	;
		return false;
	} // Final Verdadeiro IF	
				
	return true;	
}
// Fim função para validar formulario de indique p/ amigo



function validaformNewsletter(thisform)
{ // Inicio Função validaform

if (thisform.txtnome.value == null || thisform.txtNome.value  == "" )
		{ // Inicio Verdadeiro IF
		alert("Não foi digitado o nome. Favor corrigir.");
		thisform.txtNome.focus();	
		thisform.txtNome.select()	;
		return false;
		} // Final Verdadeiro IF

if (thisform.txtemail.value == null || thisform.txtemail.value  == "" )
		{ // Inicio Verdadeiro IF
		alert("Não foi digitado o e-mail. Favor corrigir.");
		thisform.txtemail.focus();	
		thisform.txtemail.select()	;
		return false;
		} // Final Verdadeiro IF

if (ValidaEmail(thisform.txtemail.value) == false)
	{ // Inicio Verdadeiro IF
	 alert("E-mail cadastrado é inválido");
	 thisform.txtemail.focus();	
	 thisform.txtemail.select()	;
	 return false;
	} // Final Verdadeiro IF
		
if (thisform.txtAgencia.value == null || thisform.txtAgencia.value  == "" )
		{ // Inicio Verdadeiro IF
		alert("Não foi digitado a agência. Favor corrigir.");
		thisform.txtAgencia.focus();	
		thisform.txtAgencia.select()	;
		return false;
		} // Final Verdadeiro IF		

			
return true;	
}


/***
* TERREMOTO - treme a tela
***/
function terremoto(num)
{
	alert ("Cheguei");
	if (self.moveby) 
	{
		for (a=10; a>0; a--)
		{
			for (b=num; b>0; b--)
			{
				self.moveby (0,a);
				self.moveby (a,0);
				self.moveby (0,-a);
				self.moveby (-a,0);
			}
		}
	}
}

//Fim da Funo Terremoto


//-----------------------------------------------------------------------------------------------------
//---  Função para validar email
//-----------------------------------------------------------------------------------------------------
function ValidaEmail(email) 
{ // Inicio Funo validaEmail
var pos, aux, pos2, dominio, carac, i
email = email.toLowerCase() 
if (email.indexOf("@",0) == -1 || email.length <= 8) 
	{return false;}
	
pos = email.indexOf("@",0); //no ASP 8, JS 7
aux = email.substring(pos+1); //pop.com.br

if (aux.indexOf(".",0) < 2) 
	{return false;}

pos2 = aux.indexOf(".",0);
dominio = aux.substr(0,pos2); //pop

if (email.indexOf(".",0) == email.length-1) 
	{return false;}
	
if (dominio.length < 2) 
	{return false;}

//carac = new Array("!" , "#" , "$" , "%" , "&" , "*" , "(" , ")" , "+" , "=" , "/" , "\\" , "|" , "?" , "'" , "\" , "{" , "}" , "[" , "]" , ":" , "," , ";" , "<" , ">" );

carac = new Array(26);
carac[0] = "!";
carac[1] = "#";
carac[2] = "$";
carac[3] = "%";
carac[4] = "&";
carac[5] = "*";
carac[6] = "(";
carac[7] = ")";
carac[8] = "+";
carac[9] = "=";
carac[10] = "/";
carac[11] = "\\";
carac[12] = "|";
carac[13] = "?";
carac[14] = "¨";
carac[15] = "'";
carac[16] = "{";
carac[17] = "}";
carac[18] = "[";
carac[19] = "]";
carac[20] = ":";
carac[21] = ";";
carac[22] = "<";
carac[23] = ">";
carac[24] = ",";
carac[25] = "'\'";

for(i=0; i<carac.length; i++) 
	{
	if (email.indexOf(carac[i],0) != -1) 
		{return false}
	}
return true;
} // Final Funo validaEmail

/*
funcao para mostrar tool tip
inicio
*/


var qTipTag = "img"; //Which tag do you want to qTip-ize? Keep it lowercase!//
var qTipX = -25; //This is qTip's X offset//
var qTipY = 15; //This is qTip's Y offset//



//There's No need to edit anything below this line//
tooltip = {
  name : "qTip",
  offsetX : qTipX,
  offsetY : qTipY,
  tip : null
}

tooltip.init = function () {
	var tipNameSpaceURI = "http://www.w3.org/1999/xhtml";
	if(!tipContainerID){ var tipContainerID = "qTip";}
	var tipContainer = document.getElementById(tipContainerID);

	if(!tipContainer) {
	  tipContainer = document.createElementNS ? document.createElementNS(tipNameSpaceURI, "div") : document.createElement("div");
		tipContainer.setAttribute("id", tipContainerID);
	  document.getElementsByTagName("body").item(0).appendChild(tipContainer);
	}

	if (!document.getElementById) return;
	this.tip = document.getElementById (this.name);
	if (this.tip) document.onmousemove = function (evt) {tooltip.move (evt)};

	var a, sTitle;
	var anchors = document.getElementsByTagName (qTipTag);

	for (var i = 0; i < anchors.length; i ++) {
		a = anchors[i];
		sTitle = a.getAttribute("title");
		if(sTitle) {
			a.setAttribute("tiptitle", sTitle);
			a.removeAttribute("title");
			a.onmouseover = function() {tooltip.show(this.getAttribute('tiptitle'))};
			a.onmouseout = function() {tooltip.hide()};
		}
	}
}

tooltip.move = function (evt) {
	var x=0, y=0;
	if (document.all) {//IE
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
		
	} else {//Good Browsers
		x = evt.pageX;
		y = evt.pageY;
	}
	this.tip.style.left = (x + this.offsetX) + "px";
	this.tip.style.top = (y + this.offsetY) + "px";
}

tooltip.show = function (text) {
	if (!this.tip) return;
	this.tip.innerHTML = text;
	this.tip.style.display = "block";
}

tooltip.hide = function () {
	if (!this.tip) return;
	this.tip.innerHTML = "";
	this.tip.style.display = "none";
}

window.onload = function () {
	tooltip.init ();
}
/*fim da funcao de tool tip*/


/* Função para abrir DIV nas paginas HTML */
function AbreDiv(DivAberta,DivFechada)
	{
	document.getElementById(DivAberta).style.display = 'block';
	document.getElementById(DivFechada).style.display = 'none';	
	}
/* FIm da função para abrir DIV nas paginas HTML */
function fechaDiv(div){
	document.getElementById('video_home').style.display = 'none';
	w3Opacity.fading('fundo',80,0,600);
	//espera acabar o fade para desabilitar a div
	fim = window.setTimeout("document.getElementById('fundo').style.display = 'none';", 600);
	//limpa os timeouts
	window.clearTimeout(inicio);
}

function iniciaVideo(){
	document.getElementById('fundo').style.display = '';
	w3Opacity.set('fundo',0);
	w3Opacity.fading('fundo',0,80,600);
	document.getElementById('video_home').style.display = '';
	w3Opacity.set('video_home',0);
	w3Opacity.fading('video_home',0,100,600);
	//w3Opacity.set('fundo',80);	
}


