/* created_at: 2012-02-11 02:30:03 */
try { console.log(); } catch(e) { console = { log: function() {} } };
// Global functions for cookie handling

function setCookie(name,value,seconds) {
  if (seconds) {
    var date = new Date();
    date.setTime(date.getTime()+(seconds*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function getCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function deleteCookie(name) {
  setCookie(name,"",-1);
}/*
	ColorBox v1.1.1 - a full featured, light-weight, customizable lightbox based on jQuery 1.3
	(c) 2009 Jack Moore - www.colorpowered.com - jack@colorpowered.com
	Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/

jQuery(document).ready(function($){
	
	var clone, loadedWidth, loadedHeight, interfaceHeight, interfaceWidth, index, related, closeModal, loadingElement, modal, modalWrap, modalOverlay, modalLoadingOverlay, modalContent, loaded, modalClose, btc, bml, bmr, bbc;
	function setModalOverlay(){
		$([modalOverlay]).css({"position":"absolute", width:$(window).width(), height:$(window).height(), top:$(window).scrollTop(), left:$(window).scrollLeft()});
	}
	function keypressEvents(e){
		if(e.keyCode == 37){
			$(document).unbind('keydown', keypressEvents);
			$("a#contentPrevious").click();
		}
		else if(e.keyCode == 39){
			$(document).unbind('keydown', keypressEvents);
			$("a#contentNext").click();
		}
	}
	closeModal = function(){
		if($("#colorboxInlineTemp").length > 0){
			$(loaded).children().insertAfter("#colorboxInlineTemp");
		}
		$([modalOverlay, modal]).css({cursor:"auto"}).fadeOut("fast", function(){
			$(loaded).remove();
			$(modal).removeData("open");
		});
		if(loadingElement){$(loadingElement).remove();}
		$(document).unbind('keydown', keypressEvents);
		$(window).unbind('resize scroll', setModalOverlay);
	};
	// Convert % values to pixels
	function setSize(size, dimension){
		return (typeof size == 'string') ? (size.match(/%/) ? (dimension/100)*parseInt(size, 10) : parseInt(size, 10)) : size;
	}

	//Initialize the modal: store common calculations, preload the interface graphics, append the html.
	$(function(){
		$("body").append(
			$([
				modalOverlay = $('<div id="modalBackgroundOverlay" />')[0], 
				modal = $('<div id="colorbox" />')[0]
			]).hide()
		);
		$(modal).append(
			$([
				modalWrap = $('<div id="modalWrap" />')[0]
			])
		);
		$(modalWrap).append(
			$([
				$('<div><div id="borderTopLeft"></div><div id="borderTopCenter"></div><div id="borderTopRight"></div></div>')[0],
				bml = $('<div id="borderMiddleLeft" />')[0],
				modalContent = $('<div id="modalContent" />')[0],
				bmr = $('<div id="borderMiddleRight" />')[0],
				$('<div><div id="borderBottomLeft"></div><div id="borderBottomCenter"></div><div id="borderBottomRight"></div></div>')[0]
			])
		);
		$(modalContent).append(
			$([
				loaded = $('<div id="modalLoadedContent"><a id="contentPrevious" href="#"></a><a id="contentNext" href="#"></a><span id="contentCurrent"></span><br id="modalInfoBr"/><span id="contentTitle"></span><div id="preloadPrevious"></div><div id="preloadNext"></div><div id="preloadClose"></div></div>')[0], 
				modalLoadingOverlay = $('<div id="modalLoadingOverlay" />')[0],
				modalClose = $('<a id="modalClose" href="#"></a>')[0]
			])
		);
		$(modalClose).click(function(){
			closeModal();
			
			return false;
		});

		btc = $("#borderTopCenter")[0];
		bbc = $("#borderBottomCenter")[0];

		$(document).bind('keydown', function(e){if(e.keyCode == 27){closeModal();}});

		$(modal).css("opacity", 0).show();

		interfaceHeight = $(btc).height()+$(bbc).height()+$(modalContent).outerHeight(true) - $(modalContent).height();//Subtraction needed for IE6
		interfaceWidth = $(bml).width()+$(bmr).width()+$(modalContent).outerWidth(true) - $(modalContent).width();

		loadedHeight = $(loaded).outerHeight(true);
		loadedWidth = $(loaded).outerWidth(true);
		$(loaded).empty();
		$(modal).css({"padding-bottom":interfaceHeight,"padding-right":interfaceWidth}).hide();//the padding removes the need to do size conversions during the animation step.
	});

	$.fn.colorbox = function(settings, callback) {
		settings = $.extend({}, $.fn.colorbox.settings, settings);
		//sets the position of the modal on screen.  A transition speed of 0 will result in no animation.
		function modalPosition(mWidth, mHeight, speed, loadedCallback){

			var winHeight = document.documentElement.clientHeight;
			var posTop = winHeight/2 - mHeight/2 + $(window).scrollTop();
			var posLeft = document.documentElement.clientWidth/2 - mWidth/2 + $(window).scrollLeft();
			//keeps the box from expanding to an inaccessible area offscreen.
			if(mHeight > winHeight){posTop -=(mHeight - winHeight);}
			if(posTop < 0){posTop = 0;} 
			if(posLeft < 0){posLeft = 0;}

			mWidth = mWidth - interfaceWidth;
			mHeight = mHeight - interfaceHeight;

			function modalDimensions(that){
				modalContent.style.width = btc.style.width = bbc.style.width = that.style.width;
				modalContent.style.height = bml.style.height = bmr.style.height = that.style.height;
			}
			$(modal).animate({height:mHeight, width:mWidth, top:posTop, left:posLeft}, {duration: speed,
				complete: function(){
					if (loadedCallback) {loadedCallback();}
					modalDimensions(this);
					$(document).bind('keydown', keypressEvents);
					if ($.browser.msie && $.browser.version < 7) {setModalOverlay();}
				},
				step: function(){
					modalDimensions(this);		
				}
			});
		}
		var preloads = [];
		function preload(){
			if(settings.preloading !== false && related.length>1){
				var previous, next;
				previous = index > 0 ? related[index-1].href : related[related.length-1].href;
				next = index < related.length-1 ? related[index+1].href : related[0].href;
				return [$("<img />").attr("src", next), $("<img />").attr("src", previous)];
			}
		}
		function centerModal(object, contentInfo){
			var speed = settings.transition=="none" ? 0 : settings.transitionSpeed;
			$(loaded).remove();
			loaded = $(object)[0];
			$(loaded).hide().appendTo('body').css({width:(settings.fixedWidth)?settings.fixedWidth - loadedWidth - interfaceWidth:$(loaded).width()}).css({height:(settings.fixedHeight)?settings.fixedHeight - loadedHeight - interfaceHeight:$(loaded).height()})
			.attr({id:"modalLoadedContent"}).append(contentInfo).prependTo($(modalContent));

			function setPosition(s){
				modalPosition(parseInt(loaded.style.width, 10)+loadedWidth+interfaceWidth, parseInt(loaded.style.height, 10)+loadedHeight+interfaceHeight, s, function(){
					$(loaded).show();
					$(modalLoadingOverlay).hide();
					if (callback) {callback();}
					if (settings.transition == "fade"){$(modal).animate({"opacity":1}, speed);}
				});
			}
			if (settings.transition == "fade") {
				$(modal).animate({"opacity":0}, speed, function(){setPosition(0);});
			} else {
				setPosition(speed);
			}
			//var preloads = preload();
		}

		function buildGallery(that){
			var href = settings.href ? settings.href : that.href;

			var info = that.title.split("|");


			var contentInfo = "<p id='contentTitle'>";
			if (info[0]){
				contentInfo += info[0] + "<br />";
			}
			if (info[1]){
				contentInfo += "<span style='font-weight:normal;'>" + info[1] + "</span>";
			}
			contentInfo += "</p>";
			if(related.length>1){
				//contentInfo += "<span id='contentCurrent'> " + settings.contentCurrent + "</span>";
				contentInfo = contentInfo.replace(/\{current\}/, index+1).replace(/\{total\}/, related.length);
				contentInfo += "<a id='contentPrevious' href='#'>"+settings.contentPrevious+"</a><a id='contentNext' href='#'>"+settings.contentNext+"</a> ";
			}
			if (settings.inline) {
				loadingElement = $('<div id="colorboxInlineTemp" />').hide().insertBefore($(href)[0]);
				clone = $(href).clone(true);
				centerModal($(href).wrapAll("<div></div>").parent(), contentInfo);
			} else if (settings.iframe) {
				centerModal($("<div><iframe name='iframe_"+new Date().getTime()+" 'frameborder=0 src =" + href + "></iframe></div>"), contentInfo);//timestamp to prevent caching.
			} else if (href.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(.*))?$/i)){
				loadingElement = $("<img id='modalPhoto' "+((related.length > 1)?"style='cursor:pointer;' class='modalPhoto'":"")+" alt='' />").load(function(){
					centerModal($("<div style='display: table-cell; vertical-align: middle; position: static;' />").append($(this)), contentInfo);
				}).attr("src",href);
			}else {
				loadingElement = $('<div></div>').load(href, function(data, textStatus){
					if(textStatus == "success"){
						centerModal($(this), contentInfo);
					} else {
						centerModal($("<p>Request unsuccessful.</p>"));
					}
				});
			}
		}

		function contentNav(){
			$(modalLoadingOverlay).show();
			if($(this).attr("id") == "contentPrevious"){
				index = index > 0 ? index-1 : related.length-1;
			} else {
				index = index < related.length-1 ? index+1 : 0;
			}
			buildGallery(related[index]);
			
			// aktion: bildwechsel
			if(typeof(settings.trackContent) != 'object' && settings.trackContent !== false){
				laut.trackClick('wl_foto','foto');
			}
			else
			{
				laut.trackClick(settings.trackContent[0], settings.trackContent[1]);
			}
			
			return false;
		}

		$(this).bind("click.colorbox", function () {
			if ($(modal).data("open") !== true) {
				$(modal).data("open", true);

				if(settings.fixedWidth){ settings.fixedWidth = setSize(settings.fixedWidth, document.documentElement.clientWidth);}
				if(settings.fixedHeight){ settings.fixedHeight = setSize(settings.fixedHeight, document.documentElement.clientHeight);}
				$(modalClose).html(settings.modalClose);
				$(modalOverlay).css({"opacity": settings.bgOpacity});
				$([modal, modalLoadingOverlay, modalOverlay]).show();
				modalPosition(setSize(settings.initialWidth, document.documentElement.clientWidth), setSize(settings.initialHeight, document.documentElement.clientHeight), 0);
				if (this.rel && 'nofollow' != this.rel) {
					related = $("a[rel='" + this.rel + "']");
					index = $(related).index(this);
				}
				else {
					related = $(this);
					index = 0;
				}
				$(modal).css({"opacity":1});
				buildGallery(related[index]);
				$("a#contentPrevious, a#contentNext, .modalPhoto").die().live("click", contentNav);
				$(document).bind('keydown', keypressEvents);
				if ($.browser.msie && $.browser.version < 7) {
					$(window).bind("resize scroll", setModalOverlay);
				}
			}
			if(settings.overlayClose!==false){
				$(modalOverlay).css({"cursor":"pointer"}).click(function(){closeModal();});
			}
			
			// aktion: galerie oeffnen
			if(typeof(settings.trackOpen) != 'object' && settings.trackOpen !== false){
				laut.trackClick('wl_foto','galerie');
			}
			else
			{
				laut.trackClick(settings.trackOpen[0], settings.trackOpen[1]);
			}
			
			$('#modalClose, #modalBackgroundOverlay').die('mousedown');
			$('#modalClose, #modalBackgroundOverlay').live('mousedown', function(){
				// aktion: galerie schliessen
				if(typeof(settings.trackClose) != 'object' && settings.trackClose !== false){
					laut.trackClick('wl_foto','galeriex');
				}
				else
				{
					laut.trackClick(settings.trackClose[0], settings.trackClose[1]);
				}
			});
			
			return false;
		});
		
		
		
		if(settings.open!==false && $(modal).data("open")!==true){
			$(this).triggerHandler('click.colorbox');
		}

		return this.each(function() { 
		});
	};

	/*
		ColorBox Default Settings.

		The colorbox() function takes one argument, an object of key/value pairs, that are used to initialize the modal.

		Please do not change these settings here, instead overwrite these settings when attaching the colorbox() event to your anchors.
		Example (Global)	: $.fn.colorbox.settings.transition = "fade"; //changes the transition to fade for all colorBox() events proceeding it's declaration.
		Example (Specific)	: $("a[href='http://www.google.com']").colorbox({fixedWidth:"90%", fixedHeight:"450px", iframe:true});
	*/
	$.fn.colorbox.settings = {
		transition : "elastic", // Transition types: "elastic", "fade", or "none".
		transitionSpeed : 350, // Sets the speed of the fade and elastic transitions, in milliseconds.
		initialWidth : "400", // Set the initial width of the modal, prior to any content being loaded.
		initialHeight : "400", // Set the initial height of the modal, prior to any content being loaded.
		fixedWidth : false, // Set a fixed width for div#loaded.  Example: "500px"
		fixedHeight : false, // Set a fixed height for div#modalLoadedContent.  Example: "500px"
		inline : false, // Set this to the selector of inline content to be displayed.  Example "#myHiddenDiv" or "body p".
		iframe : false, // If 'true' specifies that content should be displayed in an iFrame.
		href : false, // This can be used as an alternate anchor URL for ColorBox to use, or can be used to assign a URL for non-anchor elments such as images or form buttons.
		bgOpacity : 0.85, // The modalBackgroundOverlay opacity level. Range: 0 to 1.
		preloading : true, // Allows for preloading of 'Next' and 'Previous' content in a shared relation group (same values for the 'rel' attribute), after the current content has finished loading.  Set to 'false' to disable.
		contentCurrent : "image {current} of {total}", // the format of the contentCurrent information
		contentPrevious : "previous", // the anchor text for the previous link in a shared relation group (same values for 'rel').
		contentNext : "next", // the anchor text for the next link in a shared relation group (same 'rel' attribute').
		modalClose : "close", // the anchor text for the close link.  Esc will also close the modal.
		open : false, //Automatically opens ColorBox. (fires the click.colorbox event without waiting for user input).
		overlayClose : true  //If true, enables closing ColorBox by clicking on the background overlay.
	};

});
/*!
 * jQuery UI 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
 * jQuery UI Widget 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*!
 * jQuery UI Mouse 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
;/*
 * jQuery UI Slider 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Slider
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
this.handles=c.add(d(e.join("")).appendTo(a.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle",
g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!a.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");i=a._start(g,l);if(i===false)return}break}m=a.options.step;i=a.options.values&&a.options.values.length?
(h=a.values(l)):(h=a.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=a._valueMin();break;case d.ui.keyCode.END:h=a._valueMax();break;case d.ui.keyCode.PAGE_UP:h=a._trimAlignValue(i+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=a._trimAlignValue(i-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===a._valueMax())return;h=a._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===a._valueMin())return;h=a._trimAlignValue(i-
m);break}a._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(g,k);a._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();
return this},_mouseCapture:function(a){var b=this.options,c,f,e,j,g;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(b.range===true&&this.values(1)===b.min){g+=1;e=d(this.handles[g])}if(this._start(a,g)===false)return false;
this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();b=e.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-e.width()/2,top:a.pageY-b.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(a){var b=
this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;if(this.orientation==="horizontal"){b=
this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);
c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var f;if(this.options.values&&this.options.values.length){f=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>f||b===1&&c<f))c=f;if(c!==this.values(b)){f=this.values();f[b]=c;a=this._trigger("slide",a,{handle:this.handles[b],value:c,values:f});this.values(b?0:1);a!==false&&this.values(b,c,true)}}else if(c!==this.value()){a=this._trigger("slide",a,{handle:this.handles[b],value:c});
a!==false&&this.value(c)}},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=
this._trimAlignValue(a);this._refreshValue();this._change(null,0)}else return this._value()},values:function(a,b){var c,f,e;if(arguments.length>1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e<c.length;e+=1){c[e]=this._trimAlignValue(f[e]);this._change(null,e)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):
this.value();else return this._values()},_setOption:function(a,b){var c,f=0;if(d.isArray(this.options.values))f=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":if(b){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.propAttr("disabled",true);this.element.addClass("ui-disabled")}else{this.handles.propAttr("disabled",false);this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<f;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var b,c;if(arguments.length){b=this.options.values[a];
return b=this._trimAlignValue(b)}else{b=this.options.values.slice();for(c=0;c<b.length;c+=1)b[c]=this._trimAlignValue(b[c]);return b}},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=
this.options.range,b=this.options,c=this,f=!this._animateOff?b.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({width:e-
g+"%"},{queue:false,duration:b.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:b.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[f?"animate":"css"]({width:e+"%"},
b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.16"})})(jQuery);
;/**
* jQuery.smoothDivScroll - Smooth div scrolling using jQuery.
* This plugin is for turning a set of DIV's into a smooth scrolling area.
*
* Copyright (c) 2009 Thomas Kahn - thomas.kahn(at)karnhuset(dot)net
*
* This plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details. <http://www.gnu.org/licenses/>.
*
* Date: 2009-03-26
* @author Thomas Kahn
* @version 0.7
*
* Changelog
* ---------------------------------------------
* 0.7 - Added support for autoscrolling after the page has loaded. 
*       Added support for making the hotspots visible at start for X number of seconds
*       or visible all the time.
*
* 0.6 - First version.
*/

jQuery(document).ready(function($) { 

		jQuery.fn.smoothDivScroll = function(options){

			var defaults = {
			scrollingHotSpotLeft: "div.scrollingHotSpotLeft", // The hotspot that triggers scrolling left
			scrollingHotSpotRight: "div.scrollingHotSpotRight", // The hotspot that triggers scrolling right
			scrollWrapper: "div.scrollWrapper", // The wrapper element that surrounds the scrollable area
			scrollableArea: "div.scrollableArea", // The actual element that is scrolled left or right
			hiddenOnStart: false, // True or false. Determines whether the element should be visible or hidden on start
			ajaxContentURL: "", // Optional. If supplied, content is fetched through AJAX using the supplied URL
			countOnlyClass: "", // Optional. If supplied, the function that calculates the width of the scrollable area will only count elements of this class
			mouseDownSpeedBooster: 0.25, // 1 is normal speed (no speed boost), 2 is twice as fast, 3 is three times as fast, and so on
			autoScrollOnStart: false, // True or false. Determines if scrolling right should start automatically after the page has loaded . The scrollable area will keep on scrolling until the user moves the mouse over the left or right hotspot
			autoScrollSpeed: 1, //  1-2 = slow, 3-4 = medium, 5-13 = fast -- anything higher = superfast
			visibleHotSpots: "", // Optional. Leave it blank for invisible hotspots. Otherwise use the values onstart or always. Onstart makes the hotspots visible for X-number of seconds after tha page has loaded and then they become invisible. Always is for making them visible all the time.
			hotSpotsVisibleTime: 5 // If you have selected onstart, you set the number of seconds that you want the hotspots to be visible. After this time they will become invisible again.
			};

			options = $.extend(defaults, options);

			/* Identify global variables so JSLint won't raise errors when verifying the code */
			/*global autoScrollInterval, autoScrollRight, clearInterval, doScrollLeft, doScrollRight, hideHotSpotBackgrounds, hideHotSpotBackgroundsInterval, hideLeftHotSpot, hideRightHotSpot, jQuery, makeHotSpotBackgroundsVisible, setHotSpotHeightForIE, setInterval, showHideHotSpots, window, windowIsResized */


			// Iterate and reformat each matched element
			return this.each(function() {

				// Create a variable for the current "mother element"
				var $mom = $(this);

				// Load the content of the scrollable area using the optional URL.
				// If no ajaxContentURL is supplied, we assume that the content of
				// the scrolling area is already in place
				/*
				if(options.ajaxContentURL.length !== 0){
					$mom.scrollableAreaWidth = 0;
					$mom.find(options.scrollableArea).load((options.ajaxContentURL), function(){	
						$mom.find(options.scrollableArea).children((options.countOnlyClass)).each(function() {
							$mom.scrollableAreaWidth = $mom.scrollableAreaWidth + $(this).outerWidth(true);
						});

						// Set the width of the scrollable area
						$mom.find(options.scrollableArea).css("width", ($mom.scrollableAreaWidth + "px"));

						// Hide the mother element if it shouldn't be visible on start
						if(options.hiddenOnStart) {
							$mom.hide();
						}

						windowIsResized();

						setHotSpotHeightForIE();
					});		
				}
				*/

				// Some variables used for working with the scrolling
				var scrollXpos;
				var booster;

				// The left offset of the container on which you place 
				// the scrolling behavior.
				// This offset is used when calculating the mouse x-position 
				// in relation to scroll hotspots
				var motherElementOffset = $mom.offset().left;

				// A variable used for storing the current hotspot width.
				// It is used when calculating the scroll speed
				var hotSpotWidth = 0;

				// Set the booster value to normal (doesn't change until the user
				// holds down the mouse button over one of the hotspots)
				booster = 0.25;

				// Stuff to do once on load
				//$(window).one("load", lautFotoInit);
				
				lautFotoInit();
				
				function lautFotoInit(){
					// If the content of the scrolling area is not loaded through ajax,
					// we assume it's already there and can run the code to calculate
					// the width of the scrolling area, resize it to that width
					if(options.ajaxContentURL.length === 0) {
						$mom.scrollableAreaWidth = 0;
						$mom.find(options.scrollableArea).children((options.countOnlyClass)).each(function() {
							$mom.scrollableAreaWidth = $mom.scrollableAreaWidth + $(this).outerWidth(true);
						});

						$mom.find(options.scrollableArea).css("width", $mom.scrollableAreaWidth + "px");

						if(options.hiddenOnStart) { 
							$mom.hide();
						}
					}
				}
				

				function makeHotSpotBackgroundsVisible()
				{
					// Alter the CSS (SmoothDivScroll.css) if you want to customize
					// the look of the visible hotspots

					// The left hotspot
					$mom.find(options.scrollingHotSpotLeft).addClass("scrollingHotSpotLeftVisible");

					// The right hotspot
					$mom.find(options.scrollingHotSpotRight).addClass("scrollingHotSpotRightVisible");
				}

				function hideHotSpotBackgrounds()
				{
					clearInterval(hideHotSpotBackgroundsInterval);

					// The left hotspot
					$mom.find(options.scrollingHotSpotLeft).fadeTo("slow", 0.0, function(){
						$mom.find(options.scrollingHotSpotLeft).removeClass("scrollingHotSpotLeftVisible");
					});

					// The right hotspot
					$mom.find(options.scrollingHotSpotRight).fadeTo("slow", 0.0, function(){
						$mom.find(options.scrollingHotSpotRight).removeClass("scrollingHotSpotRightVisible");
					});
				}

				// EVENT - window resize
				/*
				$(window).bind("resize",function(){
					windowIsResized();
				});
				*/

				// A function for doing the stuff that needs to be
				// done when the browser window is resized
				function windowIsResized()
				{
					// If the scrollable area is not hidden on start, reset and recalculate the
					// width of the scrollable area
					if(!(options.hiddenOnStart))
					{
						$mom.scrollableAreaWidth = 0;
						$mom.find(options.scrollableArea).children((options.countOnlyClass)).each(function() {
							$mom.scrollableAreaWidth = $mom.scrollableAreaWidth + $(this).outerWidth(true);
						});

						$mom.find(options.scrollableArea).css("width", $mom.scrollableAreaWidth + 'px');
					}

					// Reset the left offset of the scroll wrapper
					$mom.find(options.scrollWrapper).scrollLeft("0");

					// Get the width of the page (body)
					var bodyWidth = $("body").innerWidth();

					// If the scrollable area is shorter than the current
					// window width, both scroll hotspots should be hidden.
					// Otherwise, check which hotspots should be shown.
					if($mom.scrollableAreaWidth < bodyWidth)
					{	
						hideLeftHotSpot();
						hideRightHotSpot();
					}
					else
					{
						showHideHotSpots();
					}
				}

				// HELPER FUNCTIONS FOR SHOWING AND HIDING HOT SPOTS
				function hideLeftHotSpot(){
					$mom.find(options.scrollingHotSpotLeft).hide();
				}
				//hideLeftHotSpot();

				function hideRightHotSpot(){
					$mom.find(options.scrollingHotSpotRight).hide();
				}

				function showLeftHotSpot(){
					$mom.find(options.scrollingHotSpotLeft).show();
					// Recalculate the hotspot width. Do it here because you can
					// be sure that the hotspot is visible and has a width
					if(hotSpotWidth <= 0)
					{
						hotSpotWidth = $mom.find(options.scrollingHotSpotLeft).width();
					}
				}

				function showRightHotSpot(){
					$mom.find(options.scrollingHotSpotRight).show();
					// Recalculate the hotspot width. Do it here because you can
					// be sure that the hotspot is visible and has a width
					if(hotSpotWidth <= 0)
					{
						hotSpotWidth = $mom.find(options.scrollingHotSpotRight).width();
					}
				}

				function setHotSpotHeightForIE()
				{
					// Some bugfixing for IE 6
					jQuery.each(jQuery.browser, function(i, val) {
						if(i=="msie" && jQuery.browser.version.substr(0,1)=="6")
						{
							$mom.find(options.scrollingHotSpotLeft).css("height", ($mom.find(options.scrollableArea).innerHeight()));
							$mom.find(options.scrollingHotSpotRight).css("height", ($mom.find(options.scrollableArea).innerHeight()));						
						}
					});
				}


				/*
				$mom.find(options.scrollingHotSpotRight).bind('mousemove',function(e){
					var x = e.pageX - (this.offsetLeft + motherElementOffset);
					x = Math.round(x/(hotSpotWidth/15));
					scrollXpos = x;
				});
				// scrolling speed booster right
				$mom.find(options.scrollingHotSpotRight).bind('mousedown',function(e){
					booster = options.mouseDownSpeedBooster;
				});
				// stop boosting the scrolling speed
				$("*").bind('mouseup',function(e){
					booster = 0.25;
				});			
				// The function that autoscrolls right
				var autoScrollRight = function()
				{	
					$mom.find(options.scrollWrapper).scrollLeft($mom.find(options.scrollWrapper).scrollLeft() + options.autoScrollSpeed);
					showHideHotSpots();
				};
				// scrolling speed booster left
				$mom.find(options.scrollingHotSpotLeft).bind('mousedown',function(e){
					booster = options.mouseDownSpeedBooster;
				});

				// mousemove left hotspot
				$mom.find(options.scrollingHotSpotLeft).bind('mousemove',function(e){
					var x = $mom.find(options.scrollingHotSpotLeft).innerWidth() - (e.pageX - motherElementOffset);
					x = Math.round(x/(hotSpotWidth/15));
					scrollXpos = x;
				});						
				*/

				// EVENTS - scroll right
				var rightScrollInterval;

				// mouseover right hotspot
				$mom.find(options.scrollingHotSpotRight).bind('mouseover',function(e){
					if(options.autoScrollOnStart)
					{
						clearInterval(autoScrollInterval);
					}
					rightScrollInterval = setInterval(doScrollRight, 15);
				});	

				// mouseout right hotspot
				$mom.find(options.scrollingHotSpotRight).bind('mouseout',function(e){
					clearInterval(rightScrollInterval);
					scrollXpos = 0;
				});

				// The function that does the actual scrolling right
				var doScrollRight = function()
				{
					//$mom.find(options.scrollWrapper).scrollLeft($mom.find(options.scrollWrapper).scrollLeft() + (scrollXpos*booster));
					$mom.find(options.scrollWrapper).scrollLeft($mom.find(options.scrollWrapper).scrollLeft() + 4);
					showHideHotSpots();
				};

				// EVENTS - scroll left
				var leftScrollInterval;

				// mouseover left hotspot
				$mom.find(options.scrollingHotSpotLeft).bind('mouseover',function(e){
					if(options.autoScrollOnStart)
					{
						clearInterval(autoScrollInterval);
					}
					leftScrollInterval = setInterval(doScrollLeft, 15);
				});	

				// mouseout left hotspot
				$mom.find(options.scrollingHotSpotLeft).bind('mouseout',function(e){
					clearInterval(leftScrollInterval);
					scrollXpos = 0;
				});


				// The function that does the actual scrolling left
				var doScrollLeft = function()
				{	
					$mom.find(options.scrollWrapper).scrollLeft($mom.find(options.scrollWrapper).scrollLeft() - 4);
					showHideHotSpots();
				};






				// Function for showing and hiding hotspots depending on the
				// offset of the scrolling
				function showHideHotSpots()
				{
					// When you can't scroll further left
					// the left scroll hotspot should be hidden
					// and the right hotspot visible
					if($mom.find(options.scrollWrapper).scrollLeft() === 0)
					{
						hideLeftHotSpot();
						showRightHotSpot();
					}
					// When you can't scroll further right
					// the right scroll hotspot should be hidden
					// and the left hotspot visible
					else if(($mom.scrollableAreaWidth) <= ($mom.find(options.scrollWrapper).innerWidth() + $mom.find(options.scrollWrapper).scrollLeft()))
					{
						hideRightHotSpot();
						showLeftHotSpot();
					}
					// If you are somewhere in the middle of your
					// scrolling, both hotspots should be visible
					else
					{
						showRightHotSpot();
						showLeftHotSpot();
					}

				}
		});
	};

});/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 * Thanks to: Seamus Leahy for adding deltaX and deltaY
 *
 * Version: 3.0.4
 *
 * Requires: 1.2.2+
 */
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(i){var g=i||window.event,f=[].slice.call(arguments,1),j=0,h=true,e=0,d=0;i=c.event.fix(g);i.type="mousewheel";if(i.wheelDelta){j=i.wheelDelta/120}if(i.detail){j=-i.detail/3}d=j;if(g.axis!==undefined&&g.axis===g.HORIZONTAL_AXIS){d=0;e=-1*j}if(g.wheelDeltaY!==undefined){d=g.wheelDeltaY/120}if(g.wheelDeltaX!==undefined){e=-1*g.wheelDeltaX/120}f.unshift(i,j,e,d);return c.event.handle.apply(this,f)}})(jQuery);/*
 * jScrollPane - v2.0.0beta11 - 2011-07-04
 * http://jscrollpane.kelvinluck.com/
 *
 * Copyright (c) 2010 Kelvin Luck
 * Dual licensed under the MIT and GPL licenses.
 */
