jQuery(document).ready(function(){
    // left navigation
    jQuery("#leftNav ul").css("display","none");
    jQuery("#leftNav .active ul").css("display","inline");
 
    jQuery('#leftNav li a').click(
        function() {
            var checkElement = jQuery(this).next();
            /* if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
                // return false;
            }
			*/
            if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
                jQuery('#leftNav ul:visible').slideUp('normal');
                checkElement.slideDown('normal');
                return false;
            }
        }
    );
    
    // breadcrumbtrail
    jQuery('#breadcrumbtrail li:first').css("background","none").css("padding-left","0").css("margin-left","0");

    // lightbox
    jQuery('a[rel*=lightbox]').lightbox();
    
    // language dropdown
    jQuery("#form_lang").dropdownmenu();
	
	// bikepark event-info (tabs)
	// wrap the content in detail pages with a div#eventAjaxContainer!
	if(jQuery("#eventNav") && jQuery("#eventInfo") ){
		
	  var imgPreload = jQuery('<img id="bike_event_loading" />').attr('src', '/images/bike_loading.gif'); // preload loading img	
	  		
	  jQuery("#eventNav a").click(function() {
		target = jQuery('#eventInfo');
		clicked = jQuery(this);
		href = clicked.attr("href");
		
		clicked.blur();
		
		target.slideUp('fast', function() {
		  target.empty();
          target.prepend(imgPreload);
		  target.show();
        });
									   
	    target.load(href+" #eventAjaxContainer", function() {
		  target.hide();
          target.slideDown('fast');
		  jQuery('#eventNav a').removeClass('active');
		  clicked.addClass('active');
        });
		return false;
      });
	}
	
	jQuery('a#objVideo').nyroModal();

});

function updateSchneeberichtIcons(){
	jQuery("img[src='http://static.bergfex.at/images/icons/lifte-pisten/status0.gif']").attr('src', '/images/schneebericht/no.gif');
	jQuery("img[src='http://static.bergfex.at/images/icons/lifte-pisten/status1.gif']").attr('src', '/images/schneebericht/yes.gif');
}

