// Função JavaScript para Janela Pop-up
function popJanela(page,foto) {
		var width = 500; //500 Define Largura.
		var height = 350; //450 Define Altura.
		var left = 150; // Define posicionamento Lateral.
		var top = 100; // Define posicionamento Vertical.
		window.open(page, foto, 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, copyhistory=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

// Daniel Sócrates
function Flash(swf, width, height, flashvars, id){
	var escreveFlash = new String();
	if (navigator.appName.indexOf("Microsoft") != -1){
		escreveFlash += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		escreveFlash += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" ';
		escreveFlash += 'width="' + width + '" height="' + height + '" name="' + id + '"id = '+ id +'">';
		escreveFlash += '<param name="movie" value="' + swf + '"/>';
		if(flashvars != null) {escreveFlash += '<param name="flashvars" value="' + flashvars + '"/>'};
		escreveFlash += '<param name="menu" value="false"/>';
		escreveFlash += '<param name="salign" value="LT"/>';
		escreveFlash += '<param name="scale" value="noscale"/>';
		escreveFlash += '<param name="wmode" value="transparent"/>';
		escreveFlash += '<param name="allowScriptAccess" value="sameDomain"/>';
		escreveFlash += '</object>';
	} else{
		escreveFlash += '<embed src="' + swf + '" ';
		escreveFlash += 'width="' + width + '" ';
		escreveFlash += 'height="' + height + '" ';
		escreveFlash += 'id="' + id + '" ';
		escreveFlash += 'name="' + id + '" ';
		escreveFlash += 'menu="false" ';
		escreveFlash += 'scale="noscale" ';
		escreveFlash += 'salign="LT" ';
		escreveFlash += 'wmode="transparent" ';
		escreveFlash += 'allowScriptAccess="sameDomain" ';
		if(flashvars != null) {escreveFlash += 'flashvars="' + flashvars + '" '};
		escreveFlash += 'type="application/x-shockwave-flash" ';
		escreveFlash += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
		escreveFlash += '</embed>';
	}
	document.write(escreveFlash);
}

// Atualiza a div "atualiza".
var req;
function loadXMLDoc(url){
	req = null;
	if (window.XMLHttpRequest) {
	 req = new XMLHttpRequest();
	 req.onreadystatechange = processReqChange;
	 req.open("GET", url, true); 
	 req.send(null);
	} else if (window.ActiveXObject) {
		try {
		req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
		} catch(e) {
		  try {
			req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
		  } catch(e) {
			try {
			  req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
			  try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			  } catch(e) {
				req = false;
			  }
			}
		  }
		}
		if (req) {
		  req.onreadystatechange = processReqChange;
		  req.open("GET", url, true);
		  req.send();
		}
	}
}
function processReqChange(){
  if (req.readyState == 4) {
	if (req.status == 200) {
	  document.getElementById("atualiza").innerHTML = req.responseText;
	} else {
	  alert("Houve um problema ao obter os dados:\n" + req.statusText);
	}
  }
}
// leonardo.lima at agence.com.br
function ValidaContato(){
	var erMail = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	dc = document.contato;
	
	if (dc.nome.value == ""){
		alert("Digite seu nome, por favor");
		dc.nome.focus();
		return false;
	}
	if (dc.email.value == ""){
		alert("Digite o e-mail, por favor");
		dc.email.focus();
		return false;
	}
	if (!(erMail.test(dc.email.value))) {
		alert("Digite um e-mail válido, por favor");
		dc.email.focus();
		return false;
	}
	if (dc.tel.value == "" || dc.tel.value.length <= 7){
		alert("Digite o telefone corretamente, por favor");
		dc.tel.focus();
		return false;
	}
	if (dc.msg.value == ""){
		alert("Digite a mensagem/comentário, por favor");
		dc.msg.focus();
		return false;
	}
	dc.submit();
	return true;
}

