// JavaScript Document

// Alles ausblenden, wenn JS aktiviert ist, um es sanft einzufaden.
var i = 0;
document.write('<style type="text/css">body {display:none;}</style>');

// Sonstiges
var currentDisplayedShopItem = 'shop1' ;

	

	
    
/*
AJAX Loader
*/
function ajaxloader(dataid){

	var navi_color = $('#colorchanger .colorchanger_border').css('border-top-color');


    $("#ajax_loader").html('<img src="img/ajax-loader.gif" />');

	
    $('.ajax_button').click(function () {
        $('.ajax_button').css({
            backgroundColor: "#aaaaaa"
        });
        $('.ajax_button').removeClass('selected');
        $(this).addClass('selected');
        $('.ajax_button.selected').css({
            backgroundColor: navi_color
        });
    });
	
    $("#item2_ajax_content").fadeOut(600, function() {
    
        
        $.ajax({
            url: 'php/ajax_content/page_'+dataid+'.php',
            success: function(data) {
                $("#item2_ajax_content").html(data);
                
                $('#item2_ajax_content').find('img').load(function() {
                    $("#item2_ajax_content").fadeIn(500,function (){
                         centerAjaxImage();
                    });
                });
                
                $("#ajax_loader").html('');
                
                                $("#item2_ajax_content img.colorchanger_bg").animate({
                    backgroundColor: navi_color
                });
            }
        });
    });
}

	
	


function resizePanel() {
	
    width = $(window).width();
    height = $(window).height();
	
    //mask_width = width * $('.item').length;
    mask_width = width * 8;
    mask_height = height * 3;
		
		
    $('#debug').html(width  + ' ' + height + ' ' + mask_width);
			
    $('#wrapper, .item').css({
        width: width,
        height: height
    });
	
    $('#wrapper, .content').css({
        width: width,
        height: height
    });
	
	
    $('#mask').css({
        width: mask_width,
        height: mask_height
    });
	
    $('#wrapper').scrollTo($('a.selected').attr('href'), 0);
}



function goto_1(anker){
    if(window.location.hash==""){
        window.location.href = anker;
        resizePanel();
        $('#wrapper').scrollTo($(this).attr('href'), 600,{
            queue:true
        });
        
        current = anker;
    }
}
	
	
/*
Colorchanger für die Bilder und Headlines
*/
function change_color_to(active_color){
    $('.colorchanger_bg').animate({
        backgroundColor: active_color
    },1500);
    $('.colorchanger_fg').animate({
        color: active_color
    },1500);
    $('.colorchanger_border').animate({
        borderTopColor: active_color
    });
		
    $(".menu_main").data("navi_color", active_color);
    $(".selected").animate({
        backgroundColor: active_color
    });
}


/*
Colorchanger für den T-Shirt Shop
*/
function change_shop_color_to(active_shop_color){
    $('img#'+currentDisplayedShopItem).animate({backgroundColor:active_shop_color},1000)
       
}
	
		
		
		
/* Einfach Wow - YCodaSlider */	

jQuery(window).ycodacss('css/ycodaslider-3.0.css');
jQuery(window).bind("load", function() {
    jQuery("div.ycodaslider")
    .eq(0).ycodaslider({
        easeFunc: "easeInOutExpo",
        easeTime: 1200
    });
    
    var _left = jQuery('<a href="#"><img style="margin-right:5px;" src="../img/ycodaslider_left.gif" width="11" height="12" /></a>')
    .click(function(){
        jQuery("div.ycodaslider").ycodaslider("left");
        return false;
    });
            
    var _right = jQuery('<a href="#"><img src="../img/ycodaslider_right.gif" width="11" height="12" /></a>')
    .click(function(){
        jQuery("div.ycodaslider").ycodaslider("right");
        return false;
    })
			
    jQuery("#unsere_helden_navi")
    .append(_left)
    .append(_right)
});
		
	

$(document).ready(function() {


    $('body').hide().fadeIn(2500);    

	resizePanel();
	
	centerImage();
    	
    // Globales deaktivieren aller jQuery Effekte - Seite funzt aber trotzdem noch.
    //jQuery.fx.off = true
	
    /* ScrollTo-Funktion auf alle Links mit der Klasse .panel setzen. */
    $('.panel').click(function () {
		
		centerAjaxImageQuick();
	
        // Das ist für die Slider Funktion - dass er weiss wohin er sliden soll
        $('.panel').removeClass('selected');
        $('.panel_slideonly').removeClass('selected');
        $(this).addClass('selected');
		
        // Das sind meine kläglichen Versuche, die Navi richtig zu formatieren.
        $('.panel').removeClass('colorchanger_bg');
        $(this).addClass('colorchanger_bg');
		
        // Alle Navi-Buttons schwarz machen:
        $('.panel').animate({
            backgroundColor: "#000000"
        });
		
        var navi_color = $('#colorchanger .colorchanger_border').css('border-top-color');
        $(this).animate({
            backgroundColor: navi_color
        });
		
		
        current = $(this);
		
        $('#wrapper').scrollTo($(this).attr('href'), 800,{
            queue:true
        });
		
		
        return false;
    });
	
	
    /* ScrollTo-Funktion auf alle Links mit der Klasse .panel setzen. */
    $('.panel_slideonly').click(function () {
		
		
        // Das ist für die Slider Funktion - dass er weiss wohin er sliden soll
        $('.panel').removeClass('selected');
        $('.panel_slideonly').removeClass('selected');
        $(this).addClass('selected');

		
		current = $(this);	
		
        $('#wrapper').scrollTo($(this).attr('href'), 1000,{
            queue:false
        });
        
        return false;
    });
	
	
	
	
    // Funktion zum setzen der Inhaltsgrösse bei jedem Ändern des Fenster neue starten
    $(window).resize(function () {
    
    	resizePanel();
        
        centerImage();

        centerAjaxImageQuick();

//       result =  $("div.test").slidinggallery2();
        
    });

	
	
    // Höhe der einzelnen Inhaltsseiten auf Fenstergrösse bringen
    $('.item').css(
    	{
        	height: $(window).height()
		}
    );
	

	
	
    // Item 1 - Hurra Wir - Details einblenden bei MouseOver
    $('#verena_button').hover(function () {
        $('#mo_verena').fadeIn(500);
		$('#mo_mirco').fadeOut(500);
    });
	
    $('#close_mo_verena').hover(function () {
        $('#mo_verena').fadeOut(500);
    });
	
	
    $('#mirco_button').hover(function () {
        $('#mo_mirco').fadeIn(500);
        $('#mo_verena').fadeOut(500);
    });
	
    $('#close_mo_mirco').hover(function () {
        $('#mo_mirco').fadeOut(500);
    });
    
     $('#text_item1').hover(function () {
        $('#mo_mirco').fadeOut(500);
        $('#mo_verena').fadeOut(500);
    });
    
    $('#hurra_wir_off_button').hover(function () {
        $('#mo_mirco').fadeOut(500);
        $('#mo_verena').fadeOut(500);
    });

	
	
	$('#homelink').click();
	
	   


}); // document.ready ENDE
