function erroIE() {
  return true;
}

window.onerror = erroIE;

		$(document).ready(function(){  
								   

		
		$("a#playerTestDrive").fancybox({
				'autoScale'			: false,
				'padding'			: 0,
				'scrolling'        	: 'no',
				'titlePosition'		: 'inside',
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic'
		});	 		
		

			
		$("#cep").blur (function(){
			$("#endereco").val("Carregando...")
			$("#bairro").val("Carregando...")
			$("#cidade").val("Carregando...")
			$("#estado").val("Carregando...")
		
		q=$("#cep").val()
		$.getScript("http://cep.republicavirtual.com.br/web_cep.php?cep="+q+"&formato=javascript",function(){
		
		endereco=unescape (resultadoCEP.logradouro)
		bairro=unescape (resultadoCEP.bairro)
		cidade=unescape (resultadoCEP.cidade)
		uf=unescape (resultadoCEP.uf)
		
			$("#endereco").val(endereco)
			$("#bairro").val(bairro)
			$("#cidade").val(cidade)
			$("#estado").val(uf)
				
		});
		});	
				
			$('#destaque-principal').cycle({
			
				 fx: 'scrollRight',
				 speed:    200, 
  				 timeout:  8000  				
				
			});
				 
		 $('ul.sf-menu').superfish();
		 $('div.televendas').corner("bottom");
				
		     jQuery('#clientes').jcarousel({
				auto: 4,
				wrap: 'last',
				initCallback: mycarousel_initCallback
			});
		  
		 }); 		 
		 
		 		function mycarousel_initCallback(carousel)
			{
				// Disable autoscrolling if the user clicks the prev or next button.
				carousel.buttonNext.bind('click', function() {
					carousel.startAuto(0);
				});
			
				carousel.buttonPrev.bind('click', function() {
					carousel.startAuto(0);
				});
			
				// Pause autoscrolling if the user moves with the cursor over the clip.
				carousel.clip.hover(function() {
					carousel.stopAuto();
				}, function() {
					carousel.startAuto();
				});
			};
			
			
// Avançar e Voltar
	function ProximaPagina() {
		window.history.forward();
	}
	
	function PaginaAnterior() {
		window.history.back();
	}

			
// limpar campo

function limpa_campo(variavel,tipo,valor){
	if(tipo == 1){texto = "Digite seu E-mail";}
	if(valor == texto){
		variavel.value = "";
	} 
	if(valor == ""){
		variavel.value = texto;
	}
}
function limpa_busca(variavel,tipo,valor){
	if(tipo == 1){texto = "Digite um termo para pesquisa";}
	if(valor == texto){
		variavel.value = "";
	} 
	if(valor == ""){
		variavel.value = texto;
	}
}
// Compilar Flash ->  <script type="text/javascript">flash('swf/flash_central.swf',620,237)<//script>
function flash(arqflash,largura,altura) {
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="' + largura + '" height="' + altura + '">');
document.write('<param name="movie" value="' + arqflash + '" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="menu" value="false" />');
document.write('<param name="wmode" value="transparent" />');
document.write('<embed src="' + arqflash + '" width="' + largura + '" height="' + altura + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed>');
document.write('</object>');
}


function AbreJanela(url) {
    window.open(url);
}


/* -- 1. Player Version detection -- */
//set player version here
var MM_contentVersion = 6;
//set sub version here
var release = "6,0,67,0";
//check for flash player

var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

if ( plugin ) {
      var words = navigator.plugins["Shockwave Flash"].description.split(" ");
       for (var i = 0; i < words.length; ++i)
       {
      if (isNaN(parseInt(words[i])))
      continue;
      var MM_PluginVersion = words[i];
       }
   var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}

else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
   && (navigator.appVersion.indexOf("Win") != -1)) {
   document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
   document.write('on error resume next \n');
   document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
   document.write('</SCR' + 'IPT\> \n');

}

/* -- 2. Deployment function -- */
function writeFlash(swf,flashVarString,w,h,bgcolor,menu,mode,q,id){

  if ( MM_FlashCanPlay ) {

     document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
     +'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+release+'" '
     +'width="'+w+'" height="'+h+'" id="'+id+'" align="">'
     +'<param name="movie" value="'+swf+'">'
     +'<param name="menu" value="'+menu+'"> '
     +'<param name="quality" value="'+q+'"> '
     +'<param name="wmode" value="'+mode+'"> '
     +'<param name="bgcolor" value="'+bgcolor+'"> '
     +'<param name="flashvars" value="'+flashVarString+'"> '
     +'<embed src="'+swf+'" flashvars="'+flashVarString+'" menu="'+menu+'" quality="'+q+'" wmode="'+mode+'" '
     +' bgcolor="'+bgcolor+'"  width="'+w+'" height="'+h+'" name="'+swf+'" '
     +' align=""  type="application/x-shockwave-flash" '
     +' pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> ');

  } else {

     //behaviour for if there is no flash player
     document.write('You require Flash Player '+MM_contentVersion+' or later to use this site. ');
     document.write('<em><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">');
     document.write('Click here to install it now.</a></em>');

     //this can be replaced by anything you want
     //e.g. document.location.replace("text.html");
  }
}

// -->

// Esta função "chama" todas as funções usadas em um documento.
function init() {
	createExternalLinks();
}
//<a href="index.php" title="Link de Exemplo" rel="externo">
/* Para chamar a função, insira no body  == <script type="text/javascript">createExternalLinks();</script>  */
function createExternalLinks() {
    if(document.getElementsByTagName) {
        var anchors = document.getElementsByTagName('a');
        for(var i=0; i<anchors.length; i++) {
            var anchor = anchors[i];
            if(anchor.getAttribute("href") && anchor.getAttribute('rel')=='externo') { // <-- É necessário inserir rel="externo" no link
                anchor.target = '_blank';
                var title = anchor.title + ' (Este link abre uma nova janela)'; // <-- Insere este texto no final do Title do link
                anchor.title = title;
            }
        }
    }
}

//........................................................................
function addEvent(obj, evType, fn){
    if(obj.addEventListener){
        obj.addEventListener(evType, fn, false);
        return true;
    } else if (obj.attachEvent){
        var r = obj.attachEvent('on'+evType, fn);
        return r;
    } else {
        return false;
    }
}
addEvent(window, "load", init);


