
 /* 0  TODO -- profile 

 */ 
function doSomething(e) {
	var posx = 0;
	var posy = 0;
	var vpW=0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}
	//vpW=$("body").width();
	vpW=0;
	x= (vpW*.5)-(posx*.02);
	y= -(posy*.005);//alert("background-position" +  x + " " + y);
	$('body').css("background-position", x + "px " + y + "px");
}



$(function(){
	// Hook up the print link.
	$(".printNEWS")
		.attr( "href", "javascript:void( 0 )" )
		.click(
			function(){
				// Print the DIV.
				$('body').append('<div style="postion:absolute;top:-9999em;" id="printNme">'+$(this).closest('.NewsSummary').html()+'</div>');
				 $('#printNme').print();
				// Cancel click event.
				$('#printNme').remove();
				return( false );
			});

	// Hook up the print link.
	$(".printEVENT")
		.attr( "href", "javascript:void( 0 )" )
		.click(
			function(){
				// Print the DIV.
				$('body').append('<div style="postion:absolute;top:-9999em;" id="printNme">'+$(this).closest('.calendar-event').html()+'</div>');
				 $('#printNme').print();
				// Cancel click event.
				$('#printNme').remove();
				return( false );
			});

});


	$(document).ready(function(){
		$(document).mousemove(function(e){
			doSomething(e);
			//$('#status').html(e.pageX +', '+ e.pageY);
		}); 
	});


function evenCol(){
	$(".cols").height('100%');
	var H = 0;
	$(".cols").each(function(i){

		var h = $(".cols").eq(i).height();
		if(h > H) H = h;
	});
	$(".cols").height(H);
	//$(".cols").height('100%');
	//$(".cols").height(H);
}



function initTabs(){

if($(".cal-upcominglist").length>0){
		$(".cal-upcominglist").data("tabs", null).tabs(".cal-upcominglist div.calendar-details",{
				tabs: '.acordHandle',
				effect: 'slide',
				initialIndex: null,
				onClick : function(event,index) {

					$(".acordHandle.opened").removeClass("opened").addClass('close').text('view details');
					$(".acordHandle.current").addClass('opened')
						.text('hide details');
						
					var CurrentTab= this.getCurrentTab();
					CurrentTab.text('hide details');
					//title=CurrentTab.siblings('eventTitle').text();
					//_tracker._trackEvent("Calendar", "Event", title);
					evenCol();
				}
		});

//		$(".acordHandle.close").live('click',function(){
//			if($(".acordHandle.current.opened").length<=0){
//				$(this).text('hide details')
//					.addClass("current")
//					.addClass("opened")
//					.removeClass('close')
//					.next(".cal-upcominglist div.calendar-details").slideDown("slow");
//				evenCol();
//			}
//		});
	}
}



$(document).ready(function(){
	evenCol();
	initTabs();
	setTimeout(evenCol, 500);
	setTimeout(evenCol, 1000);
		$(".cal-upcominglist div.calendar-details").hide();
		
		
		//Slide up and down on click
		$(".acordHandle.current.opened").live('click',function(){

				$(".cal-upcominglist div.calendar-details").slideUp("slow");
				evenCol();
				$(".acordHandle.opened").text('view details')
					.removeClass("current")
					.removeClass("opened")
					.addClass('close');


//$(".cal-upcominglist").removeData("tabs");
initTabs();
		});
		//$(".acordHandle.close").click(function(){

		//});


});
