function flash(src,w,h,alternate,string_values) { 
	if(string_values==undefined)
		document.write('<object type="application/x-shockwave-flash" data="'+src+'" width="'+w+'" height="'+h+'" wmode="transparent"><param name="movie" value="'+src+'" /><param name="wmode" value="transparent" /><img src="'+alternate+'" width="'+w+'" height="'+h+'" alt="Seu navegador não possui o plugin do Flash." title="Seu navegador não possui o plugin do Flash." /></object>'); 
	else
		document.write('<object type="application/x-shockwave-flash" data="'+src+'" width="'+w+'" height="'+h+'" wmode="transparent"><param name="movie" value="'+src+'" /><param name="wmode" value="transparent" /><param name="FlashVars" value="'+string_values+'" /><img src="'+alternate+'" width="'+w+'" height="'+h+'" alt="Seu navegador não possui o plugin do Flash." title="Seu navegador não possui o plugin do Flash." /></object>'); 
}

// Função para Navegação (Jump Menu)
function navegar(f) { var onde = f.selectedIndex; if (f.options[onde].value != 1) window.open(f.options[onde].value,"_top"); }

// Função de modificação do BG do menu
function Background(tgt) { document.getElementById(tgt).style.background = 'url('+getLiveSite()+'images/bg-menu-on.gif)'; }
function ClearBackground(tgt) { document.getElementById(tgt).style.background = 'none'; }

/* FUNÇAO PARA FAZER A TROCA DAS ABAS NA HOME */

function swapaba(div){

	if(div == "aba-resultados"){

		document.getElementById('aba-resultados').style.display = 'block';			
		document.getElementById('aba-canal').style.display = 'none';					
		document.getElementById('aba-eventos').style.display = 'none';	
		document.getElementById('aba-programas').style.display = 'none';	
	}

	if(div == "aba-canal"){

		document.getElementById('aba-canal').style.display = 'block';					
		document.getElementById('aba-resultados').style.display = 'none';							
		document.getElementById('aba-eventos').style.display = 'none';				
		document.getElementById('aba-programas').style.display = 'none';

	}

	if(div == "aba-eventos"){

		document.getElementById('aba-eventos').style.display = 'block';					
		document.getElementById('aba-resultados').style.display = 'none';							
		document.getElementById('aba-canal').style.display = 'none';				
		document.getElementById('aba-programas').style.display = 'none';

	}
	
	if(div == "aba-programas"){

		document.getElementById('aba-programas').style.display = 'block';					
		document.getElementById('aba-resultados').style.display = 'none';							
		document.getElementById('aba-canal').style.display = 'none';
		document.getElementById('aba-eventos').style.display = 'none';	

	}
}


var tags = new Array('span');
var pixelArray =  new Array('10','12','14','16','18');
var initSize = 0;

function fontSizer(inc,unit) {

	if (!document.getElementById) return;
	var size = initSize;
	size += inc;

	if (size < 0 ) {
		size = 0;
	}
	if (size > 4 ) {
		size = 4;
	}

	initSize = size;
	getBody = document.getElementsByTagName('body')[0];
	for (i = 0 ; i < tags.length ; i++ ) getallTags = getBody.getElementsByTagName(tags[i]);
	for (k = 0 ; k < getallTags.length ; k++) getallTags[k].style.fontSize = pixelArray[size]+unit;
}

function Clickheretoprint() {
  var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
      disp_setting+="scrollbars=1,width=500, height=768, left=200, top=25";
  var content_vlue = document.getElementById("impressao").innerHTML;

  var docprint=window.open("","",disp_setting);
   docprint.document.open();
   docprint.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n<title>JA - Versão para impressão</title>\n');
   docprint.document.write('<link href="'+getLiveSite()+'templates/css/default.css" rel="stylesheet" type="text/css">\n');
   /*docprint.document.write('<link href="'+getLiveSite()+'templates/css/inside.css" rel="stylesheet" type="text/css">\n');*/
   docprint.document.write('</head>\n<body onLoad="self.print()">\n<div class="miolo" style="align:left; padding-left:8px;">');
   docprint.document.write(content_vlue);
   docprint.document.write('</div>\n</body>\n</html>');
   docprint.document.close();
   docprint.focus();
}

function getLivePortal() {
   var site = document.location+'';
   return site.substr(0,site.indexOf('index'));
}

function getLiveSite() {
   var livePortal = getLivePortal();
   return livePortal.substr(0,livePortal.length-3) + 'ja/';
}

/* FUNÇÃO PARA EXIBIR / ESCONDER COMENTÁRIOS DO BLOG */
function showFormComment() {
   if(document.getElementById("form-blog-hidden").style.display == "none") {
      $("#form-blog-hidden").fadeIn(200);
   } else {
      $("#form-blog-hidden").fadeOut(200);
   }
}


function showComment() {  
   if(document.getElementById("comments-blog-hidden").style.display == "none") {
      $("#comments-blog-hidden").fadeIn(200);
   } else {
      $("#comments-blog-hidden").fadeOut(200);
   }
}
/* função para inserir comentário via ajax*/
function enviaComment() {
   $("#loader-form-comment").show();
   var campos = $("#comentario").serialize();
   var chave = new Date();
   campos += '&chave=' + chave;
   $("#nome").val("");
   $("#email").val("");
   $("#mensagem").val("");
   $.post("components/com_blog/blog_inserir_comment_ajax.php", campos , function(data) {
      $("#loader-form-comment").hide();
      $("#form-blog-result").html(data);
      $("#form-blog-result").show();
      setTimeout(function() {
         $("#form-blog-result").hide();
      }, 3000);
   });
}


$(document).ready(function() {
	//	tb_init('a.thickbox');
	$('.flash').each(function() {
		var obj = $(this).metadata();
		obj.wmode = 'transparent';
		$(this).flash(obj);
	});
});

function bannerExpandir(id) {
	$('#' + id).css('height', id.substr(id.lastIndexOf('-')+1) + 'px');
}
function bannerReduzir(id) {
	$('#' + id).css('height', '62px');
}
