﻿$(document).ready(function(){

  //menu mouseover
  $('#menu li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
  //menu blogs mouseover
  $('#blogs li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
  //navegação sobre o filme mouseover
  $('#sobreofilme_nav li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
  //navegação imprensa mouseover
  $('#imprensa_nav li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
  //logo mouseover
  $('#logo li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
  //downloads wallpapers mouseover
  $('#downloads_wallpapers li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
  //downloads icones mouseover
  $('#downloads_icones li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
  //downloads twitter background mouseover
  $('#downloads_twitter_bg li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
  //downloads poster mouseover
  $('#downloads_poster li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
  //filme de Laís Bodanzky mouseover
  $('#filme_lais li').hover(
    function(){ $(this).children('.item').show(); },
    function(){ $(this).children('.item').hide(); }
  );
  
});



// Função para abrir pop de músicas 
var win = null;
function openPop(){
    w = '201';
    h = '440';
    pos_left = (screen.width - w) / 2;
	pos_top = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',left='+ pos_left +',top='+ pos_top +'';
	win = window.open('../site/swf/player.htm', 'player', winprops);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


var simpleFlashImages = [];

function registerSimpleFlash(imagem)
{
    simpleFlashImages.push(imagem);
}

function tryToCreateSimlpeFlashes()
{
    for( var i = 0, n = simpleFlashImages.length; i <n;i++)
    {
        createSimpleFlash( simpleFlashImages[i] );
    }
}

function createSimpleFlash(imagem)
{
    var so = new SWFObject("wallpaper/swf/"+imagem+".swf", imagem, "180", "140", "9", "#fff");
    so.addParam('allowScriptAccess', 'always');
    so.addParam("wmode", "transparent");
    so.addParam("scale", "noscale");
    try
    {
        so.write("simple_flash_" + imagem);
    }
    catch(e){}
}



//**** Função que permite apenas a digitação de números em um campo ****
function somenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;
    
	if (tecla >95 && tecla<106)
		return true;
		    
    if((tecla > 47 && tecla < 58)) return true;
    else{
    if ((tecla != 8)&& (tecla != 16) && (tecla != 37) && (tecla != 39) && (tecla != 46) && (tecla != 35) && (tecla != 36)) return false;
    else return true;
    }
}



//*
//* Função para validar CPF
//*
function check_cpf (numcpf)
{
	x = 0;
	soma = 0;
	dig1 = 0;
	dig2 = 0;
	texto = "";
	numcpf1="";
	len = numcpf.length; x = len -1;
	// var numcpf = "12345678909";
	for (var i=0; i <= len - 3; i++) {
		y = numcpf.substring(i,i+1);
		soma = soma + ( y * x);
		x = x - 1;
		texto = texto + y;
	}
	dig1 = 11 - (soma % 11);
	if (dig1 == 10) dig1=0 ;
	if (dig1 == 11) dig1=0 ;
	numcpf1 = numcpf.substring(0,len - 2) + dig1 ;
	x = 11; soma=0;
	for (var i=0; i <= len - 2; i++) {
		soma = soma + (numcpf1.substring(i,i+1) * x);
		x = x - 1;
	}
	dig2= 11 - (soma % 11);
	if (dig2 == 10) dig2=0;
	if (dig2 == 11) dig2=0;
	//alert ("Digito Verificador : " + dig1 + "" + dig2);
	if ((dig1 + "" + dig2) == numcpf.substring(len,len-2)) {
		return true;
	}
	alert ("Número de CPF inválido!");
	return false;
}