(function(b,a,c){b.fn.jScrollPane=function(e){function d(D,O){var az,Q=this,Y,ak,v,am,T,Z,y,q,aA,aF,av,i,I,h,j,aa,U,aq,X,t,A,ar,af,an,G,l,au,ay,x,aw,aI,f,L,aj=true,P=true,aH=false,k=false,ap=D.clone(false,false).empty(),ac=b.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";aI=D.css("paddingTop")+" "+D.css("paddingRight")+" "+D.css("paddingBottom")+" "+D.css("paddingLeft");f=(parseInt(D.css("paddingLeft"),10)||0)+(parseInt(D.css("paddingRight"),10)||0);function at(aR){var aM,aO,aN,aK,aJ,aQ,aP=false,aL=false;az=aR;if(Y===c){aJ=D.scrollTop();aQ=D.scrollLeft();D.css({overflow:"hidden",padding:0});ak=D.innerWidth()+f;v=D.innerHeight();D.width(ak);Y=b('<div class="jspPane" />').css("padding",aI).append(D.children());am=b('<div class="jspContainer" />').css({width:ak+"px",height:v+"px"}).append(Y).appendTo(D)}else{D.css("width","");aP=az.stickToBottom&&K();aL=az.stickToRight&&B();aK=D.innerWidth()+f!=ak||D.outerHeight()!=v;if(aK){ak=D.innerWidth()+f;v=D.innerHeight();am.css({width:ak+"px",height:v+"px"})}if(!aK&&L==T&&Y.outerHeight()==Z){D.width(ak);return}L=T;Y.css("width","");D.width(ak);am.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}Y.css("overflow","auto");if(aR.contentWidth){T=aR.contentWidth}else{T=Y[0].scrollWidth}Z=Y[0].scrollHeight;Y.css("overflow","");y=T/ak;q=Z/v;aA=q>1;aF=y>1;if(!(aF||aA)){D.removeClass("jspScrollable");Y.css({top:0,width:am.width()-f});n();E();R();w();ai()}else{D.addClass("jspScrollable");aM=az.maintainPosition&&(I||aa);if(aM){aO=aD();aN=aB()}aG();z();F();if(aM){N(aL?(T-ak):aO,false);M(aP?(Z-v):aN,false)}J();ag();ao();if(az.enableKeyboardNavigation){S()}if(az.clickOnTrack){p()}C();if(az.hijackInternalLinks){m()}}if(az.autoReinitialise&&!aw){aw=setInterval(function(){at(az)},az.autoReinitialiseDelay)}else{if(!az.autoReinitialise&&aw){clearInterval(aw)}}aJ&&D.scrollTop(0)&&M(aJ,false);aQ&&D.scrollLeft(0)&&N(aQ,false);D.trigger("jsp-initialised",[aF||aA])}function aG(){if(aA){am.append(b('<div class="jspVerticalBar" />').append(b('<div class="jspCap jspCapTop" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragTop" />'),b('<div class="jspDragBottom" />'))),b('<div class="jspCap jspCapBottom" />')));U=am.find(">.jspVerticalBar");aq=U.find(">.jspTrack");av=aq.find(">.jspDrag");if(az.showArrows){ar=b('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",aE(0,-1)).bind("click.jsp",aC);af=b('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",aE(0,1)).bind("click.jsp",aC);if(az.arrowScrollOnHover){ar.bind("mouseover.jsp",aE(0,-1,ar));af.bind("mouseover.jsp",aE(0,1,af))}al(aq,az.verticalArrowPositions,ar,af)}t=v;am.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){t-=b(this).outerHeight()});av.hover(function(){av.addClass("jspHover")},function(){av.removeClass("jspHover")}).bind("mousedown.jsp",function(aJ){b("html").bind("dragstart.jsp selectstart.jsp",aC);av.addClass("jspActive");var s=aJ.pageY-av.position().top;b("html").bind("mousemove.jsp",function(aK){V(aK.pageY-s,false)}).bind("mouseup.jsp mouseleave.jsp",ax);return false});o()}}function o(){aq.height(t+"px");I=0;X=az.verticalGutter+aq.outerWidth();Y.width(ak-X-f);try{if(U.position().left===0){Y.css("margin-left",X+"px")}}catch(s){}}function z(){if(aF){am.append(b('<div class="jspHorizontalBar" />').append(b('<div class="jspCap jspCapLeft" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragLeft" />'),b('<div class="jspDragRight" />'))),b('<div class="jspCap jspCapRight" />')));an=am.find(">.jspHorizontalBar");G=an.find(">.jspTrack");h=G.find(">.jspDrag");if(az.showArrows){ay=b('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",aE(-1,0)).bind("click.jsp",aC);x=b('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",aE(1,0)).bind("click.jsp",aC);
if(az.arrowScrollOnHover){ay.bind("mouseover.jsp",aE(-1,0,ay));x.bind("mouseover.jsp",aE(1,0,x))}al(G,az.horizontalArrowPositions,ay,x)}h.hover(function(){h.addClass("jspHover")},function(){h.removeClass("jspHover")}).bind("mousedown.jsp",function(aJ){b("html").bind("dragstart.jsp selectstart.jsp",aC);h.addClass("jspActive");var s=aJ.pageX-h.position().left;b("html").bind("mousemove.jsp",function(aK){W(aK.pageX-s,false)}).bind("mouseup.jsp mouseleave.jsp",ax);return false});l=am.innerWidth();ah()}}function ah(){am.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){l-=b(this).outerWidth()});G.width(l+"px");aa=0}function F(){if(aF&&aA){var aJ=G.outerHeight(),s=aq.outerWidth();t-=aJ;b(an).find(">.jspCap:visible,>.jspArrow").each(function(){l+=b(this).outerWidth()});l-=s;v-=s;ak-=aJ;G.parent().append(b('<div class="jspCorner" />').css("width",aJ+"px"));o();ah()}if(aF){Y.width((am.outerWidth()-f)+"px")}Z=Y.outerHeight();q=Z/v;if(aF){au=Math.ceil(1/y*l);if(au>az.horizontalDragMaxWidth){au=az.horizontalDragMaxWidth}else{if(au<az.horizontalDragMinWidth){au=az.horizontalDragMinWidth}}h.width(au+"px");j=l-au;ae(aa)}if(aA){A=Math.ceil(1/q*t);if(A>az.verticalDragMaxHeight){A=az.verticalDragMaxHeight}else{if(A<az.verticalDragMinHeight){A=az.verticalDragMinHeight}}av.height(A+"px");i=t-A;ad(I)}}function al(aK,aM,aJ,s){var aO="before",aL="after",aN;if(aM=="os"){aM=/Mac/.test(navigator.platform)?"after":"split"}if(aM==aO){aL=aM}else{if(aM==aL){aO=aM;aN=aJ;aJ=s;s=aN}}aK[aO](aJ)[aL](s)}function aE(aJ,s,aK){return function(){H(aJ,s,this,aK);this.blur();return false}}function H(aM,aL,aP,aO){aP=b(aP).addClass("jspActive");var aN,aK,aJ=true,s=function(){if(aM!==0){Q.scrollByX(aM*az.arrowButtonSpeed)}if(aL!==0){Q.scrollByY(aL*az.arrowButtonSpeed)}aK=setTimeout(s,aJ?az.initialDelay:az.arrowRepeatFreq);aJ=false};s();aN=aO?"mouseout.jsp":"mouseup.jsp";aO=aO||b("html");aO.bind(aN,function(){aP.removeClass("jspActive");aK&&clearTimeout(aK);aK=null;aO.unbind(aN)})}function p(){w();if(aA){aq.bind("mousedown.jsp",function(aO){if(aO.originalTarget===c||aO.originalTarget==aO.currentTarget){var aM=b(this),aP=aM.offset(),aN=aO.pageY-aP.top-I,aK,aJ=true,s=function(){var aS=aM.offset(),aT=aO.pageY-aS.top-A/2,aQ=v*az.scrollPagePercent,aR=i*aQ/(Z-v);if(aN<0){if(I-aR>aT){Q.scrollByY(-aQ)}else{V(aT)}}else{if(aN>0){if(I+aR<aT){Q.scrollByY(aQ)}else{V(aT)}}else{aL();return}}aK=setTimeout(s,aJ?az.initialDelay:az.trackClickRepeatFreq);aJ=false},aL=function(){aK&&clearTimeout(aK);aK=null;b(document).unbind("mouseup.jsp",aL)};s();b(document).bind("mouseup.jsp",aL);return false}})}if(aF){G.bind("mousedown.jsp",function(aO){if(aO.originalTarget===c||aO.originalTarget==aO.currentTarget){var aM=b(this),aP=aM.offset(),aN=aO.pageX-aP.left-aa,aK,aJ=true,s=function(){var aS=aM.offset(),aT=aO.pageX-aS.left-au/2,aQ=ak*az.scrollPagePercent,aR=j*aQ/(T-ak);if(aN<0){if(aa-aR>aT){Q.scrollByX(-aQ)}else{W(aT)}}else{if(aN>0){if(aa+aR<aT){Q.scrollByX(aQ)}else{W(aT)}}else{aL();return}}aK=setTimeout(s,aJ?az.initialDelay:az.trackClickRepeatFreq);aJ=false},aL=function(){aK&&clearTimeout(aK);aK=null;b(document).unbind("mouseup.jsp",aL)};s();b(document).bind("mouseup.jsp",aL);return false}})}}function w(){if(G){G.unbind("mousedown.jsp")}if(aq){aq.unbind("mousedown.jsp")}}function ax(){b("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");if(av){av.removeClass("jspActive")}if(h){h.removeClass("jspActive")}}function V(s,aJ){if(!aA){return}if(s<0){s=0}else{if(s>i){s=i}}if(aJ===c){aJ=az.animateScroll}if(aJ){Q.animate(av,"top",s,ad)}else{av.css("top",s);ad(s)}}function ad(aJ){if(aJ===c){aJ=av.position().top}am.scrollTop(0);I=aJ;var aM=I===0,aK=I==i,aL=aJ/i,s=-aL*(Z-v);if(aj!=aM||aH!=aK){aj=aM;aH=aK;D.trigger("jsp-arrow-change",[aj,aH,P,k])}u(aM,aK);Y.css("top",s);D.trigger("jsp-scroll-y",[-s,aM,aK]).trigger("scroll")}function W(aJ,s){if(!aF){return}if(aJ<0){aJ=0}else{if(aJ>j){aJ=j}}if(s===c){s=az.animateScroll}if(s){Q.animate(h,"left",aJ,ae)
}else{h.css("left",aJ);ae(aJ)}}function ae(aJ){if(aJ===c){aJ=h.position().left}am.scrollTop(0);aa=aJ;var aM=aa===0,aL=aa==j,aK=aJ/j,s=-aK*(T-ak);if(P!=aM||k!=aL){P=aM;k=aL;D.trigger("jsp-arrow-change",[aj,aH,P,k])}r(aM,aL);Y.css("left",s);D.trigger("jsp-scroll-x",[-s,aM,aL]).trigger("scroll")}function u(aJ,s){if(az.showArrows){ar[aJ?"addClass":"removeClass"]("jspDisabled");af[s?"addClass":"removeClass"]("jspDisabled")}}function r(aJ,s){if(az.showArrows){ay[aJ?"addClass":"removeClass"]("jspDisabled");x[s?"addClass":"removeClass"]("jspDisabled")}}function M(s,aJ){var aK=s/(Z-v);V(aK*i,aJ)}function N(aJ,s){var aK=aJ/(T-ak);W(aK*j,s)}function ab(aW,aR,aK){var aO,aL,aM,s=0,aV=0,aJ,aQ,aP,aT,aS,aU;try{aO=b(aW)}catch(aN){return}aL=aO.outerHeight();aM=aO.outerWidth();am.scrollTop(0);am.scrollLeft(0);while(!aO.is(".jspPane")){s+=aO.position().top;aV+=aO.position().left;aO=aO.offsetParent();if(/^body|html$/i.test(aO[0].nodeName)){return}}aJ=aB();aP=aJ+v;if(s<aJ||aR){aS=s-az.verticalGutter}else{if(s+aL>aP){aS=s-v+aL+az.verticalGutter}}if(aS){M(aS,aK)}aQ=aD();aT=aQ+ak;if(aV<aQ||aR){aU=aV-az.horizontalGutter}else{if(aV+aM>aT){aU=aV-ak+aM+az.horizontalGutter}}if(aU){N(aU,aK)}}function aD(){return -Y.position().left}function aB(){return -Y.position().top}function K(){var s=Z-v;return(s>20)&&(s-aB()<10)}function B(){var s=T-ak;return(s>20)&&(s-aD()<10)}function ag(){am.unbind(ac).bind(ac,function(aM,aN,aL,aJ){var aK=aa,s=I;Q.scrollBy(aL*az.mouseWheelSpeed,-aJ*az.mouseWheelSpeed,false);return aK==aa&&s==I})}function n(){am.unbind(ac)}function aC(){return false}function J(){Y.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(s){ab(s.target,false)})}function E(){Y.find(":input,a").unbind("focus.jsp")}function S(){var s,aJ,aL=[];aF&&aL.push(an[0]);aA&&aL.push(U[0]);Y.focus(function(){D.focus()});D.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(aO){if(aO.target!==this&&!(aL.length&&b(aO.target).closest(aL).length)){return}var aN=aa,aM=I;switch(aO.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:s=aO.keyCode;aK();break;case 35:M(Z-v);s=null;break;case 36:M(0);s=null;break}aJ=aO.keyCode==s&&aN!=aa||aM!=I;return !aJ}).bind("keypress.jsp",function(aM){if(aM.keyCode==s){aK()}return !aJ});if(az.hideFocus){D.css("outline","none");if("hideFocus" in am[0]){D.attr("hideFocus",true)}}else{D.css("outline","");if("hideFocus" in am[0]){D.attr("hideFocus",false)}}function aK(){var aN=aa,aM=I;switch(s){case 40:Q.scrollByY(az.keyboardSpeed,false);break;case 38:Q.scrollByY(-az.keyboardSpeed,false);break;case 34:case 32:Q.scrollByY(v*az.scrollPagePercent,false);break;case 33:Q.scrollByY(-v*az.scrollPagePercent,false);break;case 39:Q.scrollByX(az.keyboardSpeed,false);break;case 37:Q.scrollByX(-az.keyboardSpeed,false);break}aJ=aN!=aa||aM!=I;return aJ}}function R(){D.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function C(){if(location.hash&&location.hash.length>1){var aL,aJ,aK=escape(location.hash);try{aL=b(aK)}catch(s){return}if(aL.length&&Y.find(aK)){if(am.scrollTop()===0){aJ=setInterval(function(){if(am.scrollTop()>0){ab(aK,true);b(document).scrollTop(am.position().top);clearInterval(aJ)}},50)}else{ab(aK,true);b(document).scrollTop(am.position().top)}}}}function ai(){b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function m(){ai();b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var s=this.href.split("#"),aJ;if(s.length>1){aJ=s[1];if(aJ.length>0&&Y.find("#"+aJ).length>0){ab("#"+aJ,true);return false}}})}function ao(){var aK,aJ,aM,aL,aN,s=false;am.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(aO){var aP=aO.originalEvent.touches[0];aK=aD();aJ=aB();aM=aP.pageX;aL=aP.pageY;aN=false;s=true}).bind("touchmove.jsp",function(aR){if(!s){return}var aQ=aR.originalEvent.touches[0],aP=aa,aO=I;Q.scrollTo(aK+aM-aQ.pageX,aJ+aL-aQ.pageY);aN=aN||Math.abs(aM-aQ.pageX)>5||Math.abs(aL-aQ.pageY)>5;
return aP==aa&&aO==I}).bind("touchend.jsp",function(aO){s=false}).bind("click.jsp-touchclick",function(aO){if(aN){aN=false;return false}})}function g(){var s=aB(),aJ=aD();D.removeClass("jspScrollable").unbind(".jsp");D.replaceWith(ap.append(Y.children()));ap.scrollTop(s);ap.scrollLeft(aJ)}b.extend(Q,{reinitialise:function(aJ){aJ=b.extend({},az,aJ);at(aJ)},scrollToElement:function(aK,aJ,s){ab(aK,aJ,s)},scrollTo:function(aK,s,aJ){N(aK,aJ);M(s,aJ)},scrollToX:function(aJ,s){N(aJ,s)},scrollToY:function(s,aJ){M(s,aJ)},scrollToPercentX:function(aJ,s){N(aJ*(T-ak),s)},scrollToPercentY:function(aJ,s){M(aJ*(Z-v),s)},scrollBy:function(aJ,s,aK){Q.scrollByX(aJ,aK);Q.scrollByY(s,aK)},scrollByX:function(s,aK){var aJ=aD()+Math[s<0?"floor":"ceil"](s),aL=aJ/(T-ak);W(aL*j,aK)},scrollByY:function(s,aK){var aJ=aB()+Math[s<0?"floor":"ceil"](s),aL=aJ/(Z-v);V(aL*i,aK)},positionDragX:function(s,aJ){W(s,aJ)},positionDragY:function(aJ,s){V(aJ,s)},animate:function(aJ,aM,s,aL){var aK={};aK[aM]=s;aJ.animate(aK,{duration:az.animateDuration,easing:az.animateEase,queue:false,step:aL})},getContentPositionX:function(){return aD()},getContentPositionY:function(){return aB()},getContentWidth:function(){return T},getContentHeight:function(){return Z},getPercentScrolledX:function(){return aD()/(T-ak)},getPercentScrolledY:function(){return aB()/(Z-v)},getIsScrollableH:function(){return aF},getIsScrollableV:function(){return aA},getContentPane:function(){return Y},scrollToBottom:function(s){V(i,s)},hijackInternalLinks:function(){m()},destroy:function(){g()}});at(O)}e=b.extend({},b.fn.jScrollPane.defaults,e);b.each(["mouseWheelSpeed","arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){e[this]=e[this]||e.speed});return this.each(function(){var f=b(this),g=f.data("jsp");if(g){g.reinitialise(e)}else{g=new d(f,e);f.data("jsp",g)}})};b.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,stickToBottom:false,stickToRight:false,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:c,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:0,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:0.8}})(jQuery,this);
/*
 * jQuery Autocomplete plugin 1.1
 *
 * Copyright (c) 2009 Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(3($){$.2e.1u({19:3(b,d){5 c=W b=="1B";d=$.1u({},$.M.1T,{Y:c?b:P,y:c?P:b,1J:c?$.M.1T.1J:10,X:d&&!d.1D?10:48},d);d.1y=d.1y||3(a){6 a};d.1v=d.1v||d.1R;6 A.I(3(){1M $.M(A,d)})},L:3(a){6 A.11("L",a)},1k:3(a){6 A.14("1k",[a])},2b:3(){6 A.14("2b")},28:3(a){6 A.14("28",[a])},24:3(){6 A.14("24")}});$.M=3(o,r){5 t={2Y:38,2S:40,2N:46,2I:9,2E:13,2B:27,2x:3I,2v:33,2p:34,2n:8};5 u=$(o).3r("19","3o").Q(r.2Q);5 p;5 m="";5 n=$.M.3c(r);5 s=0;5 k;5 h={1F:C};5 l=$.M.32(r,o,1Z,h);5 j;$.1Y.2X&&$(o.2U).11("45.19",3(){4(j){j=C;6 C}});u.11(($.1Y.2X?"43":"42")+".19",3(a){s=1;k=a.2M;3V(a.2M){O t.2Y:a.1d();4(l.N()){l.30()}w{12(0,D)}R;O t.2S:a.1d();4(l.N()){l.2D()}w{12(0,D)}R;O t.2v:a.1d();4(l.N()){l.2C()}w{12(0,D)}R;O t.2p:a.1d();4(l.N()){l.2A()}w{12(0,D)}R;O r.17&&$.1c(r.S)==","&&t.2x:O t.2I:O t.2E:4(1Z()){a.1d();j=D;6 C}R;O t.2B:l.Z();R;3J:1P(p);p=1O(12,r.1J);R}}).2t(3(){s++}).3E(3(){s=0;4(!h.1F){2r()}}).2q(3(){4(s++>1&&!l.N()){12(0,D)}}).11("1k",3(){5 c=(1r.7>1)?1r[1]:P;3 1N(q,a){5 b;4(a&&a.7){16(5 i=0;i<a.7;i++){4(a[i].L.J()==q.J()){b=a[i];R}}}4(W c=="3")c(b);w u.14("L",b&&[b.y,b.F])}$.I(15(u.K()),3(i,a){21(a,1N,1N)})}).11("2b",3(){n.1o()}).11("28",3(){$.1u(r,1r[1]);4("y"2h 1r[1])n.1e()}).11("24",3(){l.1p();u.1p();$(o.2U).1p(".19")});3 1Z(){5 e=l.2g();4(!e)6 C;5 v=e.L;m=v;4(r.17){5 b=15(u.K());4(b.7>1){5 f=r.S.7;5 c=$(o).18().1I;5 d,1H=0;$.I(b,3(i,a){1H+=a.7;4(c<=1H){d=i;6 C}1H+=f});b[d]=v;v=b.3f(r.S)}v+=r.S}u.K(v);1l();u.14("L",[e.y,e.F]);6 D}3 12(b,c){4(k==t.2N){l.Z();6}5 a=u.K();4(!c&&a==m)6;m=a;a=1m(a);4(a.7>=r.29){u.Q(r.26);4(!r.1s)a=a.J();21(a,3a,1l)}w{1q();l.Z()}};3 15(b){4(!b)6[""];4(!r.17)6[$.1c(b)];6 $.4h(b.23(r.S),3(a){6 $.1c(b).7?$.1c(a):P})}3 1m(a){4(!r.17)6 a;5 c=15(a);4(c.7==1)6 c[0];5 b=$(o).18().1I;4(b==a.7){c=15(a)}w{c=15(a.22(a.37(b),""))}6 c[c.7-1]}3 1G(q,a){4(r.1G&&(1m(u.K()).J()==q.J())&&k!=t.2n){u.K(u.K()+a.37(1m(m).7));$(o).18(m.7,m.7+a.7)}};3 2r(){1P(p);p=1O(1l,4g)};3 1l(){5 c=l.N();l.Z();1P(p);1q();4(r.36){u.1k(3(a){4(!a){4(r.17){5 b=15(u.K()).1n(0,-1);u.K(b.3f(r.S)+(b.7?r.S:""))}w{u.K("");u.14("L",P)}}})}};3 3a(q,a){4(a&&a.7&&s){1q();l.35(a,q);1G(q,a[0].F);l.20()}w{1l()}};3 21(f,d,g){4(!r.1s)f=f.J();5 e=n.31(f);4(e&&e.7){d(f,e)}w 4((W r.Y=="1B")&&(r.Y.7>0)){5 c={4f:+1M 4e()};$.I(r.2Z,3(a,b){c[a]=W b=="3"?b():b});$.4d({4c:"4b",4a:"19"+o.49,2V:r.2V,Y:r.Y,y:$.1u({q:1m(f),47:r.X},c),44:3(a){5 b=r.1A&&r.1A(a)||1A(a);n.1i(f,b);d(f,b)}})}w{l.2T();g(f)}};3 1A(c){5 d=[];5 b=c.23("\\n");16(5 i=0;i<b.7;i++){5 a=$.1c(b[i]);4(a){a=a.23("|");d[d.7]={y:a,F:a[0],L:r.1z&&r.1z(a,a[0])||a[0]}}}6 d};3 1q(){u.1h(r.26)}};$.M.1T={2Q:"41",2P:"3Z",26:"3Y",29:1,1J:3W,1s:C,1f:D,1w:C,1g:10,X:3U,36:C,2Z:{},1X:D,1R:3(a){6 a[0]},1v:P,1G:C,E:0,17:C,S:", ",1y:3(b,a){6 b.22(1M 3T("(?![^&;]+;)(?!<[^<>]*)("+a.22(/([\\^\\$\\(\\)\\[\\]\\{\\}\\*\\.\\+\\?\\|\\\\])/2K,"\\\\$1")+")(?![^<>]*>)(?![^&;]+;)","2K"),"<2J>$1</2J>")},1D:D,1E:3S};$.M.3c=3(g){5 h={};5 j=0;3 1f(s,a){4(!g.1s)s=s.J();5 i=s.2H(a);4(g.1w=="3R"){i=s.J().1k("\\\\b"+a.J())}4(i==-1)6 C;6 i==0||g.1w};3 1i(q,a){4(j>g.1g){1o()}4(!h[q]){j++}h[q]=a}3 1e(){4(!g.y)6 C;5 f={},2G=0;4(!g.Y)g.1g=1;f[""]=[];16(5 i=0,2F=g.y.7;i<2F;i++){5 c=g.y[i];c=(W c=="1B")?[c]:c;5 d=g.1v(c,i+1,g.y.7);4(d===C)1V;5 e=d.3Q(0).J();4(!f[e])f[e]=[];5 b={F:d,y:c,L:g.1z&&g.1z(c)||d};f[e].1U(b);4(2G++<g.X){f[""].1U(b)}};$.I(f,3(i,a){g.1g++;1i(i,a)})}1O(1e,25);3 1o(){h={};j=0}6{1o:1o,1i:1i,1e:1e,31:3(q){4(!g.1g||!j)6 P;4(!g.Y&&g.1w){5 a=[];16(5 k 2h h){4(k.7>0){5 c=h[k];$.I(c,3(i,x){4(1f(x.F,q)){a.1U(x)}})}}6 a}w 4(h[q]){6 h[q]}w 4(g.1f){16(5 i=q.7-1;i>=g.29;i--){5 c=h[q.3O(0,i)];4(c){5 a=[];$.I(c,3(i,x){4(1f(x.F,q)){a[a.7]=x}});6 a}}}6 P}}};$.M.32=3(e,g,f,k){5 h={H:"3N"};5 j,z=-1,y,1t="",1S=D,G,B;3 2y(){4(!1S)6;G=$("<3M/>").Z().Q(e.2P).T("3L","3K").1Q(1K.2w);B=$("<3H/>").1Q(G).3G(3(a){4(U(a).2u&&U(a).2u.3F()==\'2s\'){z=$("1L",B).1h(h.H).3D(U(a));$(U(a)).Q(h.H)}}).2q(3(a){$(U(a)).Q(h.H);f();g.2t();6 C}).3C(3(){k.1F=D}).3B(3(){k.1F=C});4(e.E>0)G.T("E",e.E);1S=C}3 U(a){5 b=a.U;3A(b&&b.3z!="2s")b=b.3y;4(!b)6[];6 b}3 V(b){j.1n(z,z+1).1h(h.H);2o(b);5 a=j.1n(z,z+1).Q(h.H);4(e.1D){5 c=0;j.1n(0,z).I(3(){c+=A.1a});4((c+a[0].1a-B.1b())>B[0].3x){B.1b(c+a[0].1a-B.3w())}w 4(c<B.1b()){B.1b(c)}}};3 2o(a){z+=a;4(z<0){z=j.1j()-1}w 4(z>=j.1j()){z=0}}3 2m(a){6 e.X&&e.X<a?e.X:a}3 2l(){B.2z();5 b=2m(y.7);16(5 i=0;i<b;i++){4(!y[i])1V;5 a=e.1R(y[i].y,i+1,b,y[i].F,1t);4(a===C)1V;5 c=$("<1L/>").3v(e.1y(a,1t)).Q(i%2==0?"3u":"3P").1Q(B)[0];$.y(c,"2k",y[i])}j=B.3t("1L");4(e.1X){j.1n(0,1).Q(h.H);z=0}4($.2e.2W)B.2W()}6{35:3(d,q){2y();y=d;1t=q;2l()},2D:3(){V(1)},30:3(){V(-1)},2C:3(){4(z!=0&&z-8<0){V(-z)}w{V(-8)}},2A:3(){4(z!=j.1j()-1&&z+8>j.1j()){V(j.1j()-1-z)}w{V(8)}},Z:3(){G&&G.Z();j&&j.1h(h.H);z=-1},N:3(){6 G&&G.3s(":N")},3q:3(){6 A.N()&&(j.2j("."+h.H)[0]||e.1X&&j[0])},20:3(){5 a=$(g).3p();G.T({E:W e.E=="1B"||e.E>0?e.E:$(g).E(),2i:a.2i+g.1a,1W:a.1W}).20();4(e.1D){B.1b(0);B.T({2L:e.1E,3n:\'3X\'});4($.1Y.3m&&W 1K.2w.3l.2L==="1x"){5 c=0;j.I(3(){c+=A.1a});5 b=c>e.1E;B.T(\'3k\',b?e.1E:c);4(!b){j.E(B.E()-2R(j.T("2O-1W"))-2R(j.T("2O-3j")))}}}},2g:3(){5 a=j&&j.2j("."+h.H).1h(h.H);6 a&&a.7&&$.y(a[0],"2k")},2T:3(){B&&B.2z()},1p:3(){G&&G.3i()}}};$.2e.18=3(b,f){4(b!==1x){6 A.I(3(){4(A.2d){5 a=A.2d();4(f===1x||b==f){a.4n("2c",b);a.3h()}w{a.4m(D);a.4l("2c",b);a.4k("2c",f);a.3h()}}w 4(A.3g){A.3g(b,f)}w 4(A.1C){A.1C=b;A.3e=f}})}5 c=A[0];4(c.2d){5 e=1K.18.4j(),3d=c.F,2a="<->",2f=e.3b.7;e.3b=2a;5 d=c.F.2H(2a);c.F=3d;A.18(d,d+2f);6{1I:d,39:d+2f}}w 4(c.1C!==1x){6{1I:c.1C,39:c.3e}}}})(4i);',62,272,'|||function|if|var|return|length|||||||||||||||||||||||||else||data|active|this|list|false|true|width|value|element|ACTIVE|each|toLowerCase|val|result|Autocompleter|visible|case|null|addClass|break|multipleSeparator|css|target|moveSelect|typeof|max|url|hide||bind|onChange||trigger|trimWords|for|multiple|selection|autocomplete|offsetHeight|scrollTop|trim|preventDefault|populate|matchSubset|cacheLength|removeClass|add|size|search|hideResultsNow|lastWord|slice|flush|unbind|stopLoading|arguments|matchCase|term|extend|formatMatch|matchContains|undefined|highlight|formatResult|parse|string|selectionStart|scroll|scrollHeight|mouseDownOnSelect|autoFill|progress|start|delay|document|li|new|findValueCallback|setTimeout|clearTimeout|appendTo|formatItem|needsInit|defaults|push|continue|left|selectFirst|browser|selectCurrent|show|request|replace|split|unautocomplete||loadingClass||setOptions|minChars|teststring|flushCache|character|createTextRange|fn|textLength|selected|in|top|filter|ac_data|fillList|limitNumberOfItems|BACKSPACE|movePosition|PAGEDOWN|click|hideResults|LI|focus|nodeName|PAGEUP|body|COMMA|init|empty|pageDown|ESC|pageUp|next|RETURN|ol|nullData|indexOf|TAB|strong|gi|maxHeight|keyCode|DEL|padding|resultsClass|inputClass|parseInt|DOWN|emptyList|form|dataType|bgiframe|opera|UP|extraParams|prev|load|Select|||display|mustMatch|substring||end|receiveData|text|Cache|orig|selectionEnd|join|setSelectionRange|select|remove|right|height|style|msie|overflow|off|offset|current|attr|is|find|ac_even|html|innerHeight|clientHeight|parentNode|tagName|while|mouseup|mousedown|index|blur|toUpperCase|mouseover|ul|188|default|absolute|position|div|ac_over|substr|ac_odd|charAt|word|180|RegExp|100|switch|400|auto|ac_loading|ac_results||ac_input|keydown|keypress|success|submit||limit|150|name|port|abort|mode|ajax|Date|timestamp|200|map|jQuery|createRange|moveEnd|moveStart|collapse|move'.split('|'),0,{}))// cvi_text_lib.js version 1.01 (13-Mar-2008)
// (c) 2008 by Christian Effenberger. All Rights reserved. 
// Distributed under Netzgestade Software License Agreement
// http://www.netzgesta.de/dev/text/LISENSE.txt

// font characters 30-127 and 160-255 (ISO-8859-1) 
// font charset UTF-8 or ISO-8859-1 is recommended
// font type (built in) is a sans-serif multiple master   
// single line stroke font, similar to "VAG Rounded",
// "DIN 17" and a few other fonts of that kind.
// Create your own font e.g. strokeFont["serif"] = {};
// and load as an external js file after cvi_text_lib.js
// font size is limited to min 1 max 99999 default is 12px
// font weight is limited to min 1 max 400 default is 100%
// font weight for normal text should not be more than 200%
// font width is limited to min 10 max 400 default is 100%
// char space is limited to min 10 max 1000 default is 100%
// color and opacity is set through context.strokeStyle

// extend CanvasRenderingContext2D with strokeText
//   context.strokeText(text,x,y,fontsize,fontweight,fontwidth,charspace,fonttype)
//     fontsize == baseline == textheight / 32 * 25
// IE specific
//   STRING = get_strokeText(text,x,y,fontsize,fontweight,fontwidth,charspace,fonttype,color,opacity,rotation,id)
//     fontsize == baseline == textheight / 32 * 25

// webKit patch function (Safari)
//   set_textRenderContext(context)

// check if the text function is available
//   BOOLEAN = check_textRenderContext(context)
// IE specific
//   BOOLEAN = check_strokeTextCapability()
 
// helper function
//   draw_boundingBox(context,x,y,baseline,textheight,textwidth)
// IE specific
//   STRING = get_boundingBox(context,x,y,baseline,textheight,textwidth,linewidth,color,opacity,rotation,id)

// utility functions
//   STRING = get_widthText(string,textwidth,fontsize,fontwidth,charspace,fonttype)
//   FLOAT  = get_textWidth(string,fontsize,fontwidth,charspace,fonttype)
//   FLOAT  = get_textHeight(fontsize)
//   FLOAT  = get_baseLine(fontsize)

// howto
//   <script src="cvi_text_lib.js"></script>
//   <script>
//     var context = canvas.getContext('2d');
//     set_textRenderContext(context);
//     if(check_textRenderContext(context)) {
//     ...
//       context.strokeText(text,x,y,fontsize);
//     ...
//     }
//   </script>
//   <!--[if gte IE 6]>
//   <script>
//     if(check_strokeTextCapability()) {
//     ...
//       string = get_strokeText(text,x,y,fontsize,fontweight,fontwidth,charspace,fonttype,color,opacity,rotation,id)
//       document.getElementById("div").innerHTML = string;
//     ...
//     }
//   </script>
//   <![endif]-->

function check_strokeTextCapability() {
	if(document.namespaces['v'] == null) {var stl = document.createStyleSheet(); stl.addRule("v\\:*", "behavior: url(#default#VML);"); document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); }
	if(typeof get_strokeText == 'function' && document.namespaces['v'] != null) {return true;}else {return false;}
}
function get_boundingBox(x,y,baseline,lineheight,linewidth,weight,color,opacity,rotation) {
	rotation=typeof(rotation)!='undefined'?rotation:0; color=typeof(color)!='undefined'?color:'#000000'; opacity=typeof(opacity)!='undefined'?opacity:1; id=typeof(id)!='undefined'?'id="'+id+'"':''; var w=parseInt(linewidth), b=parseInt(baseline), h=parseInt(lineheight);
	return '<v:shape '+id+' filled="f" stroked="t" coordorigin="0,0" coordsize="'+w+','+h+'" path="m 0,'+b+' l 0,0,'+w+',0,'+w+','+b+',0,'+b+',0,'+h+','+w+','+h+','+w+','+b+' e" style="rotation:'+rotation+';position:absolute;margin:0px;top:'+Math.round(y)+'px;left:'+Math.round(x)+'px;width:'+w+'px;height:'+h+'px;"><v:stroke color="'+color+'" opacity="'+opacity+'" weight="'+weight+'" /></v:shape>';	
}
function get_strokeText(string,x,y,size,weight,width,space,font,color,opacity,rotation,id) {
	function qC(cX,cY,CPx,CPy,aX,aY) {var t = new Array(6); t[0]=cX+2.0/3.0*(CPx-cX); t[1]=cY+2.0/3.0*(CPy-cY); t[2]=t[0]+(aX-cX)/3.0; t[3]=t[1]+(aY-cY)/3.0; t[4]=aX; t[5]=aY; return t;}
	size=typeof(size)!='undefined'?size:12; weight=typeof(weight)!='undefined'?weight:100; width=typeof(width)!='undefined'?width:100; space=typeof(space)!='undefined'?space:100;
	font=typeof(font)!='undefined'?font:"sans-serif"; string=typeof(string)!='undefined'?string:' '; var xx=typeof(x)!='undefined'?x:0; var yy=typeof(y)!='undefined'?y:0;
	rotation=typeof(rotation)!='undefined'?rotation:0; color=typeof(color)!='undefined'?color:'#000000'; opacity=typeof(opacity)!='undefined'?opacity:1; id=typeof(id)!='undefined'?'id="'+id+'"':'';
	var i=0,j=0,f=10,path="",a,b,z,k,c,p,o,len=string.length,mag=size/25.0,fac=Math.max(Math.min(weight,400),1)/40, faw=Math.max(Math.min(width,400),10)/100;
	var spc=Math.max(Math.min(space,1000),10)/100,mx=((mag*16*faw)*spc)-(mag*16*faw),lw=(fac*mag);x=0;y=size;
	var ww=Math.round(get_textWidth(string,size,width,space,font)), hh=Math.round(get_textHeight(size));
	var out='<v:shape '+id+' filled="f" stroked="t" coordorigin="0,0" coordsize="'+parseInt(ww*f)+','+parseInt(hh*f)+'"';
	for(i=0; i<len; i++) { c=strokeFont[font][string.charAt(i)]; if(!c) {continue;} o=0; 
		for(j=0; j<c.n; j++) {
			if(typeof(c.d[o])!="string") {o++; continue;} p=c.d[o]; o++; a=c.d[o];
			if(p=="m") {path+=' m '+parseInt((x+a[0]*mag*faw)*f)+','+parseInt((y-a[1]*mag)*f); o++;}else
			if(p=="q") {z=c.d[o-2]; o++; b=c.d[o]; k=qC(z[0],z[1],a[0],a[1],b[0],b[1]); path+=' c '+parseInt((x+k[0]*mag*faw)*f)+','+parseInt((y-k[1]*mag)*f)+','+parseInt((x+k[2]*mag*faw)*f)+','+parseInt((y-k[3]*mag)*f)+','+parseInt((x+k[4]*mag*faw)*f)+','+parseInt((y-k[5]*mag)*f); o++;}else 
			if(p=="b") {o++; b=c.d[o]; o++; z=c.d[o]; path+=' c '+parseInt((x+a[0]*mag*faw)*f)+','+parseInt((y-a[1]*mag)*f)+','+parseInt((x+a[0]*mag*faw)*f)+','+parseInt((y-a[1]*mag)*f)+','+parseInt((x+z[0]*mag*faw)*f)+','+parseInt((y-z[1]*mag)*f); o++;}else
			if(p=="l") {path+=' l '+parseInt((x+a[0]*mag*faw)*f)+','+parseInt((y-a[1]*mag)*f); o++; while(typeof(c.d[o])!="string" && o<c.d.length) {a=c.d[o]; path+=' l '+parseInt((x+a[0]*mag*faw)*f)+','+parseInt((y-a[1]*mag)*f); o++;}}
		} x+=((c.w*faw)*mag)+mx;
	} out+=' path="'+path+' e" style="rotation:'+rotation+';position:absolute;margin:0px;top:'+Math.round(yy)+'px;left:'+Math.round(xx)+'px;width:'+ww+'px;height:'+hh+'px;"><v:stroke color="'+color+'" opacity="'+opacity+'" weight="'+lw+'" miterlimit="0" endcap="round" joinstyle="round" /></v:shape>';	
	return out;
}
function get_baseLine(size) {return size;} 
function get_textHeight(size) {size=typeof(size)!='undefined'?size:12; return 32*(size/25);} 
function get_textWidth(string,size,width,space,font) {
	size=typeof(size)!='undefined'?size:12; width=typeof(width)!='undefined'?width:100; space=typeof(space)!='undefined'?space:100; string=typeof(string)!='undefined'?string:' ';
	font=typeof(font)!='undefined'?font:"sans-serif"; var total=0,len=string.length,mg=size/25.0,fw=Math.max(Math.min(width,400),10)/100,sp=Math.max(Math.min(space,1000),10)/100,m=((mg*16*fw)*sp)-(mg*16*fw); 	
	for(var i=0; i<len; i++) {var c=strokeFont[font][string.charAt(i)]; if(c) total += ((c.w*fw)*mg)+m;}return total-(m);
}
function get_widthText(string,width,size,fontwidth,space,font) {
	size=typeof(size)!='undefined'?size:12; fontwidth=typeof(fontwidth)!='undefined'?fontwidth:100; space=typeof(space)!='undefined'?space:100; string=typeof(string)!='undefined'?string:' '; width=typeof(width)!='undefined'?width:100;
	font=typeof(font)!='undefined'?font:"sans-serif"; var cur=0,total=0,len=string.length,mg=size/25.0,fw=Math.max(Math.min(fontwidth,400),10)/100,sp=Math.max(Math.min(space,1000),10)/100,m=((mg*16*fw)*sp)-(mg*16*fw); 	
	for(var i=0; i<len; i++) {var c=strokeFont[font][string.charAt(i)]; if(c) {cur = ((c.w*fw)*mg)+m; if((total+cur-(m)) <= width) {total += cur;}else {break; }}else {break; }} return string.substring(0,i); 
}
function draw_boundingBox(ctx,x,y,baseline,lineheight,linewidth) {ctx.strokeRect(x,y+baseline,linewidth,lineheight-baseline); ctx.strokeRect(x,y,linewidth,baseline);}
function do_drawText(string,x,y,size,weight,width,space,font) {
	size=typeof(size)!='undefined'?size:12; weight=typeof(weight)!='undefined'?weight:100; width=typeof(width)!='undefined'?width:100; space=typeof(space)!='undefined'?space:100;
	font=typeof(font)!='undefined'?font:"sans-serif"; x=typeof(x)!='undefined'?x:0; y=typeof(y)!='undefined'?y+size:0+size; string=typeof(string)!='undefined'?string:' ';
	var i=0,j=0,a,b,z,c,p,o,len=string.length,mag=size/25.0,fac=Math.max(Math.min(weight,400),1)/40, faw=Math.max(Math.min(width,400),10)/100;
	var spc=Math.max(Math.min(space,1000),10)/100,mx=((mag*16*faw)*spc)-(mag*16*faw),lw=this.lineWidth, ml=this.miterLimit, lj=this.lineJoin, lc=this.lineCap;
	this.lineWidth=(fac*mag); this.miterLimit=0; this.lineJoin="round"; this.lineCap="round";
	for(i=0; i<len; i++) { c=strokeFont[font][string.charAt(i)]; if(!c) {continue;} o=0; this.beginPath(); 
		for(j=0; j<c.n; j++) {
			if(typeof(c.d[o])!="string") {o++; continue;} p=c.d[o]; o++; a=c.d[o];
			if(p=="m") {this.moveTo(x+a[0]*mag*faw, y-a[1]*mag); o++;}else
			if(p=="q") {o++; b=c.d[o]; this.quadraticCurveTo(x+a[0]*mag*faw, y-a[1]*mag, x+b[0]*mag*faw, y-b[1]*mag); o++;}else 
			if(p=="b") {o++; b=c.d[o]; o++; z=c.d[o]; this.bezierCurveTo(x+a[0]*mag*faw, y-a[1]*mag, x+b[0]*mag*faw, y-b[1]*mag, x+z[0]*mag*faw, y-z[1]*mag); o++;}else 
			if(p=="l") {this.lineTo(x+a[0]*mag*faw, y-a[1]*mag); o++; while(typeof(c.d[o])!="string" && o<c.d.length) {a=c.d[o]; this.lineTo(x+a[0]*mag*faw, y-a[1]*mag); o++;}}
		} this.stroke(); x+=((c.w*faw)*mag)+mx;
	} this.lineWidth=lw; this.miterLimit=ml; this.lineJoin=lj; this.lineCap=lc;
}
function set_textRenderContext(ctx) {if(typeof CanvasRenderingContext2D == 'undefined') {ctx.strokeText=do_drawText;}}
function check_textRenderContext(ctx) {if(typeof ctx.strokeText == 'function') {return true;}else {return false;}}
if(typeof CanvasRenderingContext2D != 'undefined') {CanvasRenderingContext2D.prototype.strokeText=do_drawText; }
var strokeFont = new Array();
strokeFont["sans-serif"] = {
	' ': {w:16,n:1,d:[]},
	'!': {w:10,n:4,d:['m',[5,21],'l',[5,7],'m',[5,2],'l',[4,1],[5,0],[6,1],[5,2]]},
	'"': {w:14,n:4,d:['m',[4,21],'l',[4,14],'m',[10,21],'l',[10,14]]},
	'#': {w:21,n:8,d:['m',[11,25],'l',[4,-7],'m',[17,25],'l',[10,-7],'m',[4,12],'l',[18,12],'m',[3,6],'l',[17,6]]},
	'$': {w:20,n:12,d:['m',[16,18],'q',[15,21],[10,21],'q',[5,21],[4,17],'q',[3,12],[7,11],'l',[13,10],'q',[18,9],[17,4],'q',[16,0],[10,0],'q',[4,0],[3,4],'m',[8,25],'l',[6,-4],'m',[14,25],'l',[12,-4]]},
	'%': {w:24,n:12,d:['m',[21,21],'l',[3,0],'m',[7,21],'q',[3,21],[3,17],'q',[3,13],[7,13],'q',[11,13],[11,17],'q',[11,21],[7,21],'m',[17,8],'q',[13,8],[13,4],'q',[13,0],[17,0],'q',[21,0],[21,4],'q',[21,8],[17,8]]},
	'&': {w:26,n:14,d:['m',[23,12],'q',[23,14],[22,14],'q',[20,14],[19,11],'l',[17,6],'q',[15,0],[9,0],'q',[3,0],[3,5],'q',[3,8],[7,10],'l',[12,13],'q',[14,15],[14,17],'q',[14,21],[11,21],'q',[8,21],[8,17],'q',[8,14],[12,8],'q',[17,0],[21,0],'q',[23,0],[23,2]]},
	'\'': {w:10,n:2,d:['m',[5,19],'l',[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]]},
	'(': {w:14,n:3,d:['m',[11,25],'q',[4,19],[4,9],'q',[4,-1],[11,-7]]},
	')': {w:14,n:3,d:['m',[3,25],'q',[10,19],[10,9],'q',[10,-1],[3,-7]]},
	'*': {w:16,n:6,d:['m',[8,21],'l',[8,9],'m',[3,18],'l',[13,12],'m',[13,18],'l',[3,12]]},
	'+': {w:26,n:4,d:['m',[13,18],'l',[13,0],'m',[4,9],'l',[22,9]]},
	',': {w:10,n:2,d:['m',[6,1],'l',[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},
	'-': {w:26,n:2,d:['m',[4,9],'l',[22,9]]},
	'.': {w:10,n:2,d:['m',[5,2],'l',[4,1],[5,0],[6,1],[5,2]]},
	'/': {w:22,n:2,d:['m',[20,25],'l',[2,-7]]},
	'0': {w:20,n:7,d:['m',[10,21],'q',[3,21],[3,12],'l',[3,9],'q',[3,0],[10,0],'q',[17,0],[17,9],'l',[17,12],'q',[17,21],[10,21]]},
	'1': {w:20,n:3,d:['m',[6,17],'q',[8,18],[11,21],'l',[11,0]]},
	'2': {w:20,n:5,d:['m',[17,0],'l',[3,0],[13,10],'q',[16,13],[16,16],'q',[16,21],[10,21],'q',[4,21],[4,16]]},
	'3': {w:20,n:5,d:['m',[5,21],'l',[16,21],[10,14],'q',[17,14],[17,7],'q',[17,0],[10,0],'q',[5,0],[3,4]]},
	'4': {w:20,n:2,d:['m',[13,0],'l',[13,21],[3,7],[18,7]]},
	'5': {w:20,n:6,d:['m',[15,21],'l',[5,21],[4,12],'q',[5,14],[10,14],'q',[17,14],[17,7],'q',[17,0],[10,0],'q',[5,0],[3,4]]},
	'6': {w:20,n:8,d:['m',[16,18],'q',[15,21],[10,21],'q',[3,21],[3,12],'l',[3,7],'q',[3,0],[10,0],'q',[17,0],[17,7],'q',[17,13],[10,13],'q',[3,13],[3,7]]},
	'7': {w:20,n:2,d:['m',[3,21],'l',[17,21],[7,0]]},
	'8': {w:20,n:9,d:['m',[10,13],'q',[15,13],[15,17],'q',[15,21],[10,21],'q',[5,21],[5,17],'q',[5,13],[10,13],'q',[3,13],[3,7],'q',[3,0],[10,0],'q',[17,0],[17,7],'q',[17,13],[10,13]]},
	'9': {w:20,n:8,d:['m',[17,14],'q',[17,8],[10,8],'q',[3,8],[3,14],'q',[3,21],[10,21],'q',[17,21],[17,14],'l',[17,9],'q',[17,0],[10,0],'q',[5,0],[4,3]]},
	':': {w:10,n:4,d:['m',[5,14],'l',[4,13],[5,12],[6,13],[5,14],'m',[5,2],'l',[4,1],[5,0],[6,1],[5,2]]},
	';': {w:10,n:4,d:['m',[5,14],'l',[4,13],[5,12],[6,13],[5,14],'m',[6,1],'l',[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},
	'<': {w:24,n:2,d:['m',[20,18],'l',[4,9],[20,0]]},
	'=': {w:26,n:4,d:['m',[4,12],'l',[22,12],'m',[4,6],'l',[22,6]]},
	'>': {w:24,n:2,d:['m',[4,18],'l',[20,9],[4,0]]},
	'?': {w:18,n:8,d:['m',[3,16],'q',[3,21],[9,21],'q',[15,21],[15,16],'q',[15,11],[10,11],'q',[9,11],[9,10],'l',[9,7],'m',[9,2],'l',[8,1],[9,0],[10,1],[9,2]]},	
	'@': {w:27,n:17,d:['m',[21,3],'q',[20,1],[14,0],'l',[13,0],'q',[4,1],[3,10],'l',[3,11],'q',[4,20],[13,21],'l',[14,21],'q',[23,20],[24,11],'l',[24,10],'q',[24,6],[20,6],'q',[17,6],[18,10],'q',[18,6],[13,6],'q',[8,6],[9,11],'q',[10,15],[14,15],'q',[19,15],[18,10],'m',[18,10],'l',[19,14]]},
	'A': {w:18,n:6,d:['m',[1,0],'l',[9,21],[17,0],'m',[4,7],'l',[14,7]]},
	'B': {w:21,n:9,d:['m',[4,11],'l',[12,11],'m',[13,0],'l',[4,0],[4,21],[12,21],'q',[17,21],[17,16],'q',[17,11],[12,11],'q',[18,11],[18,6],'l',[18,5],'q',[18,0],[13,0]]},
	'C': {w:21,n:7,d:['m',[11,21],'q',[17,21],[18,16],'m',[18,5],'q',[17,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'D': {w:21,n:5,d:['m',[11,0],'l',[4,0],[4,21],[11,21],'q',[18,21],[18,12],'l',[18,9],'q',[18,0],[11,0]]},
	'E': {w:19,n:4,d:['m',[17,21],'l',[4,21],[4,0],[17,0],'m',[4,11],'l',[12,11]]},
	'F': {w:18,n:4,d:['m',[17,21],'l',[4,21],[4,0],'m',[4,11],'l',[12,11]]},
	'G': {w:21,n:8,d:['m',[11,21],'q',[17,21],[18,16],'m',[13,8],'l',[18,8],[18,5],'q',[17,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'H': {w:22,n:6,d:['m',[4,21],'l',[4,0],'m',[18,21],'l',[18,0],'m',[4,11],'l',[18,11]]},
	'I': {w:8,n:2,d:['m',[4,21],'l',[4,0]]},
	'J': {w:16,n:5,d:['m',[12,21],'l',[12,5],'q',[12,0],[7,0],'q',[2,0],[2,5],'l',[2,7]]},
	'K': {w:21,n:6,d:['m',[4,21],'l',[4,0],'m',[18,21],'l',[4,7],'m',[9,12],'l',[18,0]]},
	'L': {w:17,n:2,d:['m',[4,21],'l',[4,0],[16,0]]},
	'M': {w:24,n:2,d:['m',[4,0],'l',[4,21],[12,0],[20,21],[20,0]]},
	'N': {w:22,n:2,d:['m',[4,0],'l',[4,21],[18,0],[18,21]]},
	'O': {w:22,n:7,d:['m',[11,21],'q',[19,21],[19,12],'l',[19,9],'q',[19,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'P': {w:21,n:6,d:['m',[4,10],'l',[13,10],'q',[18,10],[18,15],'l',[18,16],'q',[18,21],[13,21],'l',[4,21],[4,0]]},
	'Q': {w:22,n:9,d:['m',[11,21],'q',[19,21],[19,12],'l',[19,9],'q',[19,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21],'m',[12,4],'l',[18,-2]]},
	'R': {w:21,n:8,d:['m',[4,10],'l',[13,10],'q',[18,10],[18,15],'l',[18,16],'q',[18,21],[13,21],'l',[4,21],[4,0],'m',[13,10],'l',[18,0]]},
	'S': {w:20,n:8,d:['m',[16,18],'q',[15,21],[10,21],'q',[5,21],[4,17],'q',[3,12],[7,11],'l',[13,10],'q',[18,9],[17,4],'q',[16,0],[10,0],'q',[4,0],[3,4]]},
	'T': {w:16,n:4,d:['m',[8,21],'l',[8,0],'m',[1,21],'l',[15,21]]},
	'U': {w:22,n:5,d:['m',[4,21],'l',[4,6],'q',[4,0],[11,0],'q',[18,0],[18,6],'l',[18,21]]},
	'V': {w:18,n:2,d:['m',[1,21],'l',[9,0],[17,21]]},
	'W': {w:24,n:2,d:['m',[2,21],'l',[7,0],[12,21],[17,0],[22,21]]},
	'X': {w:20,n:4,d:['m',[3,21],'l',[17,0],'m',[17,21],'l',[3,0]]},
	'Y': {w:18,n:4,d:['m',[1,21],'l',[9,11],[17,21],'m',[9,11],'l',[9,0]]},
	'Z': {w:20,n:2,d:['m',[3,21],'l',[17,21],[3,0],[17,0]]},
	'[': {w:14,n:2,d:['m',[11,25],'l',[4,25],[4,-7],[11,-7]]},
	'\\': {w:14,n:2,d:['m',[0,21],'l',[14,-3]]},
	']': {w:14,n:2,d:['m',[3,25],'l',[10,25],[10,-7],[3,-7]]},
	'^': {w:16,n:2,d:['m',[3,16],'l',[8,21],[13,16]]},
	'_': {w:16,n:2,d:['m',[0,-2],'l',[16,-2]]},
	'`': {w:10,n:2,d:['m',[6,21],'l',[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},
	'a': {w:19,n:10,d:['m',[15,14],'l',[15,0],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'b': {w:19,n:10,d:['m',[4,21],'l',[4,0],'m',[10,14],'l',[9,14],'q',[6,14],[4,12],'m',[4,2],'q',[6,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'c': {w:18,n:10,d:['m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[14,0],[15,3],'m',[15,11],'q',[14,14],[10,14]]},
	'd': {w:19,n:10,d:['m',[15,21],'l',[15,0],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'e': {w:18,n:8,d:['m',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[14,0],[15,3],'m',[3,8],'l',[15,8],'q',[15,14],[9,14]]},
	'f': {w:12,n:5,d:['m',[10,21],'q',[5,21],[5,17],'l',[5,0],'m',[2,14],'l',[9,14]]},
	'g': {w:19,n:12,d:['m',[15,14],'l',[15,-2],'q',[15,-7],[10,-7],'q',[7,-7],[6,-6],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'h': {w:19,n:6,d:['m',[4,21],'l',[4,0],'m',[4,10],'q',[6,14],[11,14],'q',[15,14],[15,10],'l',[15,0]]},
	'i': {w: 8,n:4,d:['m',[3,21],'l',[4,20],[5,21],[4,22],[3,21],'m',[4,14],'l',[4,0]]},
	'j': {w:10,n:5,d:['m',[5,21],'l',[6,20],[7,21],[6,22],[5,21],'m',[6,14],'l',[6,-3],'q',[6,-8],[1,-7]]},
	'k': {w:17,n:6,d:['m',[4,21],'l',[4,0],'m',[14,14],'l',[4,4],'m',[8,8],'l',[15,0]]},
	'l': {w: 8,n:2,d:['m',[4,21],'l',[4,0]]},
	'm': {w:26,n:10,d:['m',[4,14],'l',[4,0],'m',[4,10],'q',[6,14],[10,14],'q',[13,14],[13,10],'l',[13,0],'m',[13,10],'q',[15,14],[19,14],'q',[22,14],[22,10],'l',[22,0]]},
	'n': {w:19,n:6,d:['m',[4,14],'l',[4,0],'m',[4,10],'q',[6,14],[11,14],'q',[15,14],[15,10],'l',[15,0]]},
	'o': {w:19,n:7,d:['m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'p': {w:19,n:10,d:['m',[4,14],'l',[4,-7],'m',[10,14],'l',[9,14],'q',[6,14],[4,12],'m',[4,2],'q',[6,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'q': {w:19,n:10,d:['m',[15,14],'l',[15,-7],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'r': {w:13,n:4,d:['m',[4,14],'l',[4,0],'m',[4,8],'q',[5,14],[12,14]]},
	's': {w:16,n:7,d:['m',[13,11],'q',[13,14],[8,14],'q',[3,14],[3,11],'q',[3,8],[8,7],'q',[13,6],[13,3],'q',[13,0],[8,0],'q',[3,0],[3,3]]},
	't': {w:12,n:5,d:['m',[5,21],'l',[5,4],'q',[5,-1],[10,0],'m',[2,14],'l',[9,14]]},
	'u': {w:19,n:6,d:['m',[4,14],'l',[4,4],'q',[4,0],[8,0],'q',[13,0],[15,4],'m',[15,14],'l',[15,0]]},
	'v': {w:16,n:2,d:['m',[2,14],'l',[8,0],[14,14]]},
	'w': {w:22,n:2,d:['m',[3,14],'l',[7,0],[11,14],[15,0],[19,14]]},
	'x': {w:17,n:4,d:['m',[3,14],'l',[14,0],'m',[14,14],'l',[3,0]]},
	'y': {w:16,n:5,d:['m',[2,14],'l',[8,0],'m',[14,14],'l',[8,0],'q',[5,-7],[1,-7]]},
	'z': {w:17,n:2,d:['m',[3,14],'l',[14,14],[3,0],[14,0]]},
	'{': {w:14,n:9,d:['m',[9,25],'q',[5,24],[5,20],'q',[5,17],[7,16],'q',[9,15],[8,12],'q',[7,9],[4,9],'q',[7,9],[8,6],'q',[9,3],[7,2],'q',[5,1],[5,-2],'q',[5,-6],[9,-7]]},
	'|': {w: 8,n:2,d:['m',[4,25],'l',[4,-7]]},
	'}': {w:14,n:9,d:['m',[5,25],'q',[9,24],[9,20],'q',[9,17],[7,16],'q',[5,15],[6,12],'q',[7,9],[10,9],'q',[7,9],[6,6],'q',[5,3],[7,2],'q',[9,1],[9,-2],'q',[9,-6],[5,-7]]},
	'~': {w:24,n:4,d:['m',[3,6],'q',[3,12],[10,10],'l',[14,8],'q',[21,4],[21,10]]},
	' ': {w:16,n:1,d:[]},
	'¡': {w:10,n:4,d:['m',[5,10],'l',[5,-4],'m',[5,17],'l',[4,16],[5,15],[6,16],[5,17]]},
	'¢': {w:18,n:14,d:['m',[9,14],'l',[9,18],'m',[9,0],'l',[9,-4],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[14,0],[15,3],'m',[15,11],'q',[14,14],[10,14]]},
	'£': {w:18,n:8,d:['m',[4,11],'l',[13,11],'m',[16,18],'q',[15,21],[11,21],'q',[5,21],[6,16],'q',[7,8],[6,2],'q',[5,0],[4,0],'l',[16,0]]},
	'¤': {w:19,n:13,d:['m',[15,3],'l',[17,1],'m',[15,13],'l',[17,15],'m',[5,3],'l',[3,1],'m',[5,13],'l',[3,15],'m',[10,14],'q',[4,14],[4,8],'q',[4,2],[10,2],'q',[16,2],[16,8],'q',[16,14],[10,14]]},
	'¥': {w:18,n:8,d:['m',[4,7],'l',[14,7],'m',[4,11],'l',[14,11],'m',[1,21],'l',[9,11],[17,21],'m',[9,11],'l',[9,0]]},
	'¦': {w: 8,n:4,d:['m',[4,25],'l',[4,12],'m',[4,6],'l',[4,-7]]},
	'§': {w:20,n:12,d:['m',[16,18],'q',[16,21],[10,21],'q',[4,21],[4,18],'q',[4,15],[10,14],'q',[16,13],[16,10],'q',[16,6],[10,7],'m',[10,14],'q',[4,15],[4,11],'q',[4,8],[10,7],'q',[16,6],[16,3],'q',[16,0],[10,0],'q',[4,0],[4,3]]},
	'¨': {w:16,n:4,d:['m',[4,25],'l',[4,23],'m',[12,25],'l',[12,23]]},
	'©': {w:27,n:15,d:['m',[18,13],'q',[17,15],[14,15],'q',[9,15],[9,11],'l',[9,10],'q',[9,6],[14,6],'q',[17,6],[18,8],'m',[24,10],'q',[24,0],[14,0],'l',[13,0],'q',[3,0],[3,10],'l',[3,11],'q',[3,21],[13,21],'l',[14,21],'q',[24,21],[24,11],'l',[24,10]]},
	'ª': {w:14,n:9,d:['m',[4,12],'l',[10,12],'m',[10,21],'l',[10,15],'m',[4,18],'q',[4,15],[7,15],'q',[10,15],[10,18],'q',[10,21],[7,21],'q',[4,21],[4,18]]},
	'«': {w:24,n:4,d:['m',[12,16],'l',[3,9],[12,2],'m',[21,16],'l',[12,9],[21,2]]},
	'¬': {w:22,n:2,d:['m',[4,12],'l',[18,12],[18,8]]},
	'­': {w:22,n:2,d:['m',[4,9],'l',[18,9]]},
	'®': {w:27,n:17,d:['m',[9,6],'l',[9,15],[16,15],'m',[9,10],'l',[16,10],[18,6],'m',[16,10],'q',[18,10],[18,12],'l',[18,13],'q',[18,15],[16,15],'m',[24,10],'q',[24,0],[14,0],'l',[13,0],'q',[3,0],[3,10],'l',[3,11],'q',[3,21],[13,21],'l',[14,21],'q',[24,21],[24,11],'l',[24,10]]},
	'¯': {w:16,n:2,d:['m',[0,24],'l',[16,24]]},
	'°': {w:10,n:5,d:['m',[3,23],'q',[3,21],[5,21],'q',[7,21],[7,23],'q',[7,25],[5,25],'q',[3,25],[3,23]]},
	'±': {w:22,n:6,d:['m',[11,18],'l',[11,6],'m',[4,12],'l',[18,12],'m',[4,2],'l',[18,2]]},
	'²': {w:14,n:6,d:['m',[10,11],'l',[4,11],'q',[4,15],[7,15],'q',[10,15],[10,18],'q',[10,21],[7,21],'q',[4,21],[4,18]]},
	'³': {w:14,n:5,d:['m',[4,14],'q',[4,11],[7,11],'q',[10,11],[10,14],'q',[10,17],[7,17],'l',[10,21],[4,21]]},
	'´': {w:19,n:2,d:['m',[9,18],'l',[12,20]]},
	'µ': {w:19,n:7,d:['m',[4,14],'l',[4,-6],'m',[4,4],'q',[4,0],[8,0],'q',[13,0],[15,4],'m',[15,14],'l',[15,0]]},
	'¶': {w:18,n:5,d:['m',[8,11],'q',[3,11],[3,16],'q',[3,21],[9,21],'m',[9,0],'l',[9,21],[15,21],[15,0]]},
	'·': {w:10,n:2,d:['m',[5,14],'l',[4,13],[5,12],[6,13],[5,14]]},
	'¸': {w:18,n:2,d:['m',[10,0],'l',[10,-2],[7,-4]]},
	'¹': {w:10,n:2,d:['m',[4,19],'l',[6,21],[6,11]]},
	'º': {w:14,n:7,d:['m',[4,12],'l',[10,12],'m',[4,18],'q',[4,15],[7,15],'q',[10,15],[10,18],'q',[10,21],[7,21],'q',[4,21],[4,18]]},
	'»': {w:24,n:4,d:['m',[3,16],'l',[12,9],[3,2],'m',[12,16],'l',[21,9],[12,2]]},
	'¼': {w:24,n:6,d:['m',[4,19],'l',[6,21],[6,11],'m',[16,15],'l',[6,5],'m',[19,0],'l',[19,10],[14,4],[20,4]]},
	'½': {w:24,n:10,d:['m',[4,19],'l',[6,21],[6,11],'m',[16,15],'l',[6,5],'m',[20,0],'l',[14,0],'q',[14,4],[17,4],'q',[20,4],[20,7],'q',[20,10],[17,10],'q',[14,10],[14,7]]},
	'¾': {w:24,n:10,d:['m',[4,14],'q',[4,11],[7,11],'q',[10,11],[10,14],'q',[10,17],[7,17],'l',[10,21],[4,21],'m',[18,15],'l',[8,5],'m',[19,0],'l',[19,10],[14,4],[20,4]]},
	'¿': {w:18,n:7,d:['m',[9,21],'l',[8,20],[9,19],[10,20],[9,21],'m',[9,14],'l',[9,10],'q',[3,10],[3,5],'q',[3,0],[9,0],'q',[15,0],[15,5]]},	
	'À': {w:18,n:6,d:['m',[7,25],'l',[10,23],'m',[1,0],'l',[9,21],[17,0],'m',[4,7],'l',[14,7]]},
	'Á': {w:18,n:6,d:['m',[8,23],'l',[11,25],'m',[1,0],'l',[9,21],[17,0],'m',[4,7],'l',[14,7]]},
	'Â': {w:18,n:6,d:['m',[7,23],'l',[9,25],[11,23],'m',[1,0],'l',[9,21],[17,0],'m',[4,7],'l',[14,7]]},
	'Ã': {w:18,n:6,d:['m',[6,23],'l',[8,25],[10,23],[12,25],'m',[1,0],'l',[9,21],[17,0],'m',[4,7],'l',[14,7]]},
	'Ä': {w:18,n:10,d:['m',[5,25],'l',[5,23],'m',[13,25],'l',[13,23],'m',[1,0],'l',[9,21],[17,0],'m',[4,7],'l',[14,7]]},
	'Å': {w:18,n:10,d:['m',[7,23],'q',[7,21],[9,21],'q',[11,21],[11,23],'q',[11,25],[9,25],'q',[7,25],[7,23],'m',[1,0],'l',[9,21],[17,0],'m',[4,7],'l',[14,7]]},
	'Æ': {w:18,n:12,d:['m',[9,21],'l',[1,0],'m',[4,7],'l',[9,7],'m',[9,21],'l',[9,0],'m',[9,21],'l',[17,21],'m',[9,11],'l',[17,11],'m',[9,0],'l',[17,0]] },
	'Ç': {w:21,n:9,d:['m',[11,0],'l',[11,-2],[8,-4],'m',[11,21],'q',[17,21],[18,16],'m',[18,5],'q',[17,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'È': {w:19,n:8,d:['m',[7,25],'l',[10,23],'m',[17,21],'l',[4,21],[4,0],[17,0],'m',[4,11],'l',[12,11]]},
	'É': {w:19,n:8,d:['m',[9,23],'l',[12,25],'m',[17,21],'l',[4,21],[4,0],[17,0],'m',[4,11],'l',[12,11]]},
	'Ê': {w:19,n:8,d:['m',[8,23],'l',[10,25],[12,23],'m',[17,21],'l',[4,21],[4,0],[17,0],'m',[4,11],'l',[12,11]]},
	'Ë': {w:19,n:10,d:['m',[6,25],'l',[6,23],'m',[15,25],'l',[15,23],'m',[17,21],'l',[4,21],[4,0],[17,0],'m',[4,11],'l',[12,11]]},
	'Ì': {w:8,n:4,d:['m',[3,25],'l',[6,23],'m',[4,21],'l',[4,0]]},
	'Í': {w:8,n:4,d:['m',[2,23],'l',[5,25],'m',[4,21],'l',[4,0]]},
	'Î': {w:8,n:4,d:['m',[2,23],'l',[4,25],[6,23],'m',[4,21],'l',[4,0]]},
	'Ï': {w:8,n:6,d:['m',[2,25],'l',[2,23],'m',[6,25],'l',[6,23],'m',[4,21],'l',[4,0]]},
	'Ð': {w:21,n:7,d:['m',[2,10],'l',[11,10],'m',[11,0],'l',[4,0],[4,21],[11,21],'q',[18,21],[18,12],'l',[18,9],'q',[18,0],[11,0]]},
	'Ñ': {w:22,n:4,d:['m',[8,23],'l',[10,25],[12,23],[14,25],'m',[4,0],'l',[4,21],[18,0],[18,21]]},
	'Ò': {w:22,n:9,d:['m',[8,25],'l',[11,23],'m',[11,21],'q',[19,21],[19,12],'l',[19,9],'q',[19,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'Ó': {w:22,n:9,d:['m',[10,23],'l',[13,25],'m',[11,21],'q',[19,21],[19,12],'l',[19,9],'q',[19,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'Ô': {w:22,n:9,d:['m',[9,23],'l',[11,25],[13,23],'m',[11,21],'q',[19,21],[19,12],'l',[19,9],'q',[19,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'Õ': {w:22,n:9,d:['m',[8,23],'l',[10,25],[12,23],[14,25],'m',[11,21],'q',[19,21],[19,12],'l',[19,9],'q',[19,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'Ö': {w:22,n:13,d:['m',[6,25],'l',[6,23],'m',[16,25],'l',[16,23],'m',[11,21],'q',[19,21],[19,12],'l',[19,9],'q',[19,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'×': {w:12,n:4,d:['m',[2,16],'l',[10,6],'m',[10,16],'l',[2,6]]},
	'Ø': {w:22,n:9,d:['m',[3,1],'l',[19,20],'m',[11,21],'q',[19,21],[19,12],'l',[19,9],'q',[19,0],[11,0],'q',[3,0],[3,9],'l',[3,12],'q',[3,21],[11,21]]},
	'Ù': {w:22,n:7,d:['m',[8,25],'l',[11,23],'m',[4,21],'l',[4,6],'q',[4,0],[11,0],'q',[18,0],[18,6],'l',[18,21]]},
	'Ú': {w:22,n:7,d:['m',[10,23],'l',[13,25],'m',[4,21],'l',[4,6],'q',[4,0],[11,0],'q',[18,0],[18,6],'l',[18,21]]},
	'Û': {w:22,n:7,d:['m',[9,23],'l',[11,25],[13,23],'m',[4,21],'l',[4,6],'q',[4,0],[11,0],'q',[18,0],[18,6],'l',[18,21]]},
	'Ü': {w:22,n:9,d:['m',[7,25],'l',[7,23],'m',[15,25],'l',[15,23],'m',[4,21],'l',[4,6],'q',[4,0],[11,0],'q',[18,0],[18,6],'l',[18,21]]},
	'Ý': {w:18,n:6,d:['m',[8,23],'l',[11,25],'m',[1,21],'l',[9,11],[9,0],'m',[17,21],'l',[9,11]]},
	'Þ': {w:19,n:7,d:['m',[4,18],'l',[4,-5],'m',[4,14],'l',[9,14],'q',[16,14],[16,7],'q',[16,0],[9,0],'l',[4,0]]},
	'ß': {w:21,n:9,d:['m',[8,0],'l',[11,0],'q',[17,0],[17,5],'l',[17,6],'q',[17,10],[11,12],'q',[16,13],[16,16],'q',[16,21],[10,21],'q',[4,21],[4,16],'l',[4,0]]},
	'à': {w:19,n:12,d:['m',[7,20],'l',[10,18],'m',[15,14],'l',[15,0],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'á': {w:19,n:12,d:['m',[9,18],'l',[12,20],'m',[15,14],'l',[15,0],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'â': {w:19,n:12,d:['m',[7,18],'l',[9,20],[11,18],'m',[15,14],'l',[15,0],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'ã': {w:19,n:12,d:['m',[7,18],'l',[9,20],[11,18],[13,20],'m',[15,14],'l',[15,0],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'ä': {w:19,n:14,d:['m',[4,20],'l',[4,18],'m',[15,20],'l',[15,18],'m',[15,14],'l',[15,0],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'å': {w:19,n:15,d:['m',[7,18],'q',[7,16],[9,16],'q',[11,16],[11,18],'q',[11,20],[9,20],'q',[7,20],[7,18],  'm',[15,14],'l',[15,0],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[13,0],[15,2],'m',[15,12],'q',[13,14],[10,14]]},
	'æ': {w:21,n:10,d:['m',[11,14],'l',[11,0],'m',[11,8],'l',[18,8],'q',[18,14],[12,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[13,0],'q',[17,0],[18,3]]},
	'ç': {w:18,n:10,d:['m',[10,0],'l',[10,-2],[7,-4],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[14,0],[15,3],'m',[15,11],'q',[14,14],[10,14]]},
	'è': {w:18,n:10,d:['m',[7,20],'l',[10,18],'m',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[14,0],[15,3],'m',[3,8],'l',[15,8],'q',[15,14],[9,14]]},
	'é': {w:18,n:10,d:['m',[9,18],'l',[12,20],'m',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[14,0],[15,3],'m',[3,8],'l',[15,8],'q',[15,14],[9,14]]},
	'ê': {w:18,n:10,d:['m',[7,18],'l',[9,20],[11,18],'m',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[14,0],[15,3],'m',[3,8],'l',[15,8],'q',[15,14],[9,14]]},
	'ë': {w:18,n:12,d:['m',[4,20],'l',[4,18],'m',[15,20],'l',[15,18],'m',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[14,0],[15,3],'m',[3,8],'l',[15,8],'q',[15,14],[9,14]]},
	'ì': {w:8,n:4,d:['m',[3,20],'l',[6,18],'m',[4,14],'l',[4,0]]},
	'í': {w:8,n:4,d:['m',[2,18],'l',[5,20],'m',[4,14],'l',[4,0]]},
	'î': {w:8,n:4,d:['m',[2,18],'l',[4,20],[6,18],'m',[4,14],'l',[4,0]]},
	'ï': {w:8,n:6,d:['m',[2,20],'l',[2,18],'m',[6,20],'l',[6,18],'m',[4,14],'l',[4,0]]},
	'ð': {w:19,n:12,d:['m',[8,17],'l',[10,21],'m',[7,20],'l',[11,18],'q',[16,16],[16,8],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'ñ': {w:19,n:8,d:['m',[7,18],'l',[9,20],[11,18],[13,20],'m',[4,14],'l',[4,0],'m',[4,10],'q',[6,14],[11,14],'q',[15,14],[15,10],'l',[15,0]]},
	'ò': {w:19,n:9,d:['m',[7,20],'l',[10,18],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'ó': {w:19,n:9,d:['m',[9,18],'l',[12,20],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'ô': {w:19,n:9,d:['m',[7,18],'l',[9,20],[11,18],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'õ': {w:19,n:9,d:['m',[7,18],'l',[9,20],[11,18],[13,20],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'ö': {w:19,n:11,d:['m',[4,20],'l',[4,18],'m',[15,20],'l',[15,18],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'÷': {w:18,n:6,d:['m',[9,15],'l',[9,14],'m',[4,9],'l',[14,9],'m',[9,4],'l',[9,3]]},
	'ø': {w:19,n:9,d:['m',[3,1],'l',[15,14],'m',[10,14],'l',[9,14],'q',[3,14],[3,7],'q',[3,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'ù': {w:19,n:8,d:['m',[7,20],'l',[10,18],'m',[4,14],'l',[4,4],'q',[4,0],[8,0],'q',[13,0],[15,4],'m',[15,14],'l',[15,0]]},
	'ú': {w:19,n:8,d:['m',[9,18],'l',[12,20],'m',[4,14],'l',[4,4],'q',[4,0],[8,0],'q',[13,0],[15,4],'m',[15,14],'l',[15,0]]},
	'û': {w:19,n:8,d:['m',[7,18],'l',[9,20],[11,18],'m',[4,14],'l',[4,4],'q',[4,0],[8,0],'q',[13,0],[15,4],'m',[15,14],'l',[15,0]]},
	'ü': {w:19,n:10,d:['m',[4,20],'l',[4,18],'m',[15,20],'l',[15,18],'m',[4,14],'l',[4,4],'q',[4,0],[8,0],'q',[13,0],[15,4],'m',[15,14],'l',[15,0]]},
	'ý': {w:16,n:7,d:['m',[7,18],'l',[10,20],'m',[2,14],'l',[8,0],'m',[14,14],'l',[8,0],'q',[5,-7],[1,-7]]},
	'þ': {w:19,n:10,d:['m',[4,21],'l',[4,-7],'m',[10,14],'l',[9,14],'q',[6,14],[4,12],'m',[4,2],'q',[6,0],[9,0],'l',[10,0],'q',[16,0],[16,7],'q',[16,14],[10,14]]},
	'ÿ': {w:16,n:9,d:['m',[2,20],'l',[2,18],'m',[14,20],'l',[14,18],'m',[2,14],'l',[8,0],'m',[14,14],'l',[8,0],'q',[5,-7],[1,-7]]}
};
/* =========================================================
// jquery.flipv.js
// Author: OpenStudio (Arnault PACHOT)
// Mail: apachot@openstudio.fr
// Web: http://www.openstudio.fr
// Copyright (c) 2008 OpenStudio http://www.openstudio.fr
========================================================= */

jQuery(document).ready(function($){

	(function($) {

	$.fn.flipv = function(options) {

		this.each(function(){ 	
			var htmlsav = $(this).html();
			var textsav = $(this).text();
			var fontsizesav = '12';
			if ($(this).css('font-size') != '') {
				fontsizesav = parseInt($(this).css('font-size'));
			}
			var heightsav = $(this).height();
			var widthsav = Math.round((get_textWidth(textsav,fontsizesav-2)+$(this).height()*1.5)*100)/100;
			var colorsav = '#FFFF00';
			if ($(this).css('color')) {
				colorsav = $(this).css('color');
			}
			var backcolorsav = '#FF0000';
			if ($(this).css('background-color')) {
				backcolorsav = $(this).css('background-color');
			}

			var my_id = "canvas"+parseInt(Math.random()*1000);
			$(this).empty().append("<canvas id='"+my_id+"' class='verticalTab' width='"+heightsav+"' height='"+widthsav+"'>"+htmlsav+"</canvas>");

			var canvas = document.createElement('canvas');

			canvas.id = my_id;
			canvas.className = "verticalTab";
			canvas.width = heightsav;
			canvas.height = widthsav;
			canvas.innerHTML = htmlsav;

			// IE
			if ($.browser.msie) G_vmlCanvasManager.initElement(canvas);

			$(this).empty().append(canvas);

			vertical_text(textsav, fontsizesav, colorsav, backcolorsav, my_id);

		});
		return $(this);
	};
	})(jQuery);

	function vertical_text(mytext, fontsize, colorsav, backcolorsav, my_id) {
		var canvas = document.getElementById(my_id);
		if (canvas.getContext){
			var context = canvas.getContext('2d');

			context.moveTo(canvas.width, 0);
			context.lineTo(canvas.width/3, canvas.width/4);
			context.quadraticCurveTo(1, canvas.width*3/8, 1, canvas.width*2/3);
			context.lineTo(1, canvas.height-canvas.width*2/3);	
			context.quadraticCurveTo(1, canvas.height-canvas.width*3/8, canvas.width/3, canvas.height-canvas.width/4);
			context.lineTo(canvas.width, canvas.height);
			context.closePath();
			context.strokeStyle = colorsav;
			context.stroke();
			context.fillStyle = "#FFFFFF";
			context.fill();

			set_textRenderContext(context);
			if(check_textRenderContext(context)) {
				context.translate(-55,canvas.height-canvas.width*2/3+2);
				context.rotate(Math.PI*270/180);
				context.strokeStyle = colorsav;

			 // context.strokeText(text,-(w/2),-(h/2),size,weight,width,space);
				context.strokeText(mytext,3,60,fontsize-2,130);
			}
		}
	}

	$('.widget h2').flipv();

});

/**
*
*	simpleTooltip jQuery plugin, by Marius ILIE
*	visit http://dev.mariusilie.net for details
*
**/
jQuery(document).ready(function($){

	(function($){ $.fn.simpletooltip = function(){
		return this.each(function() {
			var text = $(this).attr("title");
			$(this).attr("title", "");
			if(text != undefined) {
				$(this).hover(function(e){
					var tipX = e.pageX + 12;
					var tipY = e.pageY + 12;
					$(this).attr("title", ""); 
					$("body").append("<div id='simpleTooltip' style='position: absolute; z-index: 100; display: none;'>" + text + "</div>");
					if($.browser.msie) var tipWidth = $("#simpleTooltip").outerWidth(true)
					else var tipWidth = $("#simpleTooltip").width()
					$("#simpleTooltip").width(tipWidth);
					$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("medium");
				}, function(){
					$("#simpleTooltip").remove();
					$(this).attr("title", text);
				});
				$(this).mousemove(function(e){
					var tipX = e.pageX + 12;
					var tipY = e.pageY + 12;
					var tipWidth = $("#simpleTooltip").outerWidth(true);
					var tipHeight = $("#simpleTooltip").outerHeight(true);
					if(tipX + tipWidth > $(window).scrollLeft() + $(window).width()) tipX = e.pageX - tipWidth;
					if($(window).height()+$(window).scrollTop() < tipY + tipHeight) tipY = e.pageY - tipHeight;
					$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("medium");
				});
			}
		});
	}})(jQuery);
	
});jQuery(document).ready(function($){

	/* ********************************
	   Debugfunktion
	******************************** */
	var __debug = 1;
	function debug(v, h) {
		if (__debug == 1) {
			if(('console' in window) && ('firebug' in console)) {
				console.info(v);
			}
			else {
				if(!document.getElementById('debug')) {
					var debugDiv = document.createElement('div');
					debugDiv.id = 'debug';
					debugDiv.style.background = '#ffffff';
					debugDiv.style.border     = '2px solid #c8c8c8';
					debugDiv.style.fontFamily = 'Courier, Courier New, Lucida Console';
					debugDiv.style.height     = '250px';
					debugDiv.style.margin     = '20px';
					debugDiv.style.overflow   = 'scroll';
					debugDiv.style.padding    = '5px 7px';
					debugDiv.style.width      = '750px';

					document.getElementsByTagName('body')[0].appendChild(debugDiv);
				}

				var time = new Array((new Date).getHours(), (new Date).getMinutes(), (new Date).getSeconds());

				document.getElementById('debug').innerHTML = '<span' + (h==1 ? ' style="color: #00ff00;"' : (h==2 ? ' style="color: #ff0000;"' : '')) + '>' + (time[0] < 10 ? '0' : '') + time[0] + ':' + (time[1] < 10 ? '0' : '') + time[1] + ':' + (time[2] < 10 ? '0' : '') + time[2] + ' | ' + v +  '</span><br />' + document.getElementById('debug').innerHTML;
			}
		}
		else
			return false;
	}





	function widget(parent) {
		this.parent					= parent;
		this.id						= parent.id;
		this.zeige					= widgetZeigeZustand;
		this.schalten				= widgetDurchschalten;
		this.nachOben				= widgetNachOben;
		this.setAktuellerZustand	= widgetSetAktuellerZustand;
		this.initEvents				= function(){};

		this.aktuellerZustand		= null;
		this.anzahlZustaende		= null;
		this.subnavigation			= $('#subnavi');
		this.zustandsFunktion		= function(){
			// elternwidget finden
			var vater = this.parentNode;
			while(!$(vater).hasClass('widget'))
			{
				vater = vater.parentNode;
			}
			vater.widget.zeige(this.parentNode.className);
		}
		
		
		// widget-subnavigation setzen
		var naviLink = this.subnavigation.find('ul li a.' + this.id)[0];
		if(this.id && naviLink) {
			var id = this.id;
			naviLink.onclick = function(){
				$('#' + id)[0].widget.nachOben();
				return false;
			};
		}
	}

	function widgetSetAktuellerZustand() {
		var aktiv = $(this.parent).find('.aktiv');

		for(var a = aktiv.length-1; a >= 0; a--)
		{
			this.aktuellerZustand = aktiv[a].className.match(/zustand([0-9])+/)[1];
		}
		this.anzahlZustaende = $(this.parent).find('.zustaende').length;
	}


	function widgetDurchschalten() {
		if(this.aktuellerZustand == null || this.anzahlZustaende == null) {
			this.setAktuellerZustand();
		}


		var neuerzustand = parseInt(this.aktuellerZustand)+1;
		neuerzustand = neuerzustand > (this.anzahlZustaende-1) ? 0 : neuerzustand;

		this.aktuellerZustand = neuerzustand

		this.zeige('zustand' + neuerzustand);
	}

	function widgetZeigeZustand(zustand) {
		var zustandsklasse = zustand;
		
		// wenn zu ladender zustand nicht existiert brechen wir ab
		if($(this.parent).find('.boxInhalt .' + zustand).length < 1)
		{
			return 0;
		}
		zustand = $(this.parent).find('.boxInhalt .' + zustand);
		
		
		// noch aktiven zustand holen
		var aktiv = null;
		var aktiv = $(this.parent).find('.aktiv');
		
		
		// wenn aktiver zustand der zu ladende ist brechen wir ab
		if(zustand.hasClass('aktiv')) {
			return 0;
		}
		
		
		// elternelement braucht fuer den vorgang eine relative positionierung
		var originalPosition = $(this.parent).find('.boxInhalt').css('position');
		$(this.parent).find('.boxInhalt').css('position', 'relative');
		
		
		// aktives element inaktiv setzen und absolut positionieren
		aktiv.removeClass('aktiv');
		aktiv.css('position', 'absolute');
		aktiv.css('top', '0px');
		aktiv.css('z-index', 1);
		
		// den zukuenftigen aktiven zustand aktiv setzen
		zustand.addClass('aktiv');
		zustand.css('position', 'relative');
		zustand.css('z-index', 0);
		
		// aktiven zustand ausblenden, neuen einblenden
		aktiv.fadeOut(1000);
		zustand.fadeIn(1000, function(){
			$(this.parent).find('.boxInhalt').css('position', originalPosition);
		});
		
		
		// zustandlinks anpassen
		var schalter = $(this.parent).find('ul.widgetliste li');
		
		// fuer jedes gefundene li <----------------- each?
		for(var i = 0; schalter[i]; i++) {
			
			// wenn li-klasse und gesuchter zustand matchen
			if(schalter[i].className.match(zustandsklasse)) {
				schalter[i].innerHTML = $(schalter[i]).find('a')[0].innerHTML;
				$(schalter[i]).addClass("ektivEktiv");
			}
			else {
				var linkname = schalter[i].innerHTML;
				$(schalter[i]).empty();
				$(schalter[i]).html('<a class="stark" href="javascript:void(0);">' + linkname + '</a>');
				$(schalter[i]).find('a')[0].onclick = this.zustandsFunktion;
				$(schalter[i]).removeClass("ektivEktiv");
			}
		}
		
		/*
		for(var x = 0; x < zustaende.length; x++) {
			var z = $(zustaende[x]);
			if(z.hasClass(zustand) && z.hasClass('aktiv')) {
				return 0;
			}
			
			if(!z.hasClass(zustand)) {
				z.removeClass('aktiv');
			}
			else
			{
				z.addClass('aktiv');
					$(z).fadeIn(500);
				});
			}
		}
		
		// Alle Infos beim umschalter ausblenden
		var infos = $(this.parent).find('.kopf span.zustand');
		for(var x = 0; x < infos.length; x++)
		{
			var naechster = (this.aktuellerZustand == (this.anzahlZustaende-1)) ? 0 : (this.aktuellerZustand+1);
			var info = $(infos[x]);

			if(!info.hasClass('zustand'+naechster)) {
				info.fadeOut('normal');
			}
			if(info.hasClass(zustand)) {
				var ob = $(this.parent).find('.zustand'+naechster);
				ob.fadeIn('normal');
			}
		}



		// Alle Zustaende ermitteln
		var obs  = $(this.parent).find('.koerper .zustaende');

		for(var x = 0; x < obs.length; x++) {
			var ob = $(obs[x]);

			if(ob.hasClass('aktiv') && !ob.hasClass(zustand)) {
				ob.slideUp();
				ob.removeClass('aktiv');
			}
			else if(ob.hasClass(zustand)) {
				ob.slideDown();
				ob.addClass('aktiv');
			}
		}*/
	}
	
	
	/**
	 * widget nach oben holen
	 */
	function widgetNachOben()
	{
		var parent = this.parent;					// parent ist das gewaehlte widget
		// bevor wir das element ersetzen muessen wir pruefen, ob irgendwo
		// ein scriptblock ist, der eine datei nachlaed und diesen entfernen
		// (googlemaps-widget-verschieben-problem)
		$(parent).find('script[src!=]').remove();
		
		
		var klon = $(parent).clone();				// wir brauchen einen klon, damit wir gleichzeitig ein und ausklappen koennen
		var subnavigation = this.subnavigation;
		
		var oben = $(parent.parentNode).find('.widget')[0].id;
		
		
		// wenn unser widget schon ganz oben steht, blinkt es kurz, um
		// anzuzeigen, dass der klick bemerkt wurde
		if(oben == this.id) {
			$(parent).fadeTo(50, 0.5, function(){
				$(parent).fadeTo(200, 1.0, function(){
					$(parent).fadeTo(50, 0.5, function(){
						$(parent).fadeTo(200, 1.0);
					})
				})
			});
		}
		// ansonsten muessen wir das widget nach oben holen
		else {
			// sonderfall fuer videowidgets
			if(this.id == 'videos') {
				// erstmal alle widgets holen
				var widgets = $(parent.parentNode).find('.widget');
				var oberhalb = new Array();

				// jetzt die widgets sichern, die oberhalb der videos liegen
				for(var i = 0; i < widgets.length && widgets[i].id != 'videos'; i++) {
					oberhalb[oberhalb.length] = widgets[i];
				}

				// widgets in umgekehrter reihenfolge nach videos einfuegen
				for(var i = oberhalb.length-1; i >= 0; i--) {
					$(oberhalb[i]).insertAfter(parent);
				}

				// neuen hash setzen
				laut.setzeHash(parent.id);

				//$('html').animate({ scrollTop: ($(parent).offset().top-10) }, 300, function(){});
			}
			else {
				var originalhoehe = $(parent).height();
				
				// wir ersetzen unser widget durch den erstellten klon
				$(parent).replaceWith(klon[0]);
				// unser original muss unsichtbar sein
				$(parent).css('height', '1px');
				
				
				// ueber den klon holen wir uns den widget-container
				// und fuegen das original an oberster stelle ein
				$(klon[0].parentNode).prepend(parent);
				
				// jetzt wird das original ausgefahren, gleichzeitig
				// faehrt der klon ein und wird anschliessend entfernt
				$(parent).animate({height: originalhoehe + 'px'}, 300, function(){
					$(this).css('height', 'auto');	// muss gesetzt sein, damit aufklappen nach verschieben wieder funktioniert
					//$(this).css('height', originalhoehe + 'px');	// muss gesetzt sein, damit aufklappen nach verschieben wieder funktioniert
				});
				
				klon.animate({height: '1px'}, 300, function(){
					klon.remove();
					
					// neuen hash setzen
					laut.setzeHash(parent.id);
				});
			}
			
			// aktion: formularAbschicken
			laut.trackClick('','anchor');
			
			// events initialisieren
			this.initEvents();

			// position in cookie speichern
			laut.widgets.setSortierungsCookie();
		}
		
		$('ul.inhalt > li:first-child').removeClass('last');
		var lastWidget = $('ul.inhalt > li:last-child');
		if($('ul.inhalt > li:first-child').attr('id') == $('ul.inhalt > li:last-child').attr('id')) {
			var Widget	= $(window.laut.widgets[0].widget.parent.parentNode).find('.widget');
			lastWidget = $(Widget[(Widget.length-2)]);
		}
		lastWidget.addClass('last');
		
		// anker an hash haengen
		return false;
	}
	
	/**
	 *	methode zum setzen neuer hashs
	 */
	laut.setzeHash = function(hash) {
		// pruefen ob wir es mit einem existierenden element zu tun haben
		if(document.getElementById(hash)) {
			var ob = document.getElementById(hash);

			// wir moechten nicht, dass die seitenposition veraendert wird,
			// wenn auf die navigation geklickt wird, deshalb muessen wir das
			// entsprechende ziel aendern

			// id des ziels aendern
			ob.id		= '';
			// neuen hash einfuegen
			window.location.hash = hash;
			// id zuruecksetzen auf original-id
			ob.id	 	= hash;

			hash = null;

			return true;
		}

		// sonst wird einfach gesetzt
		window.location.hash = hash;
	};


	laut.widgets = $('.inhalt .widget');
	laut.widgets.setSortierungsCookie = function(){
		var widgets;
		//
		// reihenfolge ermitteln
		widgets = $('.inhalt .widget');

		var sortierung = new Array();
		for(var i = 0; widgets[i]; i++) {
			if(widgets[i].widget) {
				sortierung[sortierung.length] = widgets[i].id;
			}
		}


		// erstmal alten keks holen
		var keks = document.cookie.split(';');

		// index sichert die position im cookie
		var index = -1;

		// gucken, ob irgendwo im keks schon was zum seitentyp zu finden ist
		for(var i = 0; keks[i]; i++) {

			// nach sortierung suchen
			var tmp = keks[i].search(/sortierung=[a-zA-Z0-9,\-&]*[;]?/);

			if(tmp != null && tmp > -1) {
				index = i;
				break;
			}
		}

		// neue sortierung und alte sortierung anlegen
		var alte_sortierung = null;
		var neue_sortierung = new Array();


		// wenn wir einen index haben, holen wir uns den string und versuchen ihn zu teilen
		if(index > -1) {
			alte_sortierung = keks[index].split('sortierung=')[1];
		}


		// jetzt finden wir heraus, ob fuer diesen seitentyp eine sortierung existiert
		var suchstring = seitentyp + ':[a-zA-Z0-9,]*[&]{0,1}';

		if(alte_sortierung != null) {
			// sollte fuer diesen seitentyp eine sortierung gefunden werden, wird sie ersetzt
			var tmp = alte_sortierung.split('&');

			for(var i = 0; tmp[i]; i++) {
				// wenn seitentyp als sortierungsbezeichnung gefunden wird, darf dieser eintrag
				// nicht weiter im cookie gesichert werden.
				if(tmp[i].search(seitentyp + ':') == -1) {
					neue_sortierung[neue_sortierung.length] = tmp[i];
				}
			}
		}


		// neue sortierung anhaengen
		neue_sortierung[neue_sortierung.length] = seitentyp + ':' + sortierung.join(',');

		//index = index > -1 ? index : keks.length;
		//keks[i] = seitentyp + ":" + sortierung.join(',');
		document.cookie = 'sortierung=' + neue_sortierung.join('&') + ';path=/';
	};
	
	for(var i = 0; laut.widgets[i]; i++) {
		// widgets speichern
		if(laut.widgets[i].className = 'widget') {
			if(!laut.widgets[i].widget){
				laut.widgets[i].widget = new widget(laut.widgets[i]);
			}
			
			// zustandsschalter mit funktion versehen
			$(laut.widgets[i]).find('.widgetschalter').click(function(){
				// elternwidget suchen
				var element = this;
				while(!$(element).hasClass('widget')) {
					element = element.parentNode;
					i++;
				}
				
				// wenn wir ein widget haben wird geschaltet
				if(element && $(element).hasClass('widget'))
				{
					element.widget.schalten();
				}
			});
			
			// zustandsliste schaltbar machen
			var schalter = $(laut.widgets[i]).find('ul.widgetliste li a');
			for(var j = 0; schalter[j]; j++) {
				$(schalter[j]).click(function(){
					
					// elternwidget finden
					var vater = this.parentNode;
					while(!$(vater).hasClass('widget'))
					{
						vater = vater.parentNode;
					}
					
					vater.widget.zeige(this.parentNode.className);
				});
			}
		}
		
	}

	/* ----------------------------------------
	   text ausklappen
	---------------------------------------- */

	var buttonAusklapp = '&nbsp;<a class="klappenText buttonFade" href="javascript:void(0);">weiterlesen</a>';
	var buttonEinklapp = '&nbsp;<a class="klappenText klappenTextOffen" href="">einklappen</a>';

	$(".leadtext").append(buttonAusklapp);
	$(".klappText").wrapInner('<a class="klappenText" href="javascript:void(0);"></a>');
	$(".volltext p:last-child").append(buttonEinklapp);

	$(".klappenText").live("click", function(){
		var parent = $(this);
		while(!parent.hasClass('scrolltop')) {
			parent = parent.parent();
		}
		if ($(parent).find(".volltext").css("display") == "none"){
			$(parent).find("em.song").css("font-weight","bold");
			$(parent).find(".buttonFade").fadeOut();
			$('html').animate({ scrollTop: ($(parent).offset().top-10) }, 0, function(){
				$(parent).find(".volltext").slideDown();
			});
		} else {
			$(parent).find("em.song").css("font-weight","normal");
			$('html').animate({ scrollTop: ($(parent).offset().top-10) }, 0, function(){
				$(parent).find(".volltext").slideUp(function(){
					$(parent).find(".buttonFade").fadeIn();		
				});	
			});
		}
		
		// aktion: text klappen
		laut.trackClick('wl_bio','weiterlesen');
		
		return false;
	});



	/* ----------------------------------------
	   kommentarfeld
	---------------------------------------- */
/*
	$('li.postEingabefeld textarea').bind("focus", function(){
		if ($(this).val() == "Dein Kommentar ...") {
			this.usertext = $(this).val();
			$(this).val("");
		}
	});
	$('li.postEingabefeld textarea').bind("blur", function(){
		if ($(this).val() == "") {
			if ((this.usertext) && (this.usertext != "")) $(this).val(this.usertext);
			else $(this).val("Dein Kommentar ...");
		}
	});
*/
	/* ----------------------------------------
	   tooltip
	---------------------------------------- */

	$(".tooltip").simpletooltip();


	/* ----------------------------------------
	   subnavi
	---------------------------------------- 

	$("#subnavi img").hover(function(){
		$("#subnavi .subheader a").addClass('jhover01');
	}, function() {
		$("#subnavi .subheader a").removeClass('jhover01');
	});

	*/
	
});

/* ----------------------------------------
   widget-mindesthoehe
---------------------------------------- */

jQuery(document).ready(function($){
	window.laut.widgets.mindesthoehe = function(){
		$.each($('li.widget'), function() {
			var widgetHeight = $(this).height();
			var canvasHeight = $(this).find('canvas').height();
			if ((canvasHeight+30) > widgetHeight) {
				//$(this).height(canvasHeight+30);
			}
		});
	};
	
	/**
	 * methode prueft welches widget das letzte ist und fuegt diesem ein
	 * bottom-margin von 15px hinzu, damit das canvas-schildchen sauber sitzt.
	 */
	window.laut.widgets.marginunten = function() {
		// letztes widget holen
		var letztesWidget	= $(window.laut.widgets[0].widget.parent.parentNode).find('.widget');
		letztesWidget		= $(letztesWidget[(letztesWidget.length-1)]);
		var canvasHoehe		= $(letztesWidget).find('canvas').height();
		var hoehe			= $(letztesWidget).height();
		
		// wenn canvashoehe exakt widgethoehe+15 ist, muessen wir es erhoehen
		if(canvasHoehe == hoehe+15) {
			hoehe = (hoehe + 30) + 'px';
			letztesWidget.css('height', hoehe);
		}
	}
	window.laut.widgets.mindesthoehe();
	//window.laut.widgets.marginunten();
	
	$('ul.inhalt > li:last-child').addClass('last');
});

jQuery('document').ready(function($) {
	if (!window.laut) {
		window.laut = {};
	}
	if (!window.laut.medium) {
		window.laut.medium = {};
	}
	displayVoting = function(obj,votingId){
		if (window.laut.medium[votingId]) {
			var parentUl = $(obj).parents().filter('ul.ulVoting');
			$.each(parentUl.find('li.liVoting'), function() {
				if ($(this).attr('title') <= laut.medium[votingId].userwertung) {
					$(this).find('a').removeClass('mover');
					$(this).find('a').addClass('uservoted');
				}
			});
		}
	};
	removeVoting = function(obj){
		$(obj).find('li.liVoting a').removeClass('uservoted');
	};
	setzeVoting = function(obj,votingId,votingWertung,c){
		var p = {
			aktion:	7,
			medium: votingId,
			stimme:	votingWertung
		}
		laut.pruefeLogin(function(){
			laut.ajax.senden(p, function(a) {
				// pruefen ob erfolgreich abgestimmt wurde
				if(a.code && a.code == 1) {
					if (!window.laut.medium[votingId]) {
						window.laut.medium[votingId] = {};
					}
					window.laut.medium[votingId].userwertung = a.stimme;
					c();
				}
				else {
					laut.login();
				}
			});
		});
	};
	$('li.liVoting').live("click",function() {
		var votingWertung = $(this).attr('title');
		var votingId = $(this).parents().filter('ul.ulVoting').attr('title');
		var akt = this;
		setzeVoting(akt,votingId,votingWertung, function() {
			displayVoting(akt,votingId);
		});
		return false;
	});
	$('li.liVoting').live("mouseover",function() {
		var parentUl = $(this).parents().filter('ul.ulVoting');
		removeVoting(parentUl);
		var voting = $(this).attr('title');
		$.each(parentUl.find('li.liVoting'), function() {
			if ($(this).attr('title') <= voting) {
				$(this).find('a').addClass('mover');
			}
		});
	});
	$('li.liVoting').live("mouseout",function() {
		$('li.liVoting a').removeClass('mover');
		var votingId = $(this).parents().filter('ul.ulVoting').attr('title');
		if (window.laut.medium[votingId]) {
			displayVoting(this,votingId);
		}
	});
});
jQuery(document).ready(function($){
	laut.community.loginForm = {};
	
	// loginform laden und anzeigen
	laut.community.loginForm.zeigen = function(c) {
		// wenn die form nicht vorhanden ist, wird sie angefordert
		if($('div#modalScreen').length == 0){
			var p = {
				aktion: 13
			};
			laut.ajax.senden(p, function(d){
				$('body').append(d);
				laut.community.loginForm.zeigen(c);
			});
			return;
		}

		// aufgerufene funktion sichern
		laut.community.loginForm.cb = c;
		laut.scrollTo($('body'),500,function() {
			laut.community.loginForm.allesweg();
			$('div#modalWindowLogin').show();			
			$('div#modalBack').fadeIn(500);
			$('div#modalScreen').fadeIn(500, function(){
				// capcthas anhaengen
				$('div.registerCaptcha').each(function(){
					if($(this).find('img.lautCaptcha').length == 0){
						$(this).append(laut.captcha.neu());
					}
				});
			});
		});

		// aktion: loginscreen laden
		laut.trackClick('kl_sonstiges','login');
	};

	// login auf jeder seite
	laut.community.loginForm.allesweg = function(c) {	
		$('div#modalWindowLogin').hide();
		$('div#modalWindowRegister').hide();
		$('div#modalWindowImport').hide();
		$('div#modalWindowPasswort').hide();
		$('div#modalWindowNachImport').hide();
		return false;
	};
	$('div.kopfLoginLinks a').live('click', function() {
		laut.community.loginForm.allesweg();
		laut.pruefeLogin(function(){
		});
		return false;
	});
	$('a.kopfLoginRegister').live('click', function() {
		laut.community.loginForm.allesweg();
		$('div#modalWindowRegister').show();
		laut.community.loginForm.zeigen();
		return false;
	});
	$('a.kopfLoginPasswort').live('click', function() {
		laut.community.loginForm.allesweg();
		$('div#modalWindowPasswort').show();
		laut.community.loginForm.zeigen();
		return false;
	});
	
	// loginform ausblenden
	laut.community.loginForm.ausblenden = function(c) {
		$('div#modalBack').fadeOut(500);
		$('div#modalScreen').fadeOut(500, function(){
			if(c && typeof(c) == 'function'){
				c();
			}
		});
	};
	$('a.modalLogin').live('click', function() {
		laut.community.loginForm.zeigen();
		return false;
	});
	$('div.modalSchliessen').live('click', function() {
		laut.community.loginForm.ausblenden();
		return false;
	});
	$('a.modalToSignup').live('click', function() {
		$('div#modalWindowLogin').fadeOut(500, function() {
			$('div#modalWindowRegister').fadeIn(100);
		});
		return false;
	});
	$('a.modalToLogin').live('click', function() {
		$('div#modalWindowImport,div#modalWindowRegister,div#modalWindowPasswort').fadeOut(500);
		setTimeout(function(){
			$('div#modalWindowLogin').fadeIn(100);
		}, 500);
		
		return false;
	});
	
	
	// login
	$('#loginSubmit').live('click', function(){
		// form holen
		var div = $(this);
		var b = $(this).parents('#login').find('#loginUsername');
		var p = $(this).parents('#login').find('#loginPasswort');
		var bv = b.attr('value'); // benutzerfeld
		var pv = p.attr('value'); // passwortfeld
		
		if((bv && bv != '') && (pv  && pv != '')){
			var p = {
				benutzer: bv,
				passwort: pv
			};
			laut.login(p, function(d){
				if(d && d.code == 1){
					var c = laut.community.loginForm.cb;
					if(c && typeof(c) == 'function'){
						c();
					}
					laut.community.loginForm.ausblenden();
				}
				// login fehlgeschlagen
				else{
					var infoFeld	= $(document.createElement('p'));
					infoFeld.addClass('infoFeld');
					infoFeld.css('color', '#ae3939');
					infoFeld.css('display', 'none');
					infoFeld.css('margin', '0px 0px 10px');
					div.before(infoFeld);
					infoFeld.html('Bitte überprüfe deine Logindaten!');
					infoFeld.slideDown(250);
				}
			});
		}
		else{
			$(new Array(b, p)).each(function(){
				if(this[0].value == ''){
					stop == 1;
					this.addClass('fehler');
				}
				else{
					this.removeClass('fehler');
				}
			});
		}
		return false;
	});
	
	
	// callbackfunktion fuer erfolgreichen facebooklogin
	laut.community.facebookCallback = function(){
		// wir muessen pruefen ob der account
		// verknuepft ist
		var p = {
			aktion:	27
		}
		$.ajax({
			url: '/php/ajax.php',
			data: p,
			dataType: 'json',
			success: function(d){
				if(d && d.code == 1){
					laut.benutzer = {
						id:		d.benutzer,
						hash:	d.hash,
						auth:	d.auth,
						name:	d.name,
						bild:	d.bild,
						url:	d.url
					}
					laut.community.loginForm.ausblenden(laut.community.loginForm.cb)
					laut.community.loginstatus();
					return true;
				}
				else{
					$('#modalWindowLogin').fadeOut(250, function(){
						$('#modalWindowNachImport').fadeIn(250);
					});
				}
			}
		});
		return false;
	};
	
	// verknuepfen mit laut-profil
	$('#loginzusatz').live('submit', function(){
		// namen holen
		var feld = $('#importUsername');
		var name = feld[0].value;
		
		// checkbox holen
		var agb	= feld.parent().find('#checkboxAgb');
		var	cb	= $(agb).find('input:checkbox');
		
		
		if(feld[0].value == ''){
			feld.css('border-color', '#ae3939');
			feld.css('background', '#fddbdb');
		}
		
		
		if(cb[0].checked != true){
			agb.css('color', '#ae3939');
		}
		else{
			agb.css('color', '#000000');
		}
		
		
		if(cb[0].checked != true || feld[0].value == ''){
			return false;
		}
		
		
		var p = {
			aktion:		10,
			n:			name
		};
		laut.ajax.senden(p, function(d){
			if(d && d.code == 0){
				feld.borderColor = feld.css('border-color');
				feld.css('border-color', '#ae3939');
				feld.css('background', '#fddbdb');
				
				if(!feld.next().hasClass('infoFeld')){
					var infoFeld = $(document.createElement('p'));
					infoFeld.addClass('infoFeld');
					infoFeld.css('color', '#ae3939');
					infoFeld.css('display', 'none');
					feld.after(infoFeld);
					infoFeld.fadeIn(250);
				}
				else{
					var infoFeld = feld.next();
				}
				infoFeld.html(d.nachricht);
			}
			else if(d && d.code == 1){
				
				laut.benutzer = {
					id:		d.user.id,
					name:	d.user.name,
					url:	d.user.url
				}
				
				laut.community.loginForm.ausblenden(laut.community.loginForm.cb)
				laut.community.loginstatus();
				return true;
			}
		});
		
		return false;
	});
	
	
	// benutzer registrieren
	$('#signupSubmit').live('click', function(){
		// name, passwort, email und checkbox holen
		var n = $('#signupUsername');
		var p = $('#signupPasswort');
		var e = $('#signupEmail');
		var c = $('#signup input[type=checkbox]');
		
		
		var stop = 0;
		if(laut.captcha.check() == false){
			stop = 1;
		}
		
		
		$(new Array(n, p, e, c)).each(function(){
			if(this[0].type == 'checkbox'){
				if(this[0].checked == true){
					this.parent().css('color', '#000000');
				}
				else{
					stop = 1;
					this.parent().css('color', '#ae3939');
				}
			}
			else{
				if(this[0].value == ''){
					stop == 1;
					this.addClass('fehler');
				}
				else{
					this.removeClass('fehler');
				}
			}
		});
		
		
		if(stop == 1){
			return false;
		}
		
		
		var p = {
			aktion:	12,
			n:		n[0].value,
			e:		e[0].value,
			p:		p[0].value,
			c:		c[0].checked
		};
		$.ajax({
			url: '/php/ajax.php',
			data: p,
			dataType: 'json',
			statusCode: {
				200: function(d){
					$('#modalWindowRegister .modalDialog').empty().html('<div style="padding: 20px;">' + d.nachricht + '</div>');
				},
				409: function(){
					alert('Der angegebene Benutzername oder die Emailadresse ist bereits bei uns registriert.');
				}
			},
			type: 'post'
		});
		return false;
	});
	
	
	// verknuepfen mit bestehendem account
	$('#connectSubmit').live('click', function(){
		var n = $('#connectUsername')[0];
		var p = $('#connectPasswort')[0];
		var stop = 0;
		
		$('#connectUsername, #connectPasswort').each(function(){
			if(this.value == ''){
				$(this).addClass('fehler');
				stop = 1;
			}
			else{
				$(this).removeClass('fehler');
				stop = 0;
			}
		});
		if(stop == 1){
			return false;
		}
		
		
		var p = {
			benutzer: n.value,
			passwort: p.value
		};
		laut.login(p, function(d){
			var div		= $($('#loginconnect fieldset div')[0]).slideUp(250);
			var infoFeld = $('#loginconnect fieldset .infoFeld');
			if(infoFeld.length > 0){
				infoFeld.slideUp(250);
			}
			else{
				var infoFeld	= $(document.createElement('p'));
				infoFeld.addClass('infoFeld');
				infoFeld.css('color', '#ae3939');
				infoFeld.css('display', 'none');
				infoFeld.css('margin', '0px 0px 10px');
				div.after(infoFeld);
			}
			
			
			if(d && d.code == 1){
				var p = {
					aktion:	11
				};
				laut.ajax.senden(p, function(d){
					if(d && d.code == 1){
						laut.community.loginForm.ausblenden(laut.community.loginForm.cb)
						return true;
					}
				});
			}
			else{
				infoFeld.html('Bitte überprüfe deine Logindaten!');
				infoFeld.slideDown(250);
			}
		});
		return false;
	});
	
	
	// passwort vergessen-form anzeigen
	$('.passwortVergessen a').live('click', function(){
		laut.community.loginForm.allesweg();
		$('#modalWindowPasswort').fadeIn(500);
		return false;
	});
	
	
	// passwort vergessen
	$('#passwortForm').live('submit', function(){
		var stop = 0;
		if(laut.captcha.check() == false){
			stop = 1;
		}
		
		
		$('#passwortEmail').each(function(){
			if(this.value == ''){
				stop = 1;
				$(this).addClass('fehler');
			}
			else{
				$(this).removeClass('fehler');
			}
		});
		
		if(stop == 0){
			var p = {
				aktion:		14,
				e:			$('#passwortEmail')[0].value
			}
			laut.ajax.senden(p, function(d){
				if(d && d.code == 1){
					laut.community.loginForm.ausblenden();
				}
			});
		}
		
		return false;
	});
	
	
	laut.community.loginstatus = function(){
		// wenn der benutzer eingeloggt ist ....
		if (laut.kommentare && typeof(laut.kommentare.posterPic) == "function")
		{
			laut.kommentare.posterPic();
		}		
		if(laut && laut.benutzer && laut.benutzer.id){
			$('#kopfwrapper .kopfLoginLinks').slideUp(250,function(){
				var div = $('#kopfwrapper .kopfLogin');
				div.find('a.loginuser').attr('href', laut.benutzer.url);
				div.find('a.loginuser').html(laut.benutzer.name);				
				div.slideDown(250);
			});
			return true;
		}
		else{
			$('#kopfwrapper .kopfLogin').slideUp(250,function(){
				$('#kopfwrapper .kopfLoginLinks').slideDown(250);
			});
		}
		// sonst nichts
		return false;
	}

	// ausloggen
	$('a.ausloggen').click(function(){
		var p = {
			aktion:		25
		}
		laut.ajax.senden(p, function(d){
			if(d && d.code == 1){
				laut.benutzer = {};
				laut.community.loginstatus();
			}
		});		
		return false;
	});
	
	// loginstatus nach dem laden der seite ueberpruefen
	laut.community.loginstatus();
	
});jQuery('document').ready(function($) {
	
	if (laut.medium) {
		
		$('#iAlbum ul li.iVoting').hover(function(){
			laut.medium.removeUservoting();
			var voting = $(this).attr('title');
			 $.each($('#iAlbum ul li.iVoting'), function() {
				 if ($(this).attr('title') <= voting) {
					 $(this).find('a').addClass('mover');
				 }
			 });
		},
		function(){
			 $('#iAlbum ul li a').removeClass('mover');
			 laut.medium.setzeUservoting();
		});
		
		laut.medium.removeUservoting = function(){
			$('#iAlbum ul li a').removeClass('uservoted');
		};
		
		laut.medium.setzeUservoting = function(){
			if (laut.medium.userwertung > 0) {
				$.each($('#iAlbum ul li.iVoting'), function() {
					if ($(this).attr('title') <= laut.medium.userwertung) {
						$(this).find('a').addClass('uservoted');
					}
				});
			}
		};
		/*
		laut.medium.setzeLeservoting = function(v){
			$('#leserWertung').empty();
			$('#leserWertung').append('&nbsp;wird neu berechnet');
			$('#leserWertung').doTimeout( 'a0' , 3000, function(){
				$('#leserWertung').empty();
				
				for (i = 1;i <= 5; i++) {
					if (i <= v) {
						$('#leserWertung').append('<a class="voll" title="20% der Leser gaben einen Punkt"><span>*</span></a>');
					}
					else {
						$('#leserWertung').append('<a class="leer" title="20% der Leser gaben einen Punkt"><span></span></a>');
					}
				}
			});
		}
		*/
		laut.medium.setzeLeservoting = function(v){
			var alteWertung = $('#leserWertung').html();
			$('#leserWertung').empty();
			$('#leserWertung').append('&nbsp;wird neu berechnet');
			
			var p = {
				aktion:	7,
				medium:	laut.medium.id,
				stimme:	v
			}
			
			
			laut.ajax.senden(p, function(a){
				// pruefen ob erfolgreich abgestimmt wurde
				if(a.code && a.code == 1)
				{
					laut.medium.userwertung = a.stimme;
					laut.medium.setzeUservoting();
				}
				
				// anzeige verzoegern
				$(this).doTimeout('leserwertung', 1000, function(){
					if(a.code == 1) {
						$('#leserWertung').empty();
						for (i = 1;i <= 5; i++) {
							if (i <= a.voting) {
								$('#leserWertung').append('<a class="voll" title="20% der Leser gaben einen Punkt"><span>*</span></a>');
							}
							else {
								$('#leserWertung').append('<a class="leer" title="20% der Leser gaben einen Punkt"><span></span></a>');
							}
						}
					}
					else {
						$('#leserWertung').html(alteWertung);
					}
				});

			});
		}
		
		
		$('#iAlbum ul li.iVoting').click(function() {
			var li = this;
			laut.pruefeLogin(function(){
				laut.medium.setzeLeservoting($(li).attr('title'));
				
				// aktion: albumvoting
				laut.trackClick('ls_voting','vote');
				
			});
			
			return false;
		});
		
		
		/*laut.medium.abstimmen =	function(n){
			var p = {
				aktion:	7,
				medium:	this.id,
				stimme: n
			};
			if(!laut.medium.abgestimmt || laut.medium.abgestimmt == 0){
				laut.ajax.senden(p, function(data){
					if(data.code && data.code == 0){
						alert(data.nachricht);
					}
					else if(data.code == 1){
						laut.medium.setzeLeservoting(data.voting);
						laut.medium.abgestimmt = 1;
					}
				});
			}
		};*/
	
	
	}
	
});

jQuery('document').ready(function($) {
	if(laut.artist){
		$('#iArtist ul li.iBand').hover(function(){
			laut.artist.removeUservoting();
			$(this).addClass('mover');
			$(this).find('a').addClass('mover');
		},
		function(){
			$(this).removeClass('mover');
			$(this).find('a').removeClass('mover');
			 laut.artist.setzeUservoting();
		});
		laut.artist.removeUservoting = function(){
			$('#iArtist ul li.iBand').removeClass('uservoted');
			$('#iArtist ul li.iBand a').removeClass('uservoted');
		};
		
		laut.artist.setzeUservoting = function(){
			if ((laut.artist.userwertung) || (laut.artist.userwertung == 0)) {
				$.each($('#iArtist ul li.iBand'), function() {
					if ($(this).find('a').attr('rel') == laut.artist.userwertung) {
						$(this).addClass('uservoted');
						$(this).find('a').addClass('uservoted');
					}
				});
			}
		};
		
		laut.artist.setzeAnzahlFans = function(f, h){
			$('#anzahlFans').empty();
			$('#anzahlBans').empty();
			$('#anzahlFans').append('<span>&nbsp;wird neu berechnet</span>');
			$('#anzahlBans').append('<span>&nbsp;wird neu berechnet</span>');
			$('#anzahlFans').doTimeout( 'a0' , 1000, function(){
				$('#anzahlFans').empty();
				$('#anzahlFans').append(f);
			});
			$('#anzahlBans').doTimeout( 'a0' , 1000, function(){
				$('#anzahlBans').empty();
				$('#anzahlBans').append(h);
			});
		};
		
		$('#iArtist ul li.iBand').click(function() {
			var li = this;
			
			laut.pruefeLogin(function(){
				var p = {
					aktion:			8,
					typ:			'interpret',
					verknuepfung:	laut.artist.id,
					wertung:		$(li).find('a')[0].rel
				};
				
				laut.ajax.senden(p, function(a){
					laut.artist.userwertung = p.wertung;
					laut.artist.setzeUservoting();
					laut.artist.setzeAnzahlFans(a.fans, a.hater);
					
					// aktion: artistvoting
					laut.trackClick('wl_voting','fan');
					
				});
			});
			return false;
		});
	}	
});

jQuery('document').ready(function($) {
	if (laut.news) {
		$('form#iNews ul li#iMyspace a').click(function(){
			$('form#iNews').submit();
			return false;
		});
		$('form.interaktiv div#kurzUrlKasten input').click(function(){
			$(this).select();
		});
	}
});

jQuery('document').ready(function($) {
  
  $('#event_search_location').autocomplete("/php/ajax.php?aktion=28", {
    width: 260,
    minChars: 2,
    cacheLength: 20,
    selectFirst: false
  });
  
  
});
/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();jQuery(document).ready(function($) {
	
	if ( $("#videos").length > 0 ) {
		
		window.laut.video['params'] = {
			quality:			"high",
			wmode:				"opaque",
			bgcolor:			"#ffffff",
			allowfullscreen:	"true",
			allowscriptaccess:	"always"
		};
		window.laut.video['attributes'] = {
			id:					"videoplayer",
			name:				"videoplayer"
		};
		window.laut.video.flashvars = new Array();
		window.laut.video.flashvars['clipfish'] = {
			angebot:			"laut",
			pl_plid:			"0",
			pl_current_pos:		"0",
			pl_last:			"0",
			nc:					"0",
			r:					"1",
			teaser:				"1",
			cat:				"386",
			as:					0,
			preroll:			"http://ad.de.doubleclick.net/adx/www.clipfish-profcon.de/lautde;dauer_min=ja;videolength=236;u=www.clipfish.de-clipfish/extern/laut/;sz=320x240;tile=3;videoid=MTcwNDMzOXwyOTAyMDk3;pos=pre;dcmt=text/xml;ord="
		};
		window.laut.video.flashvars['3min'] = {
			i18n_descriptor:			"de",
			show_mediathek:				"false",
			autostart:					"false",
			player_name:				"3min_Player_0",
			end_scenario:				"end_scenario_related",
			end_scenario_strict:		"false",
			default_playlist_startup:	"default_play_first_media",
			device_identifyer:			"web_extern",
			player_identifyer:			"web_extern_laut",
			nav_type_playlist:			"playlist_nav_standart",
			promo_ratio:				"1",
			promo_on_first_clip:		"true",
			cue_points_enabled:			"false",
			base_host:					"http://www.3min.de/"
		};
		
		// video anzeigen
		zeigeVideo = function(v,ap) {
			$('#container').html('<div id="videoContainer"></div>');
			
			var flashvars = window.laut.video.flashvars[window.laut.video[v].anbieter];
			
			if (window.laut.video[v].anbieter == 'clipfish')
			{
				flashvars['vid'] = window.laut.video[v].vid;
				flashvars['preroll'] += Math.floor(Math.random()*10000000000000000) + "?"; // ord-workaround
			}
			else if (window.laut.video[v].anbieter == '3min')
			{
				flashvars['media_id'] = window.laut.video[v].vid;
			}
				
			var streamurl = window.laut.video[v].streamurl;
					
			if (ap != "no") {
				streamurl = streamurl + window.laut.video[v].autoplay;
				
				if (window.laut.video[v].anbieter == 'clipfish')
				{
					flashvars['as'] = "1";
				}
				else if (window.laut.video[v].anbieter == '3min')
				{
					flashvars['autostart'] = "1";
				}
				
				// aktion: video zeigen
				laut.trackClick('wl_video','video');
			}
			
			swfobject.embedSWF(streamurl, "videoContainer", "463", "364", "9.0.0","expressInstall.swf", flashvars, window.laut.video['params'], window.laut.video['attributes']);

			$('#videos .zustand_video h3 span.h4').html(window.laut.video[v].anbieter + '-Video<span>: </span>');
			$('#videos .zustand_video h3 span.h3').html(window.laut.video[v].titel);
			$('#videos .zustand_video h3 a').attr('href',window.laut.video[v].quelle);
		};
		zeigeVideo(0,"no");
		
		$("#videos")[0].initEvents = function() {
			$(".makeMeScrollable").smoothDivScroll();
			$('#videos .zustand_video')[0].video = {
				vater: $('#videos .zustand_video')[0],
				zeige: function(url){
					$(this.vater).find('object')[0].data = url + '&amp;autoplay=1';
				}
			};
			$('#videos .zustand_video a.videoBild').click(function(){
				var parent = $(this);
				while(!parent.hasClass('zustand_video')) {
					parent = parent.parent();
				}
				zeigeVideo(this.rel);
				return false;
			});
		};
		$("#videos")[0].initEvents();
	}
});

jQuery(document).ready(function($){
	if ($("#fotos").length > 0) {
		$("#fotos")[0].widget.initEvents = function() {
			$(".makeMeScrollable").smoothDivScroll();
			$("a[class='galerieBild']").colorbox({transition:"elastic", contentCurrent:"{current} / {total}"});
			$(".galerieStart").click(function () {
				var parent = $(this);
				while(!parent.hasClass('scrolltop')) {
					parent = parent.parent();
				}
				$(parent).find("a[class='galerieBild']").eq(0).trigger('click');
				return false;
			}); 
		};
		$("#fotos")[0].widget.initEvents();
	}
	else
	{
		$("#subnavi a[class='galerieBild']").colorbox({transition:"elastic", contentCurrent:"{current} / {total}"});
	}
	$("div.postText a[class='galerieBild']").colorbox({transition:"elastic", contentCurrent:"{current} / {total}"});
});
jQuery(document).ready(function($){
	
	(function(){
		var timer;
		$("li.fanshopbar a").live('mouseover', function() {
			clearTimeout(timer);
			$('li.fanshopbar a.active').addClass('__clicked').removeClass('active');
		});
		$("li.fanshopbar a").live('mouseout', function() {
			timer = setTimeout(function(){
				$('li.fanshopbar a.__clicked:not(.active)').addClass('active');
			}, 100);
		});
	})();
	
	$("li.fanshopLi a.__shopOverlay").live('mousedown', function(){
		if(!this.__cbox || this.__cbox === false){
			$(this).colorbox({
				title:			'',
				scrolling:		false,
				inline:			true,
				transition:		false,
				href:			'.' + $(this).parents().find('.hidden_info').children().attr('class'),
				trackOpen:		['wl_shop','shop_produkt'],
				trackClose:		['wl_shop','shop_produktx'],
				trackContent:	false
			});
			this.__cbox = true;
		}
	});
	$("li.fanshopLi a.__shopOverlay").live('click', function(){
		return false;
	});

	$('.__ajaxfilter a').live('mousedown', function(){
		var target = $(this);
		this.callback = function(data){
			target.parents('ul.boxListe').find('li.fanshopLi').slideUp(250, function(){
				$(this).remove();
			});
			target.parents('ul.boxListe').find('li.hinweisBox').slideUp(200, function(){
				$(this).remove();
			});
			target.parents('ul.boxListe').find('li.mehrLink').slideUp(100, function(){
				$(this).remove();
			});
			setTimeout(function(){
				target.parents('.__ajaxfilter').replaceWith(data);
			}, 250);
			return true;
		};
	});
});
jQuery(document).ready(function($){
	if ((window.laut) && (window.laut.karte)){
		function showMap(LatLng){
			map.setCenter(LatLng, 15);
			var marker = new GMarker(LatLng);
			map.addOverlay(marker);
		}

		var map = new GMap2(document.getElementById("mapCanvas"));
		map.addControl(new GSmallMapControl());
		map.setMapType(G_HYBRID_MAP);


		if((window.laut.karte.dataLat != 0) && (window.laut.karte.dataLng != 0)){
			var LatLng = new GLatLng(window.laut.karte.dataLat, window.laut.karte.dataLng);
			showMap(LatLng);
		}
		else{
			geocoder = new GClientGeocoder();
			if(geocoder) {
				geocoder.getLatLng(
					window.laut.karte.strasse + "," + window.laut.karte.plz + " " + window.laut.karte.stadt + "," + window.laut.karte.land,
					function(point) {
						if(point) {
							showMap(point);
						}
					}
				);
			}
		}
	}
});
jQuery(document).ready(function($){
	if(laut && laut.forum)
	{
		// navigation abfangen
		// mehr
		laut.forum.cfg.n.find('.alle').live('click', function(){
			laut.forum.mehr();
			
			// aktion: foren ausklappen
			laut.trackClick('lb_forum','forum');
		});
		
		// array fuer eintraege anlegen
		laut.forum.d = new Array();
		
		
		// foren laden
		laut.forum.laden = function(c){
			// wir laden nur daten, wenn keine vorhanden sind
			if((!this.d || !this.d[(this.cfg.s+this.cfg.ps > this.cfg.ak ? this.cfg.at : this.cfg.s+this.cfg.ps)] || this.d == '') && this.d.length < this.cfg.at){
				var p = {
					aktion:		17,
					f:			this.cfg.f,
					s:			!this.d ? 0 : this.d.length,
					ps:			this.cfg.ps
				}
				laut.ajax.senden(p, function(d){
					if(d.ts && typeof(d.ts) == 'object'){
						for(var i in d.ts){
							laut.forum.d.push(d.ts[i]);
						}
					}
					
					if(c && typeof(c) == 'function'){
						c();
					}
				});
			}
			else{
				if(c && typeof(c) == 'function'){
					c();
				}
			}
			
			// template vorbereiten
			if(!this.tpl){
				this.tpl = laut.forum.cfg.w.find('tr.unsichtbar');
				this.tpl.parent().css('position','relative');
				this.tpl.remove();
				this.tpl.removeClass('unsichtbar');
			}
		}
		
		
		// mehr anzeigen
		laut.forum.mehr = function(){
			laut.forum.laden(function(){
				// start festlegen
				var s	= laut.forum.cfg.s;
				// proseite
				var l	= laut.forum.cfg.ps;
				var ts	= laut.forum.d;
				// tabelle holen
				var t	= laut.forum.cfg.n.prev().find('table tbody');
				
				if(s == 0){
					t.empty();
				}
				
				
				// neue themen anhaengen
				for(var i = s; i < s+l && laut.forum.d && laut.forum.d[i]; i++){
					var tmp = laut.forum.neu(laut.forum.d[i]);
					
					// tmp vor navigation anhaengen
					t.append(tmp);
					
					// ausklappen
					tmp.removeClass('unsichtbar');
				}
				
				// neuen startwert setzen
				laut.forum.cfg.s = s + laut.forum.cfg.ps;
				
				// link anpassen
				var a = laut.forum.cfg.n.find('a.alle');
				var t = a.prev().remove();
				
				if(laut.forum.d.length >= laut.forum.cfg.at)
				{
					a.remove();
					laut.forum.cfg.w.find('.__tmp').remove();
				}
				else
				{
					a.before('<span>Es werden ' + laut.forum.d.length + ' von ' + laut.forum.cfg.at + ' Themen angezeigt. </span>');
					a.html('Mehr anzeigen');
				}
			});
		}
		
		
		// neues thema fuers dom erstellen
		laut.forum.neu = function(d){
			var tmp = laut.forum.tpl.clone();
			tmp.attr('className', tmp.attr('className').replace(/(\{thread\.id\})/g, d.thread.id));
			var html = laut.forum.tpl.html();
			
			// inhalte einsetzen
			html = html.replace(/(\{thread\.id\})/g,			d.thread.id);
			html = html.replace(/(\{thread\.titel\})/g,			d.thread.titel);
			html = html.replace(/(\{thread\.antworten\})/g,		d.thread.antworten);
			html = html.replace(/(\{ersteller\.name\})/g,		d.ersteller.name);
			html = html.replace(/(\{ersteller\.url\})/g,		d.ersteller.url);
			html = html.replace(/(\{ersteller\.avatar\})/g,		d.ersteller.avatar);
			html = html.replace(/(%7Bersteller\.avatar%7D)/g,	d.ersteller.avatar);
			html = html.replace(/(\{letzter\.name\})/g,			d.letzter.name);
			html = html.replace(/(\{letzter\.url\})/g,			d.letzter.url);
			html = html.replace(/(%7Bletzter\.url%7D)/g,			d.letzter.url);
			html = html.replace(/(\{letzter\.zeit\})/g,			d.letzter.zeit);
		
			// tmp mit neuem inhalt versehen
			tmp.html(html);
			
			return tmp;
		}
		
		
		// kommentare anzeigen
		laut.forum.zeigen = function(s,l){
			laut.forum.laden(function(){
				var i		= s;	// zaehler
				var j		= 0;	// noch ein zaehler
				var tmptop	= 0;	// hier speichern wir den abstand, den
									// die LIs zum oberen rand der UL haben
									// muessen, solange sie absolut positioniert
									// sind
				var aTr		= laut.forum.cfg.w.find('.threadTr');
				var tbody	= $(aTr).parents('tbody');
				var aH		= tbody.outerHeight();	// die alte aussenhoehe der liste
				var nTr 	= [];					// array fuer die neuen TRs
				var eLi		= laut.forum.cfg.w.find('.postEingabefeld');	// eingabefeld-liste
				
				tbody.empty();
				
				
				while(laut.forum.d && laut.forum.d[i] && j < l){
					var tmp = laut.forum.tpl.clone();
					var html = laut.forum.tpl.html();
					
					// inhalte einsetzen
					html = html.replace(/(\{thread\.id\})/g,			laut.forum.d[i].thread.id);
					html = html.replace(/(\{thread\.titel\})/g,			laut.forum.d[i].thread.titel);
					html = html.replace(/(\{thread\.antworten\})/g,		laut.forum.d[i].thread.antworten);
					html = html.replace(/(\{ersteller\.name\})/g,		laut.forum.d[i].ersteller.name);
					html = html.replace(/(\{ersteller\.avatar\})/g,		laut.forum.d[i].ersteller.avatar);
					html = html.replace(/(%7Bersteller\.avatar%7D)/g,	laut.forum.d[i].ersteller.avatar);
					html = html.replace(/(\{letzter\.name\})/g,			laut.forum.d[i].letzter.name);
					html = html.replace(/(\{letzter\.zeit\})/g,			laut.forum.d[i].letzter.zeit);
					
					
					// style setzen
					tmp.html(html);
					tmp.css('background','#ffffff');
					tmp.css('position','relative');
					
					// index anhaengen und postid in classname sichern
					tmp[0].dId = i;
					tmp.addClass('p' + laut.forum.d[i].thread.id);
					
					// anhaengen
					tbody.append(tmp);
					
					// an array mit neuen elementen haengen
					nTr.push(tmp[0]);
					
					// top setzen
					tmptop += tmp.outerHeight(true);
					
					i++;
					j++;
				}
				
				
				// startwert neu setzen
				laut.forum.cfg.s = s;
			});
			
			return false;
		};
		
		
		// threadlinks verknuepfen
		$('.zustand_community_forum a.threadLink').live('click',function(){
			var titel = this.innerHTML;
			var a = this;
			
			var zustand_laden = function(){
				var p = {
					aktion:		18,
					t:			a.rel
				}
				laut.ajax.senden(p, function(d){
					// kommentare in dom umwandeln
					var ks = $(laut.HTMLtoDOM(d.html));
					ks.css('display','none');
					
					// kommentarzustand sichern
					laut.forum.cfg.kz = ks;
					
					// kommentare anhaengen
					$(laut.forum.cfg.w.find('div.boxInhalt')[0]).prepend(ks);
					laut.forum.cfg.t.find('span').html(titel);
					laut.forum.cfg.t.slideDown(250);
					
					$(laut.forum.cfg.kz.find('ul').get(0)).prepend(laut.forum.cfg.t);
					laut.forum.cfg.kz.slideDown(500);
					
					// community_thread-script nachladen
					if(!laut.kommentare.init){
						$.getScript('/js/community_thread.js', function(){
							laut.kommentare.init();
						});
					}
					else{
						// kommentar-funktionen initialisieren
						laut.kommentare.init();
					}
					
					laut.scrollTo(laut.forum.cfg.t, 250);
				});
			}
			
			// sollte bereits ein kommentarzustand existieren, wird dieser entfernt
			if(laut.forum.cfg.kz){
				laut.forum.cfg.kz.slideUp(500, function(){
					$(laut.kommentare).removeAttr('bereit');
					$(laut.kommentare).removeAttr('d');
					$(laut.kommentare).removeAttr('cfg');
					$(this).remove();
					$(laut.forum.cfg).removeAttr('kz');
					
					zustand_laden();
				});
			}
			else{
				zustand_laden();
			}
			
			// aktion: thread einblenden
			laut.trackClick('lb_forum','#thread');
			
			return false;
		});
		
		
		// forentitel ausblenden
		laut.forum.cfg.t.find('a').live('click',function(){
			laut.forum.cfg.z.find('ul li:not(.unsichtbar)').slideDown(250);
			laut.forum.cfg.z.find('ul li.unsichtbar').slideUp(250);
			laut.forum.cfg.kz.slideUp(250);
			return false;
		});
	}
	
	
	// foren-eingabe abfangen
	$('.forumEingabefeld input:submit').live('click', function(){
		laut.pruefeLogin(function(){
			var s = $(laut.forum.cfg.ef).find('input[type="text"]');
			var t = $(laut.forum.cfg.ef).find('textarea');
			
			// alle daten da, die wir bauchen?
			if(!laut || !laut.forum || !laut.forum.cfg || !laut.forum.cfg.f || laut.forum.cfg.f == 0 || !s || !t || t.val() == '' || s.val == ''){
				return false;
			}
			
			// parameter setzen
			var p = {
				aktion:	19,
				t: 		t.val(),
				s:		s.val(),
				f:		laut.forum.cfg.f
			}

			laut.ajax.senden(p, function(d){
				if(!d || !d.code || d.code == 0){
					// FEHLER
					return false;
				}
				
				// forendaten entfernen und neu anzeigen
				$(laut.forum).removeAttr('d');
				laut.forum.zeigen(0, laut.forum.cfg.ps);
				
				// felder leeren
				s.val('');
				t.val('');
				
				//console.log(d);
			});

		});
		
		return false;
	});
});jQuery(document).ready(function($){

	if(laut && laut.kommentare){
		
		laut.kommentare.posterPic = function(){
			if (laut && laut.benutzer && laut.benutzer.bild){
				$('li.postEingabefeld div.postAvatar').css("background-image","url('" + laut.benutzer.bild + "')");
			}
			else
			{
				$('li.postEingabefeld div.postAvatar').css("background-image","url('/bilder/benutzer/q40/default_profilepic_54.png')");
			}
		};
		
		laut.kommentare.init = function(){
			if(laut.kommentare.bereit == true){
				return true;
			}
		
			// sortierung der kommentare
			laut.kommentare.cfg.sort = "ASC";

			laut.kommentare.posterPic();
			
			// array fuer eintraege anlegen
			this.d = new Array();
			
			// einblenden der post-aktionen
			$('li.postLi').live('mouseover', laut.kommentare.moderation);
			$('li.postLi').live('mouseout', function(){
				$(this).find('div.aktionsLeiste').css('visibility','hidden');
			});
			
			// moderationslinks mit events versehen
			$(this.cfg.w).find('div.aktionsLeiste a').live('click', function(){
				// post-id holen
				var c	= $(this).parents('li.postLi')[0].className;
				var id	= c.match(/(p[0-9]+)/)[0].substring(1);
				
				if($(this).hasClass('alarm')){
					laut.kommentare.alarm(id);
				}
				else if($(this).hasClass('zitieren')){
					laut.kommentare.zitieren(id);
				}
				else if($(this).hasClass('editieren')){
					laut.kommentare.editieren(id);
				}
				else if($(this).hasClass('entfernen')){
					laut.kommentare.entfernen(id);
				}
				return false;
			});;	

			// kommentar-sortierung aendern
			$('a.kommentarSortierung').live('click', function(){
				laut.kommentare.cfg.s = 0;
				laut.kommentare.d = new Array();
				laut.kommentare.cfg.sort = (laut.kommentare.cfg.sort == 'ASC') ? 'DESC' : 'ASC';
				laut.kommentare.mehr(5, function(){
					laut.kommentare.cfg.s = 0;
					laut.kommentare.d = new Array();
				});
				// aktion: kommentare ausklappen 
				laut.trackClick('lb_forum','sort');
				return false;
			});
			
			// mehr anzeigen
			laut.kommentare.cfg.n.find('.alle').live('click', function(){
					laut.kommentare.mehr();
					// aktion: kommentare ausklappen 
					laut.trackClick('lb_forum','mehr');
			});
			
			laut.kommentare.bereit = true;
		}

		// kommentare laden
		laut.kommentare.laden = function(anz,c){
						
			// wir laden nur daten, wenn keine vorhanden sind
			if((!this.d || !this.d[(this.cfg.s+this.cfg.ps > this.cfg.ak ? this.cfg.ak : this.cfg.s+this.cfg.ps)] || this.d == '') && this.d.length < this.cfg.ak){
				var p = {
					aktion:		6,
					t:			this.cfg.t,
					s:			!this.d ? 0 : this.d.length,
					ps:			anz > 0 ? anz : this.cfg.ps,
					o:			this.cfg.sort
				}
				laut.ajax.senden(p, function(d){
					if(d.ks && typeof(d.ks) == 'object'){
						for(var i in d.ks){
							laut.kommentare.d.push(d.ks[i]);
						}
					}
					
					if(c && typeof(c) == 'function'){
						c();
					}
				});
			}
			else{
				if(c && typeof(c) == 'function'){
					c();
				}
			}
		};
			
		laut.kommentare.mehr = function(anz,c){
			
			//var c = c;
			
			var ul = laut.kommentare.cfg.n.parent();
			var lis = ul.find('li.postLi');
			var a = laut.kommentare.cfg.n.find('a.alle');

			// sind alle kommentare schon ins DOM geladen?
			if(laut.kommentare.d.length == laut.kommentare.anzahlGesamtPosts()){
				if(laut.kommentare.anzahlGesamtPosts() == laut.kommentare.anzahlAngezeigtePosts()){
					laut.scrollTo($('.zustand_community_thread'), 500, function(){
						for(var i = 0; i < lis.length; i++){
							if(i > 4){
								$(lis[i]).css('display','none');
							}
						}
						// navigation anpassen
						laut.kommentare.navigationAnpassen();
					});
				}
				else{
					
					// neue posts umhaengen
					laut.kommentare.neuePostsUmhaengen();
					
					// lis einblenden
					lis.css('display', 'block');
					
					// navigation anpassen
					laut.kommentare.navigationAnpassen();					
				}
			}
			else{
				laut.kommentare.laden(anz, function(){

					// start festlegen
					var s	= laut.kommentare.cfg.s;
					
					// proseite
					var l	= laut.kommentare.cfg.ps;
					var ks	= laut.kommentare.d;
					
					// liste holen
					var ul	= laut.kommentare.cfg.n.parent();
					
					// unsichtbare posts suchen
					var unsichtbar = ul.find('li.unsichtbar');
					
					// einfach mal alle kommentare raus
					if(s == 0){
						ul.find('.postLi').remove();
					}
					
					// neue kommentare anhaengen
					for(var i = s; i < s+l && laut.kommentare.d && laut.kommentare.d[i]; i++){
						var tmp = laut.kommentare.neu(laut.kommentare.d[i]);
						
						// tmp vor navigation anhaengen
						laut.kommentare.cfg.n.before(tmp);
						
						// ausklappen
						tmp.removeClass('unsichtbar');
					}
					
					// neuen startwert setzen
					if (laut.kommentare.anzahlGesamtPosts() > s + laut.kommentare.cfg.ps){
						laut.kommentare.cfg.s = s + laut.kommentare.cfg.ps;
					}

					// navigation anpassen
					laut.kommentare.navigationAnpassen();

					if(c && typeof(c) == 'function'){
						c();
					}
					
				});
			}
		}
				
		laut.kommentare.neu = function(d){
			var tmp = laut.kommentare.tpl.clone();
			tmp.attr('className', tmp.attr('className').replace(/(\{post\.id\})/g, d.post.id));
			var html = laut.kommentare.tpl.html();
			
			// inhalte einsetzen
			html = html.replace(/(\{user\.id\})/g,		d.user.id);
			html = html.replace(/(\{user\.name\})/g,	d.user.name);
			html = html.replace(/(\{user\.rang\})/g,	d.user.rang);
			html = html.replace(/(\{user\.url\})/g,		d.user.url);
			html = html.replace(/(%7Buser\.url%7D)/g,	d.user.url);
			html = html.replace(/(\{user\.avatar\})/g,	d.user.avatar);
			html = html.replace(/(%7Bpost\.id%7D)/g,	d.post.id);
			html = html.replace(/(\{post\.id\})/g,		d.post.id);
			html = html.replace(/(\{post\.text\})/g,	d.post.text);
			html = html.replace(/(\{post\.datum\})/g,	d.post.datum);
			
			// tmp mit neuem inhalt versehen
			tmp.html(html);
			
			return tmp;
		}
		
		
		laut.kommentare.moderation = function(){
			var leiste	= $(this).find('div.aktionsLeiste');	// moderationsleiste im eintrag
			var a		= $(this).find('div.postAvatar a');		// link zum profil des schreibers
			var modA	= leiste.find('a');						// moderationslinks in der leiste
			
			
			// leiste leeren
			leiste.empty();
			
			// zaehler
			var i = 0;
			// leiste mit links versehen
			modA.each(function(){
				var app = true;	// bestimmt ob der link angehängt wird oder nicht
				
				// wenn wir beim loeschen oder editieren sind, werden diese links zunaechst geblockt
				if(($(this).hasClass('loeschen') || $(this).hasClass('editieren'))){
					app = false;
					// wenn die berechtigung stimmt, werden sie angehaengt
					if(laut.benutzer && laut.benutzer.auth && (laut.benutzer.auth == a.attr('rel') || laut.benutzer.auth == 1)){
						app = true;
					}
				}
				
				
				// soll der link angehaengt werden?
				if(app == true){
					if(i > 0){
						leiste.append(' | ');
					}
					leiste.append(this);
				}
				i++;
			});
			
			
			// leiste einblenden
			if(leiste.css('visibility') == 'visible'){
				leiste.css('visibility','hidden');
			}
			else{
				leiste.css('visibility','visible');
			}
		}
		
		
		// zitate ausklappen
		$('a.postZitatAutor').live('click',function(){
			var zt = $($(this).nextAll('div.postZitatText').get(0));
			if(zt.css('display') == 'none'){
				zt.slideDown(250);
			}
			else{
				zt.slideUp(250);
			}
			laut.trackClick('lb_forum','zitat');
			return false;
		});
		
		
		// alarm
		laut.kommentare.alarm = function(id){
			if(id && id > 0){
				laut.confirm('Möchtest Du wirklich Alarm auslösen?', function(){
					var p = {
						aktion:		3,
						id:			id
					}
					laut.ajax.senden(p, function(d){
						//console.log(d);
					});
					
				});
			}
			return false;
		}
		
		
		// zitieren
		laut.kommentare.zitieren = function(id){
			if(id && id > 0){
				var p = {
					aktion:		15,
					p:			id
				}
				laut.ajax.senden(p, function(d){
					var eDiv	= laut.kommentare.cfg.w.find('.postEingabefeld');
					var tA		= eDiv.find('textarea');
					
					tA.val('[quote="' + d.d.user.name + '"]' + d.d.post.rohtext + "[/quote]\n");
					eDiv.slideDown(250);
					laut.scrollTo(eDiv, 250, function(){
						tA[0].scrollTop = tA[0].scrollHeight;
						tA[0].focus();
					});
				});
			}
			return false;
		}
		
		
		// editieren
		laut.kommentare.editieren = function(id){
			if(id && id > 0){
				var p = {
					aktion:		15,
					p:			id
				}
				laut.ajax.senden(p, function(d){
					var editLi	= laut.kommentare.cfg.w.find('.postEingabefeld');
					var text	= editLi.find('textarea');
					
					// editiermodus setzen
					laut.kommentare.cfg.e = id;
					editLi.slideDown(250);
					editLi.find('input[type=button]').fadeIn(250);
					editLi.find('input[type=button]').live('click', function(){
						$(this).fadeOut(250);
						laut.kommentare.cfg.e = 0;
						text.val('');
						return false;
					});
					
					text.val(d.d.post.rohtext);
					laut.scrollTo(editLi, 250, function(){
						text[0].focus();
					});
				});
			}
			return false;
		}
		
		// eintrag speichern
		laut.kommentare.speichern = function(){
			// formular holen
			var f	= laut.kommentare.cfg.w.find('.postEingabefeld form');
			var tA	= f.find('textarea');
			
			// editmodus?
			if(laut.kommentare.cfg.e > 0){
				var p = {
					aktion:	5,
					p:		laut.kommentare.cfg.e,
					b:		laut.benutzer.id,
					t:		tA.val()
				}
			}
			else{
				var p = {
					aktion:	1,
					b:		laut.benutzer.id,
					t:		tA.val(),
					th:		laut.kommentare.cfg.t
				}
			}
			laut.ajax.senden(p, function(d){
				if(d.code == 1){
					// erfolgreich gespeichert und neuer eintrag:
					if(!laut.kommentare.cfg.e || laut.kommentare.cfg.e == 0){
						var inhalt = {
							post: {
								datum:	d.p.post.datum + ' Uhr',
								id:		d.p.post.id,
								text:	d.p.post.text
							},
							user: {
								avatar: d.p.user.avatar,
								id:		d.p.user.id,
								name:	d.p.user.name,
								rang:	d.p.user.rang,
								url:	d.p.user.url
							}
						}
						var neu = laut.kommentare.neu(inhalt);
						var kommentarFeld = $('li.postEingabefeld');
						var hinweisFeld = $('li.postHinweis');
						var ueberschriftFeld = $('li.postAnzahl');
						neu.removeClass('unsichtbar');

						// post-anzahl erhoehen
						laut.kommentare.cfg.ak++;

						// je nach sortierung anders einhaengen
						if (laut.kommentare.cfg.sort != "DESC")
						{
							// wenn alle kommentare angezeigt werden
							if (laut.kommentare.anzahlGesamtPosts()-1 == laut.kommentare.anzahlAngezeigtePosts()){
								// kommentar am ende einhaengen, dann navigation anpassen
								laut.kommentare.cfg.n.before(neu);
								laut.kommentare.navigationAnpassen();															
							}
							else {			
								neu.addClass('__tmp');
								hinweisFeld.before(neu);
								laut.kommentare.navigationAnpassen();
							}
						}
						else{
							laut.scrollTo($('.zustand_community_thread'), 500, function(){
								ueberschriftFeld.after(neu);
								laut.kommentare.navigationAnpassen();
							});
						}							
						
						// eintrag ins dom schreiben
						if (laut.kommentare.anzahlGesamtPosts()-1 == laut.kommentare.d.length){
							laut.kommentare.d[laut.kommentare.d.length] = d.p;
						}
					}
					else{
						var id = laut.kommentare.cfg.e;
						if(id > 0){
							laut.scrollTo(laut.kommentare.cfg.w.find('.p' + id), 200, function(){
								laut.kommentare.cfg.w.find('.p' + id + ' div.postElement div.postText div:not(.postHeaderDatum, .aktionsLeiste)').html(d.p.post.text);
							});
						}
					}
					
					// fehlermeldung killen
					$('li.postHinweis').fadeOut(100);
					
					// editiermodus zuruecksetzen
					$(laut.kommentare.cfg).removeAttr('e');
					tA.val('');
				}
				else{
					if(d.code == 0 && d.nachricht != ''){
						$('li.postHinweis').html(d.nachricht);
						$('li.postHinweis').fadeIn(100);
					}
				}
			});
			return false;
		}

		// eintrag entfernen
		laut.kommentare.entfernen = function(id){
			if(id > 0){
				laut.confirm('Möchtest du diesen Eintrag wirklich entfernen?', function(){
					var p = {
						aktion:	4,
						p:		id
					}
					laut.ajax.senden(p, function(d){
						
						if(typeof(laut.kommentare.d) == 'object'){
							for(var x in laut.kommentare.d){
								if(laut.kommentare.d[x].post.id == id){
									laut.kommentare.d.splice(x,1);
								}
							}
						}

						var killKommentar = $('li.postLi.p' + id);
						killKommentar.fadeOut(500, function(){
	
							// eintrag aus dem DOM pruegeln
							$(this).remove();
							
							// anzahl der kommentare
							laut.kommentare.cfg.ak--;
							
							// ersten unteren eintrag einblenden
							var liss = $('li.postLi');
							var index = laut.kommentare.anzahlAngezeigtePosts(1);
							var liEU = liss[index];
							
							if (typeof(liEU) == 'object')
							{
								if($(liEU).hasClass('unsichtbar')){
									//console.log('neuen Post einblenden');
								}
								else{
									if($(liEU).css('display') == 'none'){
										$(liEU).css('display','block');
									}
								}
							}
							
							laut.kommentare.navigationAnpassen();
							
						});
						
					});
				});
			}
		}

		// neue posts umhaengen
		laut.kommentare.neuePostsUmhaengen = function(){
			$('li.__tmp').css('display','none');
			$('li.__tmp').removeClass('__tmp');
			var hinweis = $('li.postHinweis');
			hinweis.before(laut.kommentare.cfg.n);	
		}
		
		// anzahl angezeigte posts
		laut.kommentare.anzahlAngezeigtePosts = function(x){
			var gesamtPosts = $('li.postLi').length;
			var ausblendPosts = $('li.postLi.unsichtbar').length;
			if (x == 1) var neuePosts = $('li.postLi.__tmp').length;
			else var neuePosts = 0;
			$('li.postLi:not(.unsichtbar)').each(function(){
				if ($(this).css('display') == 'none') {
					ausblendPosts++;
				}
			});
			return (gesamtPosts - ausblendPosts - neuePosts);
		}
		
		// anzahl gesamtposts
		laut.kommentare.anzahlGesamtPosts = function(){
			return laut.kommentare.cfg.ak;
		}
		
		// kommentarnavigation anpassen
		laut.kommentare.navigationAnpassen = function(){
			
			// neuen kommentar aus temp-bereich entfernen, wenn alle kommentare angezeigt werden
			if (laut.kommentare.anzahlAngezeigtePosts(1) == laut.kommentare.anzahlGesamtPosts()){
				laut.kommentare.cfg.w.find('.__tmp').remove();
			}

			// text + link anpassen
			if (laut.kommentare.anzahlAngezeigtePosts() < laut.kommentare.anzahlGesamtPosts()){
				var liSpan = 'Es werden ' + laut.kommentare.anzahlAngezeigtePosts() + ' von ' + laut.kommentare.anzahlGesamtPosts() + ' Kommentaren angezeigt. ';
				var liLink = '<a href="javascript:void(0);" class="bar alle plusLink">Mehr anzeigen</a>';
				$('li.kommentarNavigation').html(liSpan + liLink);
			}
			else{
				var liSpan = 'Es ' + (laut.kommentare.anzahlAngezeigtePosts() == 1 ? 'wird der einzige Kommentar' : 'werden alle ' + laut.kommentare.anzahlAngezeigtePosts() + ' Kommentare') +  ' angezeigt. ';
				var liLink = '<a href="javascript:void(0);" class="bar alle minusLink">Einklappen</a>';
				$('li.kommentarNavigation').html(liSpan + liLink);
			}
			
			// ueberschrift anpassen
			$('li.postAnzahl h3').html(laut.kommentare.anzahlGesamtPosts() + (laut.kommentare.anzahlGesamtPosts() == 1 ? ' Kommentar' :  ' Kommentare'));

			// link anzeigen
			if (laut.kommentare.anzahlGesamtPosts() > 5){
				$('li.kommentarNavigation').css('display','block');
			}
			else{
				$('li.kommentarNavigation').css('display','none');
			}

		}
		laut.kommentare.cfg.w.find('input:submit').live('click', function(){
			laut.pruefeLogin(laut.kommentare.speichern);
			return false;
		});
		laut.kommentare.init();
	}
});/* <![CDATA[ */
jQuery(document).ready(function($){
	if(typeof(window.laut.favicon) != 'object')
		window.laut.favicon = {};
	
	window.laut.favicon = {
		$icon: $('div.surftippBox img'),
		pruefen: function($_p){
			for(var i = 0; i < $_p.length; i++)
			{
				if($_p[i].width != 16)
				{
					$($_p[i]).attr('src', '/grafiken/surftipps/favicon.gif');
				}
			}
		}
	};
	
	if(window.laut.favicon.$icon)
		window.laut.favicon.pruefen(window.laut.favicon.$icon);
});
/* ]]> */
/* <![CDATA[ */
jQuery(document).ready(function($) {
	if(typeof(window.laut) == 'undefined') {
		window.laut = {};
	}
	
	if(typeof(window.laut) == 'object' && typeof(window.laut.teaser) == 'object' && typeof(window.laut.teaser.myJSONObject) == 'object') {
		window.laut.teaser = {
			json: window.laut.teaser.myJSONObject,
			listenElement: new Array(),
			UL: document.createElement('ul'),
			teaserPosition: new Array(),
			teaserSteuerung: new Array(),
			status: 0,
			pruefStatus: 0,
			hoverStatus: 0,
			ieversion: function() {
				var $version = 999;
				if(navigator.appVersion.indexOf("MSIE") != -1) {
					$version = parseFloat(navigator.appVersion.split("MSIE")[1]);
				}
				return $version;
			},
			imagesPreloaden: function(_json) {
				if(typeof(this.rahmen) == 'undefined') {
					this.rahmen = new Array();
					this.rahmen['bigShadow'] = new Image();
					this.rahmen['bigShadow'].src = '/grafiken/teaserband/bigschatten.png';
					this.rahmen['shadow'] = new Image();
					this.rahmen['shadow'].src = '/grafiken/teaserband/schatten.png';
					this.rahmen['spanbg'] = new Image();
					this.rahmen['spanbg'].src = '/grafiken/teaserband/spanbg.png';
					this.rahmen['bigspanbg'] = new Image();
					this.rahmen['bigspanbg'].src = '/grafiken/teaserband/bigspanbg.png';
					this.rahmen['shadowIE'] = new Image();
					this.rahmen['shadowIE'].src = '/grafiken/teaserband/schattenIE.png';
					if(this.ieversion() < 8) {
						this.rahmen['pfeilLinksTransIE'] = new Image();
						this.rahmen['pfeilLinksTransIE'].src = '/grafiken/teaserband/tpfeil.links_trans.gif';
						this.rahmen['pfeilRechtsTransIE'] = new Image();
						this.rahmen['pfeilRechtsTransIE'].src = '/grafiken/teaserband/tpfeil.rechts_trans.gif';
						this.rahmen['pfeilLinksIE'] = new Image();
						this.rahmen['pfeilLinksIE'].src = '/grafiken/teaserband/tpfeil.links.gif';
						this.rahmen['pfeilRechtsIE'] = new Image();
						this.rahmen['pfeilRechtsIE'].src = '/grafiken/teaserband/tpfeil.rechts.gif';
					}
				}
				this.bilderArray = new Array();
				for(var $i = 0; $i < _json.length; $i++) {
					this.bilderArray[$i] = new Array();
					this.bilderArray[$i][0] = new Image();
					this.bilderArray[$i][0].src = _json[$i].bild;
					this.bilderArray[$i][1] = new Image();
					this.bilderArray[$i][1].src = _json[$i].bildGross;
				}
			},
			mouseenterVerzoegerung: function(_index, _objectHeight, _objectWidth) {
				$(this.teaserPosition[_index]).css('top', _objectHeight);
				$(this.teaserPosition[_index]).css('left', _objectWidth).show();
			},
			mouseleaveVerzoegerung: function() {
				$('div.teaserPosition').removeAttr('style');
			},
			arrayRefresh: function(_json) {
				$(this.UL).stop().empty().css('left', '0px');
				$('div.teaserPosition').remove();
				window.clearTimeout(this.autoslideTimer);
				this.json = _json;
				this.imagesPreloaden(_json);
				this.init(_json);
			},
			init: function(_json) {
				for(var $u = 0; $u < _json.length; $u++) {
					this.teaserPosition[$u] = document.createElement('div');
					this.teaserSteuerung[$u] = document.createElement('div');
					
					if($u < 5) {
						this.listenElement[$u] = document.createElement('li');
						$(this.listenElement[$u]).addClass('ele').html('<div style="background-image: url(' + _json[$u].bild + ');"><a rel="' +$u + '" href="' + _json[$u].url + '"><span class="teaserHeader">' + _json[$u].header + '</span><span class="teaserLink">:&nbsp;' + _json[$u].subheader + '</span></a></div>');
						if($u == 0) {
							$(this.listenElement[$u]).addClass('first');
						}
						if($u == 4) {
							$(this.listenElement[$u]).addClass('last');
						}
						$(this.UL).addClass('block').append(this.listenElement[$u]).appendTo('div.teaserband');
					}
					
					if(_json.length > 4) {
						var pfeilLinks = document.createElement('a');
						var pfeilRechts = document.createElement('a');
						var pfeilBauen = function(_pfeil) {
							$(_pfeil).addClass('tpfeil').attr('href', 'javascript:void(0);').html('&nbsp;');
						};
						pfeilBauen(pfeilLinks);
						pfeilBauen(pfeilRechts);
					}
					else {
						var pfeilLinks = document.createElement('div');
						var pfeilRechts = document.createElement('div');
						var pfeilBauen = function(_pfeil) {
							$(_pfeil).addClass('tpfeil');
							$(_pfeil).addClass('tpfeilBox').html('&nbsp;');
						};
						pfeilBauen(pfeilLinks);
						pfeilBauen(pfeilRechts);
					}
					
					$(this.teaserSteuerung[$u]).appendTo($(this.teaserPosition[$u]).addClass('teaserPosition')).append('<a href="' + _json[$u].url + '" rel="' + $u + '" class="indexAnchor"><h4 class="teaserHeader ' + _json[$u].rubrik + '">' + _json[$u].header + '</h4><h3 class="subHeader">' + _json[$u].subheader + '</h3></a>').addClass('teaserSteuerung');
					$(this.teaserSteuerung[$u]).append($(pfeilRechts).addClass('trechts')).prepend($(pfeilLinks).addClass('tlinks')).css('background-image', 'url(' + _json[$u].bildGross + ')').bind('mouseenter', function(){
						window.clearTimeout(window.laut.teaser.mouseEnterVrzg);
						window.clearTimeout(window.laut.teaser.mouseLeaveVrzg);
						window.clearTimeout(window.laut.teaser.autoslideTimer);
						window.laut.teaser.hoverStatus = 0;
					}).bind('mouseleave', function(){
						window.laut.teaser.mouseLeaveVrzg = window.setTimeout('window.laut.teaser.mouseleaveVerzoegerung()', 1);
						if(_json.length > 4) {
							window.laut.teaser.autoslideTimer = window.setTimeout('window.laut.teaser.slide(false);', 7000);
						}
					});
					$(this.teaserSteuerung[$u]).bind('click', function(){
						if(window.laut.teaser.hoverStatus == 0) {
							window.location.href = window.laut.teaser.json[parseInt($(this).parent().find('a.indexAnchor').attr('rel'))].url;
						}
					});
					
					if($u < 5) {
						$(this.listenElement[$u]).bind('mouseenter', function() {
							window.clearTimeout(window.laut.teaser.mouseEnterVrzg);
							window.laut.teaser.mouseEnterVrzg = window.setTimeout('window.laut.teaser.mouseenterVerzoegerung(' + $(this).find('div a').attr('rel') + ', ' + ($(this).offset().top + ($(this).outerHeight() / 2) - ($(window.laut.teaser.teaserPosition[$(this).find('div a').attr('rel')]).outerHeight() / 2)) + ', ' + ($(this).offset().left + ($(this).outerWidth() / 2) - ($(window.laut.teaser.teaserPosition[$(this).find('div a').attr('rel')]).outerWidth() / 2)) + ')', 65);
							window.laut.teaser.mouseLeaveVrzg = window.setTimeout('window.laut.teaser.mouseleaveVerzoegerung()', 1);
						}).bind('mouseleave', function(){
							window.clearTimeout(window.laut.teaser.mouseEnterVrzg);
						});
					}
					
					$('div#seite').before($(this.teaserPosition[$u]));
				}
				if(_json.length > 4) {
					this.autoslideTimer = window.setTimeout('window.laut.teaser.slide(false);', 7000);
				}
			},
			slide: function(_tmppfeil) {
				window.laut.teaser.hoverStatus = 1;
				
				if($(_tmppfeil).hasClass('trechts') || _tmppfeil == false) {
					var slideIndex = parseInt($('li.last').find('div a').attr('rel'));
					if(slideIndex == this.json.length - 1) {
						slideIndex = 0;
					}
					else {
						slideIndex = slideIndex + 1;
					}
					var left = (-$('li.ele').outerWidth() - 15);
					var liauswahl_1 = 'last';
					var liauswahl_2 = 'first';
				}
				else {
					var slideIndex = parseInt($('li.first').find('div a').attr('rel'));
					if(slideIndex == 0)
						slideIndex = this.json.length - 1;
					else
						slideIndex = slideIndex - 1;
					var left = 0;
					var liauswahl_1 = 'first';
					var liauswahl_2 = 'last';
				}
				var newLI = document.createElement('li');
				$(newLI).addClass('ele').html('<div style="background-image: url(' + this.json[slideIndex].bild + ');"><a rel="' + slideIndex + '" href="' + this.json[slideIndex].url + '"><span class="teaserHeader">' + this.json[slideIndex].header + '</span><span class="teaserLink">:&nbsp;' + this.json[slideIndex].subheader + '</span></a></div>').bind('mouseenter', function(){
					window.clearTimeout(window.laut.teaser.mouseEnterVrzg);
					window.laut.teaser.mouseLeaveVrzg = window.setTimeout('window.laut.teaser.mouseleaveVerzoegerung()', 1);
					window.laut.teaser.mouseEnterVrzg = window.setTimeout('window.laut.teaser.mouseenterVerzoegerung(' + slideIndex + ', ' + ($(this).offset().top + ($(this).outerHeight() / 2) - ($(window.laut.teaser.teaserPosition[slideIndex]).outerHeight() / 2)) + ', ' + ($(this).offset().left + ($(this).outerWidth() / 2) - ($(window.laut.teaser.teaserPosition[slideIndex]).outerWidth() / 2)) + ')', 65);
				}).bind('mouseleave', function(){
					window.clearTimeout(window.laut.teaser.mouseEnterVrzg);
				});
				
				if($(_tmppfeil).hasClass('tlinks')) {
					$(this.UL).css('left', -$('li.ele').outerWidth() - 15).prepend(newLI);
				}
				else {
					$(this.UL).append(newLI);
				}
				
				$(this.UL).animate({
					left: left
				}, 800, function(){
					if($(_tmppfeil).hasClass('trechts') || _tmppfeil == false)
						$('ul.block').css('left', 0);
					$('ul.block li.ele').removeClass(liauswahl_1).removeAttr('style');
					$('ul.block li:' + liauswahl_1).addClass(liauswahl_1);
					$('ul.block li:' + liauswahl_2).remove();
					$('ul.block li:' + liauswahl_2).addClass(liauswahl_2);
					
					if(_tmppfeil != false) {
						$('div.tpfeilBox').replaceWith(_tmppfeil);
						$('div.teaserPosition div.teaserSteuerung a.tpfeil').show();
					}
					window.laut.teaser.status = 0;
				});
				
				if(_tmppfeil == false) {
					this.autoslideTimer = window.setTimeout('window.laut.teaser.slide(false);', 7000);
				}
			}
		};
		
		$('div.teaserband').empty();
		window.laut.teaser.imagesPreloaden(window.laut.teaser.json);
		window.laut.teaser.init(window.laut.teaser.json);
		
		$('a.tpfeil').live('mousedown', function() {
			if(window.laut.teaser.status == 0) {
				window.laut.teaser.status = 1;
				window.laut.teaser.pruefStatus = 1;
				
				window.laut.teaser.thisIndex = parseInt($(this).parent().find('a.indexAnchor').attr('rel'));
				window.laut.teaser.nextIndex = null;
				
				if($(this).hasClass('trechts')) {
					if((window.laut.teaser.thisIndex + 1) == window.laut.teaser.json.length) {
						window.laut.teaser.nextIndex = 0;
					}
					else {
						window.laut.teaser.nextIndex = window.laut.teaser.thisIndex + 1;
					}
					var cssClass = 'trechts';
				}
				else {
					if(window.laut.teaser.thisIndex == 0) {
						window.laut.teaser.nextIndex = window.laut.teaser.json.length - 1;
					}
					else {
						window.laut.teaser.nextIndex = window.laut.teaser.thisIndex - 1;
					}
					var cssClass = 'tlinks';
				}
				
				var tpfeilBox = document.createElement('div');
				
				$(tpfeilBox).addClass('tpfeil').html('&nbsp;').bind('click', function() {
					return false;
				}).bind('mouseup', function() {
					if(window.laut.teaser.pruefStatus = 1) {
						window.laut.teaser.pruefStatus = 2;
					}
				});
				$(tpfeilBox).addClass('tpfeilBox');
				$(tpfeilBox).addClass(cssClass);
				$(this).replaceWith(tpfeilBox);
				$('div.teaserPosition div.teaserSteuerung a.tpfeil').hide();
				
				window.laut.teaser.slide(this);
				
				$(window.laut.teaser.teaserPosition[window.laut.teaser.nextIndex]).css('z-index', 9);
				$(window.laut.teaser.teaserPosition[window.laut.teaser.thisIndex]).css('z-index', 10);
				$(window.laut.teaser.teaserPosition[window.laut.teaser.nextIndex]).css('top', $(window.laut.teaser.teaserPosition[window.laut.teaser.thisIndex]).css('top'));
				$(window.laut.teaser.teaserPosition[window.laut.teaser.nextIndex]).css('left', $(window.laut.teaser.teaserPosition[window.laut.teaser.thisIndex]).css('left')).show();
				$(window.laut.teaser.teaserPosition[window.laut.teaser.thisIndex]).fadeOut(800, function() {
					if(window.laut.teaser.pruefStatus == 2) {
						$(this).removeAttr('style');
						window.laut.teaser.hoverStatus = 0;
						window.laut.teaser.pruefStatus = 0;
					} else {
						$('div.teaserPosition').removeAttr('style');
						window.laut.teaser.hoverStatus = 0;
						window.laut.teaser.pruefStatus = 0;
					}
				});
			}
		});
		
		for(var t = 0; t < 4; t++) {
			if(t == 0) { var __object = 'div#kopfwrapper'; } else if(t == 1) { var __object = 'div#spalteLinks'; } else if(t == 2) { var __object = 'div#spalteRechts'; } else { var __object = 'div#navigationwrapper'; }
			$(__object).bind('mouseenter', function() {
				$('div.teaserPosition').removeAttr('style');
			});
		}
	}
});
/* ]]> */
jQuery(document).ready(function($) {
	if(typeof(window.laut.newsletter) != 'object'){
		window.laut.newsletter = {};
	}
	window.laut.newsletter = {
		abonnieren: function() {

			var p = {
				aktion:	26,
				email: $('input#nl_mail').val()
			}
		
			laut.ajax.senden(p, function(data){
				if(data && data.code == 1){
					$('div#newsletterInfo').html('Danke! Du erh&auml;lst in K&uuml;rze eine Best&auml;tigungsmail an ' + $('input#nl_mail').val() + '. Sobald Du den Aktivierungslink geklickt hast, nehmen wir Dich in unseren Newsletterverteiler auf. Solltest du keine Email erhalten, schau bitte in Deinem Spamfilter nach. Nimm den Absender newsletter@laut.de am besten in Deine Whitelist auf.');
					$('div#newsletterInfo').css('margin','5px 0px 5px 0px');
					$('input#nl_mail').hide();
					$('form#newsletterwahl button').hide();
				}
				else{
					$('div#newsletterInfo').html('Du hast keine g&uuml;ltige Email-Adresse angegeben. Bitte schau da nochmal drauf.');
				}
			});
			
			return false;
		}
	};
	
	$('form#newsletterwahl button').live('click', function(){
		laut.newsletter.abonnieren();
	});
	
});



 



// json2.js:          https://github.com/douglascrockford/JSON-js/raw/master/json2.js
// compressed with:   http://dean.edwards.name/packer/
//
var JSON;if(!JSON){JSON={}}(function(){"use strict";function f(n){return n<10?'0'+n:n}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z':null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key)}if(typeof rep==='function'){value=rep.call(holder,key,value)}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null'}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null'}v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v}if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v)}}}}v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v}}if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' '}}else if(typeof space==='string'){indent=space}rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}return str('',{'':value})}}if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j}throw new SyntaxError('JSON.parse');}}}());

jQuery.noConflict();

// A PubSub implementation based on the localStorage.storage event.
// Basically there are two functions: PubSub.publish and PubSub.subscribe.
// Both take a string as PubSub channel id as the first argument.
// PubSub.subscribe takes a callback function as a second argument.
// 
// We're working around several quirks of the storage event to get the desired behaviour:
// * Duplicate messages trigger the subscribe callback twice. The plain storage event wouldn't do that.
// * Publishing triggers the callback of subscriptions within the same window, too.
//   The plain storage event wouldn't do that, although some browsers disregard the specs, here.
// * JSON serialization is used, so all nativ JSON types can be published.
// 
// To avoid name clashes "__pubsub__" is used as namespace in the localStorage.
jQuery( function($) {
  
  if( typeof( window.PubSub ) == 'undefined' ) { window.PubSub = {}; }
  
  window.PubSub = {
    channels:    {},
    
    storage: {
      
      // Gets the current value of the localStorage and removes the duplicate buster.
      get: function(channel){
        var value = this.get_raw(channel);
        return value ? value.substring(0, value.length-12) : null;
      },
      
      // Gets the current value of the localStorage without removing the duplicate buster.
      get_raw: function(channel){
        return localStorage.getItem('__pubsub__'+channel);
      },
      
      // Sets the localStorage value with the duplicate buster.
      set: function(channel, value){
        var val = value + Math.floor((Math.random()+1)*100000000000);                    // 12 digit random number
        
        localStorage.setItem('__pubsub__'+channel, val);
      },
      
      // Triggers a custom event for the given channel.
      triggerEvent: function(channel, value){
        $(window).trigger('__pubsub__'+channel, value);   // remove the last 12 chars
      },
      
      // Binds the custom event.
      bindEvent: function(channel, callback){
        var cb = function(event, value){
          var v = value ? JSON.parse(value) : null;
          callback( v );
        };
        $(window).bind('__pubsub__'+channel, cb);
      },
      
      // Stupid at the first glance, but dumb browsers don't tell us the key so we have to
      // do this for them anyway.
      // And some browsers disrespect the localStorage spec and trigger the 'storage'-Event
      // even in the same window that makes the change.
      // This way we can prevent duplicate event triggers.
      findChangedChannel: function() {
        var changed_channel = false;
        
        $.each( PubSub.channels, function( stored_channel, known_content ){
          var storage_content = PubSub.storage.get( stored_channel );
          
          if( storage_content != known_content ) {
            PubSub.channels[stored_channel] = storage_content;
            
            changed_channel = stored_channel;
            return false; // break the each loop
          }
        });
        return changed_channel;
      },
      
      // Wraps the storage event to trigger our custom event (see above) if something changes we know of.
      eventHandler: function() {
        var channel = PubSub.storage.findChangedChannel();
        
        if(!channel) { return false; }
        
        return PubSub.storage.triggerEvent(channel, PubSub.storage.get(channel));
      }
      
    },
    
    // Returns the value of the given channel.
    // PubSub usually doesn't have this, but we're using a storage anyway so why not use this?
    value:        function( channel ){
              if( typeof(channel) != 'string' ){ return false; }
              return JSON.parse(this.storage.get(channel));
    },
    
    // Subscribe a given channel and register a callback.
    subscribe:    function( channel, callback ) {
              if( typeof(channel) != 'string' ){ return false; }
              if( typeof(callback) != 'function' && typeof(callback) != 'object' ){ return false; }
              
              var current_value = this.storage.get_raw(channel);
              
              this.channels[channel] = current_value;         // Initial den aktuellen rohen Wert merken
              
              this.storage.bindEvent(channel, callback);     // Der übergebenen Callback ist unser Event-Listener
              
              return true;
            },
    
    // Publish a value on a channel.
    publish:    function( channel, value ) {
              if( typeof(channel) != 'string' ){ return false; }
              
              this.storage.set(channel, JSON.stringify(value)); // Neue Information in den HTML5 Local Storage schreiben
              PubSub.storage.eventHandler();                    // Manuell Event triggern, da im selben Fenter 'storage' Events (i.d.R) nicht ausgelöst werden
              
              return true;
            },
    
    // Unsubscribe a given channel.
    unsubscribe:   function( channel ) {
              if( typeof( localStorage.getItem(channel) ) == 'undefined' ) { return false; }
              
              var key = '__pubsub__' + channel;
              
              $(window).unbind(key);                      // Löscht Event Listener für den Kanal-Event
              
              return true;
            }
  };
  
  if( window.addEventListener ) {
    window.addEventListener( 'storage', PubSub.storage.eventHandler, false );     // Fuer Firefox, Chrome, Safari und Opera
  } else {
    // IE triggert erst Event, macht dann den Storage-Eintrag.
    // Durch den timeout stellen wir sicher, dass der Storage-Eintrag da ist, wenn das Event feuert.
    document.attachEvent( 'onstorage', function(e){
      setTimeout( function(){PubSub.storage.eventHandler(e); }, 100) ;
    });
  }
  
});
// Utility function to control external windows.
// 
// It makes sure an external window with a given id is only opened (and loaded) once.
// It basically takes the options known as of window.open, namely a url, an id ([\w\d_]+) and a list of options (as string).
// 
// Additionaly these callbacks are taken: onOpen, onClose.
// * onOpen is called when a new window is actually opened, i.e. it's not been opened before.
//   onOpen receives the opened window instance as argument.
// * onClose is called when the external window is closed. It doesn't matter where the close is triggered:
//   From this window, the external window itself or another window. In every case onClose is called.
// 
// It returns the window instance if a new window is opened, false otherwise.
// 

window.controlledWindow = {
  watchTimers: {},
  
  now: function(){ return (new Date().getTime()); },
  setTimestamp: function(id, delta){ localStorage.setItem('__win_open__'+id, this.now()+delta); },
  getTimestamp: function(id){ return localStorage.getItem('__win_open__'+id); },
  
  addWatchTimerFor: function(id, interval, callback){
    if(window.controlledWindow.watchTimers[id]){
      clearTimeout(window.controlledWindow.watchTimers[id]);
    };
    
    window.controlledWindow.watchTimers[id] = setTimeout(callback, interval);
  },
  
  isOpen: function(id){
    return this.getTimestamp(id) > this.now();
  },
  
  watch: function(id, options){
    var onOpen        = options.onOpen;
    var onClose       = options.onClose;
    var current_state = options.current_state || 'closed';
    var interval      = 350;
    
    var now           = this.now();
    var win_open_timestamp = this.getTimestamp(id);
    
    var next_check
    if(win_open_timestamp >= now){
      if(current_state=='closed' && onOpen){ onOpen(); };
      next_check = Math.max(win_open_timestamp - now, interval);
      current_state = 'open';
    }else{
      if(current_state=='open' && onClose){ onClose(); };
      next_check = interval;
      current_state = 'closed';
    }
    
    this.addWatchTimerFor(id, interval, function(){
      controlledWindow.watch(id, {onClose: onClose, onOpen: onOpen, current_state: current_state}) ;
    });
  },
  
  open: function(url, id, opts, o){
    var onOpen   = o.onOpen;
    var onClose  = o.onClose;
    var win_open = controlledWindow.isOpen(id);
    var guarantee = 10000;
    
    this.setTimestamp(id, guarantee);
    this.watch(id, {onOpen: onOpen, onClose: onClose});
    
    return win_open ? false : window.open(url, id, opts);
  },
  
  beControlledAs: function(id){
    var interval = 2000;
    var guarantee = 10000;
    
    // publish that we're open...
    this.setTimestamp(id, guarantee);
    // ... and over and over again.
    var open_win_timer = setInterval(function(){controlledWindow.setTimestamp(id, guarantee)}, interval);
    
    // publish that we're closing
    var onunload = function(){
      clearInterval(open_win_timer);
      controlledWindow.setTimestamp(id, 0);
    }
    
    var oldonbeforeunload = window.onbeforeunload;
    if (typeof window.onbeforeunload != 'function'){
      window.onbeforeunload = onunload;
    } else {
      window.onbeforeunload = function(){ oldonbeforeunload(); onunload(); }
    }
    
  }

};
laut.include_js = function(url, callback) {
  var script, head;
  
  head = document.getElementsByTagName('head')[0];
  script = document.createElement('script');
  script.setAttribute('type', 'text/javascript');
  script.setAttribute('src', url);
  head.appendChild(script);
  
  // For IE:
  script.onreadystatechange = function () {
    if (script.readyState == 'loaded' || script.readyState == 'complete') { callback(); }
  }
  
  // For browsers:
  script.onload = callback;
  
  return false;
}
jQuery(document).ready(function($) {
  $.extend({
    keys: function(obj){
      if (typeof Object.keys == 'function') return Object.keys(obj);
      
      var a = [];
      $.each(obj, function(k){ a.push(k) ; });
      return a;
    }
  });
  
  var lautde_seite = $('#seitenWrapper');
  var player_container = $('#lautfm_player');
  var player_content = $('#lautfm_player div.content');
  var play_controls = {
    expandButton: player_container.find('.play_controls .expand'),
    playButton:   player_container.find('.play_controls .play'),
    vol30Button:  player_container.find('.play_controls .vol30'),
    vol90Button:  player_container.find('.play_controls .vol90')
  };
  var current_station = {
    name: function(){ return current_station.bar.name.text().replace('laut.fm/','') ; },
    bar : {
      container:    player_container.find('.current_station'),
      image:        player_container.find('.current_station .image'),
      name:         player_container.find('.current_station .name'),
      format:       player_container.find('.current_station .format')
    },
    full : {
      container:    player_container.find('.current_station_full'),
      image:        player_container.find('.current_station_full .image'),
      name:         player_container.find('.current_station_full .name'),
      dj_info:      player_container.find('.current_station_full .dj_info'),
      format:       player_container.find('.current_station_full .format'),
      website:      player_container.find('.current_station_full .website'),
      description:  player_container.find('.current_station_full .description'),
      current_playlist: player_container.find('.current_station_full .playlist.current'),
      next_playlist:    player_container.find('.current_station_full .playlist.next'),
      last_songs:   player_container.find('.current_station_full .last_songs ul')
    }
  };
  var current_song = {
    title:        player_container.find('.current_song .title'),
    artist:       player_container.find('.current_song .artist'),
    releaseyear:  player_container.find('.current_song .releaseyear'),
    album:        player_container.find('.current_song .album')
  };
  
  var stations_browser        = player_container.find('.stations_browser .genres');
  var station_search          = player_container.find('.stations_browser .search');
  var station_search_input    = station_search.find('input');
  var station_top100          = player_container.find('.stations_browser .top100');
  var station_recent          = player_container.find('.stations_browser .recent');
  var station_recommendations = player_container.find('.stations_browser .recommendations');
  var station_list            = player_container.find('.stations ul');
  
  var set_player_open_state   = function(){ player_container.addClass('player_open'); };
  var set_player_closed_state = function(){
    player_container.removeClass('player_open');
    // PubSub.publish('fm_player_play', '');
  };
  
  var openPlayerWindow = function(){
    var win = controlledWindow.open('/elemente/lautfm_player/lautfm_player.html',
      'lautfmplayer',
      'location=no, status=no, scrollbars=no, toolbar=no, directories=no, width=315, height=340, copyhistory=no, resizable=no, top=0, right=0',
      {
        onOpen: set_player_open_state,
        onClose: set_player_closed_state
    });
    
    if(win){ win.blur() ; };
    window.focus();
  };
  
  // Play a certain station. Open the player window, unless already open.
  var play = function(station){
    openPlayerWindow();
    PubSub.publish('fm_player_play', station);
    store_station(station);
    show_recent();
  };
  
  var store_station = function(station_name){
    var stored_stations = $.map(getStoredStations(), function(station){
      if(station.name != station_name){ return station; }
    });
    stored_stations.unshift({ 'name': station_name, 'last_played':(new Date).getTime() });
    stored_stations = stored_stations.slice(0,20);
    setStoredStations(stored_stations);
  };
  
  var setStoredStations = function(stations){
    localStorage.setItem('lautfm_last_stations', JSON.stringify(stations));
  };
  
  var getStoredStations = function(){
    var stations = localStorage.getItem('lautfm_last_stations');
    if(stations){
      return JSON.parse(stations);
    }else{
      return [];
    }
    
  };
  
  // toggle play/stop functionality
  var toggle_play = function(station){
    if(controlledWindow.isOpen('lautfmplayer')){
      PubSub.publish('fm_player_play', '');
      track_click('fmplayer','pause',station,true);
    } else {
      play(station);
      track_click('fmplayer','play',station,true);
    }
  };
  
  var first_last_ul = function(ul){
    var lis = $(ul).find('li');
    lis.removeClass('first');
    lis.removeClass('last');
    $(ul).find('li:first').addClass('first');
    $(ul).find('li:last').addClass('last');
  };
  
  // show a single station in the current station container
  var show_station = function(station){
    var format = station['format'].length==0 ? station['description'].substring(0,65) : station['format'];
    format = format.replace(/([a-z0-9]),([a-z0-9])/gi, "$1, $2");
    
    var dj_info = [];
    if (station['djs'].length > 0) {
      dj_info.push(station['djs']);
    }
    if (station['location'].length > 0) {
      dj_info.push(station['location']);
    }
    dj_info = dj_info.join(', ');
    
    current_station.bar.format.html(format);
    current_station.bar.name.html('laut.fm/' + station['name']);
    current_station.bar.image.attr('src', station['images']['station']);
    
    current_station.full.format.html(format);
    current_station.full.name.html('laut.fm/' + station['name']);
    current_station.full.image.attr('src', station['images']['station']);
    current_station.full.description.html(station['description']);
    current_station.full.dj_info.html(dj_info);
    
    current_station.full.website.empty();
    if(station['website']){
      var website = station['website'];
      if(!website.match(/^http:\/\//)){ website = 'http://'+website}
      var link = $('<a href="'+website+'" target="blank">'+station['website']+'</a>');
      current_station.full.website.append(link);
      current_station.full.website.closest('p').show();
    } else {
      current_station.full.website.closest('p').hide();
    }
    
    if (station['images']['background'] && typeof(station['images']['background']) != 'undefined') {
      player_content.css('background-image', 'url('+station['images']['background']+')');
    } else {
      player_content.css('background-image', 'none');
    }
    
    player_content.css('background-color', station['color'] || '#555');
    
    if(station['current_playlist']){
      var started_at_string = station['current_playlist']['started_at'].getHours()+':00';
      current_station.full.current_playlist.find('.name').html(station['current_playlist']['name']);
      current_station.full.current_playlist.find('.started_at').html(started_at_string);
      current_station.full.current_playlist.find('.description').html(station['current_playlist']['description']);
      current_station.full.current_playlist.show();
    } else {
      current_station.full.current_playlist.hide();
    }

    if(station['next_playlist']){
            current_station.full.next_playlist.show();
    } else {
      current_station.full.next_playlist.hide();
    }

    // need this to defer the actual call:
    setTimeout(function(){ current_station.full.container.scroller.reinitialise(); }, 100);
    
    show_player();
    station_list.find('.'+station['name']).addClass('active');
  };
  
  var show_songs = function(songs){
    show_song(songs[0]);
    show_last_songs(songs);
  };
  
  // show a single song info in the current song container
  var show_song = function(song){
    current_song.title.html(song['title']);
    current_song.artist.html(song['artist']['name']);
    
    if(song['artist']['laut_url']){
      current_song.artist.attr('href', song['artist']['laut_url']).addClass('wort');
    }else{
      current_song.artist.removeAttr('href');
    };
    
    if(song['releaseyear']){
      current_song.releaseyear.html(' ('+song['releaseyear']+')');
    }else{
      current_song.releaseyear.html();
    };
    
    current_song.album.html(song['album']);
    show_player();
  };
  
  var song_li_for = function(song){
    var h = song['started_at'].getHours();
    var m = song['started_at'].getMinutes();
    m = m < 10 ? '0'+m : m;
    var started_at =  h + ':' + m;
    
    return $('<li>'+
            '<span class="started_at">' + started_at + '</span> ' +
            '<a'+
              (song['artist']['laut_url'] ? ' href="'+song['artist']['laut_url']+'">' : '>') +
              song['artist']['name']+
            '</a>'+
            ' - <span>'+song['title']+'</span>'+
          '</li>');
  };
  
  var show_last_songs = function(songs){
    current_station.full.last_songs.empty();
    $(songs).each(function(i,song){
      current_station.full.last_songs.append(song_li_for(song));
    });
    
    // need this to defer the actual call:
    setTimeout(function(){ current_station.full.container.scroller.reinitialise(); }, 100);
  };
  
  var station_li_for = function(station){
    var info_line = station['info_line'] || station['format'].replace(/([a-z0-9]),([a-z0-9])/gi, "$1, $2");
    
    var li = $('<li>'+
              '<div class="station_img">'+
                '<img src="'+station['images']['station_80x80']+'" />'+
              '</div>'+
              '<span class="name">'+station['name']+'</span>'+
              '<span class="format">'+info_line+'</span>'+
            '</li>');
    li.addClass(station['name']);
    li.station_name = station['name'];
    
    return li;
  };
  
  var station_lis_for = function(stations){
    return $(stations).map(function(station_index,station){
      var li = station_li_for(station);
      
      li.click(function(){
        play(station['name']);
        $(this).siblings().removeClass('active');
        $(this).addClass('active');
        track_click('fmplayer','station',station['name'],true);
      });
      return li;
    });
  };
  
  // showing a list of stations in the stations column
  var show_stations = function(stations){
    if(stations['offset']==0){
      station_list.empty();
      if(station_list.scroller){ station_list.scroller.scrollToY(0) ; };
    };
    
    var station_lis = station_lis_for(stations['items']);
    
    $(station_lis).each(function(i, station_li){
      station_list.append(station_li);
    });
    
    first_last_ul(station_list);
    if(current_station.name()){
      station_list.find('.'+current_station.name()).addClass('active');
    }
    station_list.closest('.stations').removeClass('search');
    setTimeout(function(){ station_list.scroller.reinitialise(); }, 100);
  };
  
  var show_stations_search = function(station_results){
    if(station_results['offset']==0){
      station_list.empty();
      station_list.scroller.scrollToY(0);
    };
    
    $(station_results['results']).each(function(result_index,result){
      $(result['items']).each(function(station_index,station_result){
        var station = station_result['station'];
        
        if(station_result['current_song']){
          station['info_line'] = 'Jetzt: '+station_result['current_song']['artist']['name']+' - '+station_result['current_song']['title'];
        }else if(station_result['next_artists']){
          station['info_line'] = 'Gleich: '+station_result['next_artists'];
        }else{
          station['info_line'] = station['format'].replace(/([a-z0-9]),([a-z0-9])/gi, "$1, $2");
        }
        
        var station_li = station_li_for(station);
        station_li.click(function(){
          load_station(station['name']);
          play(station['name']);
          $(this).siblings().removeClass('active');
        });
        
        if(station_list.find('.'+station_li.station_name).length == 0){
          station_list.append(station_li);
        }
      });
    });
    first_last_ul(station_list);
    if(current_station.name() != ''){
      station_list.find('.'+current_station.name()).addClass('active');
    }
    station_list.closest('.stations').addClass('search');
    setTimeout(function(){ station_list.scroller.reinitialise(); }, 100);
  };
  
  var load_genre = function(genre, offset){
    var offset = offset || 0;
    $(window).unbind('stations_scroll_pane_at_bottom');
    
    laut.fm.stations.genre(genre,
      function(stations){
        if(stations['next_offset']){
          $(window).bind('stations_scroll_pane_at_bottom', function(){
            load_genre(genre, stations['next_offset']);
          });
        }
        
        show_stations(stations);
      },
    {'limit':20, 'offset':offset});
    
    if (offset == 0) {
    	track_click('fmplayer','list',genre,true);
    } else {
    	track_click('fmplayer','extendlist',genre);
    }
    
  };
  
  // showing a list of genres in the browse column
  var show_genres = function(genres){
    $(genres).each(function(genre_index,genre){
      var li = $('<li><strong>' + genre.name + '</strong> (' + genre.score + ')</li>');
      
      var klass;
      if(genre_index==0){ klass = 'first'; } else if(genre_index==genres.length-1){ klass = 'last'; };
      if(typeof klass != 'undefined'){li.addClass(klass);};
      
      li.click(function(){
        load_genre(genre.name);
        clear_stations_browser_active_state();
        $(this).addClass('active');
      });
      stations_browser.append(li);
    });
    first_last_ul(station_list);
    if(stations_browser.scroller){ stations_browser.scroller.scrollToY(0) ; };
    setTimeout(function(){ stations_browser.scroller.reinitialise(); }, 100);
  };
  
  // show the whole player bar; only used directly after page load
  var show_player = function(context){
    if( current_song.title.html() == '' ){ return false ; };
    if( current_station.bar.name.html() == '' ){ return false ; };
    if( player_container.hasClass('shown') ){ return false ; };
    player_container.addClass('shown');
    player_container.stop(true);
    
    if (getCookie('lautfm') != 'mini') {
    	player_container.css('left','0px');
    	lautde_seite.css('margin-bottom','50px');
   	}
	player_container.animate({ 'bottom': '-400px' }, 500);
    track_click('fmplayer','init');
  };
  
  // expand the player and show genres, stations and full current station column
  var toggle_expand_player = function(){
    if(player_container.hasClass('expanded')) {
      player_container.animate({ 'bottom': '-400px' }, 500);
      lautde_seite.animate({ 'margin-bottom': '50px' }, 500);
      player_container.removeClass('expanded');
      track_click('fmplayer','contract','',true);
    } else {
      player_container.animate({ 'bottom': '0px' }, 500);
      lautde_seite.animate({ 'margin-bottom': '450px' }, 500);
      player_container.addClass('expanded');
      track_click('fmplayer','expand','',true);
    }
  };

  var load_station = function(station){
    if( typeof player_container.data('station') != 'undefined' ){ player_container.data('station').unwatch(); };
    
    player_container.data('station', laut.fm.station(station).
                                  info(show_station).
                                  last_songs(show_songs, true));
  };
  
  var load_search = function(query, offset, with_result, on_empty){
    var offset = offset || 0;
    $(window).unbind('stations_scroll_pane_at_bottom');
    
    laut.fm.search.stations(query, function(stations){
      if(stations['next_offset']){
        $(window).bind('stations_scroll_pane_at_bottom', function(){
          load_search(query, stations['next_offset']);
        });
      }
      
      if(stations['total'] > 0){
        show_stations_search(stations);
        if(typeof with_result == 'function'){ with_result(stations) ; }
      } else {
        if(typeof on_empty == 'function'){ on_empty(query) ; }
      }
    }, {'offset': offset});
  };
  
  var load_top100 = function(offset){
    var offset = offset || 0;
    $(window).unbind('stations_scroll_pane_at_bottom');
    
    laut.fm.stations.all(function(stations){
      if(stations['next_offset'] && stations['next_offset'] < 100){
        $(window).bind('stations_scroll_pane_at_bottom', function(){
          load_top100(stations['next_offset']);
        });
      }
      
      show_stations(stations);
    }, {'limit':10, 'offset':offset});
    
    if (offset == 0) {
    	// track_click('fmplayer','list','top100',true);
    } else {
    	track_click('fmplayer','extendlist','top100');
    }
    
  };
  
  var init_top100 = function(){
    station_top100.click(function(){
      clear_stations_browser_active_state();
      station_top100.addClass('active');
      load_top100();
    });
  };
  
  var init_recommendations = function(){
    station_recommendations.click(function(){
      clear_stations_browser_active_state();
      station_recommendations.addClass('active');
      load_recommendations();
    });
  };
  
  var load_recommendations = function(){
    $(window).unbind('stations_scroll_pane_at_bottom');
    
    var station_names = $.keys(window.laut.lautfm_recommendations);
    
    laut.fm.stations.names(station_names, function(stations){
      $.each(stations, function(i,station){
        station.format = window.laut.lautfm_recommendations[station.name];
      });
      
      show_stations({offset:0, items: stations});
    });
    // track_click('fmplayer','list','redaktion',true);
  };
  
  var load_recent = function(){
    $(window).unbind('stations_scroll_pane_at_bottom');
    
    var station_names = $.map(getStoredStations(), function(stored_station){ return stored_station.name; });
    if(station_names.length == 0){ return false; };
    
    laut.fm.stations.names(station_names, function(stations){
      show_stations({offset:0, items: stations});
    });
    // track_click('fmplayer','list','recent',true);
  };
  
  var show_recent = function(){
    if(getStoredStations().length != 0){
      station_top100.removeClass('last');
      station_recent.show();
    }
  };
  
  var init_recent = function(){
    station_recent.click(function(){
      clear_stations_browser_active_state();
      station_recent.addClass('active');
      load_recent();
    });
    show_recent();
  };
  
  var init_search = function(){
    var to = 0;
    var tracking_timeout = 0;
    var query = '';
    
    station_search_input.keyup(function(){
      if(query == $(this).val()){ return false; };
      query = $(this).val();
      
      if(query.length < 2){ return false; };
      
      clear_stations_browser_active_state();
      station_search.addClass('active');
      
      clearTimeout(to);
      to = setTimeout(function(){ load_search(query) ; }, 200);
      
      clearTimeout(tracking_timeout);
      tracking_timeout = setTimeout(function(){ track_click('fmplayer','search',query,true); }, 3000);
    });
    
    station_search_input.focus( function(){
      if(this.value == this.defaultValue || this.value == $(this).attr('default_query')){
        $(this).val('');
      } else {
        load_search(this.value);
      }
    });
    station_search_input.blur( function(){
      if(this.value == ''){ $(this).val($(this).attr('default_query') || this.defaultValue); }
    });
  };
  
  var init_scrollers = function(){
    jScrollPaneOptions = {'enableKeyboardNavigation':false, 'autoReinitialise':false};
    stations_browser.scroller = player_container.
          find('.stations_browser').
          bind('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
            if(isAtBottom){ $(window).trigger('genres_scroll_pane_at_bottom') ; }
          }).
          jScrollPane(jScrollPaneOptions).
          data('jsp');
    
    station_list.scroller = player_container.
          find('.stations').
          bind('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
            if(isAtBottom){ $(window).trigger('stations_scroll_pane_at_bottom') ; }
          }).
          jScrollPane(jScrollPaneOptions).
          data('jsp');
    
    current_station.full.container.scroller = current_station.full.container.
          jScrollPane(jScrollPaneOptions).
          data('jsp');
    
    
    $(window).resize(function(){
      setTimeout(function(){
        stations_browser.scroller.reinitialise();
        station_list.scroller.reinitialise();
        current_station.full.container.scroller.reinitialise();
      }, 100);
    });
  };
  
  var initial_search = function(load_default){
    var query;
    if(typeof window.laut.lautfm_interpret != 'undefined'){
      query = window.laut.lautfm_interpret;
      // query = 'artist:'+window.laut.lautfm_interpret;
    }else if(typeof window.laut.lautfm_genre != 'undefined'){
      query = window.laut.lautfm_genre;
      // query = 'genre,format:'+window.laut.lautfm_genre;
    };
    
    if(typeof query != 'undefined'){
      load_search(query, 0,
        function(stations){
          if(load_default){ load_station(stations['results'][0]['items'][0]['station']['name']); }
          station_search_input.val(query);
          station_search_input.attr('default_query', query);
          station_search.addClass('active');
        },
        function(){
          load_recommendations();
          if(load_default){ load_station('eins'); };
        }
      );
    } else {
      load_recommendations();
      station_recommendations.addClass('active');
      if(load_default){ load_station('eins'); };
    }
  };
  
  var init_player = function(){
    if(controlledWindow.isOpen('lautfmplayer')){
      load_station( PubSub.value('fm_player_play') );
      initial_search(false);
    } else {
      initial_search(true);
    }
    
    PubSub.subscribe('fm_player_play', function(station){
      if( station == '' ){ return false; };
      load_station(station);
      station_list.find('li').removeClass('active');
    });
  };
  
  var clear_stations_browser_active_state = function(){
    stations_browser.find('li').removeClass('active');
    station_top100.removeClass('active');
    station_recent.removeClass('active');
    station_recommendations.removeClass('active');
    station_search.removeClass('active');
  };
  
  var init_lautfm_player_body_links = function(){
    $("a[href^='lautfm://']").each(function(){
      var station = $(this).attr('href').replace('lautfm://', '');
      
      $(this).attr('title', 'Sender "'+station+'" im Player laden.');
      
      $(this).click(function(event, elm){
        event.preventDefault();
        
        load_station(station);
        play(station);
        station_list.find('li').removeClass('active');
        
        return false;
      });
    });
  };
  
  var init_play_controls = function(){
    current_station.bar.container.click(toggle_expand_player);
    play_controls.expandButton.click(toggle_expand_player);
    play_controls.playButton.click(function(){ toggle_play( current_station.name() ); } );
  };
  
  var init_volume_slider = function(){
    
    var vol;
    if(!PubSub.value('fm_player_vol')){
      vol = 100;
      PubSub.publish('fm_player_vol', 100);
    };
    
    $('#lautfm_player .volume_slider').slider({
      value: vol,
      slide: function(event, ui) {
        PubSub.publish('fm_player_vol', ui.value);
        $('#lautfm_player .volume_slider_left').css('width', (ui.value*0.85)+'%');
      }
    });
    
    $('#lautfm_player .play_controls .volume').mouseenter(function(){
      var self = $(this);
      var t = setTimeout(function(){
        var val = PubSub.value('fm_player_vol');
        self.find('.volume_slider').show().slider('value', val);
        self.addClass('active');
        self.find('.volume_slider_left').css('width', (val*0.85)+'%');
        $('#lautfm_player .volume_slider_background, #lautfm_player .volume_slider_left').show();
      }, 200);
      self.mouseleave(function(){
        clearTimeout(t);
      });
    });
    
    $('#lautfm_player .play_controls .volume').mouseleave(function(){
      $(this).removeClass('active');
      $(this).find('.volume_slider, .volume_slider_background, .volume_slider_left').hide();
    });
  };
  
  // listenklicks
  $('#lautfm_player div.stations_browser li.top100').click(function(){
    track_click('fmplayer','list','top100',true);
  });
  $('#lautfm_player div.stations_browser li.recommendations').click(function(){
    track_click('fmplayer','list','redaktion',true);
  });
  $('#lautfm_player div.stations_browser li.recent').click(function(){
    track_click('fmplayer','list','recent',true);
  });
  
  // somstige klicks mittracken
  $('#lautfm_player a.logo').click(function(){
    track_click('fmplayer','lead_logo');
  });
  $('#lautfm_player div.last_songs ul li a[href]').live('click', function(){
    track_click('fmplayer','lead_playlist',$(this).attr('href'));
  });
  $('#lautfm_player div.current_song a[href]').live('click', function(){
    track_click('fmplayer','lead_song',$(this).attr('href'));
  });
  
  // tracking
  var track_click = function(category, action, label, ivw){
  	  
  	// ivw
  	if (ivw === true) {
		switch(laut.seite.typ){
			case 'home':
				code = 'homepage';
				break;
			case 'news-uebersicht':
				code = 'vl_start';
				break;
			case 'news':
				code = 'vl_news';
				break;
			case 'album-uebersicht':
				code = 'ls_start';
				break;
			case 'album':
				code = 'ls_cd';
				break;	
			case 'artist-uebersicht':
				code = 'wl_start';
				break;
			case 'artist':
				code = 'wl_artist';
				break;		
			case 'artist-az':
				code = 'wl_archiv';
				break;		
			case 'event-uebersicht':
				code = 'lh_start';
				break;		
			case 'tour':
				code = 'lh_termine';
				break;		
			case 'event':
				code = 'lh_suche';
				break;		
			case 'genre-uebersicht':
				code = 'lw_start';
				break;		
			case 'genre':
				code = 'lw_genre';
				break;		
			case 'meta':
				code = 'kl_sonstiges';
				break;
			default:
				code = 'laut';
		}			
		var pixel = new Image();
		pixel.src = 'http://laut.ivwbox.de/cgi-bin/ivw/CP/' + code + ';' + (new Date).getTime() + '?r=' + escape(document.referrer)+"&d="+(Math.random()*100000);
	}

	if(typeof(pageTracker) != 'undefined' && pageTracker) {
		if (action == 'init' || action == 'mini') {
			pageTracker._trackEvent(category, action, label, undefined, true);
		} else {
			pageTracker._trackEvent(category, action, label);
		}
	}
	
  };
  
  is_mobile = function(){
    return (
        (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPod") != -1) ||
        (navigator.userAgent.indexOf("Android") != -1)
    );
  }
  
  var init = function(){
    if(is_mobile()){ return false ; }
    
    init_search();
    init_top100();
    init_recent();
    init_recommendations();
    laut.fm.genres(show_genres);
    init_scrollers(); // TODO: only initialize when player is ejected the first time?
    init_player();
    init_lautfm_player_body_links();
    
    // Watch the player window. Act on open and on close.
    controlledWindow.watch('lautfmplayer', {onOpen: set_player_open_state, onClose: set_player_closed_state});
    
    // The play_controls functionality:
    init_play_controls();
    init_volume_slider();
  }
  
  // include the lautfm_tools and initialize the player
  laut.include_js('http://api.laut.fm/js_tools/lautfm_js_tools.0.3.0.js', function(){
    init();    
  });
  
  $('div#lautfm_player div.control_bar div.meta a.schliessen').live('click', function(){
	if (player_container.hasClass('expanded')) {
	  toggle_expand_player();
	}
    player_container.animate({ 'left': '-100%' }, 300);
   	lautde_seite.stop(true).css('margin-bottom','0px');
   	setCookie('lautfm','mini',36000);
   	track_click('fmplayer','mini');
  });

  $('div#lautfm_player div.control_bar div#minimax').live('click', function(){
    player_container.animate({ 'left': '0px' }, 300);
   	lautde_seite.css('margin-bottom','50px');
   	deleteCookie('lautfm');
   	track_click('fmplayer','maxi');
  });
  
});


