
	$(document).ready( function() {
		$('#issues-side').slideUp();
		//$('.rounded').corners();
		$('.rounded').corner("5px");
		$('.free_block').corner("5px");

		$('.hotnews').mouseover(function(){
			 $('.'+this.id).css("background","#7ba5c0");
			 $(this).css("background-image","url(<?=base_url();?>application/views/images/bg_teal.gif)");
			 var $imageURL = $(this).attr("imgurl");
			 $('#img'+this.id).css("background-image","url("+ $imageURL + ")");
		});
		
		$('.hidden_menu').click(function(){
			$('#cont_menulist').slideToggle();
		});
		$('#primaryNav').addClass("menulist");
		
		// issues
		$('.toggle').click(function(){
			$('#issues-side').slideToggle();
		});
		
	//Background color, mouseover and mouseout
	var colorOver = '#d43800';
	var colorOut = '#1f1f1f';

	//Padding, mouseover
	var padLeft = '10px';
	var padRight = '10px';
	
	//Default Padding
	var defpadLeft = $('#issues-in li a').css('paddingLeft');
	var defpadRight = $('#issues-in li a').css('paddingRight');
		
	//Animate the LI on mouse over, mouse out
	$('#issues-in li').click(function () {	
		//Make LI clickable
		window.location = $(this).find('a').attr('href');
		
	}).mouseover(function (){
		
		//mouse over LI and look for A element for transition
		$(this).find('a')
		.animate( { paddingLeft: padLeft, paddingRight: padRight}, { queue:false, duration:100 } )
		.animate( { backgroundColor: colorOver , width: '220'}, { queue:false, duration:200 });

	}).mouseout(function () {
	
		//mouse oout LI and look for A element and discard the mouse over transition
		$(this).find('a')
		.animate( { paddingLeft: defpadLeft, paddingRight: defpadRight}, { queue:false, duration:100 } )
		.animate( { backgroundColor: colorOut, width: '220'}, { queue:false, duration:200 });
	});	
	
	//Scroll the menu on mouse move above the #sidebar layer
	$('#issues-side').mousemove(function(e) {

		//Sidebar Offset, Top value
		var s_top = parseInt($('#issues-side').offset().top);		
		
		//Sidebar Offset, Bottom value
		var s_bottom = parseInt($('#issues-side').height() + s_top);
	
		//Roughly calculate the height of the menu by multiply height of a single LI with the total of LIs
		var mheight = parseInt(28 * $('#issues-in li').length);
	
		//I used this coordinate and offset values for debuggin
		$('#debugging_mouse_axis').html("X Axis : " + e.pageX + " | Y Axis " + e.pageY);
		$('#debugging_status').html(Math.round(((s_top - e.pageY)/100) * mheight / 2));
			
		//Calculate the top value
		//This equation is not the perfect, but it 's very close	
		var top_value = Math.round(( (s_top - e.pageY) /100) * mheight / 2);
		
		//Animate the #menu by chaging the top value
		$('#issues-in').animate({top: top_value}, { queue:false, duration:500});
	});
		
});

var listMenu = new FSMenu('listMenu', true, 'display', 'block', 'none');
listMenu.animations[listMenu.animations.length] = FSMenu.animFade;
listMenu.animations[listMenu.animations.length] = FSMenu.animSwipeDown;
var arrow = null;
if (document.createElement && document.documentElement)
{
 arrow = document.createElement('span');
 arrow.appendChild(document.createTextNode('»'));
 arrow.className = 'subind';
}
addReadyEvent(new Function('listMenu.activateMenu("primaryNav", arrow)'));



