function tabDim(itemid,acao) {

if (acao == "1") {
	//var acaoid = "block";
	var acaoid = "";
}
else {
	var acaoid = "none";
}
var thisLevel = document.getElementById(itemid);
thisLevel.style.display = acaoid;
}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' invalido.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' nao foi preenchido.\n'; }
    } if (errors) alert('Erros encontrados:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function GerarSWF($arquivo,$largura,$altura,$id){
    document.writeln('    <object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + $largura + '" height="' + $altura + '" id="' + $id + '" name="' + $id + '">');
    document.writeln('        <param name="movie" value="' + $arquivo + '" />');
    document.writeln('        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
//    document.writeln('        <param name="bgcolor" value="#ffffff" />');
    document.writeln('        <param name="menu" value="false" />');
    document.writeln('        <param name="quality" value="high" />');
//    document.writeln('        <param name="salign" value="tl" />');
//    document.writeln('        <param name="scale" value="noscale" />');
    document.writeln('        <param name="wmode" value="transparent" />');
    document.writeln('        <embed id="globalnav-embed" src="' + $arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" menu="false" quality="high" id="' + $id + '" width="' + $largura + '" height="' + $altura + '"></embed>');
    document.writeln('    </object>');
}

/* MARQUEE DA HOME */

var ostat = false;
function scrollstop() {
news.scrollAmount = 0;
ostat = true;
}
function scrollplay() {
news.scrollAmount = 1;
ostat = false;
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function validaFormFranquia(el) {

	
conf = false;

if(document.getElementById("nome").value==""){
conf="- Nome";
}
if(document.getElementById("nascimento").value==""){
conf = conf + "\n- Ano de nascimento";
}
//if(document.getElementById("sexo").checked==false){
if(document.getElementById("sexocheck").value==""){
conf = conf + "\n- Sexo";
}

if(document.getElementById("telefone").value==""){
conf = conf + "\n- Telefone c/ DDD";
}
if(document.getElementById("emeil").value==""){
conf = conf + "\n- E-Mail";
} else {
	var val = document.getElementById("emeil").value;
	var p = val.indexOf('@');
	if (p<1 || p==(val.length-1)) conf = conf + "\n- E-mail invalido";
	
}
if(document.getElementById("idade").value==""){
conf = conf + "\n- Idade";
}
//if(document.getElementById("sexo").value==""){
if(document.getElementById("cidade").value==""){
conf = conf + "\n- Cidade e Estado";
}
if(document.getElementById("cidadeint").value==""){
conf = conf + "\n- Cidades de interesse";
}
if(document.getElementById("dv").value==""){
conf = conf + "\n- Minimo disponivel para investimento";
}
if(document.getElementById("av").value==""){
conf = conf + "\n- Maximo disponivel para investimento";
}

//if(document.getElementById("aseg").value==""){
//conf = conf + "\n- Selecione pelo menos um segmento";
//}
if (conf) {
msgwrite = "Favor preencher os seguintes campos:\n\n" + conf
alert(msgwrite);
conf = false;
return false;
} else {
	el.submit();	
}
}

function validaCheckSexo(vde) {
	document.getElementById('sexocheck').value=vde
}
function validaCheckDe(vde) {
	document.getElementById('dv').value=vde
}
function validaCheckA(va) {
	document.getElementById('av').value=va
}
function validaCheckNascimento(nascimento) {
	document.getElementById('idade').value=nascimento
}

function validaCheckSeg(valor,elem) {
     //ve = "<"+valor+">|";
     //document.getElementById('aseg').value+=valor
     ve = "<"+valor+">|";
     if (elem.checked)
     {
       document.getElementById('aseg').value += ve
     }  
     else
     {
       document.getElementById('aseg').value = document.getElementById('aseg').value.replace(ve,"");
     }  
}


