$(document).ready(function(){
        $('.tempFont').removeClass('tempFont');
    
        Cufon.replace(".fontReplace", { fontFamily : "Arabic Typesetting",	hover: true});
	Cufon.replace("h2", { fontFamily : "Arabic Typesetting",	hover: true});
    
	$("#slider").easySlider({
		prevId: 'slide-prev',
		nextId: 'slide-next',
		controlsShow: false,
		speed: 2000,
		auto: true,
		pause: 2000,
		continuous: true
	});
	
	$("#slider-cinema").easySlider({
		prevId: 'slide-prev',
		nextId: 'slide-next',
		controlsShow: false,
		speed: 2000,
		auto: true,
		pause: 2000,
		continuous: true
	});


	$('span#assita-trailler').click(function(){
		$(this).parent().find('div.accordion').slideToggle("slow");
	});
        
        $('.nyroModal').nyroModal();
});
/******************************** enviar news */
function lightBoxNewsletter(acao, msg, erro)
{
	acao = acao.toUpperCase();
	
	if (acao == "SHOW")
	{
		$lb = $('<div id="lightBoxNewsletter">');
		$shadow = $('<div class="shadow"></div>');
		$box = $('<div class="lightBox"></div>');
		$boxContent = $('<span></span>');
		$boxButtom = $('<div class="buttom"></div');
		$boxImgButtom = $('<a href="javascript:void(0);" id="buttomOK" alt="Fechar" title="Fechar">x</a>')
			.click(function ()
			{
				lightBoxNewsletter("HIDE");
			});
		
		if (erro)
		{
			$box.addClass("erro");
		}
		
		$boxButtom.append($boxImgButtom);
		$boxContent.append(msg);
		$box.append($boxButtom).append($boxContent);
		$lb.append($shadow).append($box);
		
		$("#newsletter").prepend($lb);
	}
	else if (acao == "HIDE")
	{
		$("#lightBoxNewsletter").remove();
	}
}

function formNewsSubmit(url)
{
	$("#newsForm").append('<div class="lightbox loading"></div>');
	
	var $dc_email = $("#dc_email");
	var dc_email = $dc_email.val();
	
	$dc_email.val("Enviando...");
	
	$.ajax(
	{
		type: "POST",
		url: url + "/themes/larocca/newsletter.php",
		data: "dc_email=" + dc_email,
		success: function(msg)
		{
			$("#newsForm").children(".loading").remove();
			
			var erro = false;
			
			if (msg.indexOf("#") != -1)
			{
				erro = true;
				msg = msg.split("#");
				msg = msg[1];
			}
			
			lightBoxNewsletter("SHOW", msg, erro);
			
			$("#dc_email").val("");
		}
	});
}
