/*
 *
 * 	trendmarke - Werbeagentur GmbH
 *	General JavaScript Functions
 *	general.js
 *
 */
 
 // Set JQuery in Compatibility Mode
 jQuery.noConflict();
 
/*
 *	DO WHEN LOADED
 */
 jQuery(document).ready(function(){
 		
		
		
		/*
		 * SOUND
		 */
		jQuery(".header-content").append('<span href="#" class="sound-on" id="soundlink">sound on</span>');
		// check current settif
		if (jQuery.cookie("trendmarke_sound") != null) {
			changeSound();
		}
		jQuery("#soundlink").click(function() {
			changeSound();
		});
		// play sound
		if (document.getElementById("soundauto") != null) {
			document.getElementById("soundauto").play();
		}
		// change sound
		function changeSound() {
			if (jQuery("#soundlink").hasClass("sound-on")) {
				document.getElementById("soundauto").volume = 0;
				jQuery.cookie("trendmarke_sound", "off");
				jQuery("#soundlink").html("sound off");
			} else {
				//document.getElementById("soundauto").volume = 100;
				jQuery.cookie("trendmarke_sound", null);
				jQuery("#soundlink").html("sound on");
			}
			jQuery("#soundlink").toggleClass("sound-on");
		}
		
		/*
		 *	KUNDEN MENU
		 */
		
		/*jQuery('.kunden-menu .no').hover(
  			function () {
    			jQuery(this).find('.kunden-menu-desc').show('slow');
  			},
  			function () {
    			jQuery(this).find('.kunden-menu-desc').hide('slow');
  			}
		);*/
		
		// activeate the light box
		//jQuery('.banner-wrap .csc-textpic-imagewrap a').lightBox();
		
		
		jQuery('.brosch-link').click(
  			function () {
			 jQuery('<div id="ajax-content"></div>').insertAfter('.copyright');
			 jQuery('#ajax-content').hide();
			 jQuery('#ajax-content').load('index.php?id=59 .presentation-wrapper', function(response, status, xhr) {
			  if (status == "success") {
				// show in fancy box
				jQuery.fancybox(
		jQuery("#ajax-content").html(),
		{
        		'autoDimensions'	: false,
			'width'         		: 1200,
			'height'        		: 1200,
			'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false,
		'hideOnOverlayClick'		: true,	
		'overlayShow'	:	true,
		'centerOnScroll' : true,
		'overlayOpacity' : 0.6
		}
	);

				

    		  }
			  if (status == "error") {
				jQuery('#ajax-content').html('Pr&auml;sentation konnte nicht geladen werden');
			  } 
			});
			 return false; 
			});
		/*
		 *	TOP LINK
		 */
		// first hide
		jQuery('.top-link').css('bottom','-25px');
		
		jQuery('.top-link').hover(
  			function () {
				jQuery('.top-link').animate({
				    bottom: '+=25',
				  }, 1000);
  			},
  			function () {
    			jQuery('.top-link').animate({
				    bottom: '-=25',
				  }, 1000);
  			}
		);

});

