// expeditionn.js - PS - 20.07.2010
jQuery.noConflict();
jQuery(document).ready(function() {

// Accordion Pressearchiv Jahreszahlen
jQuery('#accordion').accordion({active:false, autoHeight: false, collapsible: true, header: 'h2'});

// ***
// Lightbox - Fancybox

// Lightbox wt_gallery
// Klickvergrößern
jQuery(".clickenlarge").fancybox({
	'zoomSpeedIn'		: 600,
	'zoomSpeedOut'	: 500,
	'padding'				: 10,
	'titleShow'		: true,
	'titlePosition'	:	'inside',
	'titleFromAlt' : true 
});
jQuery(".clickenlarge02").fancybox({
	'zoomSpeedIn'		: 600,
	'zoomSpeedOut'	: 500,
	'padding'				: 10,
	'titleShow'		: true,
	'titlePosition'	:	'inside',	
	'titleFromAlt': true 
});
jQuery(".clickenlarge02:first").append('<a href="#" class="gallery-trigger">Zur Bildgalerie</a>');


jQuery(".gallery-lightbox").attr('rel', 'lightbox[galerie]').fancybox({
	'titleFromAlt': true,
	'titlePosition'	:	'inside'	
});



// CO2-Rechner 
 jQuery("a.co2rechner").fancybox({
  'transitionIn'	:  'elastic',
  'speedIn'       :  '1000',
  'easingIn'      :  'swing',
	'speedIn'		 		: 600, 
	'speedOut'			:  200,
  'width'         :  700,
  'height'        :  600,
	'autoScale'			: 'false',
	'scrolling'			: 'no',
  'padding'       :  5,    
	'type'          :  'iframe',
	'overlayShow'   :  'true',
	'overlayOpacity':  '0.8',
	'titleShow'			: false
});

// ***
// Lightbox - Fancybox


// Klimachecker   
jQuery("a.klimachecker").fancybox({
  'transitionIn'  :	'elastic',
  'speedIn'       : '1000',
  'easingIn'      : 'swing',
	'speedIn'		    :	600, 
	'speedOut'		  : 200,
  'width'         : 975,
  'height'        : 733,
  'padding'       : 0,    
	'type'          : 'iframe',
	'overlayShow'   : 'true',
	'overlayOpacity': '0.9',
	'titleShow'			: false
	});	


// Brennstoffzelle 
 jQuery("#c679  a").fancybox({
	'titleShow'			: false,
	'type'          : 'iframe',
	'width'					: 843,
	'height'				: 570,	
	'autoScale'			: 'false',
	'scrolling'			: 'no',
	'padding'				: 5
});

//Quiz
 jQuery("#c695 a").fancybox({
  'type' : 'iframe',
  'height'	: 1000,
  'scrolling'	: 'yes',
  'autoscale'	: 'true',
  'padding'	: 0
});

// *** 
// Lightbox end
	
//***
// Accordion 
 
// *** Accordion Handling - Accordion Content - begin ***

// jQuery Accordion basierend auf http://bit.ly/cM4fxN
jQuery('div.rgaccord1-content').hide(); //close all containers
jQuery('h3.rgaccord1-toggle:first').addClass('active').next().slideToggle('fast'); //Add "active" class to first trigger, then show/open the immediate next container
//On Click
jQuery('h3.rgaccord1-toggle').click(function(){
	if( jQuery(this).next().is(':hidden') ) { //If immediate next container is closed...
		jQuery('h3.rgaccord1-toggle').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
		jQuery(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
	}
	return false; //Prevent the browser jump to the link anchor
}); // Accordion end

// *** Accordion Handling - Accordion Content - end ***

// *** Accordion Handling - Sitemap - begin ***

// jQuery Accordion basierend auf http://bit.ly/cM4fxN
jQuery('.sitemap-third').hide(); //close all containers
jQuery('.toggle:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
//On Click
jQuery('div.toggle').click(function(){
	if( jQuery(this).next().is(':hidden') ) { //If immediate next container is closed...
		jQuery('div.toggle').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
		jQuery(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
	}
	return false; //Prevent the browser jump to the link anchor
}); // Accordion end

// *** Accordion Handling - Sitemap - end ***


//
// *** Accordion end 

//***
// Tooltip begin
jQuery('#popup').hide();

	//jQuery('#app-select').each(function () { // deaktiviert und auf Rechte Spalte gesetzt um alles klickbar zu machen
	jQuery('#RECHTE-SPALTE').each(function () {
	var distance = 0;
    var time = 250;
    var hideDelay = 300;
    var hideDelayTimer = null;
    var beingShown = false;
    var shown = false;
    var trigger = jQuery('.trigger-new', this);
    var info = jQuery('#popup', this).css('opacity', 0);

    jQuery([trigger.get(0), info.get(0)]).mouseover(function () {
        if (hideDelayTimer) clearTimeout(hideDelayTimer);
        if (beingShown || shown) {
            // don't trigger the animation again
            return;
        } else {
            // reset position of info box
            beingShown = true;
            info.css({
                top: 0,
                right: 0,
                display: 'block'
            }).animate({
                top: '-=' + distance + 'px',
						right: 0,
                opacity: 1
            }, time, 'swing', function() {
                beingShown = false;
                shown = true;
            });
        }

        return false;
    }).mouseout(function () {
        if (hideDelayTimer) clearTimeout(hideDelayTimer);
        hideDelayTimer = setTimeout(function () {
            hideDelayTimer = null;
            info.animate({
                top: '-=' + distance + 'px',
                opacity: 0
            }, time, 'swing', function () {
                shown = false;
                info.css('display', 'none');
            });

        }, hideDelay);

        return false;
    });
});

// Tooltip end

//--- begin
jQuery('#c691,#c692,#c693,').hover(
  function () {
    jQuery(this).stop(true, false).addClass('preispanel').fadeIn('slow', pulse);
		
		//.addClass("preispanel");
  },
  function () {
    jQuery(this).removeClass("preispanel");
  }
);
//--- end
  
//***
}); //document.ready end
