/* js for package: std-layout */


/*===========================================================================================*/
/*     BROWSER DETECTION		*/
/*===========================================================================================*/


var cb;
var cbv;

jQuery.each(jQuery.browser, function(i, val) {

	if(i != 'version'){
		//alert(i);
		cb = i;
		$("html").addClass(cb);
	}else{
	 	//alert(val.slice(0,3));
		cbv = val.slice(0,3);
		cbv = cbv.replace(".", "-");

		$("html").addClass(cb+'_'+cbv);		
	}
     	
});



/*===========================================================================================*/
/*     CUFON		*/
/*===========================================================================================*/


/*
Cufon.replace("#main-menu a.cufon-replace", { fontFamily: 'Akkurat Pro', hover: true});
Cufon.replace("h1[class!='noreplace']", { fontFamily: 'Akkurat Pro', hover: true});
Cufon.replace("h2[class!='noreplace']", { fontFamily: 'Akkurat Pro', hover: true});
Cufon.replace(".startseiten-link .title", { fontFamily: 'Akkurat Pro', hover: true});
*/

/*
Cufon.replace("h1[class!='noreplace']",{ fontFamily: "LubalinGraphEFOP-Bold", hover: true, color: '-linear-gradient(#fad53f, #f48129)', textShadow: '1px 1px #666'});
Cufon.replace("h2[class!='noreplace'],h3[class!='noreplace']",{ fontFamily: "LubalinGraphEFOP-Bold", hover: true});
*/


/*===========================================================================================*/
/*     SUPERFISH MENU		*/
/*===========================================================================================*/


jQuery(function(){			
	$('ul.sf-menu').each(function() {
	 	$(this).superfish();
		$(this).css({position: "absolute", zIndex: "999"});
		$(this).parent().css({ height: $(this).height() +"px"});
	  
	});	
});


/*===========================================================================================*/
/*     JQUERY - DOCUMENT READY               */
/*===========================================================================================*/


$(document).ready(function() {
	
			
		
	/*===========================================================================================*/
	/*        BODY & GENERAL			*/
	/*===========================================================================================*/
	
	$('body').each(function() {
	  if ($(this).hasClass('no-js')) {
		$(this).removeClass("no-js");
	    	$(this).addClass("js");
	  }
	});
	
	$("a.avtext[href*='http://']").each(function() {
		$(this).addClass("external_link");
	});
	
	$("a.avtext[href*='mailto']").each(function() {
		$(this).addClass("email_link");
	});
	
	/*===========================================================================================*/
	/*       YOUTUBE LINKS ersetzen                 */
	/*===========================================================================================*/
	
	if(1 == 1){
		// Youtube Link wird mit Youtube Vorschaubild ersetzt
		$('a.avtext[href*="youtube"]').each(function() {
			var url = '';
			var title = $(this).html();
			$(this).html('');
			$(this).addClass("fancybox_youtube");
			if($(this).attr('href') != '') {
				url = $.jYoutube($(this).attr('href'),'small');
				$(this).append($('<img src="'+url+'" class="youtube_preview_pic" />'));				
			}
			
			if(title.indexOf('http://www.youtube') < 0){
				$(this).attr("title", title );
			}
			// Autostart von Videos
			var change_url = $(this).attr("href");
			$(this).attr("href", change_url + ";autoplay=1");
			
			// Youtube Logo darüberlegen
			$(this).append('<div class="youtube_logo_layer"></div>');			
		});
		
		$('.youtube_logo_layer').append('<img src="resources/images/icons/youtube.png" alt="" />')
		
		// Fancybox wird geöffnet und Video abgespielt
		$("a.fancybox_youtube").click(function(){
			$.fancybox({
				'padding'         : 0,
				'autoScale'       : false,
				'transitionIn'    : 'none',
				'transitionOut'   : 'none',
				'title'           : this.title,
				'width'           : 640,
				'height'          : 385,
				'href'            : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'            : 'swf',
				'swf'             : {
				'wmode'           : 'transparent',
				'allowfullscreen' : 'true'
				}
			});
			return false;
		});		
	}
	


	/*===========================================================================================*/
	/*       CLICK BOX               */
	/*===========================================================================================*/
	
	$('.click-box').each(function() {
		$('.box', this).hide();
		$(this).hover(
		  function () {
		    $('.box', this).slideToggle('fast');		  
		  }, 
		  function () {
		    $('.box', this).slideToggle('fast');
		  }
		);
	});

	
	/*===========================================================================================*/
	/*                      */
	/*===========================================================================================*/

	
	
	/*===========================================================================================*/
	/*                      */
	/*===========================================================================================*/

	
	


  


});



