// initialise plugins
   $(document).ready(
   
  
   
	function(){
	
	jQuery('ul.sf-menu').superfish();
	
		 $('.slideshow') 
	.before('<div id="nav">') 
	.cycle({ 
		fx:     'turnDown', 
		speed:  'fast', 
		timeout: 8000, 
   		delay:  -2000,
		next:   '#next2', 
        prev:   '#prev2' ,
		pager:  '#nav' 
	});
		
		$('ul#flash').innerfade({
			speed: 1000,
			timeout: 7000,
			type: 'sequence',
			containerheight: '283px'
		});
		
		$(".face").tooltip({
			track: true,
			delay: 0,
			showURL: false,
			fixPNG: true,
			showBody: " - ",
			extraClass: "pretty fancy",
			top: -15,
			left: 5
		});
});	

		

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