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>')
}
var xmlhttp;
function loadFile (qual)
{
	xmlhttp=null;
	if (window.XMLHttpRequest)
  	{// code for IE7, Firefox, Opera, etc.
  		xmlhttp=new XMLHttpRequest();
  	}
	else if (window.ActiveXObject)
 	{// code for IE6, IE5
 		 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
 	}
	if (xmlhttp!=null)
	{
	  xmlhttp.onreadystatechange = function()
	  {
	  	if (xmlhttp.readyState == 4)
		{// 4 = "loaded"
			gE('boxPop').innerHTML = '<div align="right"><a href="javascript:removerDivs()">[X]Fechar</a></div>' + xmlhttp.responseText
		}
	  }
	  xmlhttp.open("GET",'_home/pop'+qual+'.htm',true);
	  xmlhttp.send(null);
	}
	else
	{
	  alert("Your browser does not support XMLHTTP.");
	}
}
// Utilizado para evitar de digitar: document.getElementById toda hora, tornando o processo mais prático
function gE(ID) {
	return document.getElementById(ID);
}

// Utilizado para evitar de digitar: document.getElementsByTagName toda hora, tornando o processo mais prático
function gEs(tag) {
	return document.getElementsByTagName(tag);
}
// Utilizado para criar o fundo sobre a página (wiewport), body.
function exibirBgBody() {
	// Seleciona a tag body. item(0) por que só existe uma tag body
	var tagBody = gEs('body').item(0);
	// Pega os tamanhos atuais da página, como largura, altura, ...
	var sizesPage = getPageSize();
	// Vamos criar uma tag div
	var bgBody = document.createElement('div');
	// Setar o atributo ID a div criada
	bgBody.setAttribute('id','bgBody');
	// Essa div terá o tamanho exato da página
	bgBody.style.height = arrayPageSize[1] + 'px';
	// Essa div terá a largura exata da página
	bgBody.style.width = arrayPageSize[0] + 'px';
	// Evita criar a div novamente
	if (!gE('bgBody')) {
		tagBody.insertBefore(bgBody, tagBody.firstChild);
	}
}
// Cria a div denominada como boxPop, a qual conterá os pops de conteudo
function boxPop() {
	// Seleciona a tag body. item(0) por que só existe uma tag body
	var tagBody = gEs('body').item(0);
	// Pega os tamanhos atuais da página, como largura, altura, ...
	var sizesPage = getPageSize();
	// Vamos criar uma tag div
	var boxPop = document.createElement('div');
	// Setar o atributo ID a div criada
	boxPop.setAttribute('id','boxPop');
	// Evita criar a div novamente
	if (!gE('boxPop')) {
		tagBody.insertBefore(boxPop, tagBody.firstChild);
	}
}
function criaPop(qual)
{
	exibirBgBody()
	boxPop()
	loadFile(qual)
}
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
    
    var xScroll, yScroll;
    
    if (window.innerHeight && window.scrollMaxY) {    
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
    
    var windowWidth, windowHeight;
    if (self.innerHeight) {    // all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }    
    
    // for small pages with total height less then height of the viewport
    if(yScroll < windowHeight){
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if(xScroll < windowWidth){    
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }
    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
    return arrayPageSize;
}
// Esta função elimina da página o fundo criado sobre o body e o boxCad;
function removerDivs() {
	var bgBody = gE('bgBody');
	var boxPop = gE('boxPop');
	bgBody.parentNode.removeChild(bgBody);
	if (boxPop) { // Por que ao clicar X (para deletar um registro) cria-se somente o encobridor e não o boxCad	
		boxPop.parentNode.removeChild(boxPop);
	}
}

function enviaFaleConsco() {
	var nome = document.formdados.nome.value	
	var telefone  = document.formdados.telefone.value	
	var email  = document.formdados.email.value	
	var msg  = document.formdados.msg.value	
	document.formdados.action = 'envia.asp?nome='+nome+'&telefone='+telefone+'&email='+email+'&msg='+ msg
	document.formdados.submit()
	
}