function bookmark_site(die_bookmark_url, der_bookmark_text) 
{
  if (navigator.appName == 'Microsoft Internet Explorer' && parseInt(navigator.appVersion) >= 4) {
    window.external.addFavorite(die_bookmark_url, der_bookmark_text)
  } else {
    alert("Diese Funktion ist leider nur mit Microsoft Internet Explorer m�glich!");
  }
}

function set_home_site(olink,welche_url){
  olink.blur();
  if (navigator.appName == 'Microsoft Internet Explorer' && parseInt(navigator.appVersion) >= 4) {
    olink.style.behavior='url(#default#homepage)';
    olink.setHomePage(welche_url);
  } else {
    alert("Diese Funktion ist leider nur mit Microsoft Internet Explorer m�glich!");
  }
  return false;
}


jQuery(document).ready(function(){
	
	// nach jeder Reihe das Floating clearen --> IE6 und 7 Bug damit behoben
	jQuery('#images #thumbs li:eq(2), #images #thumbs li:eq(5)').after('<div class="clear"></div>');


	jQuery('.video_popup a').each(function(){
		var $this = jQuery(this);
		//$this.attr('title',$this.html());
		$this.click(function(){
			showVideoLightbox(jQuery(this).attr('href'));
			return false;
		});
	});

	//window.console && window.console.log(window.location.hash);

	if (window.location.hash == '#video_popup') {
		jQuery('.video_popup a').click();
	}
	
	
	
// lightbox -> mmcMediabox
    //$("#mediasuche_wrap .lightbox").mmcMediabox({
      //labels: {
       // close : 'schlie&szlig;en',
        //next: 'weiter',
       // prev: 'zur&uuml;ck',
       // of: 'von',
        //download: 'Download'
      //}
    //});

	
});






function showVideoLightbox(video_url) {
	
	var old_hash = window.location.hash;
	window.location.hash = 'video_popup';

	jQuery('body').append('<div id="vid_lightbox_bg"></div><div id="vid_lightbox"><div id="flash_videoplayer"><p>Bitte installieren Sie das <a href="http://get.adobe.com/de/flashplayer/" target="_blank">Flash-Plugin</a> in Ihrem Browser, um die Videos anzusehen!</p></div><div id="share_video"></div><div class="close">Schlie&szlig;en</div></div>');

	var top = (jQuery(window).height()-jQuery('#vid_lightbox').height())/2 + jQuery(document).scrollTop();
	var left = (jQuery(window).width()-jQuery('#vid_lightbox').width())/2 + jQuery(document).scrollLeft();
	jQuery('#vid_lightbox').css({
		'position': 'absolute',
		'top': top,
		'left': left
	});
	
	function resizeLightboxBg(){
		jQuery('#vid_lightbox_bg').hide();
		var bgMinW = jQuery(document).width();
		var bgW = jQuery(window).width();
		var bgH = jQuery(window).height();
		jQuery('#vid_lightbox_bg').show().css({
			'width': bgW,
			'min-width': bgMinW,
			'height': bgH,
			'position': 'fixed'
		});
	}
	jQuery(window).resize(function(){
		resizeLightboxBg();
	});
	resizeLightboxBg();

	jQuery('#vid_lightbox .close').click(function(){
		jQuery('#vid_lightbox_bg').remove();
		jQuery('#vid_lightbox').remove();
		window.location.hash = old_hash;
	});
	
	
	/*
	<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4da712130dc41f13"></script>
	 */
	
	
	jQuery.getScript('http://s7.addthis.com/js/250/addthis_widget.js', function() {
		
		
		window.addthis_config = {
           pubid : 'xa-4da712130dc41f13'
        };
		addthis.init();
		//window.console && console.log(addthis);
		
		addthis.button('#share_video', {
			ui_click: false
		});
		
		
		function adjustPos(evt) {
		    var d = document.getElementById("at15s");
		    d.style.top = jQuery('#share_video').offset().top -190 +"px";
		    d.style.left = jQuery('#share_video').offset().left - 50 + "px";
		}
		
		addthis.addEventListener("addthis.menu.open", adjustPos);
		
	});
		
	
	
	jQuery.getScript('fileadmin/templates/assets/js/swfobject/swfobject.js', function() {
		var flashvars = {
			file: '/'+video_url,
			controlbar: 'over',
			skin: '/fileadmin/templates/assets/flash/jwplayer/bekle.swf',
			autostart: true
		};
		var params = {
			allowFullscreen: true,
			allowScriptAccess: 'always',
			wmode: 'opaque'
		};
		var attributes = {
			id: 'flash_videoplayer',
			name: 'flash_videoplayer'
		};
		
		swfobject.embedSWF("/fileadmin/templates/assets/flash/jwplayer/player-licensed.swf", "flash_videoplayer", "460", "253", "9.0.0",false, flashvars, params, attributes);
	});
	
	/*
	
	jwplayer("flash_videoplayer").setup({
		flashplayer: "/fileadmin/system/assets/flash/jwplayer/player.swf",
		file: video_url,
		skin: '/fileadmin/system/assets/flash/jwplayer/bekle.swf',
		height: 253,
		width: 460
	});
	
	*/
}




