function erroIE() {
  return true;
}

window.onerror = erroIE;

$(document).ready(function(){
						   
						   
	    $('#destaque-principal').cycle({
		    fx:     'scrollUp', 
			timeout: 6000, 
			delay:  -2000 
		});
		
		$("#datanascimento").mask("9999-99-99");
		$("#telefone").mask("(99)9999-9999");
		$("#celular").mask("(99)9999-9999");
		
		$("#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(){
		
		tipo=unescape (resultadoCEP.tipo_logradouro)
		endereco=unescape (resultadoCEP.logradouro)
		bairro=unescape (resultadoCEP.bairro)
		cidade=unescape (resultadoCEP.cidade)
		uf=unescape (resultadoCEP.uf)
		
			$("#endereco").val(tipo + " " + endereco)
			$("#bairro").val(bairro)
			$("#cidade").val(cidade)
			$("#estado").val(uf)
				
		});
		});	
		
		$("#cep2").blur (function(){
			$("#endereco2").val("Carregando...")
			$("#bairro2").val("Carregando...")
			$("#cidade2").val("Carregando...")
			$("#estado2").val("Carregando...")
		
		q=$("#cep2").val()
		$.getScript("http://cep.republicavirtual.com.br/web_cep.php?cep="+q+"&formato=javascript",function(){
		
		tipo2=unescape (resultadoCEP.tipo_logradouro)
		endereco2=unescape (resultadoCEP.logradouro)
		bairro2=unescape (resultadoCEP.bairro)
		cidade2=unescape (resultadoCEP.cidade)
		uf2=unescape (resultadoCEP.uf)
		
			$("#endereco2").val(tipo2 + " " + endereco2)
			$("#bairro2").val(bairro2)
			$("#cidade2").val(cidade2)
			$("#estado2").val(uf2)
				
		});
		});			
		

		
		
	jQuery('ul.sf-menu').superfish();
	
	
		$('.galeria_cat').addClass('gallery_demo'); // adds new class name to maintain degradability
		
		$('ul.gallery_demo').galleria({
			history   : true, // activates the history object for bookmarking, back-button etc.
			clickNext : true, // helper for making the image clickable
			insert    : '#main_image', // the containing selector for our main image
			numThumbs:                 15,

			onImage   : function(image,caption,thumb) { // lets add some image effects for demonstration purposes
				
				// fade in the image & caption
				image.css('display','none').fadeIn(1000);
				caption.css('display','none').fadeIn(1000);
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.3);
				
				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');
				
				// add a title for the clickable image
				image.attr('title','Next image >>');
			},
			onThumb : function(thumb) { // thumbnail effects goes here
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.3';
				
				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
				
				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.3); } 
				)
			}
		});


		
});

function show(x,y,w,h){
document.getElementById(x).style.display='block';
document.getElementById(y).style.display='none';
document.getElementById(w).style.display='none';
document.getElementById(h).style.display='block';
}





//************** 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;

	}

}



//************** Clima Tempo ***************************************



function CompilaFlash(arq,largura,altura,parametro,dia,skin) {

    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+largura+"' height='"+ altura +"' id='flash' align='middle' VIEWASTEXT>"+

     "<param name='allowScriptAccess' value='always' />"+

     "<param name='movie' value='"+ arq +"?CODCIDADE=" +parametro+ "&DIA="+dia+"&SKIN="+ skin +"' />"+

     "<param name='quality' value='high' />"+

     "<param name='wmode' value='transparent' />"+

     "<param name='menu' value='false' />"+

     "<embed src='"+ arq +"?CODCIDADE=" +parametro+ "&DIA="+dia+"&SKIN="+ skin +"' quality='high' wmode='transparent' menu='false' width='"+largura+"' height='"+ altura +"' name='flash' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+

    "</object>");

}





//******************************************************************************

//* 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);
