// JavaScript Document

/*
// --------------------------------------------------------------------------
// jQuery.custom.js by orangepointsolutions Ltd., www.orangepointsolutions.de
// --------------------------------------------------------------------------
*/

 $(document).ready(function() {

	//$(".nav_main > div").hide();
	//$("#arrow001").show();
	//$("#arrow002").show();

    $("#nav001").mouseover( function() { $("#arrow001").toggleClass("arrow001hover"); });

/*    $("#nav001").mouseover( function() { $("#arrow001").fadeIn("slow"); });
    $("#nav001").mouseout( function() { $("#arrow001").fadeOut("slow"); });
    $("#arrow001").mouseover( function() { $(this).show(); });

    $("#nav002").mouseover( function() { $("#arrow002").fadeIn("slow"); });
    $("#nav002").mouseout( function() { $("#arrow002").fadeOut("slow"); });
    $("#arrow002").mouseover( function() { $(this).show(); });

    $("#nav003").mouseover( function() { $("#arrow003").fadeIn("slow"); });
    $("#nav003").mouseout( function() { $("#arrow003").fadeOut("slow"); });
    $("#arrow003").mouseover( function() { $(this).show(); });

    $("#nav004").mouseover( function() { $("#arrow004").fadeIn("slow"); });
    $("#nav004").mouseout( function() { $("#arrow004").fadeOut("slow"); });
    $("#arrow004").mouseover( function() { $(this).show(); });

*/

	$("#go_page1").addClass("active");
    $(".page").hide();
    $("#page1").fadeIn("slow");
	
	if ( $("#page1 > #news").height() <= 350 ) {
		$(".page_scroll_up").hide();
		$(".page_scroll_down").hide();
	} else {
		$(".page_scroll_up").show();
		$(".page_scroll_down").show();
	}
	
	$("#pages > li").mouseover(function() {
		$(this).toggleClass("hover");
	});

	$("#pages > li").mouseout(function() {
		$(this).toggleClass("hover");
	});

    $(".go_page").click(function(){
		// extract id
		var regExpression = /(\w.+)_(\w.+)/;
		regExpression.exec( $(this).attr("id") );
		var myId = RegExp.$2;
		var current_page_number = myId.substr(4);

	    if ( !$(this).hasClass("active") ) {
			
			for ( i=1; i<= 50; i++ ) {
				
				if ( i != current_page_number ) {
					
					if ($("#page"+i).length>0) { 
					
						$("#page"+i).hide();
					}
					
				}
				
			}
				
			$("#page"+current_page_number).fadeIn("slow");

			if ( $("#page"+current_page_number+" > #news").height() <= 350 ) {
				$(".page_scroll_up").hide();
				$(".page_scroll_down").hide();
			} else {
				$(".page_scroll_up").show();
				$(".page_scroll_down").show();
			}
	
            /*$(".page[id!='" + myId + "']").fadeOut("fast", function() {
				$("#"+myId).fadeIn("slow");
			});*/
		    $(this).toggleClass("active");
		    $(".go_page").removeClass("active");
		    $(this).addClass("active");
		}
	});

	// scroll pages navigation
    $(".page_scroll_up").click(function(){
		$('.page').scrollTo('-=280px', 1100, {axis:'y'});
	});
	
    $(".page_scroll_down").click(function(){
		$('.page').scrollTo('+=280px', 1100, {axis:'y'});
	});
	
    $("#scrollpages_prev").click(function(){
		$('#pages_wrap').scrollTo('-=180px', 1100, {axis:'x'});
	});
    $("#scrollpages_next").click(function(){
		$('#pages_wrap').scrollTo('+=180px', 1100, {axis:'x'});
	});
	
	
	// references
    $("#btn_references_slideout").click(function(){ 
        $("#references").slideToggle("fast");
    });

// toggle content initialisation
	$("#references").hide();
	
 });

// --- end of jQuery.custom.js ---


