	// JavaScript Document
	
	//DATA ATUALIZADA
	var montharray=new Array("01","02","03","04","05","06","07","08","09","10","11","12")
	function getthedate(){
	var mydate=new Date()
	var year=mydate.getYear()
	if (year < 1000)
	year+=1900
	var day=mydate.getDay()
	var month=mydate.getMonth()
	var daym=mydate.getDate()
	if (daym<10)
	daym="0"+daym
	var hours=mydate.getHours()
	var minutes=mydate.getMinutes()
	var seconds=mydate.getSeconds()
	var dn="AM"
	if (hours>=12)
	dn="PM"
	if (hours>12){
	hours=hours-12
	}
	if (hours==0)
	hours=12
	if (minutes<=9)
	minutes="0"+minutes
	if (seconds<=9)
	seconds="0"+seconds
	//change font size here
	var cdate="  <font color='#000000'>"+daym+"/"+montharray[month]+"/"+year+"   |   "+hours+":"+minutes+":"+seconds+" "+dn+" </font> "
	if (document.all)
	document.all.clock.innerHTML=cdate
	else if (document.getElementById)
	document.getElementById("clock").innerHTML=cdate
	else
	document.write(cdate)
	}
	if (!document.all&&!document.getElementById)
	getthedate()
	function clock(){
	if (document.all||document.getElementById)
	setInterval("getthedate()",1000)
	}
		
	//VALIDA EMAIL
	function valida_email( valor ) 
	{
	  if (valor.indexOf('@', 0) == -1 || valor.indexOf('.', 0) == -1) 
	  { 
		return (false); 
	  } else {
		return (true); 
	  }
	}  
	
	//SITES EXTERNOS
	function OpenSite(TIPO) 
	{
		if(TIPO == 1) 
		{ 
			var URL = "http://www.suporteallline.com.br"; 
			var Nome = "SuporteAllline";
		} 
		else if(TIPO == 2) 
		{ 
			var URL = "http://www.arenagsm.com.br"; 
			var Nome = "ArenaGSM";
		} 
		
		var Atributos = "toolbar=yes,location=none,status=yes,menubar=none,scrollbars=yes,resizable=yes";
		Janela = window.open(URL,Nome,Atributos);
		Janela.focus();
	}
	
	function Busca()
	{
		var MARCA = document.FormBusca.Busca_Marca;
		var MODELO = document.FormBusca.ModeloSel.value;	
		
		if(MARCA.value == "")
		{
			alert("Busca\n ------------------------------------------------\n Selecione uma das Marcas\n");
			MARCA.focus();
		}
		else
	   {
		  var URL = "?Area=busca&IdMarca="+MARCA.value +"&IdModelo="+MODELO;
											   
			window.location= URL;
	   }
	}
	
	//Download
	function Download(TIPO, ARQUIVO) 
	{
		if(TIPO == 1) 
		{ 
			var URL = "../files/produtos/drivers/download.php?FILE="+ARQUIVO; 
		} 
		else if(TIPO == 2) 
		{ 
			var URL = "../files/produtos/manuais/download.php?FILE="+ARQUIVO; 
		} 
		else if(TIPO == 3) 
		{ 
			var URL = "../files/produtos/softwares/download.php?FILE="+ARQUIVO; 
		} 
		window.location = URL;
	}
		
	//VALIDAR CONTATO
	function Invalido(CAMPO)
	{
		var Cor = '#cc0000';
		var CorFundo = '#F5E9E0';
		var Borda ='1px solid #cc0000';
		
		CAMPO.style.color = Cor;
		CAMPO.style.backgroundColor = CorFundo;
		CAMPO.style.border = Borda;	
	}
	
	function Valido(CAMPO)
	{
		var Cor = '#000000';
		var CorFundo = '';
		var Borda ='1px solid #4E83B8';
		
		CAMPO.style.color = Cor;
		CAMPO.style.backgroundColor = CorFundo;
		CAMPO.style.border = Borda;	
		return true;
	}
	
	function ValidaContato()
	{
		var FORM = document.FormContato;
		
		if(FORM.Contato_Nome.value == "")
		{
			Invalido(FORM.Contato_Nome);
			alert("Contato\n ------------------------------------------------\n Preencha o campo com seu Nome\n");
			FORM.Contato_Nome.focus();
		}
		else if((Valido(FORM.Contato_Nome)) && (FORM.Contato_Email.value == ""))
		{
			Invalido(FORM.Contato_Email);
			alert("Contato\n ------------------------------------------------\n Preencha o campo com seu E-mail\n");
			
			FORM.Contato_Email.focus();
		}
		 else if ((Valido(FORM.Contato_Email)) && (FORM.Contato_Email.value.indexOf('@', 0) == -1 || FORM.Contato_Email.value.indexOf('.', 0) == -1))
	   {   
			Invalido(FORM.Contato_Email);
			alert("Contato\n ------------------------------------------------\n Seu E-mail não é um E-Mail Válido\n");
			FORM.Contato_Email.focus();
	   }
	   else if((Valido(FORM.Contato_Email)) && (FORM.Contato_Assunto.value == ""))
	  {
			Invalido(FORM.Contato_Assunto);
			alert("Contato\n ------------------------------------------------\n Preencha o campo Assunto\n");
			FORM.Contato_Assunto.focus();
		}
		else if((Valido(FORM.Contato_Assunto)) && (FORM.Contato_Mensagem.value == ""))
	  {
			Invalido(FORM.Contato_Mensagem);
			alert("Contato\n ------------------------------------------------\n Preencha o campo Mensagem\n");
			FORM.Contato_Mensagem.focus();
		}
	   else
	   {
		   Valido(FORM.Contato_Mensagem);
		   if(confirm("Contato\n ------------------------------------------------\n Enviar Mensagem?\n"))
		   {
				FORM.submit();
		   }
	   }
	}
	
	function ValidaIndicacao()
	{
		var FORM = document.FormIndicacao;
		
		if(FORM.Indicar_Nome.value == "")
		{
			Invalido(FORM.Indicar_Nome);
			alert("Indicar\n ------------------------------------------------\n Preencha o campo com Seu Nome\n");
			FORM.Indicar_Nome.focus();
		}
		else if((Valido(FORM.Indicar_Nome)) && (FORM.Indicar_Email.value == ""))
		{
			Invalido(FORM.Indicar_Email);
			alert("Indicar\n ------------------------------------------------\n Preencha o campo com Seu E-mail\n");
			
			FORM.Indicar_Email.focus();
		}
		 else if ((Valido(FORM.Indicar_Email)) && (FORM.Indicar_Email.value.indexOf('@', 0) == -1 || FORM.Indicar_Email.value.indexOf('.', 0) == -1))
	   {   
			Invalido(FORM.Indicar_Email);
			alert("Indicar\n ------------------------------------------------\n Seu E-mail não é um E-Mail Válido\n");
			FORM.Contato_Email.focus();
	   }
	   else if((Valido(FORM.Indicar_Email)) && (FORM.Indicar_Amigo_Nome.value == ""))
	  {
			Invalido(FORM.Indicar_Amigo_Nome);
			alert("Indicar\n ------------------------------------------------\n Preencha o campo Nome do Amigo\n");
			FORM.Indicar_Amigo_Nome.focus();
	  }
		else if((Valido(FORM.Indicar_Amigo_Nome)) && (FORM.Indicar_Amigo_Email.value == ""))
	   {
			Invalido(FORM.Indicar_Amigo_Email);
			alert("Indicar\n ------------------------------------------------\n Preencha o campo E-mail do Amigo\n");
			FORM.Indicar_Amigo_Email.focus();
		}
		else if ((Valido(FORM.Indicar_Amigo_Email)) && (FORM.Indicar_Amigo_Email.value.indexOf('@', 0) == -1 || FORM.Indicar_Amigo_Email.value.indexOf('.', 0) == -1))
	   {   
			Invalido(FORM.Indicar_Amigo_Email);
			alert("Indicar\n ------------------------------------------------\n O E-mail do Amigo não é um E-Mail Válido\n");
			FORM.Indicar_Amigo_Email.focus();
	   }
	   else
	   {
		   Valido(FORM.Indicar_Amigo_Email);
		   if(confirm("Indicar\n ------------------------------------------------\n Enviar Indicação?\n"))
		   {
				FORM.submit();
		   }
	   }
	}
	
	//JANELA DE ZOOM
	function Zoom(itemid, id, tipo)
	{
		var width = 680;
		var height = 540;
									
		var left = ((screen.width - width)/2);
		var top = ((screen.height - height)/2);
					
		var URL = "popups/zoom.php?Tipo="+tipo+"&ItemId="+itemid+"&FotoId="+id;
					   
		var Janela = window.open(URL,'PopupZoom', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no, maximize=no');
				
		Janela.focus();
	}
	
	//JANELA DE IMPRESSAO
	function Formulario()
	{
		var width = 350;
		var height = 400;
									
		var left = ((screen.width - width)/2);
		var top = ((screen.height - height)/2);
					
		var URL = "formulario.php";
					   
		var Janela = window.open(URL,'Formulario', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no, maximize=no');
				
		Janela.focus();
	}
	
	//JANELA DE IMPRESSAO
	function Revendedor()
	{
		var width = 420;
		var height = 440;
									
		var left = ((screen.width - width)/2);
		var top = ((screen.height - height)/2);
					
		var URL = "novo_revendedor.php";
					   
		var Janela = window.open(URL,'Revendedor', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no, maximize=no');
				
		Janela.focus();
	}

	//JANELA DA ENQUETE
	function Enquete(ACAO)
	{
		var width = 470;
		var height = 450;
									
		var left = ((screen.width - width)/2);
		var top = ((screen.height - height)/2);
					
		var URL = "popups/enquete.php?Acao="+ACAO;
					   
		var Janela = window.open(URL,'Enquete', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no, maximize=no');
				
		Janela.focus();
	}
	
	//LIMITE DE CARACTERES
	var lim=500;
	function limite(texto,total)
	{
		if (texto.value.length > lim)
		{
			event.keyCode=0;
			texto.value = texto.value.substring(0,lim);
			Total.innerHTML = lim - texto.value.length;
			//document.form1.texto.disabled=true;
			alert("Esta caixa está limitada em "+lim+" caracteres.");
			return;
		}
		Total.innerHTML = lim - texto.value.length + " caracteres restantes.";
	}
	
	function ListaCategorias(id, total)
	{
			for(i=0; i<total; i++)
			{
				if(i == id)
				{
					if(document.getElementById('MenuCategorias_'+ i +'').style.display == 'block')
					{
						document.getElementById('MenuCategorias_'+ i +'').style.display='none';
					}
					else
					{
						document.getElementById('MenuCategorias_'+ i +'').style.display='block';
					}
				}
				else
				{
					document.getElementById('MenuCategorias_'+ i +'').style.display='none';
				}

				
			}
	}
	
	function AbreMarca()
	{   
		var URL = document.Marca.Destino.value;
		window.location = ""+URL+"";
	}
	
	function Marca(id, total)
	{
			for(i=0; i<total; i++)
			{
				if(i == id)
				{
					if(document.getElementById('Celulares_'+ i +'').style.display == 'block')
					{
						document.getElementById('Celulares_'+ i +'').style.display='none';
					}
					else
					{
						document.getElementById('Celulares_'+ i +'').style.display='block';
					}
				}
				else
				{
					document.getElementById('Celulares_'+ i +'').style.display='none';
				}

				
			}
	}
	
	function Tipo(id, total)
	{
			for(i=0; i<total; i++)
			{
				if(i == id)
				{
					if(document.getElementById('Categorias_'+ i +'').style.display == 'block')
					{
						document.getElementById('Categorias_'+ i +'').style.display='none';
					}
					else
					{
						document.getElementById('Categorias_'+ i +'').style.display='block';
					}
				}
				else
				{
					document.getElementById('Categorias_'+ i +'').style.display='none';
				}

				
			}
	}
	
	function ListaCats(id, total)
	{
			for(i=0; i<total; i++)
			{
				if(i == id)
				{
					if(document.getElementById('MenuCats_'+ i +'').style.display == 'block')
					{
						document.getElementById('MenuCats_'+ i +'').style.display='none';
					}
					else
					{
						document.getElementById('MenuCats_'+ i +'').style.display='block';
					}
				}
				else
				{
					document.getElementById('MenuCats_'+ i +'').style.display='none';
				}

				
			}
	}
		
	function IDLWindow(URL) 
	{
		var Nome = "IDLWindow";
		var Atributos = "toolbar=yes,location=none,status=yes,menubar=none,scrollbars=yes,resizable=yes";
		Janela = window.open(URL,Nome,Atributos);
		Janela.focus();
	}
	
	function Open(respostas)
	{
		var width = 470;
		var height = 450;
									
		var left = ((screen.width - width)/2);
		var top = ((screen.height - height)/2);
					
		var URL = "popups/enquete.php"+respostas+"||&acao=votar&Acao="+document.EnqueteForm.Acao.value+"&EID="+document.EnqueteForm.ENQ.value;
					   
		var Janela = window.open(URL,'Enquete', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no, maximize=no');
				
		Janela.focus();
	}
	
	function Votar(limite)
	{
		var formularios = document.forms.length;
		for(i=0;i<formularios;i++)
		{
			if(document.forms[i].name == "EnqueteForm")
			{
				var formulario = i;
				break;
			}
		}
															
		var num_respostas = document.forms[formulario].opcao.length;
		var resposta = num_respostas;
		var respostas = "";
		
		//selecionadas
		var selecionadas = 0;
		
		for(i=0;i<num_respostas;i++)
		{
			if(document.forms[formulario].opcao[i].checked)
			{
				selecionadas++;
			}
		}
			
		if(selecionadas > limite)
		{
			alert('Enquetes\n ------------------------\n Esta enquete tem o limite de '+limite+' opções e você selecionou '+selecionadas+' opções\n');
		}
		else
		{
			for(i=0;i<num_respostas;i++)
			{
				if(document.forms[formulario].opcao[i].checked)
				{
					resposta = i;
					if(respostas)
					{
						respostas = respostas + "&";
					}
					else
					{
						respostas = respostas + "?";
					}
					
					respostas = respostas + "R"+ i + "=" + document.forms[formulario].opcao[i].value;
					
				}
			}
			
			if(resposta==num_respostas)
			{
				alert("Enquetes\n ---------------------------\n Selecione uma das opções disponíveis.\n");
			}
			else
			{
				
				Open(respostas);
			}
		}
	}
	
	function Resposta(id)
	{
		var DIV = "Resposta_"+id;
		var result = document.getElementById(DIV).style.display;
		if( result == "block")
		{
			document.getElementById(DIV).style.display = "none";
		}
		else
		{
			document.getElementById(DIV).style.display = "block";
		}
	}
	
	function ajaxInit() 
	{
		 var req;
		 
		 try 
		 {
		  req = new ActiveXObject("Microsoft.XMLHTTP");
		 } 
		 catch(e) 
		 {
		  	try 
			{
		   		req = new ActiveXObject("Msxml2.XMLHTTP");
		  	} 
			catch(ex) 
			{
		  		 try 
			 	{
					req = new XMLHttpRequest();
		   		} 
				catch(exc) 
				{
					alert("Esse browser não tem recursos para uso do Ajax");
					req = null;
		   		}
		  	}
		 }
	 }
	 
	 function Cadastro() 
	{
		var FORM = document.FormNewsletter;
		var NOME = document.FormNewsletter.News_Nome;
		var EMAIL = document.FormNewsletter.News_Email;
		  
		if(NOME.value == "")
		{
			Invalido(NOME);
			alert("Cadastro\n ------------------------------------------------\n Preencha o campo com seu Nome\n");
			NOME.focus();
		}
		else if((Valido(NOME)) && (EMAIL.value == ""))
		{
			Invalido(EMAIL);
			alert("Cadastro\n ------------------------------------------------\n Preencha o campo com seu E-Mail\n");
			EMAIL.focus();
		}
		else if ((Valido(EMAIL)) && (EMAIL.value.indexOf('@', 0) == -1 || EMAIL.value.indexOf('.', 0) == -1))
	   {   
			Invalido(EMAIL);
			alert("Cadastro\n ------------------------------------------------\n Seu E-mail não é um E-Mail Válido\n");
			EMAIL.focus();
	   }
		else
		{
		  FORM.submit();
		}
	}

