// JavaScript para exibir o flash original
function flash(largura, altura, arquivo){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+largura+'" height="'+altura+'" id="teste" align="center">');
	document.write('<param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="transparent" />');
	document.write('<param name="movie" value="'+arquivo+'" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><embed src="'+arquivo+'" wmode="transparent" quality="best" width="'+largura+'" height="'+altura+'" name="teste" align="center" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

// Valida o formulário de contato
function valida_form(form_contato) {

     	if (form_contato.Nome.value.length == 0) {
		alert("Preencha o seu nome!");
		form_contato.Nome.focus();
		return false;
	}

    if (form_contato.Email.value.length == 0) {
        alert("Informe o seu e-mail!");
        form_contato.Email.focus();
        return false;
    }

    if (form_contato.Email.value.indexOf('@', 0) == -1 || form_contato.Email.value.indexOf('.', 0) == -1) {
        alert("Informe seu e-mail corretamente!"); 
        form_contato.Email.focus();
        return false;
    }


   if (form_contato.Fone.value.length == 0) {
		alert("Informe seu telefone!");
		form_contato.Fone.focus();
		return false;
	}	
	
   if (form_contato.Endereco.value.length == 0) {
		alert("Informe seu indereço!");
		form_contato.Endereco.focus();
		return false;
	}		
	
   if (form_contato.Cidade.value.length == 0) {
		alert("Informe sua cidade!");
		form_contato.Cidade.focus();
		return false;
	}	
	
   if (form_contato.Cep.value.length == 0) {
		alert("Informe seu CEP!");
		form_contato.Cep.focus();
		return false;
	}		
	
	if (form_contato.Mensagem.value.length == 0) {
		alert("Favor escreva uma mensagem!");
		form_contato.Mensagem.focus();
		return false;
	}	

    return true;
}


/* ############# Função Over em Imagens ###############*/
function onoff(imgName,state){
	var classe = document.getElementById("li_"+imgName).className;					
	if (classe != "onab" && classe != "onfe" && classe != "onsem"){						
		document.images[imgName].src = eval(imgName+state+".src");
	}
}


// Janela para exibir as fotos 
function open_center(url, Wwidth, Wheight)
{
Swidth = screen.width;
Sheight = screen.height;

Wleft = (Swidth / 2) - (Wwidth / 2) - 8;
Wtop = (Sheight / 2) - (Wheight / 2) - 20;

options = "status=no,scrollbars=no,left="+Wleft+",top="+Wtop+",width="+Wwidth+",height="+Wheight;

window.open(url, 'win', options);
}
// ***** Popup Control *********************************************************

// ***** at_show_aux *****

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ***** at_show *****

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);
  clearTimeout(c["at_timeout"]);
}

// ***** at_hide *****

function at_hide()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

// ***** at_click *****

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible") at_show_aux(p.id, c.id); else c.style.visibility = "hidden";
  return false;
}

// ***** at_attach *****

// PARAMETERS:
// parent   - id of the parent html element
// child    - id of the child  html element that should be droped down
// showtype - "click" = drop down child html element on mouse click
//            "hover" = drop down child html element on mouse over
// position - "x" = display the child html element to the right
//            "y" = display the child html element below
// cursor   - omit to use default cursor or specify CSS cursor name

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}
