	$(function() {

		
		$("#tablemenu tr td div").hover(function(){
		
		var el=$(this);
		var mn=$("#"+el.attr("rel"));
		el.bind("mouseover",function(){
		//alert('vv');
		$("[class=tablemenusubmenu]").hide();
		el.css("cursor",'pointer');
		pos=el.position();
		mn.show(10, function(){
		$("#"+el.attr("rel")+"").children().each(function()
		{
		
			$(this).bind("mouseover",function(){mn.show();});
		});
		                      }).css("top", pos.top+30).css("left",pos.left);
		});
		
		el.bind("mouseout",function(){$(this).css("cursor",'');
		$("#"+el.attr("rel")).bind("mouseout",function(){
		$("#"+el.attr("rel")).hide();});
		
		});
		
		});
	});
	
	
	
	$(document).ready(function(){
    $('.topmenu ul li').hover(
        function() {
         $(this).find('table').width($(this).width());
            $(this).addClass("active");
            pos=$(this).position();
             $(".imgcolor").hide();
            $(this).find('table').stop(true, true);
ShowPictures($(this).attr("rel"));
            $(this).find('table').attr("left", pos.left-1000+"px").width($(this).width()).slideDown(1);
        },
        function() {
        $("imgcolor").hide();
            $(this).removeClass("active");
            $(this).find('table').width($(this).width()).slideUp('fast');
        }
    );
});

function ShowPictures(imgIdDataPosition)
{

				$(this).css('cursor','pointer');
						//alert("#"+mapinfo[i].top_y + "_"+ mapinfo[i].top_x+"png");
						$("#"+ coords[imgIdDataPosition-1].idpicture).show().css("top", coords[imgIdDataPosition-1].coordpic_y).css("left", coords[imgIdDataPosition-1].coordpic_x).one("click",function(){$('#dialog-message').dialog('open');}).one("mouseout",
						
						function(){$(this).hide()
							try{
								for(var j = 0; j < coords[imgIdDataPosition-1].subpicture.length;j++){
									$("#"+ coords[imgIdDataPosition-1].subpicture[j].idpicture).hide();
								}
								}catch(sagfa){}
						}).css("cursor",'pointer');
						try{
						for(var j = 0; j < coords[imgIdDataPosition-1].subpicture.length;j++){
						//alert("#"+ mapinfo[i].subpicture[j].idpicture);
						$("#"+ coords[imgIdDataPosition-1].subpicture[j].idpicture).show().css("top", coords[imgIdDataPosition-1].subpicture[j].coordpic_y).css("left", coords[imgIdDataPosition-1].subpicture[j].coordpic_x);
						}
						
						}
						catch(sagfa){}
}
