Effect = {};

Effect.Appear = function(element) {
 /* effect appear hace que la imagen aparezca en miniatura con opción de verla más grande */

 if ( $("#"+element ).length )
  {
  //ocultamos otro eventual abierto antes:
  $(".preview_container").hide();
  //abrimos este
  $("#"+element ).css("left", "auto").fadeIn();
  }
 else alert ("not found: "+element);
}



Effect.Fade = function(element) { 

 if ( $("#"+element ).length ) $("#"+element ).fadeOut();
 else alert ("not found: "+element);

};


/** FIN DOCUMENT READY --------- */


$(document).ready(function() {



    //only for the prefacio

	if ($('.zitem').length)
	{
	//move the image in pixel
	var move = -15;
	
	//zoom percentage, 1.2 =120%
	var zoom = 1.2;

	//On mouse over those thumbnail
	$('.zitem').hover(function() {
		
		//Set the width and height according to the zoom percentage
		width = $('.zitem').width() * zoom;
		height = $('.zitem').height() * zoom;
		
		//Move and zoom the image
		$(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:200});
		
		//Display the caption
		$(this).find('div.caption').stop(false,true).fadeIn(200);
	},
	function() {
		//Reset the image
		$(this).find('img').stop(false,true).animate({'width':$('.zitem').width(), 'height':$('.zitem').height(), 'top':'0', 'left':'0'}, {duration:100});	

		//Hide the caption
		$(this).find('div.caption').stop(false,true).fadeOut(200);
	});
	}






});

/** FIN DOCUMENT READY --------- */


function aumentarFuente(){
  resizeFont("#main_content", "large");
  //ahora ff es "13.1167" ; hay q pasarlo a formato decimal y sumarle 2
}


function disminuirFuente(){
  resizeFont("#main_content", "small");
}
function resizeFont(elemento, action)
{

           var ourText = $(elemento);
           var currFontSize = ourText.css('fontSize');
           var finalNum = parseFloat(currFontSize, 10);
           var stringEnding = currFontSize.slice(-2);

            if(action == 'large') {
				finalNum = Math.min( finalNum * 1.2, 25);
			}
			else if (action == 'small'){
				finalNum = Math.max( finalNum / 1.2, 8);
			}
			ourText.css('fontSize', finalNum + stringEnding);
            
}
 
