$(document).ready(function(){

    //mainNavigationPoint
	//When mouse rolls over
	$(".mainNavigationPoint").mouseover(function(){
	    $(".subNavigation").css('z-index', 100);
        var elementId = "#"+$(this).attr('id')+"-subNavigation";
        $(elementId).css('z-index', 110);
        $(elementId).stop().animate({height:'213px'},{queue:false, duration:500, easing: 'easeOutQuad'});
	});
	$(".subNavigation").mouseover(function(){
	    $(".subNavigation").css('z-index', 100);
        $(this).css('z-index', 110);
        $(this).stop().animate({height:'213px'},{queue:false, duration:500, easing: 'easeOutQuad'});
	});
	//When mouse is removed
	$(".mainNavigationPoint").mouseout(function(){
        var elementId = "#"+$(this).attr('id')+"-subNavigation";
        $(elementId).stop().animate({height:'0px'},{queue:false, duration:500, easing: 'easeOutQuad'});
	});
	$(".subNavigation").mouseout(function(){
	    $(this).stop().animate({height:'0px'},{queue:false, duration:500, easing: 'easeOutQuad'});
	});

	//subNavigationPoint
	//When mouse rolls over
	$(".subNavigationPoint").mouseover(function(){
	    $(".thirdNavigation").css('z-index', 200);
	    var elementId = "#"+$(this).attr('id')+"-thirdNavigation";
        $(elementId).css('z-index', 210);
        $(elementId).stop().animate({width:'249px'},{queue:false, duration:500, easing: 'easeOutQuad'});
	});
	/* unused
	$(".thirdNavigation").mouseover(function(){
	    $(".thirdNavigation").css('z-index', 200);
        $(this).css('z-index', 210);
        $(this).stop().animate({width:'249px'},{queue:false, duration:500, easing: 'easeOutQuad'});
        //rollover subNavigationPoint, when mouse rolls over
        var id = $(this).attr('id');
	    var subNavigationPointId = id.substring(0, id.lastIndexOf('-thirdNavigation'));
	    var imgObject = $("#"+subNavigationPointId).children("a").children("img");
        var newSource = eval(imgObject.attr('name')+"_h.src");
        imgObject.attr('src', newSource);
	});
	*/
	//When mouse is removed
	$(".subNavigationPoint").mouseout(function(){
        var elementId = "#"+$(this).attr('id')+"-thirdNavigation";
        $(elementId).stop().animate({width:'0px'},{queue:false, duration:500, easing: 'easeOutQuad'});
	});
	/* unused
    $(".thirdNavigation").mouseout(function(){
        $(this).stop().animate({width:'0px'},{queue:false, duration:500, easing: 'easeOutQuad'});
       	//rollover subNavigationPoint, when mouse is removed
        var id = $(this).attr('id');
	    var subNavigationPointId = id.substring(0, id.lastIndexOf('-thirdNavigation'));
	    var imgObject = $("#"+subNavigationPointId).children("a").children("img");
        var newSource = eval(imgObject.attr('name')+"_n.src");
        imgObject.attr('src', newSource);
	});
	*/


    //slideContentNavigation
    slideContentUrls = new Array();
    $(".slideContentHiddenValue").each(function(index) {
        slideContentUrls.push($(this).attr('value'));
    });
    var currentSlideContentUrl = slideContentUrls[0];
    if(currentSlideContentUrl!=null) {
        $("#pictureSlide").css('visibility', 'visible');
        loadSlideContent(currentSlideContentUrl);
    }
});

function loadSlideContent(currentUrl) {
    var currentIndex = -1;
    for(var i=0; i<slideContentUrls.length; i++) {
        if (slideContentUrls[i]==currentUrl) {
            currentIndex = i;
            break;
        }
    }
    if(currentIndex==0) {
        $("#slideContentPrevent").css('visibility', 'hidden');
    } else {
        $("#slideContentPrevent").css('visibility', 'visible');
        $("#slideContentPrevent").attr('href', "javascript:loadSlideContent('"+slideContentUrls[currentIndex-1]+"');");
    }
    
    if(currentIndex>=(slideContentUrls.length-1)) {
        $("#slideContentNext").css('visibility', 'hidden');
    } else {
        $("#slideContentNext").css('visibility', 'visible');
        $("#slideContentNext").attr('href', "javascript:loadSlideContent('"+slideContentUrls[currentIndex+1]+"');");
    }
	$("#slideContent").load(currentUrl+" #contentLeft > *");
}

