

$(document).ready(function(){
    $('.topmenu ul li').hover(

        function() {
            $(this).find('ul:first').slideDown(1);
			},
        function() {      
          
			$(this).find('ul:first').slideUp(1);
		}
    );    
 
	 $('li.in').each(

        function() {
        
		var height=29;
		var top_margin = 77;
		var num = $(this).attr("rel");
		var n =  $(this).parents('li').attr("rel");
		var n2 =  $(this).parents('li').parents('li').attr("rel");
		tops = -(num*height+n*height+n2*height+top_margin);
		var pla = $(this).find('a').attr("rel");
		$(pla).css('top', tops);
					
					
					
					/* var id = "#header";
					var offset = $(this).offset();
				//	alert(offset);
					var pla = $(this).find('a').attr("rel");
					//alert(pla);
					
					$(pla).css(offset); */
					
					//var position = {}; 
					//position = $(this).position(); 
				//	alert(position);
					
					
					
		
			}
    );    
	 
	
    $('.topmenu li:has(ul)').find('a:first').addClass('inz');
	
	$('.zz').each(function(){
	
	var nz =  $(this).parents('li').attr("rel");
	
		var height1=29;
		var top_margin1 = 77;
		topz = -(nz*height1+top_margin1);
		$(this).css('top', topz);
	
	});
	
	$('.zzz').each(function(){
	
	var nzz =  $(this).parents('li').attr("rel");
	var nzzz =  $(this).parents('li').parents('li').attr("rel");
	
		var height1=29;
		var top_margin1 = 77;
		topz = -(nzz*height1+nzzz*height1+top_margin1);
		$(this).css('top', topz);
	
	});
	
	
	
   $(".pitem a").click(function(){
 
        var largePath = $(this).attr("href");
        var largeAlt = $(this).attr("title");
        var href_to = $(this).attr("rel");
 
        $("#img_big").attr({ src: largePath, alt: largeAlt });
		if (href_to=='1')
		{
			largePath2 =largePath.substr(0, 13)+"big"+largePath.substr(13);
		    $("#img_href").attr({ href: "" + largePath2 + "", title: largeAlt });
		}
		else
		{
			 $("#img_href").attr({ href: "" + largePath + "", title: largeAlt });
		}
 
		
		$("div.img div").html("" + largeAlt + ""); 
		if (largeAlt==''){
		//alert('ûûû');
		$("div.img div").slideUp(1);
		}
		else 
		{
		$("div.img div").slideDown(1);
		}
		return false;
    });
	 	
});




