<!--
function verifica_preenchimento()
{
	if (document.formulario.STR_THUMBNAIL.value == "")
	{
		alert("Preencha o campo THUMBNAIL");
		document.formulario.STR_THUMBNAIL.focus();
		return false;
	}
	if (document.login.str_email.value == "")
	{
		alert("Preencha o campo email");
		document.login.str_email.focus();
		return false;
	}
	if (document.login.str_senha.value == "")
	{
		alert("Preencha o campo senha");
		document.login.str_senha.focus();
		return false;
	}
	document.login.submit();
}

function highlight(field) {
       field.focus();
       field.select();
	   field.clipboardData.setData('text',"videolink");
}

function muda_lingua()
{
	document.id_lang.submit();
}

function toggle(obj) {
var el = document.getElementById(obj);
if ( el.style.display != 'none' ) {
el.style.display = 'none';
}
else {
el.style.display = '';
}
}

function SimpleSwap(elm,which){
  elm.src=elm.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

function seguindo(){
	toggle("msgbox");
}
function hideIt(){
setTimeout("doStuff2()", 3100);
}
function doStuff2(){
for(var i=0; i<10000; i++)
status = i;
seguindo();
}

function muda()
{
	document.frmPub.submit();
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}


var headline_count; 
var headline_interval; 
var old_headline = 0; 
var current_headline = 0; 
$(document).ready(function(){ 
	 headline_count = $("div.headline").size(); 
	$("div.headline:eq("+current_headline+")").css('top','0px'); 
	headline_interval = setInterval(headline_rotate,15000); //time in milliseconds 
	$('#scrollup').hover(function() { 
		clearInterval(headline_interval); }, function() { 
		headline_interval = setInterval(headline_rotate,5000); //time in milliseconds 
		headline_rotate(); 
		}); 
	}); 
	function headline_rotate() { 
		current_headline = (old_headline + 1) % headline_count; 
		$("div.headline:eq(" + old_headline + ")").animate({top: -405},"slow", function() { 
			$(this).css('top','410px'); }); 
		$("div.headline:eq(" + current_headline + ")").show().animate({top: 0},"slow"); 
		old_headline = current_headline; 
} 


function uploader($buquet,$token) 
{
	document.writeln('	<div id="uploadiv" style="display:none;"> ');
	document.writeln('	<iframe src="http://www.tivio.tv/my/channel/video/upload/'+ $buquet +'/?tk='+ $token +'" ');
	document.writeln('	scrolling="no" width="600" height="100" frameborder="0"></iframe> ');
	document.writeln('	</div> '); 
	
}

function uploader_pd1($buquet,$token) 
{
	document.writeln('	<div id="uploadiv" style="display:none;"> ');
	document.writeln('	<iframe src="http://www.tivio.tv/tools/apps/video/server/encoders/'+ $buquet +'?tk='+ $token +'" ');
	document.writeln('	scrolling="no" width="600" height="100" frameborder="0"></iframe> ');
	document.writeln('	</div> '); 
	
}

function megabar($tamanhobarra,$tamanhosubbarra)
{
	document.writeln('	<div style="position:relative;text-align:left; background-color:#FFF; border:1px #3b5998 solid; ');
	document.writeln('	padding:0; margin:4px 0 0 0; width:'+ $tamanhobarra +'px; height:25px;');		
	document.writeln('	background:url(http://www.tivio.tv/images/bg_upload_1.gif); "> ');
	document.writeln('	<div style="position:relative;background-color:#3b5998; padding:0; width:'+ $tamanhosubbarra +'px; height:25px; ');
	document.writeln('	margin:0;float:left;background:url(http://www.tivio.tv/images/bg_upload_2.gif);"></div>  ');
}

function taxabar($tamanhobarra,$tamanhosubbarra)
{
	document.writeln('	<div style="position:relative;text-align:left; background-color:#FFF; border:1px #3b5998 solid; ');
	document.writeln('	padding:0; margin:4px 0 0 0; width:'+ $tamanhobarra +'px; height:25px;');		
	document.writeln('	background:url(http://www.tivio.tv/images/bg_upload_1.gif); "> ');
	document.writeln('	<div style="position:relative;background-color:#3b5998; padding:0; width:'+ $tamanhosubbarra +'px; height:25px; ');
	document.writeln('	margin:0;float:left;background:url(http://www.tivio.tv/images/bg_upload_2.gif);"></div>  ');
}


function muda_mes()
{
	document.frmMes.submit();
}

function muda_ano()
{
	document.frmAno.submit();
}

function validabusca(msg_busca){
	if (document.frm_search.palavra.value == "")
	{
		alert(msg_busca);
		document.frm_search.palavra.focus();
		return false;
	}
	return true;
}

function evalidarv(msg_search){
	if (document.formv.palavra.value == "")
	{
		alert(msg_search);
		document.formv.palavra.focus();
		return false;
	}
	return true;
	}
	function muda1()
	{
	document.frmCategoria.submit();
}

	function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	}
  var friendCount = 0
  function get_friend_likes() {
   FB.api('/me/friends', function(response)
   {
        friendCount = response.data.length;
		//alert (friendCount);
	});	
   FB.api('/me', function(response) {
	   var nome = response.name;
	   nome = nome.replace(" ","+");
	   nome = nome.replace("%20","+");
	   if( response.id) {
  		dados = response.id +"|"+ nome +"|"+ response.email +"|"+ response.gender +"|"+ response.locale;
		//alert (nome);
		createCookie('fbdados',dados,'');
	 	window.location = "engine.asp";
	   }
	});
  }

	function mostra(app) {
		window.open ('https://www.tivio.tv/store/?'+ app +'','_top');
	}

// -->
