$(document).ready(function()
{
			// ScrollNavigation im RefMenü 
     	$('#ie8vor').click(function(){    		    
		
				$("#ref_window").scrollTo( {top:'-=0px', left:'+=100px'}, 1800 );
				$("#ie8vor").css("margin-top", "12px");
				
		var zeitvor = 100;
		
			setTimeout(function()
				{
				$("#ie8vor").css("margin-top", "10px");		
		},zeitvor
		);

    	});
	
    // TRIGGER
	$(".trigger").click(
	function() {
		$(".rrslider").slideDown(100);
		$("#trigger_hide").css("display", "block");
		$("#trigger_show").css("display", "none");
		return false;
	});

	$(".trigger_close").click(
	function() {
		$(".rrslider").slideUp(100);
		$("#trigger_hide").css("display", "none");
		$("#trigger_show").css("display", "block");
		return false;
	});
	
	
	
	
	   $('#prevpicA').click(function(e){
				$("#prevpics").css("margin-top", "+2px");
				var zeitprev = 100;
		
			setTimeout(function()
		{
				$("#prevpics").css("margin-top", "0px");
		},zeitprev
		);
		});
		
		
		
	   $('#nextpicA').click(function(e){
				$("#nextpics").css("margin-top", "+2px");
				var zeitnext = 100;
		
			setTimeout(function()
		{
				$("#nextpics").css("margin-top", "0px");
		},zeitnext
		);
		});

    // REF CONTROL
	//$("#ref_control").hover(
	//function(){
	//	$("#ctrl-slide").stop().animate({left: ($(window).width() - 380) + 'px'}, 200);
	//},
	//function () {
	//	$("#ctrl-slide").stop().animate({left: ($(window).width() - 0) + 'px'}, 200);
	//});

    // BUTTON IMG
	//$("#button_img").hover(
	//function() {
	//	$("#slide_info").stop().animate({left: ($(window).width() - 195) + 'px'}, 200);
	//},
	//function () {
	//	$("#slide_info").stop().animate({left: ($(window).width() - 0) + 'px'}, 200);
	//});
	// BUTTON IMG
	//$("#slide_info").hover(
	//function() {
	//	$("#slide_info").stop().animate({left: ($(window).width() - 195) + 'px'}, 200);
	//},
	//function () {
	//	$("#slide_info").stop().animate({left: ($(window).width() - 0) + 'px'}, 200);
	//});


    //  SLIDE THE REFERENCES MENUE UP AND DOWN
	
			if (jQuery.browser.msie) {
			$("#pfeilleiste").animate({ opacity: .5 }, 500 );
			$("#pfeilleiste").css("background","#ebebeb");

		}else{
					$("#pfeilleiste").animate({ opacity: 1.0 }, 500 );
};
	
	

    $("#col1").stop().animate({top: ($(window).height() - 35) + 'px'}, 0);
	$("#col1").hover(
	function() {
		
	
		
	    $('#loading').hide(); //we need to hide the loader, because it is located behind the images
			$("#refinfo").css("display", "none");
			$(".segment-0").animate({ opacity: 0.0 }, 0 );
			$("#pfeilleiste").animate({ opacity: 0.0 }, 0 );
			
				$(".seg1").css("margin-top", "0px");
				$(".segment-1").css("margin-top", "0px");
				
		$(this).stop().animate({top: ($(window).height() - 175) + 'px'}, 500);
		$("#superbgimage").animate({opacity: 0.2}, 200);
		$("#film").animate({opacity: 0.2}, 200);
		$("ul.splitter").css("margin-top", "0px");
	},
	function() {
	
		
		$('#loading').hide();
		$(this).stop().animate({top: ($(window).height() - 35) + 'px'}, 500);
		$("#superbgimage").animate({opacity: 1.0}, 200);
		$("#film").animate({opacity: 1.0}, 200);
	
		
			var zeiten = 500;
		
			setTimeout(function()
			{
			$(".segment-0").animate({ opacity: 1.0 }, 500 );
			
					// IE Opacity Pfeilleiste
					if (jQuery.browser.msie) {
						$("#pfeilleiste").css("background","#ebebeb");
						$("#pfeilleiste").animate({ opacity: .5 }, 500 );
					}else{
						$("#pfeilleiste").animate({ opacity: 1.0 }, 500 );
					};
					
			$("#refinfo").show("slow");
			},zeiten);
	
	});
	});

    // IF THE WINDOW SIZE IS CHANGED, REPOSITION THE REFERENCES MENUE
    $(window).resize(function() {
        $("#col1").css("top", ($(window).height() - 35) + 'px');
    });

    jQuery(
    function() {
    	$("a.seg0").stop().css("cursor", "pointer");
    	$("a.seg1").stop().css("cursor", "pointer");
    	$("a.seg2").stop().css("cursor", "pointer");
    	$("a.seg3").stop().css("cursor", "pointer");
    	$("a.seg4").stop().css("cursor", "pointer");
    	
		
		
		
		
		// ScrollNavigation im RefMenü 
     	$('.vor').click(function(e){
				$(".vor").css("margin-top", "-145px");
				
				// IE 7
				if (jQuery.browser.msie && jQuery.browser.version > 8) {
					$(".vor").css("margin-top", "-133px");
				}

				if (jQuery.browser.msie && jQuery.browser.version <= 7) {
					$(".vor").css("margin-top", "-153px");
				}

				
		var zeitvor = 100;
		
			setTimeout(function()
				{
				$(".vor").css("margin-top", "-147px");
				
				// IE 7
				if (jQuery.browser.msie && jQuery.browser.version <= 7) {
					$(".vor").css("margin-top", "-155px");
				}
		},zeitvor
		);
				
				
				
     	    e.preventDefault();
     	    
    	    count = Math.round(($(window).width() - 300) / 215);

    		    $("#ref_window").stop().scrollTo( {top:'-=0px', left:'+=' + (count * 223)}, 1800 );
    	});
    	$('.zuruck').click(function(e){
				$(".zuruck").css("margin-top", "-28px");
				
	
				// IE 7
	
				if (jQuery.browser.msie && jQuery.browser.version <= 7) {
					$(".zuruck").css("margin-top", "-15px");
				}
				
		var zeitzuruck = 100;
		
			setTimeout(function()
				{
				$(".zuruck").css("margin-top", "-30px");
				// IE 7
				if (jQuery.browser.msie && jQuery.browser.version <= 7) {
					$(".zuruck").css("margin-top", "-17px");
				}
		},zeitzuruck
		);
				
    	    e.preventDefault();
    	    
    	    count = Math.round(($(window).width() - 300) / 215);
    		$("#ref_window").stop().scrollTo( {top:'-=0px', left:'-=' + (count * 223)}, 1800 );
    	});

    	$('.seg1').click(function(){
    		$(".nav-selected").removeClass('nav-selected');
    		$(".segment-1").stop().addClass('nav-selected');
			
			$(".ref_img_Design").show("fast");
			$(".ref_img_Web").hide("fast");
			$(".ref_img_Fotografie").hide("fast");
			$(".ref_img_Video").hide("fast");
			
    		$("#ref_window").stop().scrollTo( {top:'-=0px', left:'-=4000'}, 500 );
    		return false;
    	});
	
    	$('.seg2').click(function(){
    		$(".nav-selected").removeClass('nav-selected');
    		$(".segment-2").stop().addClass('nav-selected');
			
		$(".ref_img_Design").hide("fast");
			$(".ref_img_Web").show("fast");
			$(".ref_img_Fotografie").hide("fast");
			$(".ref_img_Video").hide("fast");
			
    		$("#ref_window").stop().scrollTo( {top:'-=0px', left:'-=4000'}, 500 );
    		return false;
    	});
	
    	$('.seg3').click(function(){
    		$(".nav-selected").removeClass('nav-selected');
    		$(".segment-3").stop().addClass('nav-selected');
			
		$(".ref_img_Design").hide("fast");
			$(".ref_img_Web").hide("fast");
			$(".ref_img_Fotografie").show("fast");
			$(".ref_img_Video").hide("fast");
			
    		$("#ref_window").stop().scrollTo( {top:'-=0px', left:'-=4000'}, 500 );
    		return false;
    	});

    	$('.seg4').click(function(){
    		$(".nav-selected").removeClass('nav-selected');
    		$(".segment-4").stop().addClass('nav-selected');
			
		$(".ref_img_Design").hide("fast");
			$(".ref_img_Web").hide("fast");
			$(".ref_img_Fotografie").hide("fast");
			$(".ref_img_Video").show("fast");
			
    		$("#ref_window").stop().scrollTo( {top:'-=0px', left:'-=4000'}, 500 );
    		return false;
    	});
    }
);
