  //AC_Flash();
	
	
	var UrlBase = "http://www.lucit.com.br/";
	// var UrlBase = "http://www.lucit.local/";
	
	var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

	var xmlhttp = ajax();

	function ajax(){
	
		oHtml = false;
	
		try { oHtml=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { 
	
		        try { oHtml=new ActiveXObject("Msxml2.XMLHTTP");} catch(ee){ 

				try { oHtml=new XMLHttpRequest(); } catch(eee) { oHtml=false;} 


			}
		}
	
		return oHtml;
	}




	// Handle all the the FSCommand messages in a Flash movie
	function menu_DoFSCommand(command, args) {
	var menuObj = InternetExplorer ? menu : document.menu;
		if ( command == "EMPRESA" ) 
			{ 
			CarregarCorpoImagem(2,"BEM VINDO","EMPRESA") ; 
			}
		else
			 { CarregarCorpoImagem(1,command); 
			 }
  
	}


	// Hook for Internet Explorer 
	if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
		navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
		document.write('<SCRIPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('Sub menu_FSCommand(ByVal command, ByVal args)\n');
		document.write('  call menu_DoFSCommand(command, args)\n');
		document.write('end sub\n');
		document.write('</SCRIPT\> \n');
	}
		
	
	function AC_Flash() {
		
		theObjects = document.getElementsByTagName("object");
			
			for (var i = 0; i < theObjects.length; i++) {
				theObjects[i].outerHTML = theObjects[i].outerHTML;
			}

	}
	
	function CalularTOrc() {
		habOrc();
	}
	
	function habOrc() {
	
		th1 = (document.getElementById("edNome").value.length > 0);
		th2 = (document.getElementById("edFone").value.length > 0);
		th3 = (document.getElementById("edEmail").value.length > 8);   
		th4 = (document.getElementById("edEmpresa").value.length >=0);			
	
		document.getElementById("Enviar_Orcamento").disabled = (! (th1 && th2 && th3 && th4));
	
	}



	function FinalizarOrc() {
	  SaveOrc();
	  
	  document.getElementById("avisoOrc").innerHTML = 'Finalizando Orçamento';
	  	
	  url = UrlBase+"cesta.php?ac=sav";
	    xmlhttp.open("GET",url,true); 
				xmlhttp.onreadystatechange = function(){
                if(xmlhttp.readyState == 4) {
					// document.getElementById("avisoOrc").innerHTML = '';
	  	    	}
	  	    	}	
	     
	    xmlhttp.send(null);
	    
	    var messagem = "";
		messagem += '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; font-family:Verdana; color:#454867; font-size:10 pt; font-weight:bold" bordercolor="#111111" width="766" height="217">';
		messagem += '<TR><TD align="center">';
		messagem += '<p align="center">&nbsp Obrigado o seu orçamento ja foi inserido em nosso sistema <br> em breve entraremos em contato ! </p>' ;
		messagem += '</TD></TR>';
		messagem += '</table>';
		document.getElementById("textBody").innerHTML = messagem;
	}



	
	function SaveOrc() {
	  document.getElementById("avisoOrc").innerHTML = 'Salvando...';
	  nm = document.getElementById("edNome").value;
	  fn = document.getElementById("edFone").value;
	  em = document.getElementById("edEmail").value;
	  ep = document.getElementById("edEmpresa").value;	
	  cp = document.getElementById("edCEP").value;	
	  ob = document.getElementById("edObs").value;	
	
	  url = UrlBase+"cesta.php?ac=an&nome="+nm + "&fone="+fn +  "&mail="+em + "&empresa="+ep + "&cep="+cp + "&obs="+ob;
	    xmlhttp.open("GET",url,true); 
				xmlhttp.onreadystatechange = function(){
                if(xmlhttp.readyState == 4) {
					document.getElementById("avisoOrc").innerHTML = '';
					
	  	    	}
	  	    	}	
	     
	    xmlhttp.send(null);
	}
	
	
	
	function SaveOrcID(id) {
		document.getElementById("avisoOrc").innerHTML = 'Salvando...';
	
		theQtd = document.getElementById("edQTD"+id);
		url = UrlBase+"cesta.php?ac=a&id="+id+ "&qtd="+ theQtd.value ;
		
		xmlhttp.open("GET",url,true);  
	    
	    xmlhttp.onreadystatechange = function(){
                if(xmlhttp.readyState == 4) {
					document.getElementById("avisoOrc").innerHTML = '';
					
	  	    	}	
	  	    	}
	    xmlhttp.send(null);
	}
	

	function CalculeOrc(id) 
	{
		theQtd = document.getElementById("edQTD"+id);
		thePreco = document.getElementById("edPRECO"+id);
		theSubTotal = document.getElementById("edSUBTOTAL"+id);		
	    theTotal = document.getElementById("edTOTAL");		
	  	theSubTotal.value = (theQtd.value * thePreco.value);
	
		  theObjects = document.getElementsByTagName("input");
			var ntotal = 0;
			for (var i = 0; i < theObjects.length; i++) {
				if (theObjects[i].name.substring(0,10) === 'edSUBTOTAL')
				
				if (theObjects[i].value > 0)				
				ntotal += parseFloat(theObjects[i].value);
				
  		    }
  			
  			theTotal.value = formatCurrency(ntotal);    
	    return true;	
	}        


function numerico() 
     {
	    if( !(event.keyCode >= 48 && event.keyCode <= 57 ) ) 
		 {
         return false;
         }
	 }
	                 

	function formatCurrency(num) {
			num = num.toString().replace(/\$|\,/g,'');
			if(isNaN(num))
				num = "0";
			
			sign = (num == (num = Math.abs(num)));
			num = Math.floor(num*100+0.50000000001);
			cents = num%100;
			num = Math.floor(num/100).toString();
			
			if(cents<10)
				cents = "0" + cents;

			for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
				num = num.substring(0,num.length-(4*i+3))+','+
				num.substring(num.length-(4*i+3));
				return (((sign)?'':'-') + '' + num + '.' + cents);
		
	}	
	


	function IncOrc(id,pre,pro) {
	    url = UrlBase+"cesta.php?ac=i&id="+id+"&pre="+pre+"&pro="+pro;
	    xmlhttp.open("GET",url,true);  
	    xmlhttp.onreadystatechange = function(){
                if(xmlhttp.readyState == 4) {
					document.getElementById(id).innerHTML = "<a href='?pg=ORÇAMENTO'>Adcionado ao Orçamento</a>"
					
	  	    	}	
	  	    	
        }	
	    xmlhttp.send(null);
		
	}
	
	
	function ExcOrc(id) {
	    url = UrlBase+"cesta.php?ac=e&id="+id;
	    xmlhttp.open("GET",url,true);  
	    xmlhttp.onreadystatechange = function(){
                if(xmlhttp.readyState == 4) {
					CarregarCorpoImagem(1,'ORÇAMENTO');
	  	    	}	
	  	    	
        }	
	    xmlhttp.send(null);
	    
		
	}
	
	
	function LimparOrc() {
	    url = UrlBase+"cesta.php?ac=c";
	    xmlhttp.open("GET",url,true);  
	    xmlhttp.onreadystatechange = function(){
                if(xmlhttp.readyState == 4) {
					CarregarCorpoImagem(1,'ORÇAMENTO');
	  	    	}	
	  	    	
        }	
	    xmlhttp.send(null);
	}
	
	

	function ChangePesquisa(novaPesquisa) {
	  CarregarCorpoImagem(1,novaPesquisa);
	}

	
	

	function ChangeCategoria(novaCategoria) {
	  Messagem('Aguarde Carregando......'+novaCategoria);
	  var r = Math.random();
	  CarregarCorpo(UrlBase+"body.php?pg=PRODUTOS"+"&n="+r+"&ct="+novaCategoria);
	}


	function exibirFoto( titulo , foto, id ) {
		var r = Math.random();
		url = UrlBase+"cesta.php?ac=ra&id="+id+"&n="+r;
		window.open(foto,titulo,"height=400,width=500,status=yes,toolbar=no,menubar=no,location=no");	  	     		
		xmlhttp.open("GET",url,true) 
		xmlhttp.onreadystatechange = function() {  
				if(xmlhttp.readyState == 4) {
					
	  	    	}	
                }							
            xmlhttp.send(null);
	}


	function PesquisaProduto(pesquisa) {
	
	  pesquisa = pesquisa.toLowerCase();
	
	  Messagem('Pesquisando por: '+pesquisa);
	  
	  var r = Math.random();
	  CarregarCorpo(UrlBase+"body.php?pg=PRODUTOS"+"&n="+r+"&ps="+pesquisa);
	}


	function Messagem(Mess) 
	{
	
	var messagem = "";
	messagem += '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; font-family:Verdana; color:#454867; font-size:10 pt; font-weight:bold" bordercolor="#111111" width="766" height="217">';
	messagem += '<TR><TD align="center">';
	messagem += '<img src="load.gif">' ;
	messagem += '<p align="center">&nbsp' + Mess + '</p>' ;
	messagem += '</TD></TR>';
	messagem += '</table>';
	document.getElementById("textBody").innerHTML = messagem;
	
	}

		
	
	function trocaTitulo() 
	{
	   document.getElementById("hee").innerHTML = "Novo titulo !";
	}

	function CarregarCorpoImagem(idModelo,cTitulo1,cTitulo2,cTitulo3)
	{
	  	  
	   
	   Messagem('Aguarde Carregando...!!! ');
	   	   
	   oTD1 = document.getElementById("imageHeader");
	   oTD2 = document.getElementById("imageBody");
	   
	   oTT1 = document.getElementById("title1");
	   oTT2 = document.getElementById("title2");
	   		
		if (idModelo == 1) {
		    oTD1.background="images/index_09.jpg";
		    oTD2.background="";
		    oTT1.innerHTML = cTitulo1;
		    oTT2.innerHTML = "";
		    var r = Math.random();
		     CarregarCorpo(UrlBase+"body.php?pg="+cTitulo1+"&n="+r);
	    
		} else {

			document.getElementById("textBody").innerHTML = '';		    
		    CarregarCorpo(UrlBase+"body.php");
		    oTD1.background="images/index_09a.jpg";
		    oTD2.background="images/index_10a.jpg";
		    oTT1.innerHTML = cTitulo1;
		    oTT2.innerHTML = cTitulo2;
		    
		    
		    
		}
	
	}
	
	function CarregarCorpo(url)
	{
		   // Envia a Requisicao
            xmlhttp.open("GET", url, true);
		
                xmlhttp.onreadystatechange = function(){
                if(xmlhttp.readyState == 4) {
			  	     document.getElementById("textBody").innerHTML = xmlhttp.responseText;
	  	    	}	
                }							

            xmlhttp.send(null);
            
	}

