$(document).ready(function(){
		
	$("div.foo").carousel(
	{ effect: "fade", loop: true, nextBtn:".seta-proximo-box-maisjogos", prevBtn:".seta-anterior-box-maisjogos", btnsPosition: "inside", nextBtnInsert: "appendTo",	prevBtnInsert: "appendTo" }	
	);

	$("div.foo1").carousel(
	{ loop: true, autoSlide: true, effect: "fade", autoSlideInterval: 8000, animSpeed: "slow", btnsPosition: "inside", nextBtnInsert: "appendTo",	prevBtnInsert: "appendTo" }	
	);
	
	$("#data_edicao").mask("99/99/9999");
	
	$('.listaPromocao li').click(function(){

        $(".listaPromocao").find("input").each(function() {
            $(this).removeAttr("checked");
        });
        $(".listaPromocao").find("li").each(function() {
            $(this).removeAttr("class");
        });
        
	    $(this).find("input[xurl]").attr("checked", "checked");
	    $(this).attr("class", "ativo");
	    var v = $(this).find("input[xurl]").attr("xurl");
	    $('a.promocaoCamiseta').attr("href",v);
	});
	$('a.promocaoCamiseta').click(function(){			
		if($(this).attr('href').indexOf("##") == -1){
			//document.location = $(this).attr("href");
		}else{
			alert("Por favor escolha um modelo e tamanho de camiseta");
			return false;
		}
	});
});

function novoBlocoFlutuante( conteudo , titulo , width , height , modal, idBox, idConteudo ){

	if(idBox==undefined) idBox = "o-box";
	if(idConteudo==undefined) idConteudo = "o-conteudo";
	
	$("#"+idBox).remove();
	
	temp =  '<div id="'+idBox+'" style="height: '+height+'px; margin-top: -'+Math.round(height/2)+'px; width: '+width+'px; margin-left: -'+Math.round(width/2)+'px;">';
	temp += 	'<div id="titulo"><a class="finalizar" alt="Fechar" title="Fechar" style="float: right;" onclick="fecharBloco(\''+idBox+'\')"> Fechar </a>'+titulo+'</div>';
	temp += 	'<div id="'+idConteudo+'">'+conteudo+'</div>';
	temp += '</div>';
	
	$("body").append(temp);
	
	bloquearTela(idBox,modal);
	$("#"+idBox).fadeIn(1000);
	
}

function boxFlutuante ( conteudo , titulo , width , height , modal , funcionExit ){

	$("#o-box").remove();
	
	temp =  '<div id="o-box" style="height: '+height+'px; margin-top: -'+Math.round(height/2)+'px; width: '+width+'px; margin-left: -'+Math.round(width/2)+'px;">';
	temp += 	'<div id="titulo"><a class="finalizar" alt="Fechar" title="Fechar" style="float: right;" onclick="fecharBloco(\'o-box\','+funcionExit+');"> X </a>'+titulo+'</div>';
	temp += 	'<div id="o-conteudo">'+conteudo+'</div>';
	temp += '</div>';
	
	$("body").append(temp);
	
	bloquearTela( "o-box" , modal , funcionExit );
	$("#o-box").fadeIn(1000);
	
}
