
/* state of the resizing mechanism*/
 var zoom_state= "medium";
   
 /* font resizer function*/
 /* mechanism: every node resizable class and its children will be traversed and the font will be modified with given value*/
 /* input: quo - value which will be added to the value of the current font*/
 function font_zoom(quo,destState)
 {	
		$('.resizable').find('*').each(function () 
		{	
			
			var curSize = $(this).css('font-size');								
			
			if(curSize!=null && curSize!='undefined')
			{	
				switch(destState)
				{
					case "dec":
						if(!$(this).hasClass(destState))						
						{
							$(this).removeClass("inc");
							$(this).removeClass("medium");
						}
						break;
					case "inc":
						if(!$(this).hasClass(destState))						
						{
							$(this).removeClass("dec");
							$(this).removeClass("medium");
						}
						break;
					
					default:
						if(!$(this).hasClass("medium"))						
						{
							$(this).removeClass("inc");
							$(this).removeClass("dec");
						}
						break;
				
				}
				
				
				var num = parseFloat(curSize, 0);
				var newnum= num + quo;
				if(num!=0 && newnum>0)
				{					
					$(this).css('font-size', newnum + "px");
					$(this).addClass(destState);
				}					
								
			}				
		});
 }
 
 
 /* function for font size increase*/
 function font_inc()
 {
	switch(zoom_state)
	{
		case "inc":		
		break;
		case "dec":
			font_zoom(2,"inc");
			zoom_state="inc";
		break;
		
		default:
			font_zoom(1,"inc");
			zoom_state="inc";
		break;
	} 
 }
 
 /* function for font size decrease*/
 function font_dec()
 {
	switch(zoom_state)
	{
		case "inc":	
			font_zoom(-2,"dec");
			zoom_state="dec";
		break;
		
		case "dec":			
		break;
		
		default:
			font_zoom(-1,"dec");
			zoom_state="dec";
		break;
	}	 
 }
 
 
 /* function for font size reset*/
 function font_reset()
 {
	switch(zoom_state)
	{
		case "inc":	
			font_zoom(-1,"medium");
			zoom_state="medium";
		break;
		
		case "dec":			
			font_zoom(1,"medium");
			zoom_state="medium";
		break;
		
		default:			
		break;
	}	 
 }
 
   
$(document).ready(function() {
   $('.resizable').find('*').each(function () 
	{	
		var curSize = $(this).css('font-size');	
		var num = parseFloat(curSize, 0);
		
		if(num>0)
		{					
			$(this).css('font-size', num + "px");			
		}	
	});
});


 
  
 
