jQuery(document).ready(function($){

    //IE png fix
    $(document).pngFix();

    //form text swap
    swapValues = [];
    $(".swap_value").each(function(i){
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {
                $(this).val("");
            }
        }).blur(function(){
            if ($.trim($(this).val()) == "") {
                $(this).val(swapValues[i]);
            }
        });
    });

    
    //IE7 z-index bugfix
    if ( $.browser.msie && $.browser.version < 8 ) {
        var zIndexNumber = 1000;
        $('div').each(function() {
            $(this).css('z-index', zIndexNumber);
            zIndexNumber -= 10;
        });
    }

    //dropdown menu
    $("#menu li a").hover(function(){

        $(this).parent().find("ul.subnav").slideDown(500);

        $(this).parent().hover(function() {
            $(this).addClass("menu_item_hover");
           
        }, function() {
            $(this).parent().find("ul.subnav").slideUp(500);
            $(this).removeClass("menu_item_hover");

        })
    });

    //lightbox
    $(".lightbox").lightbox({
        fileLoadingImage : '/images/loading.gif',
        fileBottomNavCloseImage : '/images/close.gif',
        strings : {
            prevLinkTitle: '',
            nextLinkTitle: '',
            prevLinkText:  '',
            nextLinkText:  '',
            closeTitle: '',
            image: '',
            of: ' / '
        }
			
    });
	 	 
    $("a.to_gallery").click(function(){
        var index = "#gallery_" + $(this).attr("rel");
        $(index).trigger('click');
        return false;
    });

    /*
    //menu font
    $(".menu_font").FontEffect({
        shadow          :true, 
        shadowColor     :"#0c2c77",
        shadowOffsetTop :4,    
        shadowOffsetLeft:0,     
        shadowBlur      :1,     
        shadowOpacity   :0.1   
    })
    */
   
    $("#jump_to_the_top").click(function(){
        scrollTo(0,0);
        return false;
    }); 

    //for external links
    $("a").click(function(){
        if( $(this).attr('rel') == 'external' ){
            window.open($(this).attr('href'));
            return false;
        }
    });

    //carousel
    $('#slide_holder').agile_carousel({
        hover_next_prev_buttons: "yes",
        stop_rotate_on_hover: "yes",
        continue_timer_after_click: "no",
        first_last_buttons: "no",
        next_prev_buttons: "yes",

        path_to_slides: "/kepek_a_slideshowhoz",
        slide_directory: "kepek_a_slideshowhoz",

        php_doc_location: "/make_slides.php",

        pause_button: "no",
        slide_buttons: "no",
        slide_number_display: "no",
        timer_length: "6000",
        transition_duration: 2000,
        transition_easing: "easeOutBack",
        transition_type: "fade",
        water_mark: "no"
    }); 
});

