﻿$(document).ready(function(){	
	
	var $selected;
	
	$('ul#menuUL li').hover(function() { 		
		$('ul', this).css('display', 'block'); 
		if($(this).children('a').hasClass('selected'))
			$selected = $(this).children('a').attr('id');
		$(this).children('a').addClass('selected');
		
	},function() { 		
		$('ul', this).css('display', 'none'); 
		if($(this).children('a').attr('id') != $selected)
			$(this).children('a').removeClass('selected')
	});
	
});

function openPDF(fileName){
	tb_show('','/files/pdf/'+ fileName + '?KeepThis=true&TB_iframe=true&height=600&width=900');return false;		
}
function openInitiativePDF(fileName){
	fileName = '/files/initiatives/'+fileName;	
	tb_show('',fileName + '?KeepThis=true&TB_iframe=true&height=600&width=900');return false;		
}


/********Image Preview In Initiative*************/
this.screenshotPreview = function(){	
	
	xOffset = 10;
	yOffset = 30;
	
	$("a.screenshot").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");								 
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#screenshot").remove();
    });
	
	$("a.screenshot").mousemove(function(e){
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

/**************************************************/