/*
 * jQuery mmcMediabox: lightbox for all purposes v1.1.1 - 2011-06-17 
 * http://www.mmc-agentur.at
 * 
 * Copyright (c) 2011 DaR David Rerych - mmc:agentur
 */
(function($){var instanceId=0;function log(msg){if(window.console&&window.console.log){window.console.log(msg)}}String.prototype.betterMatch=function(pattern){var matcharray=[];var match=pattern.exec(this);while(match){matcharray.push(match);match=pattern.exec(this)}return matcharray};RegExp.escape=function(str){var specials=new RegExp("[.*+?|()\\[\\]{}\\\\]","g");return str.replace(specials,"\\$&")};var parseMarkup=function(markup){var $el=this;var markers=markup.betterMatch(/\{(.+?)\}/g);for(var i=0;i<markers.length;i++){var marker=markers[i][0];var marker_inner=markers[i][1];var marker_fragments=marker_inner.split('|');var newcontent='';for(var j=0;j<marker_fragments.length;j++){var marker_fragment_fragments=marker_fragments[j].split('.');var marker_fragment_type=marker_fragment_fragments.shift();var marker_fragment_marker=marker_fragment_fragments.join('.');if(marker_fragment_type=='attr'){newcontent=$el.attr(marker_fragment_marker)}else if(marker_fragment_type=='data'){newcontent=eval('$el.o.'+marker_fragment_marker)}if(newcontent){break}}var regexp=new RegExp(RegExp.escape(marker));markup=markup.replace(regexp,newcontent)}return markup};var methods={init:function(options){var This=this;this.instanceId=instanceId++;var defaults={appendToDomElement:'body',labels:{close:'schlie&szlig;en',next:'weiter',prev:'zur&uuml;ck',of:'von',download:'Download'},classes:{overlay:'mediabox-overlay',container:'mediabox-container',innerWrapper:'mediabox-innerwrapper',content:'mediabox-content',infoArea:'mediabox-infoarea',closeBtn:'mediabox-closebtn',hoverNav:'mediabox-hovernav',downloadLink:'mediabox-download',infoAreaNavigation:'mediabox-navigation'},containerFadeDuration:100,contentFadeDuration:400,resizeDuration:400,fitToScreen:true,viewportPadding:10,initialWidth:200,initialHeight:200,width:null,height:null,modal:true,onAction:function(evt,$el){},onResizeReady:function(width,height){},onOpen:function(){},onInitReady:function(){},classPrefix:null,downloadURL:null,overrideHref:null,params:{'wmode':'transparent','allowscriptaccess':'always'},flashvars:null,attributes:null,mediaelement:{features:['playpause','current','progress','duration','volume','fullscreen'],plugins:['flash','silverlight'],pluginPath:'/fileadmin/system/assets/js/mediaelement/',flashName:'flashmediaelement.swf',silverlightName:'silverlightmediaelement.xap'},infoArea:{counter:function($el){var hidden_class=this.currentImageset.length==1?'hidden':'';var infoAreaCounter='<span class="numberDisplay '+hidden_class+'"><span class="current">'+parseInt($el.idx+1,10)+'</span>&nbsp;'+$el.o.labels.of+'&nbsp;<span class="total">'+this.currentImageset.length+'</span></span>';return infoAreaCounter},title:function($el){var title=$el.attr('title');var titleHtml='';if(typeof title!=='undefined'){titleHtml=' <span class="title">'+title+'</span>'}return titleHtml},navigation:function($el){var hidden_class=this.currentImageset.length==1?'hidden':'';var infoAreaNavigation='<span class="'+$el.o.classes.infoAreaNavigation+'"><span class="prev '+hidden_class+'">'+$el.o.labels.prev+'</span> <span class="next '+hidden_class+'">'+$el.o.labels.next+'</span> '+'<span class="close">'+$el.o.labels.close+'</span></span>';return infoAreaNavigation},downloadLink:function($el){var downloadLink='';if($el.o.downloadURL){downloadLink='<a href="'+$el.o.downloadURL+'" class="'+$el.o.classes.downloadLink+'">'+$el.o.labels.download+'</a>'}return downloadLink}},onInfoAreaReady:function($infoArea){},type:null,types:{'image':{markup:'<img src="{data.overrideHref|attr.href}" alt="{attr.title}" /><div class="{data.classes.hoverNav}"><div class="next">{data.labels.next}</div><div class="prev">{data.labels.prev}</div></div>',fileExtensions:['jpg','jpeg','png','gif'],loadContentFn:function($el,type){var This=this;var href=$el.o.href;var typeOpts=$el.o.types[type];var imageLoader=new Image();var $image=This.$content.find('img').hide();var $loading=This.$content.find('.loading').show();var $infoAreaTitle=this.$infoArea.find('.title').hide();imageLoader.onload=function(){var imgWidth=$el.o.width?$el.o.width:imageLoader.width;var imgHeight=$el.o.height?$el.o.height:imageLoader.height;methods.resize.call(This,imgWidth,imgHeight,null,$el.o,function(){$loading.hide();$image.attr('src',href).hide().add($infoAreaTitle).fadeIn($el.o.contentFadeDuration).css({'width':'100%','height':'100%'})})};imageLoader.src=href}},'video':{markup:'<video width="{data.width}" height="{data.height}" controls="controls" preload="none"><source src="{data.overrideHref|attr.href}" type="{data.videoType}" /></video>',fileExtensions:['mp4','m4v','ogv','webm','flv'],width:600,height:338,loadContentFn:function($el,type){var This=this;var href=$el.o.href;var itemOpts=$el.o;var typeOpts=itemOpts.types[type];var $video=This.$content.find('video').hide();var $loading=This.$content.find('.loading').show();var $infoAreaTitle=this.$infoArea.find('.title').hide();if($el.o.additionalVideoTypes){$.each($el.o.additionalVideoTypes,function(idx,val){$video.append('<source src="'+val+'" type="'+idx+'" />')})}var width=$el.o.width?$el.o.width:$el.o.types[type].width;var height=$el.o.height?$el.o.height:$el.o.types[type].height;methods.resize.call(This,width,height,null,$el.o,function(w,h){$video.attr('width',w);$video.attr('height',h);$video.fadeIn($el.o.contentFadeDuration);$loading.hide();if(typeof MediaElementPlayer!=='undefined'){var videoPlayer=new MediaElementPlayer($video,$el.o.mediaelement);$(videoPlayer.container).add($infoAreaTitle).hide().fadeIn($el.o.contentFadeDuration)}})}},'swf':{markup:'<object type="application/x-shockwave-flash" data="{data.swfPath}{data.overrideHref|attr.href}" width="100%" height="100%"><param name="movie" value="{data.swfPath}{data.overrideHref|attr.href}" /><a href="http://get.adobe.com/flashplayer/">Download Adobe&reg; Flash&reg; Player</a></object>',fileExtensions:['swf'],width:800,height:600,loadContentFn:function($el,type){var This=this;var href=$el.o.href;var itemOpts=$el.o;var typeOpts=itemOpts.types[type];var width=$el.o.width?$el.o.width:$el.o.types[type].width;var height=$el.o.height?$el.o.height:$el.o.types[type].height;var $loading=this.$content.find('.loading').show();var $object=this.$content.find('object').hide();var $infoAreaTitle=this.$infoArea.find('.title').hide();var flashvars=$el.o.flashvars?$.param($el.o.flashvars):'';var params='';if($el.o.params){$.each($el.o.params,function(idx,val){params+='<param name="'+idx+'" content="'+val+'" />'})}if($el.o.attributes){$.each($el.o.attributes,function(idx,val){$object.attr(idx,val)})}$object.append('<param name="flashvars" content="'+flashvars+'" />'+params);methods.resize.call(This,width,height,null,$el.o,function(){$loading.hide();$object.show();$infoAreaTitle.fadeIn($el.o.contentFadeDuration)})}},'iframe':{markup:'<iframe src="{data.overrideHref|attr.href}" scrolling="{data.scrolling}" frameborder="0" allowtransparency="true"></iframe>',fileExtensions:['html','htm'],width:800,height:600,loadContentFn:function($el,type){var This=this;var width=$el.o.width?$el.o.width:$el.o.types[type].width;var height=$el.o.height?$el.o.height:$el.o.types[type].height;var $loading=this.$content.find('.loading').show();var $iframe=this.$content.find('iframe');var $infoAreaTitle=this.$infoArea.find('.title').hide();$iframe.hide();$iframe.load(function(){methods.resize.call(This,width,height,null,$el.o,function(width,height){$iframe.width(width).height(height).attr('width',width).attr('height',height);$loading.hide();$iframe.add($infoAreaTitle).fadeIn($el.o.contentFadeDuration)})})}},'ajax':{markup:'<div class="ajax-container"></div>',fileExtensions:[],width:800,height:600,loadContentFn:function($el,type){var This=this;var href=$el.o.href;var ajaxURL=$el.o.fragment?href+' '+$el.o.fragment:href;var width=$el.o.width?$el.o.width:$el.o.types[type].width;var height=$el.o.height?$el.o.height:$el.o.types[type].height;var $loading=this.$content.find('.loading').show();var $ajaxContainer=this.$content.find('.ajax-container');var $infoAreaTitle=this.$infoArea.find('.title').hide();$ajaxContainer.hide();$ajaxContainer.load(ajaxURL,function(){methods.resize.call(This,width,height,null,$el.o,function(w,h){$ajaxContainer.add($infoAreaTitle).fadeIn($el.o.contentFadeDuration).width(w).height(h);$loading.hide()})})}}}};this.mainOpts=$.extend(true,{},defaults,options);$.each(this.mainOpts.classes,function(idx,val){if(This.mainOpts.classPrefix!==null){This.mainOpts.classes[idx]+=' '+This.mainOpts.classPrefix+val}});methods.buildMarkup.apply(this);This.isOpen=false;this.$overlay.click(function(e){e.preventDefault();methods.close.call(This);return false});$(window).bind('resize',function(){methods.reposition.call(This)});this.allItems=[];this.allImagesets=[];this.each(function(){var $el=$(this);$el.o=$.metadata?$.extend({},This.mainOpts,$el.metadata()):This.mainOpts;var imagesetString=$el.attr('rel');var imagesetId=$.inArray(imagesetString,This.allImagesets);if(imagesetId<0){imagesetId=This.allImagesets.length;This.allImagesets.push(imagesetString);This.allItems[imagesetId]=[]}$el.imagesetId=imagesetId;$el.idx=This.allItems[imagesetId].length;$el.click(function(e){e.preventDefault();e.stopPropagation();methods.open.call(This,$el);return false});This.allItems[imagesetId].push($el)});function checkHash(){var mmcMediaboxHash=$.bbq.getState('mmcMediabox');if(typeof mmcMediaboxHash!=='undefined'&&mmcMediaboxHash!==''){var fragments=decodeURIComponent(mmcMediaboxHash).split(';');var instanceId=parseInt(fragments[0],10);var imagesetId=parseInt(fragments[1],10);var itemId=parseInt(fragments[2],10);if(This.instanceId==instanceId){if(This.allItems[imagesetId]){if(!This.isOpen){methods.open.call(This,This.allItems[imagesetId][itemId])}else{if(This.current!=itemId){methods.loadContent.call(This,This.allItems[imagesetId][itemId])}}}else{log('no Imageset with this id')}}}}if($.bbq){checkHash();$(window).bind('hashchange',checkHash)}This.mainOpts.onInitReady.call(This);return this},buildMarkup:function(){var This=this;var classes=this.mainOpts.classes;this.$overlay=$('<div class="'+classes.overlay+'"></div>').appendTo(this.mainOpts.appendToDomElement);this.$container=$('<div class="'+classes.container+'"></div>').insertAfter(this.$overlay);this.$innerWrapper=$('<div class="'+classes.innerWrapper+'"></div>').appendTo(this.$container);this.$content=$('<div class="'+classes.content+'"></div>').appendTo(this.$innerWrapper);this.$infoArea=$('<div class="'+classes.infoArea+'"></div>').appendTo(this.$innerWrapper);this.$closeBtn=$('<div class="close">'+this.mainOpts.labels.close+'</div>').appendTo(this.$container);this.emptyOuterWidth=this.$container.outerWidth();this.emptyOuterHeight=this.$container.outerHeight();this.$overlay.add(this.$container).hide()},reposition:function($el){$el=$el?$el:false;var This=this;this.viewport={};this.viewport.width=$(window).width();this.viewport.height=$(window).height();this.document={};this.document.width=$(document).width();this.document.height=$(document).height();this.$overlay.width(this.document.width).height(this.document.height)},removeMarkup:function(){this.$overlay.add(this.$container).remove()},destroy:function(){methods.removeMarkup.call(this);$(this).unbind('click')},open:function($el){var This=this;$el=$el?$el:this.allItems[0][0];this.current=$el.idx;This.currentImageset=This.allItems[$el.imagesetId];methods.reposition.call(This,$el);if(This.mainOpts.modal){This.$overlay.show()}var currentWidth=parseInt(This.$content.css('width'),10);var currentHeight=parseInt(This.$content.css('height'),10);var newWidth=currentWidth>0?currentWidth:This.mainOpts.initialWidth;var newHeight=currentHeight>0?currentHeight:This.mainOpts.initialHeight;newWidth=$el&&$el.o.width?$el.o.width:newWidth;newHeight=$el&&$el.o.height?$el.o.height:newHeight;methods.resize.call(This,newWidth,newHeight,0,null);This.$container.fadeIn(This.mainOpts.containerFadeDuration,function(){methods.loadContent.call(This,$el)});document.onkeydown=function(evt){methods.keyboardAction.call(This,evt)};this.isOpen=true;this.mainOpts.onAction.call(this,'open',$el)},close:function(){var $el=this.currentImageset[this.current];this.$overlay.hide();this.$container.fadeOut(this.mainOpts.containerFadeDuration);this.$content.html('');var url_states={'mmcMediabox':''};$.bbq.pushState(url_states);this.mainOpts.onAction.call(this,'close',$el);document.onkeydown='';this.isOpen=false},next:function(){if(this.current+1<this.currentImageset.length){var $el=this.currentImageset[this.current+1];methods.loadContent.call(this,$el);this.mainOpts.onAction.call(this,'next',$el)}},prev:function(){if(this.current>0){var $el=this.currentImageset[this.current-1];methods.loadContent.call(this,$el);this.mainOpts.onAction.call(this,'prev',$el)}},keyboardAction:function(e){var This=this;var keycode,escapeKey;if(e===null){keycode=event.keyCode;escapeKey=27}else{keycode=e.keyCode;escapeKey=e.DOM_VK_ESCAPE}var key=String.fromCharCode(keycode).toLowerCase();if((key=='x')||(key=='o')||(key=='c')||(keycode==escapeKey)){methods.close.call(This)}else if((key=='p')||(keycode==37)){methods.prev.call(This)}else if((key=='n')||(keycode==39)){methods.next.call(This)}},loadContent:function($el,event){this.current=$el.idx;var This=this;event=event?event:null;var href=$el.o.overrideHref?$el.o.overrideHref:$el.attr('href');$el.o.href=href;var fileExtension=(/[.]/.exec(href))?/[^.]+$/.exec(href)+'':undefined;fileExtension=fileExtension.toLowerCase();var type='';if($el.o.type===null){type='iframe';$.each($el.o.types,function(idx,val){if($.inArray(fileExtension,val.fileExtensions)>-1){type=idx;return}})}else{type=$el.o.type}$el.type=type;var availableTypes=[];$.each($el.o.types,function(idx,val){availableTypes.push(idx)});if($.bbq){var url_states={'mmcMediabox':This.instanceId+';'+$el.imagesetId+';'+$el.idx};$.bbq.pushState(url_states)}var infoAreaContent='';$.each(this.mainOpts.infoArea,function(idx,val){infoAreaContent+=val.call(This,$el)});this.$infoArea.html(infoAreaContent);this.mainOpts.onInfoAreaReady.call(this,this.$infoArea);This.$content.removeClass(availableTypes.join(' '));var parsedMarkup=parseMarkup.call($el,$el.o.types[type].markup);This.$content.addClass(type).html(parsedMarkup+'<div class="loading" style="display:none;"></div>');this.$next=this.$container.find('.next').unbind('click').bind('click',function(e){e.preventDefault();methods.next.call(This);return false});this.$prev=this.$container.find('.prev').unbind('click').bind('click',function(e){e.preventDefault();methods.prev.call(This);return false});this.$closeBtn=this.$container.find('.close').unbind('click').bind('click',function(e){e.preventDefault();methods.close.call(This);return false});if(this.current+1<this.currentImageset.length){this.$next.removeClass('disabled')}else{this.$next.addClass('disabled')}if(this.current>0){this.$prev.removeClass('disabled')}else{this.$prev.addClass('disabled')}$el.o.types[type].loadContentFn.call(This,$el,type)},resize:function(newWidth,newHeight,duration,opts,callbackFn){var This=this;opts=opts?opts:This.mainOpts;duration=duration?duration:opts.resizeDuration;callbackFn=callbackFn?callbackFn:function(){};newWidth=parseInt(newWidth,10);newHeight=parseInt(newHeight,10);var horizontalPadding=this.emptyOuterWidth;var verticalPadding=this.emptyOuterHeight;if(opts.fitToScreen){var maxWidth=This.viewport.width-opts.viewportPadding*2-horizontalPadding;var maxHeight=This.viewport.height-opts.viewportPadding*2-verticalPadding;if((newWidth/newHeight)>(maxWidth/maxHeight)){if(newWidth>maxWidth){newHeight=newHeight*(maxWidth/newWidth);newWidth=maxWidth}}else{if(newHeight>maxHeight){newWidth=newWidth*(maxHeight/newHeight);newHeight=maxHeight}}}var currentWidth=parseInt(This.$content.css('width'),10);var currentHeight=parseInt(This.$content.css('height'),10);if(currentWidth==newWidth&&currentHeight==newHeight){duration=0}This.$content.animate({'width':newWidth+'px','height':newHeight+'px'},duration,function(){callbackFn.call(This,newWidth,newHeight);This.mainOpts.onResizeReady.call(This,newWidth,newHeight)}).css('overflow','visible');var newLeft=(This.viewport.width-newWidth-horizontalPadding)/2+$(window).scrollLeft();var newTop=(This.viewport.height-newHeight-verticalPadding)/2+$(window).scrollTop();newLeft=newLeft<0?opts.viewportPadding:newLeft;newTop=newTop<0?opts.viewportPadding:newTop;This.$container.animate({'top':newTop+'px','left':newLeft+'px'},duration).css('overflow','visible')}};$.fn.mmcMediabox=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof method==='object'||!method){return methods.init.apply(this,arguments)}else{$.error('Method '+method+' does not exist on mmc-mediabox')}}})(jQuery);
