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"></a>')
			.click(function ()
			{
				lightBoxNewsletter("HIDE");
			});
		
		if (erro)
		{
			$box.addClass("erro");
		}
		
		$boxContent.append(msg);
		$boxButtom.append($boxImgButtom);
		$box.append($boxContent).append($boxButtom);
		$lb.append($shadow).append($box);
		
		$("body").prepend($lb);
	}
	else if (acao == "HIDE")
	{
		$("#lightBoxNewsletter").remove();
	}
}

function formNewsSubmit(url)
{
	$("#news").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/abc/newsletter.php",
		data: "dc_email=" + dc_email,
		success: function(msg)
		{
			$("#news").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("");
		}
	});
}

$(document).ready(function ()
{
	$("#slider").easySlider({
		prevId: 'slide-prev',
		nextId: 'slide-next',
		controlsShow: false
	});
	
	$("#banner-slider ul").cycle();
	
	$("#banner-prev, #banner-next").hide();
	
	$("#banner-slider").mouseover(function ()
	{
		this.mouseover = true;
		
		if (!this.show)
		{
			this.show = true;
			
			$("#banner-prev, #banner-next").show();
		}
	});
	$("#banner-slider").mouseout(function ()
	{
		this.mouseover = false;
		
		var el = this;
		
		var fnc = function ()
		{
			if (el.show && !el.mouseover)
			{
				el.show = false;
				
				$("#banner-prev, #banner-next").hide();
			}
		}
		
		setTimeout(fnc, 500);
	});
	
});

Cufon.replace(".fontReplace", { fontFamily : "Myriad Pro",	hover: true});
Cufon.replace("h2", { fontFamily : "Myriad Pro",	hover: true});
Cufon.replace("h3", { fontFamily : "Myriad Pro",	hover: true});
Cufon.replace("h4", { fontFamily : "Myriad Pro",	hover: true});
