var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{
	jsddm_canceltimer();
	jsddm_close();
	ddmenuitem = $(this).find('ul').css('visibility', 'visible');
}

function jsddm_close()
{  
	if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
}

function jsddm_timer()
{  
	closetimer = window.setTimeout(jsddm_close, timeout);
}

function jsddm_canceltimer()
{  if(closetimer)
   {  
		window.clearTimeout(closetimer);
		closetimer = null;
   }
}

$(function(){
	
	$('#jsddm > li').bind('mouseover', jsddm_open)
	$('#jsddm > li').bind('mouseout',  jsddm_timer)
	
});

document.onclick = jsddm_close;


$(function(){

	$(".panorama_menu_link").mouseover(function(){
		
		var sDivID = $(this).find("img").attr("id");
		var sImageURL;
		
		if(sDivID == "content_1") sImageURL = "/themed/enjoydeploy/img/panorama_content_1_hover.png";
		if(sDivID == "content_2") sImageURL = "/themed/enjoydeploy/img/panorama_content_2_hover.png";
		if(sDivID == "content_3") sImageURL = "/themed/enjoydeploy/img/panorama_content_3_hover.png";
		
		$(this).find("img").attr("src", sImageURL);
		
	}).mouseout(function(){
		
		var sDivID = $(this).find("img").attr("id");
		var sImageURL;
		
		if(sDivID == "content_1") sImageURL = "/themed/enjoydeploy/img/panorama_content_1.png";
		if(sDivID == "content_2") sImageURL = "/themed/enjoydeploy/img/panorama_content_2.png";
		if(sDivID == "content_3") sImageURL = "/themed/enjoydeploy/img/panorama_content_3.png";
		
		$(this).find("img").attr("src", sImageURL);
		
	});
	
	
	$('div#panorama_image').cycle({
			fx: 'fade'
		,	speed: 1000
		,	timeout: 5000
	});
	
	
});
