	function abretexto(id) { 
		fechafotos();
		loading(true);
		$.ajax({
		   url: "texts/index/" + id,
			dataType: "html",
			success: function(html) {
				$("#content_loading").html('');
				$("#content").html(html);	
			}
		});
	}
		
	function abremenu(div) {
		fechafotos();
		$("#menu_content").html($("#submenu_" + div).html());
	}
	
	function webalbum_abrefotos(cat) {
		var str;
		$("#fotos").animate( { top: "575px" }, 300);
		loading(true);
			
		$.ajax({
		   url: "albumphotos/list_photos/" + cat,
			dataType: "html",
			success: function(html) {
				str = getContentPhoto();
				$("#content").html(str);
				$("#fotos_content").html(html);
				abrefoto(0);
			}
		});
	}
	
	function webalbum_abrefoto(id) {
		/*
			tipo: 'prev', 'next', ''
		
		*/
		var html;
		var id_prev = parseInt(id) - 1;
		var id_next = parseInt(id) + 1;
		
		loading(false);
		
		//alert($("#content").html());
		
		if($("#content").html() == '')
			$("#content").html(getContentPhoto());
		
		$("#photo_left").html(id_prev);
		$("#photo_right").html(id_next);
		
		if(id)
   		$("#photo_left").show();
		else
			$("#photo_left").hide();
		//seta direita
		if(arrPhoto[id + 1] !== undefined)
	   	$("#photo_right").show();
		else
			$("#photo_right").hide();
		
		$("#content_loading").html('');
		$("#content").hide();
		$("#inner").html(arrPhoto[id]);
		$("#content_description").html(arrDesc[id]);
		$("#content").fadeIn("slow");

	}
	
	function abrefotos(cat) {
		var str;
		$("#fotos").animate( { top: "575px" }, 300);
		loading(true);
			
		$.ajax({
		   url: "photos/list_photos/" + cat,
			dataType: "html",
			success: function(html) {
				str = getContentPhoto();
				$("#content").html(str);
				$("#fotos_content").html(html);
				abrefoto(0);
			}
		});
	}
	
	function abrefoto(id) {
		/*
			tipo: 'prev', 'next', ''
		
		*/
		var html;
		var id_prev = parseInt(id) - 1;
		var id_next = parseInt(id) + 1;
		
		loading(false);
		
		//alert($("#content").html());
		
		if($("#content").html() == '')
			$("#content").html(getContentPhoto());
		
		$("#photo_left").html(id_prev);
		$("#photo_right").html(id_next);
		
		if(id)
   		$("#photo_left").show();
		else
			$("#photo_left").hide();
		//seta direita
		if(arrPhoto[id + 1] !== undefined)
	   	$("#photo_right").show();
		else
			$("#photo_right").hide();
		
		$("#content_loading").html('');
		$("#content").hide();
		$("#inner").html(arrPhoto[id]);
		$("#content_description").html(arrDesc[id]);
		$("#content").fadeIn("slow");

	}
	
	function abrecontato() {
		fechafotos();
		loading(true);
		
		$.ajax({
		   url: "texts/contato",
			dataType: "html",
			success: function(html) {
				$("#content_loading").html('');
				$("#content").html(html);
			}
		});
	}
	
	function enviaEmail() {
		if(!$("#TextsNome").val()) {
			alert("Favor informar o nome!");
			return false;
		} else if(!$("#TextsEmail").val()) {
			alert("Favor informar o e-mail!");
			return false;
		} else if(!$("#TextsAssunto").val()) {
			alert("Favor informar o assunto!");
			return false;
		} else if(!$("#TextsMsg").val()) {
			alert("Favor informar a mensagem!");
			return false;
		}
			
		loading(false);
		
		$.post("texts/contato", {
				 	"data[Texts][nome]": $("#TextsNome").val(),
					"data[Texts][email]": $("#TextsEmail").val(),
					"data[Texts][assunto]": $("#TextsAssunto").val(),
					"data[Texts][msg]": $("#TextsMsg").val() }, 
					function(html) {
					    $("#content").html(html);
						 $("#content_loading").html('');
				    }); 
	}
	
	function fechafotos() {
		//$("fotos_content").html('');
		$("#fotos").animate( { top: "475px" }, 300);
	}
	
	function listphotos_initCallback(carousel) {
		 jQuery('#photo_left').bind('click', function() {
			  carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
			  abrefoto(jQuery.jcarousel.intval(jQuery(this).text()));
			  return false;
		 });
		 jQuery('#photo_right').bind('click', function() {
			  carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
			  abrefoto(jQuery.jcarousel.intval(jQuery(this).text()));
			  return false;
		 });
	}
	
	function getContentPhoto() {
		var str;
		
		str  = '<div class="content_photo">';
		str += '   <div id="photo_left" class="photo_left"></div>';
		str += '   <div class="middle">';
		str += '      <div id="inner" class="inner">';
		str += '      </div>';
		str += '	  </div>';
		str += '   <div id="photo_right" class="photo_right"></div>';
		str += '</div>';
		str += '<div id="content_description" class="content_description">';
		str += '</div>';	
		
		return str;
	}
