$(document).ready(function(){
    var PH, PH_ua = new Array();
        PH_ua[0] = "Замовити";
    var PH_ru = new Array();
        PH_ru[0] = "Заказать";   
    var PH_en = new Array();
        PH_en[0] = "Order";
    if (langid == "01") {
        PH = PH_ua;
    } else {
        if (langid == "02") {
            PH = PH_ru;
        } else {
            PH = PH_en;
        }
    }

    //alternative photo
    if ($('#altimages').html()) {
        $('#altimages a').focus(function(){
            $(this).blur();
        });
        $('#altimages a').hover(function(){
            $(this).children("span").children('img').animate({
                width: 68,
                height: 100,
                opacity: 1,
                marginTop: 0
              }, 300 );
        }, function(){
            $(this).children("span").children('img').animate({
                width: 34,
                height: 50,
                opacity: .7,
                marginTop: 50
              }, 200 );
        });

        $('#altimages a').click(function(){
            $('#mainphoto span.themesmallimg img').remove();
            $('#mainphoto span.themesmallimg').html('<img src="'+$(this).attr('href')+'" />');
            return false;
        });
    }
    //photocat title - shadow
    if ($('#photogallerylist .categorylist ul li .title h3').html()) {
        $('#photogallerylist .categorylist ul li .title h3').each(function(){
            $(this).prepend('<span class="shadow">'+$(this).text()+'</span>');
        });
    }
    if ($('#tableonmainpage h3').html()) {
        $('#tableonmainpage h3').each(function(){
            $(this).prepend('<span class="shadow">'+$(this).text()+'</span>');
        });
    }
    if ($('#tableonmainpage h4').html()) {
        $('#tableonmainpage h4').each(function(){
            $(this).prepend('<span class="shadow">'+$(this).text()+'</span>');
        });
    }
    
    //prevnextlink
    $('.prevnext a').hover(function(){
        $(this).animate({
            opacity: 1
          }, 300 );
    }, function(){
        $(this).animate({
            opacity: .7
          }, 200 );
    });
    //посуває стрілочку вліво, якщо немає посилання на попередню картинку
    if (!$('.prevnext a.prevlink').text()) {
        $('.prevnext a.nextlink').css('margin-left','170');
    }

    //strong span with *
    $('span.strong').append('<span class=\"strongstar\">*</span>');

    //agencies
//    if ($('#content #description h5').length) {
//        if($('#content #description').find('p').length > 1) {
//            $('#content #description h5').css('cursor','pointer');
//            $('#content #description').find('p').slideUp('slow');
//            $('.accordion h5:first').addClass('active');
//            $('.accordion ul:not(:first)').hide();
//            $('#content #description h5').click(function(){
//                $(this).next('p').slideToggle()
//                .siblings('p:visible').slideUp();
//                $(this).toggleClass('active');
//                $(this).siblings('h5').removeClass('active');
//            });
//        } else {
//            $('#content #description h5:first').addClass('active');
//        }
//    }

    //menu on main page
    if ($('#mainpagemenu').html()){
        $('td#mainmenuplace').html($('#mainpagemenu').html());
        $('#mainpagemenu').remove();
    }

    //photoeffects
    $('.itemlist ul li a[class!=selected]').hover(function(){
        $(this).find('span.themesmall').animate({opacity: '.7'}, 300).animate({opacity: '1'}, 300);
    }, function(){
        $(this).find('span.themesmall').animate({opacity: '1'}, 500);
    });


    //#photogallery .photolist .itemlist ul li
    if($('#photogallery .photolist .itemlist ul li').length == 6 ) {
        $('#photogallery .photolist .itemlist ul li').css('marginLeft','53');
    }

    //pages

    if ($('.pages').html()) {
        $('.pages a').focus(function(){
            $(this).blur();
        });
        $('.pages a').hover(function(){
            $(this).animate({
                fontSize: 14,
                paddignLeft: 0,
                paddignRight: 0,
                paddignTop: 0,
                paddignBottom: 0
              }, 200 );
        }, function(){
            $(this).animate({
                fontSize: 11,
                paddignLeft: 2,
                paddignRight: 2,
                paddignTop: 2,
                paddignBottom: 2
              }, 200 );
        });
    }

    //block right & middle mouse
    $('#photogallery, #mainphoto, .smallitemlist').bind("contextmenu",function(e){
        return false;
    });
    //$(document).bind("contextmenu",function(e){
//		return false;
//	});

    //photogallery mainphoto altimages smallitemlist
});