    $(document).ready(function(){ 

        $(document).pngFix(); 
 
        initgallery();
        initgalleryleft();
        
        $('.mainmen > .item > .shad').hide();
        
        $('.mainmen > .item > a').mouseenter(function(){
        	$(this).parent().children('.shad').show();
        });

        $('.mainmen > .item > a').mouseleave(function(){
        	$(this).parent().children('.shad').hide();
        });
        
    }); 
    
    function initgallery()
    {
        $('.photogallery > .inner > .item > a').append('<div class="shad"><img src="/img/shad.png"></div>');
        $('.photogallery').pngFix(); 
        $('.photogallery > .inner > .item > a > .shad').hide();
        
        $('.photogallery > .inner > .item > a').mouseenter(function(){
        	$(this).children().fadeIn(200);
        });


        $('.photogallery > .inner > .item > a').mouseleave(function(){
        	$(this).children().fadeOut(200);	
        });
	
    }

    function initgalleryleft()
    {
        $('.photogalleryLeft > .inner > .item > a').append('<div class="shad"><img src="/img/shad.png"></div>');
        $('.photogalleryLeft').pngFix(); 
        $('.photogalleryLeft > .inner > .item > a > .shad').hide();
        
        $('.photogalleryLeft > .inner > .item > a').mouseenter(function(){
        	$(this).children().fadeIn(200);
        });


        $('.photogalleryLeft > .inner > .item > a').mouseleave(function(){
        	$(this).children().fadeOut(200);	
        });
	
    }
    
    function hideleftmenu(){
    	$('.leftcol').animate({marginLeft: '-270px'},300);
    	$('.rightcol').animate({paddingLeft: '45px'},300);
    	$('#lmhidebut,#lmshowbut').toggle();
    }
    
    function showleftmenu(){
    	$('.leftcol').animate({marginLeft: '0'},300);
    	$('.rightcol').animate({paddingLeft: '300px'},300);
    	$('#lmhidebut,#lmshowbut').toggle();
    }
    
    function choosepage(gal,p,obj,layout)
    {
			var res=$.ajax({
		  	url: "/phogogalpage.php?gal="+gal+"&p="+p+"&layout="+layout,
			  dataType: "text",
			  contentType: 'text/html; charset=windows-1251',
				async: false
			}).responseText;
			$('.photogallery').html(res);
			
			
			initgallery();
			
			$('.photogallery_pager > a').removeClass('sel');
			$(obj).addClass('sel');
    }
