/* bundling ./modules/kind/kind_mime_headers_hide.js */
jQuery(document).ready(function() {
    $(".kind_mime_more_headers").click(function() {
	var t=$(this).parents(".kind_mime_headers");
	$("tr",t).show();
	$(this).parent().hide();
    });
});
/* bundling ./types/usr/usr_password_quality.js */
    var usr_check_password_quality=function(pw,name,email,input)
    {
	var ret=0;
	jQuery.pai_call("usr_auth_password_quality",{
	    form_password:pw,
	    form_email:email,
	    form_name:name
	    },function(data) {
		var pd=data.pai_data,
		    q=pd.value,
		    t=pd.longtext,
		    id="usr_check_password_quality",
		    d;

		$("#"+id).remove();
		d="<span id='"+id+"'> "+t+"</span>";
		$(input).after(d);
		ret=q;
		if (q<12) {
		    $("#"+id).css("font-weight","bold");
		} else {
		    $("#"+id).css("font-weight","normal");
		}
	    },"POST",{
		async:false
	    });
	return ret;
    };
/* bundling js/versioned/jquery.nyroModal-1.6.2.min.js */
/*
 * nyroModal - jQuery Plugin
 * http://nyromodal.nyrodev.com
 *
 * Copyright (c) 2010 Cedric Nirousset (nyrodev.com)
 * Licensed under the MIT license
 *
 * $Date: 2010-02-23 (Tue, 23 Feb 2010) $
 * $version: 1.6.2
 */
jQuery(function($){var userAgent=navigator.userAgent.toLowerCase();var browserVersion=(userAgent.match(/.+(?:rv|webkit|khtml|opera|msie)[\/: ]([\d.]+)/)||[0,'0'])[1];var isIE6=(/msie/.test(userAgent)&&!/opera/.test(userAgent)&&parseInt(browserVersion)<7&&(!window.XMLHttpRequest||typeof(XMLHttpRequest)==='function'));var body=$('body');var currentSettings;var callingSettings;var shouldResize=false;var gallery={};var fixFF=false;var contentElt;var contentEltLast;var modal={started:false,ready:false,dataReady:false,anim:false,animContent:false,loadingShown:false,transition:false,resizing:false,closing:false,error:false,blocker:null,blockerVars:null,full:null,bg:null,loading:null,tmp:null,content:null,wrapper:null,contentWrapper:null,scripts:new Array(),scriptsShown:new Array()};var resized={width:false,height:false,windowResizing:false};var initSettingsSize={width:null,height:null,windowResizing:true};var windowResizeTimeout;$.fn.nyroModal=function(settings){if(!this)return false;return this.each(function(){var me=$(this);if(this.nodeName.toLowerCase()=='form'){me.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(e.isDefaultPrevented())return false;if(me.data('nyroModalprocessing'))return true;if(this.enctype=='multipart/form-data'){processModal($.extend(settings,{from:this}));return true}e.preventDefault();processModal($.extend(settings,{from:this}));return false})}else{me.unbind('click.nyroModal').bind('click.nyroModal',function(e){if(e.isDefaultPrevented())return false;e.preventDefault();processModal($.extend(settings,{from:this}));return false})}})};$.fn.nyroModalManual=function(settings){if(!this.length)processModal(settings);return this.each(function(){processModal($.extend(settings,{from:this}))})};$.nyroModalManual=function(settings){processModal(settings)};$.nyroModalSettings=function(settings,deep1,deep2){setCurrentSettings(settings,deep1,deep2);if(!deep1&&modal.started){if(modal.bg&&settings.bgColor)currentSettings.updateBgColor(modal,currentSettings,function(){});if(modal.contentWrapper&&settings.title)setTitle();if(!modal.error&&(settings.windowResizing||(!modal.resizing&&(('width'in settings&&settings.width==currentSettings.width)||('height'in settings&&settings.height==currentSettings.height))))){modal.resizing=true;if(modal.contentWrapper)calculateSize(true);if(modal.contentWrapper&&modal.contentWrapper.is(':visible')&&!modal.animContent){if(fixFF)modal.content.css({position:''});currentSettings.resize(modal,currentSettings,function(){currentSettings.windowResizing=false;modal.resizing=false;if(fixFF)modal.content.css({position:'fixed'});if($.isFunction(currentSettings.endResize))currentSettings.endResize(modal,currentSettings)})}}}};$.nyroModalRemove=function(){removeModal()};$.nyroModalNext=function(){var link=getGalleryLink(1);if(link)return link.nyroModalManual(getCurrentSettingsNew());return false};$.nyroModalPrev=function(){var link=getGalleryLink(-1);if(link)return link.nyroModalManual(getCurrentSettingsNew());return false};$.fn.nyroModal.settings={debug:false,blocker:false,windowResize:true,modal:false,type:'',forceType:null,from:'',hash:'',processHandler:null,selIndicator:'nyroModalSel',formIndicator:'nyroModal',content:null,bgColor:'#000000',ajax:{},swf:{wmode:'transparent'},width:null,height:null,minWidth:400,minHeight:300,resizable:true,autoSizable:true,padding:25,regexImg:'[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$',addImageDivTitle:false,defaultImgAlt:'Image',setWidthImgTitle:true,ltr:true,gallery:null,galleryLinks:'<a href="#" class="nyroModalPrev">Prev</a><a href="#"  class="nyroModalNext">Next</a>',galleryCounts:galleryCounts,galleryLoop:false,zIndexStart:100,cssOpt:{bg:{position:'absolute',overflow:'hidden',top:0,left:0,height:'100%',width:'100%'},wrapper:{position:'absolute',top:'50%',left:'50%'},wrapper2:{},content:{},loading:{position:'absolute',top:'50%',left:'50%',marginTop:'-50px',marginLeft:'-50px'}},wrap:{div:'<div class="wrapper"></div>',ajax:'<div class="wrapper"></div>',form:'<div class="wrapper"></div>',formData:'<div class="wrapper"></div>',image:'<div class="wrapperImg"></div>',swf:'<div class="wrapperSwf"></div>',iframe:'<div class="wrapperIframe"></div>',iframeForm:'<div class="wrapperIframe"></div>',manual:'<div class="wrapper"></div>'},closeButton:'<a href="#" class="nyroModalClose" id="closeBut" title="close">Close</a>',title:null,titleFromIframe:true,openSelector:'.nyroModal',closeSelector:'.nyroModalClose',contentLoading:'<a href="#" class="nyroModalClose">Cancel</a>',errorClass:'error',contentError:'The requested content cannot be loaded.<br />Please try again later.<br /><a href="#" class="nyroModalClose">Close</a>',handleError:null,showBackground:showBackground,hideBackground:hideBackground,endFillContent:null,showContent:showContent,endShowContent:null,beforeHideContent:null,hideContent:hideContent,showTransition:showTransition,hideTransition:hideTransition,showLoading:showLoading,hideLoading:hideLoading,resize:resize,endResize:null,updateBgColor:updateBgColor,endRemove:null};function processModal(settings){if(modal.loadingShown||modal.transition||modal.anim)return;debug('processModal');modal.started=true;callingSettings=$.extend(true,settings);setDefaultCurrentSettings(settings);if(!modal.full)modal.blockerVars=modal.blocker=null;modal.error=false;modal.closing=false;modal.dataReady=false;modal.scripts=new Array();modal.scriptsShown=new Array();currentSettings.type=fileType();if(currentSettings.forceType){if(!currentSettings.content)currentSettings.from=true;currentSettings.type=currentSettings.forceType;currentSettings.forceType=null}if($.isFunction(currentSettings.processHandler))currentSettings.processHandler(currentSettings);var from=currentSettings.from;var url=currentSettings.url;initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height;if(currentSettings.type=='swf'){setCurrentSettings({overflow:'visible'},'cssOpt','content');currentSettings.content='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+currentSettings.width+'" height="'+currentSettings.height+'"><param name="movie" value="'+url+'"></param>';var tmp='';$.each(currentSettings.swf,function(name,val){currentSettings.content+='<param name="'+name+'" value="'+val+'"></param>';tmp+=' '+name+'="'+val+'"'});currentSettings.content+='<embed src="'+url+'" type="application/x-shockwave-flash" width="'+currentSettings.width+'" height="'+currentSettings.height+'"'+tmp+'></embed></object>'}if(from){var jFrom=$(from).blur();if(currentSettings.type=='form'){var data=$(from).serializeArray();data.push({name:currentSettings.formIndicator,value:1});if(currentSettings.selector)data.push({name:currentSettings.selIndicator,value:currentSettings.selector.substring(1)});showModal();$.ajax($.extend({},currentSettings.ajax,{url:url,data:data,type:jFrom.attr('method')?jFrom.attr('method'):'get',success:ajaxLoaded,error:loadingError}));debug('Form Ajax Load: '+jFrom.attr('action'))}else if(currentSettings.type=='formData'){initModal();jFrom.attr('target','nyroModalIframe');jFrom.attr('action',url);jFrom.prepend('<input type="hidden" name="'+currentSettings.formIndicator+'" value="1" />');if(currentSettings.selector)jFrom.prepend('<input type="hidden" name="'+currentSettings.selIndicator+'" value="'+currentSettings.selector.substring(1)+'" />');modal.tmp.html('<iframe frameborder="0" hspace="0" name="nyroModalIframe" src="javascript:\'\';"></iframe>');$('iframe',modal.tmp).css({width:currentSettings.width,height:currentSettings.height}).error(loadingError).load(formDataLoaded);debug('Form Data Load: '+jFrom.attr('action'));showModal();showContentOrLoading()}else if(currentSettings.type=='image'){debug('Image Load: '+url);var title=jFrom.attr('title')||currentSettings.defaultImgAlt;initModal();modal.tmp.html('<img id="nyroModalImg" />').find('img').attr('alt',title);modal.tmp.css({lineHeight:0});$('img',modal.tmp).error(loadingError).load(function(){debug('Image Loaded: '+this.src);$(this).unbind('load');var w=modal.tmp.width();var h=modal.tmp.height();modal.tmp.css({lineHeight:''});resized.width=w;resized.height=h;setCurrentSettings({width:w,height:h,imgWidth:w,imgHeight:h});initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({overflow:'visible'},'cssOpt','content');modal.dataReady=true;if(modal.loadingShown||modal.transition)showContentOrLoading()}).attr('src',url);showModal()}else if(currentSettings.type=='iframeForm'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Form Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal()}else if(currentSettings.type=='iframe'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal()}else if(currentSettings.type){debug('Content: '+currentSettings.type);initModal();modal.tmp.html(currentSettings.content);var w=modal.tmp.width();var h=modal.tmp.height();var div=$(currentSettings.type);if(div.length){setCurrentSettings({type:'div'});w=div.width();h=div.height();if(contentElt)contentEltLast=contentElt;contentElt=div;modal.tmp.append(div.contents())}initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({width:w,height:h});if(modal.tmp.html())modal.dataReady=true;else loadingError();if(!modal.ready)showModal();else endHideContent()}else{debug('Ajax Load: '+url);setCurrentSettings({type:'ajax'});var data=currentSettings.ajax.data||{};if(currentSettings.selector){if(typeof data=="string"){data+='&'+currentSettings.selIndicator+'='+currentSettings.selector.substring(1)}else{data[currentSettings.selIndicator]=currentSettings.selector.substring(1)}}showModal();$.ajax($.extend(true,currentSettings.ajax,{url:url,success:ajaxLoaded,error:loadingError,data:data}))}}else if(currentSettings.content){debug('Content: '+currentSettings.type);setCurrentSettings({type:'manual'});initModal();modal.tmp.html($('<div/>').html(currentSettings.content).contents());if(modal.tmp.html())modal.dataReady=true;else loadingError();showModal()}else{}}function setDefaultCurrentSettings(settings){debug('setDefaultCurrentSettings');currentSettings=$.extend(true,{},$.fn.nyroModal.settings,settings);setMargin()}function setCurrentSettings(settings,deep1,deep2){if(modal.started){if(deep1&&deep2){$.extend(true,currentSettings[deep1][deep2],settings)}else if(deep1){$.extend(true,currentSettings[deep1],settings)}else{if(modal.animContent){if('width'in settings){if(!modal.resizing){settings.setWidth=settings.width;shouldResize=true}delete settings['width']}if('height'in settings){if(!modal.resizing){settings.setHeight=settings.height;shouldResize=true}delete settings['height']}}$.extend(true,currentSettings,settings)}}else{if(deep1&&deep2){$.extend(true,$.fn.nyroModal.settings[deep1][deep2],settings)}else if(deep1){$.extend(true,$.fn.nyroModal.settings[deep1],settings)}else{$.extend(true,$.fn.nyroModal.settings,settings)}}}function setMarginScroll(){if(isIE6&&!modal.blocker){if(document.documentElement){currentSettings.marginScrollLeft=document.documentElement.scrollLeft;currentSettings.marginScrollTop=document.documentElement.scrollTop}else{currentSettings.marginScrollLeft=document.body.scrollLeft;currentSettings.marginScrollTop=document.body.scrollTop}}else{currentSettings.marginScrollLeft=0;currentSettings.marginScrollTop=0}}function setMargin(){setMarginScroll();currentSettings.marginLeft=-(currentSettings.width+currentSettings.borderW)/2;currentSettings.marginTop=-(currentSettings.height+currentSettings.borderH)/2;if(!modal.blocker){currentSettings.marginLeft+=currentSettings.marginScrollLeft;currentSettings.marginTop+=currentSettings.marginScrollTop}}function setMarginLoading(){setMarginScroll();var outer=getOuter(modal.loading);currentSettings.marginTopLoading=-(modal.loading.height()+outer.h.border+outer.h.padding)/2;currentSettings.marginLeftLoading=-(modal.loading.width()+outer.w.border+outer.w.padding)/2;if(!modal.blocker){currentSettings.marginLeftLoading+=currentSettings.marginScrollLeft;currentSettings.marginTopLoading+=currentSettings.marginScrollTop}}function setTitle(){var title=$('h1#nyroModalTitle',modal.contentWrapper);if(title.length)title.text(currentSettings.title);else modal.contentWrapper.prepend('<h1 id="nyroModalTitle">'+currentSettings.title+'</h1>')}function initModal(){debug('initModal');if(!modal.full){if(currentSettings.debug)setCurrentSettings({color:'white'},'cssOpt','bg');var full={zIndex:currentSettings.zIndexStart,position:'fixed',top:0,left:0,width:'100%',height:'100%'};var contain=body;var iframeHideIE='';if(currentSettings.blocker){modal.blocker=contain=$(currentSettings.blocker);var pos=modal.blocker.offset();var w=modal.blocker.outerWidth();var h=modal.blocker.outerHeight();if(isIE6){setCurrentSettings({height:'100%',width:'100%',top:0,left:0},'cssOpt','bg')}modal.blockerVars={top:pos.top,left:pos.left,width:w,height:h};var plusTop=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderTopWidth'));var plusLeft=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderLeftWidth'));full={position:'absolute',top:pos.top+plusTop,left:pos.left+plusLeft,width:w,height:h}}else if(isIE6){body.css({marginLeft:0,marginRight:0});var w=body.width();var h=$(window).height()+'px';if($(window).height()>=body.outerHeight()){h=body.outerHeight()+'px'}else w+=20;w+='px';body.css({width:w,height:h,position:'static',overflow:'hidden'});$('html').css({overflow:'hidden'});setCurrentSettings({cssOpt:{bg:{position:'absolute',zIndex:currentSettings.zIndexStart+1,height:'110%',width:'110%',top:currentSettings.marginScrollTop+'px',left:currentSettings.marginScrollLeft+'px'},wrapper:{zIndex:currentSettings.zIndexStart+2},loading:{zIndex:currentSettings.zIndexStart+3}}});iframeHideIE=$('<iframe id="nyroModalIframeHideIe" src="javascript:\'\';"></iframe>').css($.extend({},currentSettings.cssOpt.bg,{opacity:0,zIndex:50,border:'none'}))}contain.append($('<div id="nyroModalFull"><div id="nyroModalBg"></div><div id="nyroModalWrapper"><div id="nyroModalContent"></div></div><div id="nyrModalTmp"></div><div id="nyroModalLoading"></div></div>').hide());modal.full=$('#nyroModalFull').css(full).show();modal.bg=$('#nyroModalBg').css($.extend({backgroundColor:currentSettings.bgColor},currentSettings.cssOpt.bg)).before(iframeHideIE);modal.bg.bind('click.nyroModal',clickBg);modal.loading=$('#nyroModalLoading').css(currentSettings.cssOpt.loading).hide();modal.contentWrapper=$('#nyroModalWrapper').css(currentSettings.cssOpt.wrapper).hide();modal.content=$('#nyroModalContent');modal.tmp=$('#nyrModalTmp').hide();if($.isFunction($.fn.mousewheel)){modal.content.mousewheel(function(e,d){var elt=modal.content.get(0);if((d>0&&elt.scrollTop==0)||(d<0&&elt.scrollHeight-elt.scrollTop==elt.clientHeight)){e.preventDefault();e.stopPropagation()}})}$(document).bind('keydown.nyroModal',keyHandler);modal.content.css({width:'auto',height:'auto'});modal.contentWrapper.css({width:'auto',height:'auto'});if(!currentSettings.blocker&&currentSettings.windowResize){$(window).bind('resize.nyroModal',function(){window.clearTimeout(windowResizeTimeout);windowResizeTimeout=window.setTimeout(windowResizeHandler,200)})}}}function windowResizeHandler(){$.nyroModalSettings(initSettingsSize)}function showModal(){debug('showModal');if(!modal.ready){initModal();modal.anim=true;currentSettings.showBackground(modal,currentSettings,endBackground)}else{modal.anim=true;modal.transition=true;currentSettings.showTransition(modal,currentSettings,function(){endHideContent();modal.anim=false;showContentOrLoading()})}}function clickBg(e){if(!currentSettings.modal)removeModal()}function keyHandler(e){if(e.keyCode==27){if(!currentSettings.modal)removeModal()}else if(currentSettings.gallery&&modal.ready&&modal.dataReady&&!modal.anim&&!modal.transition){if(e.keyCode==39||e.keyCode==40){e.preventDefault();$.nyroModalNext();return false}else if(e.keyCode==37||e.keyCode==38){e.preventDefault();$.nyroModalPrev();return false}}}function fileType(){var from=currentSettings.from;var url;if(from&&from.nodeName){var jFrom=$(from);url=jFrom.attr(from.nodeName.toLowerCase()=='form'?'action':'href');if(!url)url=location.href.substring(window.location.host.length+7);currentSettings.url=url;if(jFrom.attr('rev')=='modal')currentSettings.modal=true;currentSettings.title=jFrom.attr('title');if(from&&from.rel&&from.rel.toLowerCase()!='nofollow'){var indexSpace=from.rel.indexOf(' ');currentSettings.gallery=indexSpace>0?from.rel.substr(0,indexSpace):from.rel}var imgType=imageType(url,from);if(imgType)return imgType;if(isSwf(url))return'swf';var iframe=false;if(from.target&&from.target.toLowerCase()=='_blank'||(from.hostname&&from.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,''))){iframe=true}if(from.nodeName.toLowerCase()=='form'){if(iframe)return'iframeForm';setCurrentSettings(extractUrlSel(url));if(jFrom.attr('enctype')=='multipart/form-data')return'formData';return'form'}if(iframe)return'iframe'}else{url=currentSettings.url;if(!currentSettings.content)currentSettings.from=true;if(!url)return null;if(isSwf(url))return'swf';var reg1=new RegExp("^http://|https://","g");if(url.match(reg1))return'iframe'}var imgType=imageType(url,from);if(imgType)return imgType;var tmp=extractUrlSel(url);setCurrentSettings(tmp);if(!tmp.url)return tmp.selector}function imageType(url,from){var image=new RegExp(currentSettings.regexImg,'i');if(image.test(url)){return'image'}}function isSwf(url){var swf=new RegExp('[^\.]\.(swf)\s*$','i');return swf.test(url)}function extractUrlSel(url){var ret={url:null,selector:null};if(url){var hash=getHash(url);var hashLoc=getHash(window.location.href);var curLoc=window.location.href.substring(0,window.location.href.length-hashLoc.length);var req=url.substring(0,url.length-hash.length);if(req==curLoc||req==$('base').attr('href')){ret.selector=hash}else{ret.url=req;ret.selector=hash}}return ret}function loadingError(){debug('loadingError');modal.error=true;if(!modal.ready)return;if($.isFunction(currentSettings.handleError))currentSettings.handleError(modal,currentSettings);modal.loading.addClass(currentSettings.errorClass).html(currentSettings.contentError);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();modal.loading.css({marginTop:currentSettings.marginTopLoading+'px',marginLeft:currentSettings.marginLeftLoading+'px'})}function fillContent(){debug('fillContent');if(!modal.tmp.html())return;modal.content.html(modal.tmp.contents());modal.tmp.empty();wrapContent();if(currentSettings.type=='iframeForm'){$(currentSettings.from).attr('target','nyroModalIframe').data('nyroModalprocessing',1).submit().attr('target','_blank').removeData('nyroModalprocessing')}if(!currentSettings.modal)modal.wrapper.prepend(currentSettings.closeButton);if($.isFunction(currentSettings.endFillContent))currentSettings.endFillContent(modal,currentSettings);modal.content.append(modal.scripts);$(currentSettings.closeSelector,modal.contentWrapper).unbind('click.nyroModal').bind('click.nyroModal',removeModal);$(currentSettings.openSelector,modal.contentWrapper).nyroModal(getCurrentSettingsNew())}function getCurrentSettingsNew(){return callingSettings;var currentSettingsNew=$.extend(true,{},currentSettings);if(resized.width)currentSettingsNew.width=null;else currentSettingsNew.width=initSettingsSize.width;if(resized.height)currentSettingsNew.height=null;else currentSettingsNew.height=initSettingsSize.height;currentSettingsNew.cssOpt.content.overflow='auto';return currentSettingsNew}function wrapContent(){debug('wrapContent');var wrap=$(currentSettings.wrap[currentSettings.type]);modal.content.append(wrap.children().remove());modal.contentWrapper.wrapInner(wrap);if(currentSettings.gallery){modal.content.append(currentSettings.galleryLinks);gallery.links=$('[rel="'+currentSettings.gallery+'"], [rel^="'+currentSettings.gallery+' "]');gallery.index=gallery.links.index(currentSettings.from);if(currentSettings.galleryCounts&&$.isFunction(currentSettings.galleryCounts))currentSettings.galleryCounts(gallery.index+1,gallery.links.length,modal,currentSettings);var currentSettingsNew=getCurrentSettingsNew();var linkPrev=getGalleryLink(-1);if(linkPrev){var prev=$('.nyroModalPrev',modal.contentWrapper).attr('href',linkPrev.attr('href')).click(function(e){e.preventDefault();$.nyroModalPrev();return false});if(isIE6&&currentSettings.type=='swf'){prev.before($('<iframe id="nyroModalIframeHideIeGalleryPrev" src="javascript:\'\';"></iframe>').css({position:prev.css('position'),top:prev.css('top'),left:prev.css('left'),width:prev.width(),height:prev.height(),opacity:0,border:'none'}))}}else{$('.nyroModalPrev',modal.contentWrapper).remove()}var linkNext=getGalleryLink(1);if(linkNext){var next=$('.nyroModalNext',modal.contentWrapper).attr('href',linkNext.attr('href')).click(function(e){e.preventDefault();$.nyroModalNext();return false});if(isIE6&&currentSettings.type=='swf'){next.before($('<iframe id="nyroModalIframeHideIeGalleryNext" src="javascript:\'\';"></iframe>').css($.extend({},{position:next.css('position'),top:next.css('top'),left:next.css('left'),width:next.width(),height:next.height(),opacity:0,border:'none'})))}}else{$('.nyroModalNext',modal.contentWrapper).remove()}}calculateSize()}function getGalleryLink(dir){if(currentSettings.gallery){if(!currentSettings.ltr)dir*=-1;var index=gallery.index+dir;if(index>=0&&index<gallery.links.length)return gallery.links.eq(index);else if(currentSettings.galleryLoop){if(index<0)return gallery.links.eq(gallery.links.length-1);else return gallery.links.eq(0)}}return false}function calculateSize(resizing){debug('calculateSize');modal.wrapper=modal.contentWrapper.children('div:first');resized.width=false;resized.height=false;if(false&&!currentSettings.windowResizing){initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height}if(currentSettings.autoSizable&&(!currentSettings.width||!currentSettings.height)){modal.contentWrapper.css({opacity:0,width:'auto',height:'auto'}).show();var tmp={width:'auto',height:'auto'};if(currentSettings.width){tmp.width=currentSettings.width}else if(currentSettings.type=='iframe'){tmp.width=currentSettings.minWidth}if(currentSettings.height){tmp.height=currentSettings.height}else if(currentSettings.type=='iframe'){tmp.height=currentSettings.minHeight}modal.content.css(tmp);if(!currentSettings.width){currentSettings.width=modal.content.outerWidth(true);resized.width=true}if(!currentSettings.height){currentSettings.height=modal.content.outerHeight(true);resized.height=true}modal.contentWrapper.css({opacity:1});if(!resizing)modal.contentWrapper.hide()}if(currentSettings.type!='image'&&currentSettings.type!='swf'){currentSettings.width=Math.max(currentSettings.width,currentSettings.minWidth);currentSettings.height=Math.max(currentSettings.height,currentSettings.minHeight)}var outerWrapper=getOuter(modal.contentWrapper);var outerWrapper2=getOuter(modal.wrapper);var outerContent=getOuter(modal.content);var tmp={content:{width:currentSettings.width,height:currentSettings.height},wrapper2:{width:currentSettings.width+outerContent.w.total,height:currentSettings.height+outerContent.h.total},wrapper:{width:currentSettings.width+outerContent.w.total+outerWrapper2.w.total,height:currentSettings.height+outerContent.h.total+outerWrapper2.h.total}};if(currentSettings.resizable){var maxHeight=modal.blockerVars?modal.blockerVars.height:$(window).height()-outerWrapper.h.border-(tmp.wrapper.height-currentSettings.height);var maxWidth=modal.blockerVars?modal.blockerVars.width:$(window).width()-outerWrapper.w.border-(tmp.wrapper.width-currentSettings.width);maxHeight-=currentSettings.padding*2;maxWidth-=currentSettings.padding*2;if(tmp.content.height>maxHeight||tmp.content.width>maxWidth){if(currentSettings.type=='image'||currentSettings.type=='swf'){var useW=currentSettings.imgWidth?currentSettings.imgWidth:currentSettings.width;var useH=currentSettings.imgHeight?currentSettings.imgHeight:currentSettings.height;var diffW=tmp.content.width-useW;var diffH=tmp.content.height-useH;if(diffH<0)diffH=0;if(diffW<0)diffW=0;var calcH=maxHeight-diffH;var calcW=maxWidth-diffW;var ratio=Math.min(calcH/useH,calcW/useW);calcW=Math.floor(useW*ratio);calcH=Math.floor(useH*ratio);tmp.content.height=calcH+diffH;tmp.content.width=calcW+diffW}else{tmp.content.height=Math.min(tmp.content.height,maxHeight);tmp.content.width=Math.min(tmp.content.width,maxWidth)}tmp.wrapper2={width:tmp.content.width+outerContent.w.total,height:tmp.content.height+outerContent.h.total};tmp.wrapper={width:tmp.content.width+outerContent.w.total+outerWrapper2.w.total,height:tmp.content.height+outerContent.h.total+outerWrapper2.h.total}}}if(currentSettings.type=='swf'){$('object, embed',modal.content).attr('width',tmp.content.width).attr('height',tmp.content.height)}else if(currentSettings.type=='image'){$('img',modal.content).css({width:tmp.content.width,height:tmp.content.height})}modal.content.css($.extend({},tmp.content,currentSettings.cssOpt.content));modal.wrapper.css($.extend({},tmp.wrapper2,currentSettings.cssOpt.wrapper2));if(!resizing)modal.contentWrapper.css($.extend({},tmp.wrapper,currentSettings.cssOpt.wrapper));if(currentSettings.type=='image'&&currentSettings.addImageDivTitle){$('img',modal.content).removeAttr('alt');var divTitle=$('div',modal.content);if(currentSettings.title!=currentSettings.defaultImgAlt&&currentSettings.title){if(divTitle.length==0){divTitle=$('<div>'+currentSettings.title+'</div>');modal.content.append(divTitle)}if(currentSettings.setWidthImgTitle){var outerDivTitle=getOuter(divTitle);divTitle.css({width:(tmp.content.width+outerContent.w.padding-outerDivTitle.w.total)+'px'})}}else if(divTitle.length=0){divTitle.remove()}}if(currentSettings.title)setTitle();tmp.wrapper.borderW=outerWrapper.w.border;tmp.wrapper.borderH=outerWrapper.h.border;setCurrentSettings(tmp.wrapper);setMargin()}function removeModal(e){debug('removeModal');if(e)e.preventDefault();if(modal.full&&modal.ready){$(document).unbind('keydown.nyroModal');if(!currentSettings.blocker)$(window).unbind('resize.nyroModal');modal.ready=false;modal.anim=true;modal.closing=true;if(modal.loadingShown||modal.transition){currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;modal.transition=false;currentSettings.hideBackground(modal,currentSettings,endRemove)})}else{if(fixFF)modal.content.css({position:''});modal.wrapper.css({overflow:'hidden'});modal.content.css({overflow:'hidden'});$('iframe',modal.content).hide();if($.isFunction(currentSettings.beforeHideContent)){currentSettings.beforeHideContent(modal,currentSettings,function(){currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove)})})}else{currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove)})}}}if(e)return false}function showContentOrLoading(){debug('showContentOrLoading');if(modal.ready&&!modal.anim){if(modal.dataReady){if(modal.tmp.html()){modal.anim=true;if(modal.transition){fillContent();modal.animContent=true;currentSettings.hideTransition(modal,currentSettings,function(){modal.loading.hide();modal.transition=false;modal.loadingShown=false;endShowContent()})}else{currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;fillContent();setMarginLoading();setMargin();modal.animContent=true;currentSettings.showContent(modal,currentSettings,endShowContent)})}}}else if(!modal.loadingShown&&!modal.transition){modal.anim=true;modal.loadingShown=true;if(modal.error)loadingError();else modal.loading.html(currentSettings.contentLoading);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();currentSettings.showLoading(modal,currentSettings,function(){modal.anim=false;showContentOrLoading()})}}}function ajaxLoaded(data){debug('AjaxLoaded: '+this.url);if(currentSettings.selector){var tmp={};var i=0;data=data.replace(/\r\n/gi,'nyroModalLN').replace(/<script(.|\s)*?\/script>/gi,function(x){tmp[i]=x;return'<pre style="display: none" class=nyroModalScript rel="'+(i++)+'"></pre>'});data=$('<div>'+data+'</div>').find(currentSettings.selector).html().replace(/<pre style="display: none;?" class="?nyroModalScript"? rel="(.?)"><\/pre>/gi,function(x,y,z){return tmp[y]}).replace(/nyroModalLN/gi,"\r\n")}modal.tmp.html(filterScripts(data));if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading()}else loadingError()}function formDataLoaded(){debug('formDataLoaded');var jFrom=$(currentSettings.from);jFrom.attr('action',jFrom.attr('action')+currentSettings.selector);jFrom.attr('target','');$('input[name='+currentSettings.formIndicator+']',currentSettings.from).remove();var iframe=modal.tmp.children('iframe');var iframeContent=iframe.unbind('load').contents().find(currentSettings.selector||'body').not('script[src]');iframe.attr('src','about:blank');modal.tmp.html(iframeContent.html());if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading()}else loadingError()}function iframeLoaded(){if((window.location.hostname&&currentSettings.url.indexOf(window.location.hostname)>-1)||currentSettings.url.indexOf('http://')){var iframe=$('iframe',modal.full).contents();var tmp={};if(currentSettings.titleFromIframe){tmp.title=iframe.find('title').text();if(!tmp.title){try{tmp.title=iframe.find('title').html()}catch(err){}}}var body=iframe.find('body');if(!currentSettings.height&&body.height())tmp.height=body.height();if(!currentSettings.width&&body.width())tmp.width=body.width();$.extend(initSettingsSize,tmp);$.nyroModalSettings(tmp)}}function galleryCounts(nb,total,elts,settings){if(total>1)settings.title+=(settings.title?' - ':'')+nb+'/'+total}function endHideContent(){debug('endHideContent');modal.anim=false;if(contentEltLast){contentEltLast.append(modal.content.contents());contentEltLast=null}else if(contentElt){contentElt.append(modal.content.contents());contentElt=null}modal.content.empty();gallery={};modal.contentWrapper.hide().children().remove().empty().attr('style','').hide();if(modal.closing||modal.transition)modal.contentWrapper.hide();modal.contentWrapper.css(currentSettings.cssOpt.wrapper).append(modal.content);showContentOrLoading()}function endRemove(){debug('endRemove');$(document).unbind('keydown',keyHandler);modal.anim=false;modal.full.remove();modal.full=null;if(isIE6){body.css({height:'',width:'',position:'',overflow:'',marginLeft:'',marginRight:''});$('html').css({overflow:''})}if($.isFunction(currentSettings.endRemove))currentSettings.endRemove(modal,currentSettings)}function endBackground(){debug('endBackground');modal.ready=true;modal.anim=false;showContentOrLoading()}function endShowContent(){debug('endShowContent');modal.anim=false;modal.animContent=false;modal.contentWrapper.css({opacity:''});fixFF=/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)&&parseFloat(browserVersion)<1.9&&currentSettings.type!='image';if(fixFF)modal.content.css({position:'fixed'});modal.content.append(modal.scriptsShown);if(currentSettings.type=='iframe')modal.content.find('iframe').attr('src',currentSettings.url);if($.isFunction(currentSettings.endShowContent))currentSettings.endShowContent(modal,currentSettings);if(shouldResize){shouldResize=false;$.nyroModalSettings({width:currentSettings.setWidth,height:currentSettings.setHeight});delete currentSettings['setWidth'];delete currentSettings['setHeight']}if(resized.width)setCurrentSettings({width:null});if(resized.height)setCurrentSettings({height:null})}function getHash(url){if(typeof url=='string'){var hashPos=url.indexOf('#');if(hashPos>-1)return url.substring(hashPos)}return''}function filterScripts(data){if(typeof data=='string')data=data.replace(/<\/?(html|head|body)([^>]*)>/gi,'');var tmp=new Array();$.each($.clean({0:data},this.ownerDocument),function(){if($.nodeName(this,"script")){if(!this.src||$(this).attr('rel')=='forceLoad'){if($(this).attr('rev')=='shown')modal.scriptsShown.push(this);else modal.scripts.push(this)}}else tmp.push(this)});return tmp}function getOuter(elm){elm=elm.get(0);var ret={h:{margin:getCurCSS(elm,'marginTop')+getCurCSS(elm,'marginBottom'),border:getCurCSS(elm,'borderTopWidth')+getCurCSS(elm,'borderBottomWidth'),padding:getCurCSS(elm,'paddingTop')+getCurCSS(elm,'paddingBottom')},w:{margin:getCurCSS(elm,'marginLeft')+getCurCSS(elm,'marginRight'),border:getCurCSS(elm,'borderLeftWidth')+getCurCSS(elm,'borderRightWidth'),padding:getCurCSS(elm,'paddingLeft')+getCurCSS(elm,'paddingRight')}};ret.h.outer=ret.h.margin+ret.h.border;ret.w.outer=ret.w.margin+ret.w.border;ret.h.inner=ret.h.padding+ret.h.border;ret.w.inner=ret.w.padding+ret.w.border;ret.h.total=ret.h.outer+ret.h.padding;ret.w.total=ret.w.outer+ret.w.padding;return ret}function getCurCSS(elm,name){var ret=parseInt($.curCSS(elm,name,true));if(isNaN(ret))ret=0;return ret}function debug(msg){if($.fn.nyroModal.settings.debug||currentSettings&&currentSettings.debug)nyroModalDebug(msg,modal,currentSettings||{})}function showBackground(elts,settings,callback){elts.bg.css({opacity:0}).fadeTo(500,0.75,callback)}function hideBackground(elts,settings,callback){elts.bg.fadeOut(300,callback)}function showLoading(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px',opacity:0}).show().animate({opacity:1},{complete:callback,duration:400})}function hideLoading(elts,settings,callback){callback()}function showContent(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px'}).show().animate({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'},{duration:350,complete:function(){elts.contentWrapper.css({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'}).show();elts.loading.fadeOut(200,callback)}})}function hideContent(elts,settings,callback){elts.contentWrapper.animate({height:'50px',width:'50px',marginTop:(-(25+settings.borderH)/2+settings.marginScrollTop)+'px',marginLeft:(-(25+settings.borderW)/2+settings.marginScrollLeft)+'px'},{duration:350,complete:function(){elts.contentWrapper.hide();callback()}})}function showTransition(elts,settings,callback){elts.loading.css({marginTop:elts.contentWrapper.css('marginTop'),marginLeft:elts.contentWrapper.css('marginLeft'),height:elts.contentWrapper.css('height'),width:elts.contentWrapper.css('width'),opacity:0}).show().fadeTo(400,1,function(){elts.contentWrapper.hide();callback()})}function hideTransition(elts,settings,callback){elts.contentWrapper.hide().css({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px',opacity:1});elts.loading.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:function(){elts.contentWrapper.show();elts.loading.fadeOut(400,function(){elts.loading.hide();callback()})},duration:350})}function resize(elts,settings,callback){elts.contentWrapper.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:callback,duration:400})}function updateBgColor(elts,settings,callback){if(!$.fx.step.backgroundColor){elts.bg.css({backgroundColor:settings.bgColor});callback()}else elts.bg.animate({backgroundColor:settings.bgColor},{complete:callback,duration:400})}$($.fn.nyroModal.settings.openSelector).nyroModal()});var tmpDebug='';function nyroModalDebug(msg,elts,settings){if(elts.full&&elts.bg){elts.bg.prepend(msg+'<br />'+tmpDebug);tmpDebug=''}else tmpDebug+=msg+'<br />'}/* bundling js/ufmodal.js */
jQuery(document).ready(function() {
    jQuery("a.ufmodalobject,span.ufmodalobject").each(function() {
	var oid=$(this).attr('data-object_id');
	if (oid) {
	    $(this).attr('href','ajax.php?action=object_tabpreview_more&format=text&object_id='+oid);
	}
    });
    jQuery("a.ufmodal,span.ufmodal").live('click',function(e) {
	var h=$(this).attr('data-ufmodal-href');
	var old=$(this).attr('href');
	if (h) {
	    $(this).attr('href',h);
	}
	$(this).nyroModalManual({
	    showBackground:function(elts, settings, callback) {
			    // was 500.
			    elts.bg.css({opacity:0}).fadeTo(50, 0.75, callback);
		    },	
	    hideBackground:function(elts, settings, callback) {
			    // was 300
			    elts.bg.fadeOut(30, callback);
		    },
	    showLoading:function(elts, settings, callback) {
			    elts.loading
				    .css({
					    marginTop: settings.marginTopLoading+'px',
					    marginLeft: settings.marginLeftLoading+'px',
					    opacity: 0
				    })
				    .show()
				    .animate({
					    opacity: 1
				    }, {complete: callback, duration: 10}); // was 400
		    },
	    bgColor: '#222222',
	    padding: 10
	});
	$(this).attr('href',old);
	return false;
    });
});
var ufmodal_open=function(ele) {
    $(ele).nyroModalManual({
	showBackground:function(elts, settings, callback) {
			// was 500.
	                elts.bg.css({opacity:0}).fadeTo(50, 0.75, callback);
		},	
	hideBackground:function(elts, settings, callback) {
			// was 300
			elts.bg.fadeOut(30, callback);
		},
	showLoading:function(elts, settings, callback) {
			elts.loading
				.css({
					marginTop: settings.marginTopLoading+'px',
					marginLeft: settings.marginLeftLoading+'px',
					opacity: 0
				})
				.show()
				.animate({
					opacity: 1
				}, {complete: callback, duration: 10}); // was 400
		},
	bgColor: '#222222',
	padding: 10
    });
};

var ufmodal_close=function() {
    $.nyroModalRemove();
};
/* bundling site/modules/rk/rk.js */
jQuery(document).ready(function() {
    $(".lightbox-add").click(function() {
	var oid=$(this).attr('data-object_id');
	var coo=$(this).attr('data-cookie');
	var c=cookie_get(coo);
	var re=new RegExp(","+oid+",", "g");
	c=c.replace(re,',');
	c+=','+oid+',';
	c=c.replace(/,,/g,',');
	cookie_set(coo,c);
	if(uf_growl_info) uf_growl_info('In Leuchtpult abgelegt');
    });
    $(".lightbox-del").click(function() {
	var oid=$(this).attr('data-object_id');
	var coo=$(this).attr('data-cookie');
	var c=cookie_get(coo);
	var re=new RegExp(","+oid+",", "g");
	c=c.replace(re,',');
	c=c.replace(/,,/g,',');
	cookie_set(coo,c);
	if(uf_growl_info) uf_growl_info('Aus Leuchtpult entfernt');
    });
});

/* bundling js/versioned/jquery.okNotify-first.js */
/*
 * jquery.okNotify.js
 *
 * Copyright (c) 2009 Asher Van Brunt | http://www.okbreathe.com
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 * Date: 08/13/2009
 *
 * @projectDescription Create a Growl-like notifications simply
 * @author Asher Van Brunt
 * @mailto asher@okbreathe.com
 * @version 1.0
 *
 * @id jQuery.noticeAdd
 * @param {Object} Hash of settings, none are required.
 * @return {jQuery} Returns the notice.
 * @id jQuery.noticeRemove
 * @param {Object or Selector} 
 * @return {jQuery} Nothing
 *
 */

(function($) {
  function addContainer(opts){
    var $container = $("."+opts.containerClass+"."+opts.position),
    styles = {
      'top-left'     : { left: 0, top:0    },
      'top-right'    : { right:0, top:0    },
      'bottom-right' : { right:0, bottom:0 },
      'bottom-left'  : { left: 0, bottom:0 },
      'center'       : { top: 0,  width: "50%", left: "25%"},
      'top-center'   : { top: 0,  width: "50%", left: "25%"}
    };
    if ($container.length === 0 ) {
      $container = $('<div></div>')
        .addClass(opts.containerClass)
        .addClass(opts.position)
        .css($.extend({position:opts.fixed ? 'fixed' : 'absolute',padding:'10px',zIndex:9999},styles[opts.position]))
        .appendTo('body');
    }

    if (opts.position == 'center') {
      $container.center(true);
    }

    return $container;
  }

  function uniqueId() {
    return "notice_" + parseInt(new Date().getTime()+Math.random(), 10);
  }

  // Center the element within the screen
  $.fn.center = function (absolute) {
    return this.each(function () {
      var self = $(this);
      self.css({
        position:	absolute ? 'absolute' : 'fixed', 
        left:		'50%', 
        top:		'50%', 
        zIndex:	'99'
      }).css({
        marginLeft:	'-' + (self.outerWidth() / 2) + 'px', 
        marginTop:	'-' + (self.outerHeight() / 2) + 'px'
      });

      if (absolute) {
        self.css({
          marginTop:	parseInt(self.css('marginTop'), 10) + $(window).scrollTop(), 
          marginLeft:	parseInt(self.css('marginLeft'), 10) + $(window).scrollLeft()
        });
      }
    });
  };

  $.extend({      
      noticeAdd: function(opts) {  
        opts = typeof(opts) == "string" ? {text:opts} : opts;
        opts = $.extend(true, {
          inEffect:         {            // passed to $.fn.animate(), any parameters that it accepts are valid         
            opacity: 'show'           
          },
          inEffectDuration: 600,         // in effect duration in miliseconds
          duration:         3000,        // time before the item disappears
          text:             '',          // content of the notification
          title:            '',          // title of the notification
          stay:             false,       // should the notice item stay or not? (if false it will fade after duration milliseconds)
          type:             'notice',    // could also be error, success etc.
          position:         'top-right', // top-center, top-left, top-right, bottom-left, bottom-right, center
          containerClass :  'ui-notification-container', // class that wraps the container
          template:         'standard',  // Extend the $.noticeAdd.templates object to add additional templates
          fixed:            false        // Whether to use absolute or fixed positioning. (Note: IE6 doesn't support position fixed)  
        }, opts);

        var $container,
            $notice  = $($.noticeAdd.templates[opts.template]),
            text     = $.trim(opts.text);

        $notice.attr('id', uniqueId());

        $.noticeAdd.notices = $.noticeAdd.notices.add($notice);

        $container = addContainer(opts);

        // Append the title 
        $('.ui-notification-title', $notice).append(opts.title);
        // Append the text, wrap it in a <p> if it doesn't look like markup
        $('.ui-notification-content', $notice).append(text[0] == "<" ? text : '<p>'+text+'</p>');

        // Append the notice
        $notice
          .hide()
          .addClass(opts.type)
          .appendTo($container)
          .animate(opts.inEffect, opts.inEffectDuration);

        $('.ui-notification-close', $notice).click(function(e) { 
            e.preventDefault();
            $.noticeRemove($notice);
         });

        if (!opts.stay) {
          setTimeout(function() {
              $.noticeRemove($notice);
            },
            opts.duration);
        }
        return $notice;
      },

      noticeRemove: function(obj) {
        if (obj) {
          obj = typeof(obj) == "string" ? $(obj) : obj;
          obj.animate({ opacity: '0' }, 600, function() {
            obj.animate({ height: '0px' }, 300, function() {
              $.noticeAdd.notices.splice($.noticeAdd.notices.index(obj),1); 
              obj.parent().children().length <= 0 ? obj.parent().remove() : obj.remove();
            });
          });
        } else {
          $.noticeAdd.notices.fadeOut(function(){ 
            $(this).parent().remove();
            $.noticeAdd.notices = $([]);
          });
        }
      }
    }); // $.extend

    // Extend the templates to add more
    $.noticeAdd.templates = {
      standard: "<div class='ui-notification'><div class='ow'><div class='iw'><div class='ui-notification-titlebar'><span class='ui-notification-title'></span><a class='ui-notification-close' href='#'>x</a></div> <div class='ui-notification-content'> </div></div></div></div>"
    };

    // List of active notices
    // Start by storing an empty jQuery object
    $.noticeAdd.notices = $([]);

})(jQuery);
/* bundling js/versioned/jquery.bigPicture-1.0b1-uwe2.js */
/**
 * BIG PICTURE
 * Unobtrusive jQuery plugin to display images in a modal window including full
 * description.
 * 
 * @version 1.0b1
 * @author Jorge Tite
 * @copyright &copy; 2009 Jorge Tite
 * 
 * 
 * TERMS OF USE
 * This work is licensed under a Creative Commons Attribution-Share Alike 3.0 
 * United States License. 
 * http://creativecommons.org/licenses/by-sa/3.0/us/
 * 
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this 
 * list of conditions and the following disclaimer.
 * 
 * Redistributions in binary form must reproduce the above copyright notice, 
 * this list of conditions and the following disclaimer in the documentation 
 * and/or other materials provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to 
 * endorse or promote products derived from this software without specific prior 
 * written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE. 
 * 
 */


(function($) {
	// define plugin namespace
	$.jquery = $.jquery || {};
	$.jquery.ux = $.jquery.ux || {};
	$.jquery.ux.ui = $.jquery.ux.ui || {};
	
	
	$.jquery.ux.ui.BPHelper = function() {
		return {
			AUTO_ID: 1001,
			
			galleries: {},
			
			isBoxRendered: function() {
				return $('#bp').size() > 0 ? true: false;
			},
			
			isBoxVisible: function() {
				return $('#bp > .bp-wrap').is(':visible');
			},
			
			renderBox: function() {
				if ( $.jquery.ux.ui.BPHelper.isBoxRendered() ) {
					return;
				}
				
				// create main elements
				var sbox = document.createElement('div');	// container
				var mask = document.createElement('div');	// overlay mask
				var wrap = document.createElement('div');	// box wrapper
				var main = document.createElement('div');	// main box
				var view = document.createElement('div');	// view port
				var bbar = document.createElement('div');	// bottom bar
				
				// render bottom bar
				$(bbar).addClass('bp-bbar')
				.append('<div class="bp-hide-link"><a href="#"><span>Close</span></a></div>')
				.append('<div class="bp-slideshow-link"><a href="#"><span>Slideshow</span></a></div>')
				.append('<div class="bp-info-link"><a href="#"><span>Image info</span></a></div>')
				.append('<div class="bp-title"></div>')
				.append('<div class="bp-clear"></div>');
				
				// render view port
				$(view).addClass('bp-view')
				.css({'margin': 0})
				.append('<div class="bp-nav bp-prev-link"><a href="#"><span>Prev</span></a></div>')
				.append('<div class="bp-nav bp-next-link"><a href="#"><span>Next</span></a></div>')
				.append('<div class="bp-info-wrap"><div class="bp-info"></div></div>');
				
				// render main box
				$(main).addClass('bp-main')
				.css({'margin-left': 'auto', 'margin-right': 'auto'})			// center box horizontally
				.append(view)
				.append(bbar);
				
				// render box wrapper
				$(wrap).addClass('bp-wrap')
				.append(main);
				
				// render mask
				$(mask).addClass('bp-mask');
				
				// render container
				$(sbox).attr('id', 'bp')
				.append(mask)
				.append(wrap)
				.appendTo('body');
				
				/* 
				 * apply global events
				 */
				
				// window resize event
				$(window).resize(function(e) {
					if ( $.jquery.ux.ui.BPHelper.isBoxVisible() ) {
						$.jquery.ux.ui.BPHelper.onWindowResize();
					}
				});
				
				// click event for wrapper (hide main box)
				$(mask).click(function(e) {
					$.jquery.ux.ui.BPHelper.hideBox();
				});
				
				// click event for wrapper (hide main box)
				$(wrap).click(function(e) {
					$.jquery.ux.ui.BPHelper.hideBox();
				});
				
				// click event for main box (prevent close)
				$(main).click(function(e) {
					e.preventDefault();
					return false;
				});
				
				// click event for hide link
				$('.bp-hide-link', bbar).click(function(e) {
					e.preventDefault();
					$.jquery.ux.ui.BPHelper.hideBox();
				});
			},
			
			showBox: function() {
				// position main box
				$.jquery.ux.ui.BPHelper.onWindowResize();
				
				// show box elements
				$('#bp .bp-mask').show();
				$('#bp .bp-wrap').show();
			},
			
			hideBox: function() {
				$.jquery.ux.ui.BPHelper.resetBox();
				
				// hide box elements
				$('#bp .bp-wrap').fadeOut('fast', function() {
					$('#bp .bp-mask').hide();
				});
			},
			
			resetBox: function() {
				$('#bp .bp-bbar').stop().hide();
				$('#bp .bp-info-wrap').stop().hide().css({'marginTop': 0});
				$('#bp .bp-info-link > a').removeClass('active');
				$('#bp .bp-view > img').remove();
			},
			
			onWindowResize: function() {
				var ds = $.jquery.ux.ui.BPHelper.getDimensions();
				var ps = $.jquery.ux.ui.BPHelper.getPageScroll();
				
				$('#bp .bp-mask').width(ds.pageWidth).height(ds.pageHeight);
				    var mainheight=$('#bp .bp-main').outerHeight();
				    ny=(ds.windowHeight-mainheight)/2
				    if (ny<0) ny=0;
				    if (ny>ds.windowHeight*0.08)
					ny=ds.windowHeight*0.08;

				$('#bp .bp-wrap').css({
					'left': 0, 
					'top': ny
				});
			},
			
			getDimensions: function() {
				var dims = {};
				var dbw, dbh;
				
				if (window.innerHeight && window.scrollMaxY) {	
					dbw = window.innerWidth + window.scrollMaxX;
					dbh = window.innerHeight + window.scrollMaxY;
				} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
					dbw = document.body.scrollWidth;
					dbh = document.body.scrollHeight;
				} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
					dbw = document.body.offsetWidth;
					dbh = document.body.offsetHeight;
				}
				
				if (self.innerHeight) {	// all except Explorer
					if(document.documentElement.clientWidth){
						dims.windowWidth = document.documentElement.clientWidth; 
					} else {
						dims.windowWidth = self.innerWidth;
					}
					dims.windowHeight = self.innerHeight;
				} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
					dims.windowWidth = document.documentElement.clientWidth;
					dims.windowHeight = document.documentElement.clientHeight;
				} else if (document.body) { // other Explorers
					dims.windowWidth = document.body.clientWidth;
					dims.windowHeight = document.body.clientHeight;
				}
				
				dims.pageHeight = Math.max(dbh, dims.windowHeight);
				dims.pageWidth = Math.max(dbw, dims.windowWidth);
				
				return dims;
			},
				
			getPageScroll: function() {
				var scroll = {};
				
				if (self.pageYOffset) {
					scroll.y = self.pageYOffset;
					scroll.x = self.pageXOffset;
				} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
					scroll.y = document.documentElement.scrollTop;
					scroll.x = document.documentElement.scrollLeft;
				} else if (document.body) {// all other Explorers
					scroll.y = document.body.scrollTop;
					scroll.x = document.body.scrollLeft;	
				}
				
				return scroll;
			}
		};
	}();
	
	$.jquery.ux.ui.BigPicture = function(el, conf) {
		// instance properties
		this.images = [];		// images array
		this.index = 0;			// current image index
		this.gallery = '';		// gallery name
		this.offset = false;	// border and padding offset
		this.loading = false;           // flag whether we are loading an image
		this.last_load = 0;             // time when the last image load finished
		this.slideshow_interval_handle = false;  // false or result of setInterval.
		this.slideshow_keep=0;      // time to keep an image.
		
		// apply default options
		conf = $.extend({
			'cls': '',						// An optional class applied to the main container
			'prevLabel': 'Prev',			// Prev link label
			'nextLabel': 'Next',			// Next link label
			'infoLabel': 'Image info',		// Info link label
			'hideLabel': 'Close',			// Hide link label
			'slideshowLabel': 'Slideshow',		// Slideshow link label
			'slideshowKeep': 3,		        // How long to keep a slideshow.
			'boxEaseFn': '',				// Box resize ease function (i.e easeInOutExpo)
			'boxEaseSpeed': 750,			// Box resize effect speed
			'enableInfo': false,			// Enable image info link (show/hide)
			'enableSlideshow': false,		// Enable slideshow link
			'showTitle': false,			// Show title in details line.
			'infoPosition': 'bottom',		// Info box position (top|bottom)
			'infoEaseFn': '',				// Ease function for show/hide image info container (i.e easeInOutExpo)
			'infoEaseSpeed': 500,			// Info box effect speed
			'positionString': 'Image %n of %t'
		}, conf);
		this.slideshow_keep=conf.slideshowKeep;
		
		// automatically assign an ID if the element has no ID
		if ( !$(el).attr('id') ) {
			$(el).attr('id', 'bigPicture-' + $.jquery.ux.ui.BPHelper.AUTO_ID++);
		}
		
		// init gallery cache (only if not exists)
		this.gallery = $(el).attr('rel');
		if ( this.gallery && !$.jquery.ux.ui.BPHelper.galleries[this.gallery] ) {
			$.jquery.ux.ui.BPHelper.galleries[this.gallery] = $("a[rel='" + this.gallery + "']").get();
		}
		
		
		this.launchBox = function() {
			// images array lazy initialization 
			if ( this.images.length == 0 ) {
				if ( this.gallery ) {
					this.images = $.jquery.ux.ui.BPHelper.galleries[this.gallery];
				}
				else {
					this.images.push(el);
				}
			}
			
			// sets current image index
			this.index = 0;
			for (var i = 0; i < this.images.length; i++) {
				if ( this.images[i].id == el.id ) {
					this.index = i;
					break;
				}
			}
			
			// load and display image
			this.show();
		};
		
		this.show = function() {
			// render box if needed
			$.jquery.ux.ui.BPHelper.renderBox();
			
			// set extra class
			$('#bp').removeClass().addClass(conf.cls);
			
			// set box instance labels
			$('#bp .bp-prev-link > a > span').html(conf.prevLabel);
			$('#bp .bp-next-link > a > span').html(conf.nextLabel);
			$('#bp .bp-info-link > a > span').html(conf.infoLabel);
			$('#bp .bp-hide-link > a > span').html(conf.hideLabel);
			$('#bp .bp-slideshow-link > a > span').html(conf.slideshowLabel);
			
			/*
			 * set box instance events
			 */
			var sbox = this;
			
			// viewport event (show navigation links on mouse enter)
			$('#bp .bp-view').unbind('mouseenter.bp')
			.unbind('mouseleave.bp')
			.bind('mouseenter.bp', function() {
				sbox.toggleNavigation(true);
			})
			.bind('mouseleave.bp', function() {
				sbox.toggleNavigation(false);
			});
			
			// navigation links event (show next/prev image)
			$('#bp .bp-prev-link > a').unbind('click.bp')
			.bind('click.bp', function(e) {
				e.preventDefault();
				sbox.back();
			});
			
			$('#bp .bp-next-link > a').unbind('click.bp')
			.bind('click.bp', function(e) {
				e.preventDefault();
				sbox.next();
			});
			
			// image info link event (show/hide image details)
			if ( conf.enableInfo ) {
				$('#bp .bp-info-link').show();
				
				$('#bp .bp-info-link > a').unbind('click.bp')
				.bind('click.bp', function(e) {
					e.preventDefault();
					sbox.toggleInfo(this);
				});
			}
			else {
				$('#bp .bp-info-link').hide();
			}
			if ( conf.enableSlideshow ) {
				var slideshow_interval_handler = function() {
				    if ($("#bp .bp-wrap").is(":hidden")) {
					// thing is hidden, turn off.
					// race if bigpicture is closed and reopened fast.
					window.clearInterval(sbox.slideshow_interval_handle);
					sbox.slideshow_interval_handle=false;
					return;
				    }
				    var ll=sbox.last_load;
				    var now=new Date;
				    now=now.getTime();
				    var keep=$("#bp").bigPicture()[0].bigPicture.slideshow_keep;
				    if (now < ll + keep*1000) 
					return;
				    sbox.next();
				};

				$('#bp .bp-slideshow-link').show();
				
				$('#bp .bp-slideshow-link > a').unbind('click.bp')
				.bind('click.bp', function(e) {
					e.preventDefault();
					if (!sbox.slideshow_interval_handle) {
					    sbox.slideshow_interval_handle=window.setInterval(slideshow_interval_handler,1000);
					} else {
					    window.clearInterval(sbox.slideshow_interval_handle);
					    sbox.slideshow_interval_handle=false;
					}
				});
			}
			else {
				$('#bp .bp-slideshow-link').hide();
			}
			
			// reset box dimensions
			$('#bp .bp-main').width(64).height(64);
			
			// show box and load current image
			if ( !$.jquery.ux.ui.BPHelper.isBoxVisible() ) {
				$.jquery.ux.ui.BPHelper.showBox();
			}
			this.load();
		};
		this.keyDown = function(e) {
		    var kc=e.keyCode;
		    // console.log("keydown "+kc);
		    if (kc==27 || kc==88 || kc==81) { // escape, x, q.
			$("#bp").bigPicture()[0].bigPicture.hide();
		    } else if (kc==37 || kc==80) { // Left arrow (37), 'p' (80)
			$('#bp .bp-prev-link > a').click();
		    } else if (kc==39 || kc==78) { // Right arrow (39), 'n' (78)
			$('#bp .bp-next-link > a').click();
		    } else if (kc==83) { // 's' - slideshow
			if ( conf.enableSlideshow ) 
			    $('#bp .bp-slideshow-link > a').click();
		    } else if (kc==61) { // '+'
			var n=$("#bp").bigPicture()[0].bigPicture.slideshow_keep;
			$("#bp").bigPicture()[0].bigPicture.slideshow_keep=n+1;
		    } else if (kc==109) { // '-'
			var n=$("#bp").bigPicture()[0].bigPicture.slideshow_keep;
			if (n>=2)
			    $("#bp").bigPicture()[0].bigPicture.slideshow_keep=n-1;
		    } else if (kc>=48 && kc<=57) { // 0..9
			var n=(kc-48)*2;
			if (n==0) n=20;
			$("#bp").bigPicture()[0].bigPicture.slideshow_keep=n;
		    }
		};
		
		this.hide = function() {
			var point_of_interest=0;
			$(document).unbind('keydown.bp');
			if (this.slideshow_interval_handle) {
			    window.clearInterval(this.slideshow_interval_handle);
			}
			this.slideshow_interval_handle=false;
			$.jquery.ux.ui.BPHelper.hideBox();
		};
		
		this.reset = function() {
			$(document).bind('keydown.bp',this.keyDown);
			$.jquery.ux.ui.BPHelper.resetBox();
		};
		
		this.load = function() {
			if (this.loading) 
			    return;
			this.loading=true;

			// stop box animations and hide elements
			this.reset();
			
			// show loading image
			$('#bp .bp-main').addClass('loading');
			
			// calculate border and padding offset
			this.calculateOffset();
			
			// load current image
			var box = this;
			var img = new Image();
			
			$(img).load(function() {
				$('#bp .bp-main').animate({'width': img.width + box.offset.x, 'height': img.height + box.offset.y}, conf.boxEaseSpeed, conf.boxEaseFn, function() {
					box.onLoad(img);
					var d=new Date;
					box.last_load=d.getTime();
					box.loading=false;
				});
			})
			.error(function() {
				box.hide();
				var d=new Date;
				box.last_load=d.getTime();
				box.loading=false;
				alert('There was an error loading the image');
			})
			.attr('src', $(this.images[this.index]).attr('href'));
		};
		
		this.onLoad = function(img) {
			// builds image details
			if (conf.showTitle) {
			    title = $(this.images[this.index]).attr('title');
			    if (title) {
				$('#bp .bp-title').html("<span class='bp-info-link-title'>"+title+"</span>");
			    }  else {
				$('#bp .bp-title').html("");
			    }
			}
			if ( conf.enableInfo ) {
				var title = $(this.images[this.index]).attr('title');
				var divId = $(this.images[this.index]).attr('name');
				var count = this.images.length;
				var $wrap = $('#bp .bp-info-wrap');
				var txt = '';
				
				if ( count > 1 ) {
					txt = conf.positionString
					txt = txt.replace("%n",this.index+1);
					txt = txt.replace("%t",count);
					//txt += '<div class="bp-count">Image ' + (this.index + 1) + ' of ' + count + '</div>'; 
					txt = '<div class="bp-count">' + txt+ '</div>'; 
				}
				txt += title ? '<h2>' + title + '</h2>': '';
			
				if (divId) {
				    $('#bp .bp-info').html( txt )
				    .append( $('#' + divId).contents().clone(true) );
				} else {
				    $('#bp .bp-info').html( txt );
				}
				
				/*
				 * FIX: temp fix for enabling link defualt click action
				 * TODO: find the cause of the bug
				 */
				$('#bp .bp-info a').click(function(e) {
					var href = $(this).attr('href');
					if ( href && href.charAt(0) != '#') {
						document.location = href;
					}
				});
				
				var y = conf.infoPosition == 'top' ? (-1 * $wrap.outerHeight()): img.height;
				$wrap.css({'top':  y});
			}
			
			// display image
			$('#bp .bp-main').removeClass('loading');
			$('#bp .bp-info-wrap').before(img);
			
			// set viewport dimensions
			$('#bp .bp-view').width(img.width)
			.height(img.height)
			.fadeIn('normal');
			
			// set navigation links dimensions
			$('#bp .bp-nav > a').width( Math.floor(img.width / 2) )
			.height(img.height);
			
			// show bottom bar
			var bh = img.height + this.offset.y + $('#bp .bp-bbar').outerHeight();
			$('#bp .bp-bbar').show();
			$('#bp .bp-main').animate({'height': bh}, 350);
			$.jquery.ux.ui.BPHelper.onWindowResize();
			
			$(img).click().focus();
		};
		
		this.toggleInfo = function(link) {
			if ( !conf.enableInfo ) {
				return;
			}
			
			var h = $('#bp .bp-info-wrap').outerHeight();
			var b = conf.infoPosition == 'top' ? 0: $('#bp .bp-view > img').height();
			var hide = false;
			
			if ( $(link).hasClass('active') ) {
				$(link).removeClass('active');
				h = conf.infoPosition == 'top' ? h: 0;
				hide = true;
			}
			else {
				$(link).addClass('active');
				h = conf.infoPosition == 'top' ? 0: h;
			}
			$('#bp .bp-info-wrap').show()
			.animate({'top': b - h}, conf.infoEaseSpeed, conf.infoEaseFn, function() {
				if ( hide ) {
					$('#bp .bp-info-wrap').hide();
				}	
			});
		};
		
		this.toggleNavigation = function(show) {
			if (show == true && this.images.length > 1) {
				$('#bp .bp-nav').fadeIn(250);
			}
			else {
				$('#bp .bp-nav').hide();
			}
			return false;
		};
		
		this.back = function() {
			if (this.loading)
			    return;
			this.index--;
			if ( this.index < 0 ) {
				this.index = this.images.length - 1;
			}
			this.load();
		};
		
		this.next = function() {
			if (this.loading)
			    return;
			this.index++;
			if ( this.index == this.images.length ) {
				this.index = 0;
			}
			this.load();
		};
				
		this.calculateOffset = function() {
			if (this.offset) {
				return;
			}
			
			var $view = $('#bp .bp-view');
			
			this.offset = {x: 0, y: 0};
			this.offset.x = $view.outerWidth() -  $view.width();
			this.offset.y = $view.outerHeight() -  $view.height();
		};
	};
	
	$.fn.bigPicture = function(p) {
		return this.each( function() {
			if ( this.bigPicture instanceof $.jquery.ux.ui.BigPicture) {
				return this;
			}
			
			var box = new $.jquery.ux.ui.BigPicture(this, p);
			$(this).click(function(e) {
				e.preventDefault();
				box.launchBox();
			});
			
			this.bigPicture = box;
			return this;			
		});
	};
})(jQuery);
/* bundling js/object_tabpreview_read_more.js */
jQuery(".object_tabpreview_read_more").live("click",function() {
    var rel=$(this).attr('data-object-id');
    var pa=$(this).parent();
    jQuery.getJSON("ajax.php?action=object_tabpreview_more&object_id="+rel,
	function(data) {
	    $(pa).html(data.content);
	});
});

/* bundling js/baselib.js */
/* Well, this file is _far_ too large, but i failed to make it modular. */
function uf_translate_pai_status(s) {
    if (s=='warning')
	return 'Warnung';
    if (s=='error')
	return 'Fehler';
    if (s=='ok')
	return 'OK';
    return s;
}
function pai_display_message(x)
{
    var pai_display='none';
    var pai_message='';
    var pai_status='';
    if (x && x.pai_display)
	pai_display=x.pai_display;
    if (x && x.pai_status)
	pai_status=x.pai_status;
    if (x && x.pai_message)
	pai_message=x.pai_message;
    if (pai_display=='none')
	return;

    var did=0;
    pai_status=uf_translate_pai_status(pai_status);
    if (pai_status==pai_message)
	pai_message="";
    if (typeof uf_growl != 'undefined') {
	did=1;
	if (pai_display=='info')
	    uf_growl_info(pai_status,pai_message);
	else if (pai_display=='warning')
	    uf_growl_warning(pai_status,pai_message,1);
	else
	    uf_growl_error(pai_status,pai_message);
    }
    if (!did)
	alert(pai_status+"\n"+pai_message);
}
function uf_ajax_error_message(s)
{
    if (typeof uf_growl != 'undefined')
	uf_growl_error("Ein Fehler ist aufgetreten",s);
    else
	alert("Ein Fehler ist aufgetreten: "+s);
}
function uf_pai_data(data)
{
    try {
	var x=jQuery.parseJSON(data);
	if (x && x.pai_data) {
	    return x.pai_data;
	}
    } catch(e) { };
    return null;
}
function pai_data_filter(d,t)
{
    try {
	var x=jQuery.parseJSON(d);
	return d;
    } catch(e) { }
    // this forces a invalid json error message, which is actually the best we can do.
    s = "Ein Fehler ist aufgetreten: "+d;
    return s;
}

jQuery.extend({
    pai_call: function( action, data, callback, type, opts) {
	// shift arguments if data argument was ommited
	if ( jQuery.isFunction( data ) ) {
	    opts = type;
	    type = callback;
	    callback = data;
	    data = null;
	}
	if (typeof type == "undefined")
	    type="GET";
	var url="ajax.php?action="+action;
	if (typeof opts == "undefined") 
	    opts={};
	opts['type']=type;
	opts['url']=url;
	opts['dataFilter']=pai_data_filter;
	opts['type']=type;
	opts['data']=data;
	opts['success']=callback;
	opts['dataType']="json";

	return jQuery.ajax(opts);
    }
});


jQuery(document).ready(function() {
    function uf_translate_pai_status(s) {
	if (s=='warning')
	    return 'Warnung';
	if (s=='error')
	    return 'Fehler';
	if (s=='ok')
	    return 'OK';
	return s;
    }
    $('html').ajaxSuccess(function(ev,xhr,options) {
	try {
	    var x=jQuery.parseJSON( xhr.responseText )
	    var ti="";
	    var tx=""
	    var pai_display='none';
	    var pai_message='';
	    var pai_status='';
	    if (x && x.pai_display) 
		pai_display=x.pai_display;
	    if (x && x.pai_status) 
		pai_status=x.pai_status;
	    if (x && x.pai_message) 
		pai_message=x.pai_message;
	    if (pai_display=='info') {
		if (options.success)
		    pai_display='none';
	    }
	    if (pai_display!='none') {
		var did=0;
		pai_status=uf_translate_pai_status(pai_status);
		if (pai_status==pai_message)
		    pai_message="";
		if (typeof uf_growl != 'undefined') {
		    did=1;
		    if (pai_display=='info')
			uf_growl_info(pai_status,pai_message);
		    else if (pai_display=='warning')
			uf_growl_warning(pai_status,pai_message,1);
		    else 
			uf_growl_error(pai_status,pai_message);
		}
		if (!did)
		    alert(pai_status+"\n"+pai_message);
	    } else {
		if (x && x.info_title) 
		    ti=x.info_title;
		if (x && x.info_text) 
		    tx=x.info_text;
		if (tx>'' || ti>'') {
		    if (typeof uf_growl != 'undefined')
			uf_growl_info(ti,tx);
		    else
			alert(ti+"\n"+tx);
		}
	    }
	} catch(e) { };
    });
    $('html').ajaxError(function(ev,xhr,options,exc) {
	var did=0;
	if (!did) {
	    try {
		var x=jQuery.parseJSON( xhr.responseText )
		var pai_display='none';
		var pai_message='';
		var pai_status='';
		if (x && x.pai_display) 
		    pai_display=x.pai_display;
		if (x && x.pai_status) 
		    pai_status=x.pai_status;
		if (x && x.pai_message) 
		    pai_message=x.pai_message;
		if (pai_display!='none') {
		    pai_status=uf_translate_pai_status(pai_status);
		    if (typeof uf_growl != 'undefined') {
			did=1;
			if (pai_display=='info')
			    uf_growl_info(pai_status,pai_message);
			else if (pai_display=='warning')
			    uf_growl_warning(pai_status,pai_message,1);
			else 
			    uf_growl_error(pai_status,pai_message);
		    }
		    if (!did)
			alert(pai_status+"\n"+pai_message);
		    did=1;
		}
	    } catch (e) { };
	}
	if (!did && exc) {
		if (window.console) console.log("error: ev",ev);
		if (window.console) console.log("error: xhr",xhr);
		if (window.console) console.log("error: options",options);
		if (window.console) console.log("error: exception",exc);
		var s=exc.toString();
		var i=s.indexOf("\n");
		var j=s.indexOf("<");
		if (j>-1 && j<i)
		    i=j;
		if (i!=-1)
		    s=s.substr(0,i);
		uf_ajax_error_message(s);
		did=1;
	}
	if (!did) {
	    if (xhr.readyState<4) {
		did=1;
		uf_ajax_error_message("timeout / keine Daten erhalten");
	    }
	    if (xhr.readyState==4) {
		if (xhr.status==0) {
		    // abort
		    did=1
		}
	    }
	}
	if (!did) {
	    var s=xhr.responseText;
	    uf_ajax_error_message(s);
	    if (console) console.log("ajaxError");
	    if (console) console.log("ev",ev);
	    if (console) console.log("xhr",xhr);
	    if (console) console.log("options",options);
	    if (console) console.log("exception",exc);
	}
    });
    $('input[type=reset]').click(function() {
	if (!confirm("Wirklich zurücksetzen?"))
	    return false;
	return true;
    });
    $('a.object_menu_box').html("M").css('visibility','visible');
    $('.uf_micropreview.with_menu_box').each(function() {
	var oid=$(this).data("object_id");
	$(this).wrap("<span class='uf_object_menu_box_container' />");
	var a=$("<a />", {
	    href: 'ajax.php?action=object_functionblock_get&object_id='+oid,
	    title: 'Funktionen wählen',
	    text: 'M'
	});
	$(a).attr('class','ufmodal object_menu_box');
	$(this).before(a);

    });
    $('.javascript-only').show();
    $('.ajaxfunction').live('click',function(e) {
	var u=$(this).attr('href');
	jQuery.get(u);
	return false;
    });
    $('.uf_simple_pai').live('click',function(e) {
	var u=$(this).attr('href');
	jQuery.get(u);
	return false;
    });
    $('.pai_action').live("click",function(e) {
	var oid=$(this).attr('data-object_id');
	var action=$(this).attr('data-action');
	var p=$(this).attr('data-param');
	var c=$(this).attr('data-confirm');
	var cl=$(this).attr('data-ufmodal_close');
	var sr=$(this).attr('data-success-replace');
	var sc=$(this).attr('data-success-callback');
	if (oid) {
	    if (p)
		p=p+"&object_id="+oid;
	    else
		p="object_id="+oid;
	}
	if (c>'') {
	    if (!confirm(c))
		return false;
	    if (p)
		p=p+"&confirmed=2";
	    else
		p=p+"confirmed=2";
	}
	var thing=this;
	$.pai_call(action,p,function(d) {
	    if (sr) {
		if (sr=='pai_message')
		    $(thing).replaceWith(d.pai_message);
		else
		    $(thing).replaceWith(sr);
	    }
	    if (sc) {
		sc(thing,d);
	    }
	    pai_display_message(d);
	    if (cl)
		ufmodal_close();
	});
	return false;
    });
    var uid=$('#generic_user_id').html();
    if ($('.author-'+uid).length)
	$('.mayfilterbyauthor').before('<p><input type="checkbox" id="filter-only-mine" value="1" />Nur meine zeigen</p>');
    $('#filter-only-mine').change(function() {
	var ch=$(this).is(":checked");
	if (ch) {
	    $('.mayfilterbyauthor .hasauthorinfo').each(function() {
		$(this).attr('old-display',$(this).css('display')).css('display','none');
	    });
	    $('.mayfilterbyauthor .author-'+uid).each(function() {
		$(this).css('display',$(this).attr('old-display'));
	    });
	} else {
	    $('.mayfilterbyauthor .hasauthorinfo').css('display','table-row');
	}
    });
});
jslog=function(s) {
    s=new Date().valueOf()+" "+s;
    if (window.console)
	console.log(s);
    jQuery("<div>"+s+"</div>").appendTo("#timingdebughelp");
};

my_overlay_ajaxcall=function(url,data,title, lv) {
    if (typeof(lv)=='undefined')
      lv=1000;
    var sel='#generic_overlay_'+lv;
    $(sel).remove(); // just in case
    var fullerstring="<a class='generic_overlay_fuller' href='#'>&#x25A1;</a>";
    if (typeof(data['fullsize'])!='undefined' && data['fullsize']>0) {
      fullerstring='';
    }
    var x=jQuery('<div></div>').attr({
      id: 'generic_overlay_'+lv,
      level: lv
    }).addClass('generic_overlay').css('display','none')
    .html("<div class='generic_overlay_head'>"
	   +"<a class='generic_overlay_closer' href='#'>X</a>"
	   +fullerstring
	   +"<h1 class='generic_overlay_title'>"+title+"</h1>"
	   +"</div>"
	   +"<div class='generic_overlay_main'></div>\n"
    );
    x.appendTo(document.body);
    if (fullerstring=='')
      $(sel).css({left: '0%', right: '0%', top: '0%', bottom: '0%', margin:0, border:0});
    $("#generic_busywait").show();
    $.ajax({
      url: url,
      data: data,
      dataType: 'html',
      success: function(data,sta) {
        $(sel).css("position","absolute");
	$(sel).css({top: '10%', left: '10%', bottom:'0', right:'10%'});
	$(sel).height("80%");
        $("#generic_busywait").hide();
	$(sel + ' .generic_overlay_main').html(data);
	$(sel + ' .generic_overlay_closer').click(function() {
	  $.dimScreenStop(function() {
	    $(sel).hide();
	    $(sel).remove();
	    return false;
	  },parseInt($(sel).attr('level'))-1);
	});
	if ($.browser.msie) {
	  if ($.browser.version.substr(0,3)=='6.0') {
	    $(sel).width("80%");
	    $(sel).css('overflow','auto');
	    $(sel).css('pading',"0 1em");
	  }
	}
	$(sel + ' .generic_overlay_fuller').click(function() {
	  var l=$(sel).css('left');
	  l=parseInt(l);
	  if (l==0) {
	    $(sel).css({left: '10%', right: '10%', top: '10%', bottom: '10%'});
	    if ($.browser.msie) {
	      if ($.browser.version.substr(0,3)=='6.0') {
		$(sel).height("80%");
		$(sel).width("80%");
	      }
	      if ($.browser.version.substr(0,3)=='7.0') {
		$(sel).height("80%");
	      }
	    }
	    $(this).html("&#x25A1;");
	  } else {
	    $(sel).css({left: '0', right: '0', top: '0', bottom: '0'});
	    if ($.browser.msie) {
	      if ($.browser.version.substr(0,3)=='6.0') {
	        $(sel).height($(window).height()-25);
	        $(sel).width($(window).width()-25);
	      }
	      if ($.browser.version.substr(0,3)=='7.0') {
	        $(sel).height($(window).height()-25);
	      }
	    }
	    $(this).html("&#x25A3;");
	  }
	});
        
	var workaround=function() {
	  var h;
	  var t;
	  h=$(sel + ' .generic_overlay_main h1');
          t=h.html();
          if (t=='') {
	    h=$(sel + ' .generic_overlay_main h2');
            t=h.html();
          }
          if (t>'') {
            h.hide();
            $(sel + ' .generic_overlay_title').html(t);
          }
	  $(sel).show();
	};
	$.dimScreen(200,0.500,workaround,parseInt($(sel).attr('level'))-1);
      }
    });  
};

my_kwpreview=function(u,v) {
    data={
      action: 'make-kwpreview',
      text: v
    };
    my_overlay_ajaxcall(u,data,'');
};
my_kwguess_bbcode=function(u,v,w) {
    data={
      action: 'kw_guess_bbcode',
      text: v,
      keywords: w
    };
    my_overlay_ajaxcall(u,data,'');
};

my_ajax_op_with_confirm=function(opkey,text) {
    var data={
      opkey:opkey
    };
    var ch=confirm(text);
    if (ch) {	
      d=$("#generic_directory").html();
      my_overlay_ajaxcall(d+'ajax.php?action=op',data,'',1000);
    }
};
my_ajax=function(url,lv) {
    my_overlay_ajaxcall(url,{},'title',lv);
};
my_ajax_base=function(url,title, lv) {
    my_overlay_ajaxcall(url, {},title,lv);
};
my_ajax_edit_object=function(oid,text) {
    var data={
      object_id:oid
    };
    var ch=confirm(text);
    if (ch) {	
      d=$("#generic_directory").html();
      my_overlay_ajaxcall(d+'ajax.php?action=object_edit',data,'',250);
    }
};

imagetrail_fix=function(e)
    {
	var xOffset = 10;
	var yOffset = 30;
	var t=jQuery("div#imgtrail");
	var dh=jQuery(document).height();
	var wh=jQuery(window).height();
	var st=jQuery(window).scrollTop();
	var th=t.outerHeight();
	var my=e.pageY;
	my+=yOffset;

	var dw=jQuery(document).width();
	var ww=jQuery(window).width();
	var sl=jQuery(window).scrollLeft();
	var tw=t.outerWidth();
	var mx=e.pageX;
	mx+=xOffset;
	var fixed=0; // avoid fixing x and y: that could move the mouse over the trailer, therefore triggering mouseout.   
	if (my+th>st+wh) {
	  my=st+wh-th;
	  fixed=1;
	}
	if (mx+tw>sl+ww && !fixed) {
	  mx=sl+ww-tw;
	} else if (mx+tw>sl+ww) {
	  mx=e.pageX-xOffset-tw;
        }
	t.css("top",my+"px");
	t.css("left",mx+"px");
    };

imagetrail_setup=function(id,bigsrc,bigw,bigh) {

    var thing;
    thing=jQuery("#"+id);
    thing.hover(
      function(e){

	this.t=this.title;
	this.title = "";
	var c = (this.t != "") ? "<br/>" + this.t : "";
	add="";
	if (bigw)
	  add=add+" width='"+bigw+"' height='"+bigh+"'";
	jQuery("body").append("<div id='imgtrail'><img src='"+ bigsrc +"' alt='Image preview' "+add+" />"+ c +"</div>");   
	jQuery('div#imgtrail')
		.css("display","none")
		.css("position","absolute")
		.css("top","0px")
		.css("z-index","1000")
		.css("left","0px")
		.css("border","1px solid #888")
		.css("text-align","center")
		.css("background","#333")
		.css("color","#fff")
		.css("padding","5px")
		.fadeIn("fast");
	imagetrail_fix(e);
      },
      function(e){
	this.title = this.t;
	jQuery("div#imgtrail").remove();
      }
    );
    thing.mousemove(function(e){
      imagetrail_fix(e);
    });
};
jQuery("a.livemodal,span.livemodal").live('click',function(e) {
    $(this).nyroModalManual();
    return false;
});
var livemodal_close=function() {
    $.nyroModalRemove();
};
jQuery(".uf_imagetrail").live('mouseover mouseout mousemove',function(e) {
    if (e.type=='mouseover') {
	this.t=this.title;
	this.title = "";
	var c = (this.t != "") ? "<br/>" + this.t : "";
	add="";
	var bigw=$(this).attr('data-image-width');
	var bigh=$(this).attr('data-image-height');
	var bigsrc=$(this).attr('data-image-url');
	if (bigw)
	  add=add+" width='"+bigw+"' height='"+bigh+"'";
	jQuery("body").append("<div id='imgtrail'><img src='"+ bigsrc +"' alt='Image preview' "+add+" />"+ c +"</div>");   
	jQuery('div#imgtrail')
		.css("display","none")
		.css("position","absolute")
		.css("top","0px")
		.css("z-index","2000")
		.css("left","0px")
		.css("border","1px solid #888")
		.css("text-align","center")
		.css("background","#333")
		.css("color","#fff")
		.css("padding","5px")
		.fadeIn("fast");
	imagetrail_fix(e);
    } else if (e.type=='mouseout') {
	this.title = this.t;
	jQuery("div#imgtrail").remove();
    } else if (e.type=='mousemove') {
        imagetrail_fix(e);
    }
});

  autocomplete_format_item=function(r,p,n,t) {
    return t;
    var r = $.trim(t);
    r = r.split("##");
    return r[0];
  };
  autocomplete_format_result=function(r,p,n) {
    return p;
    var r = $.trim(p);
    r = r.split("##");
    return r[1];
  };


/*************************************************************************
  taken from quirksmode.org
 *************************************************************************/

var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
  &&
    navigator.userAgent.indexOf('Mac') != -1
);

var W3CDOM = (!bugRiddenCrashPronePieceOfJunk && 
    document.getElementsByTagName && document.createElement);
var IE = document.all?true:false;

function getObjNN4(obj,name)
{
  var x = obj.layers;
  var foundLayer;
  for (var i=0;i<x.length;i++)
  {
    if (x[i].id == name)
      foundLayer = x[i];
    else if (x[i].layers.length)
      var tmp = getObjNN4(x[i],name);
    if (tmp) foundLayer = tmp;
  }
  return foundLayer;
}


function get_object_by_id(name)
{
  if (document.getElementById) {
    return document.getElementById(name);
  } else if (document.all) {
    return document.all[name];
  } else if (document.layers) {
    return getObjNN4(document,name);
  }
}

function get_object_style_by_id(name)
{
  if (document.getElementById) {
    return document.getElementById(name).style;
  } else if (document.all) {
    return document.all[name].style;
  } else if (document.layers) {
    return getObjNN4(document,name);
  }
}

function movecommentthing(id)
{
  var thing, style;
  old=get_object_by_id('com_bit');
  oldp=old.parentNode;
  val=oldp.removeChild(old);

  thing=get_object_by_id('com_'+id);
//#  thing.innerHTML=val.innerHTML;
  thing.appendChild(val);

// reactive disabled "comment this" links
  a=document.getElementsByTagName("a");
  for (i=0;i<a.length;i++) {
    l=a[i].attributes.length;
    for (j=0;j<l;j++) {
      x=a[i].attributes[j];
//      val.innerHTML=val.innerHTML+'<div>'+i+","+j+": "+x.nodeValue+" "+x.nodeName+'</div>';
      // com_a_118008 id
      if (x.nodeName=='id') {
        if (x.nodeValue.substr(0,6)=='com_a_') {
          a[i].style.display='inline';
        }
      }
    }
  }
  x=get_object_by_id("com_a_"+id);
  if (x)
    x.style.display='none';

  // make sure the reference object is selected correctly.
  if (1) {
    var cb=$('#com_bit');
    $('#com_bit_refselect option').attr('selected','');
    $('#com_bit_refselect option[value='+id+']').attr('selected','selected');
  }
}

var ajax;
function fix_XMLHttpRequest() {
  if( !window.XMLHttpRequest )
    XMLHttpRequest = function() {
      try{ return new ActiveXObject("MSXML3.XMLHTTP") }catch(e){}
      try{ return new ActiveXObject("MSXML2.XMLHTTP.3.0") }catch(e){}
      try{ return new ActiveXObject("Msxml2.XMLHTTP") }catch(e){}
      try{ return new ActiveXObject("Microsoft.XMLHTTP") }catch(e){}
      throw new Error("Could not find an XMLHttpRequest alternative.")
    };
}
function ajaxcall(dir,q,callback)
{
  if (!XMLHttpRequest)
    fix_XMLHttpRequest();
  if (!ajax)
    ajax = new XMLHttpRequest();

  ajax.open("POST",dir+"ajax.php",true);
  ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  ajax.setRequestHeader("Content-length", q.length);
  ajax.setRequestHeader("Connection", "close");
  ajax.onreadystatechange=callback;
  ajax.send(q);
}
function ajax_preview_close()
{
  div=get_object_by_id("generic_preview_background");
  if (div) div.style.display='none';
  div=get_object_by_id("generic_preview");
  if (div) div.style.display='none';
}
function ajax_preview_callback()
{
  if (ajax.readyState==4 && ajax.status>199) {
    div=get_object_by_id("generic_preview_background");
    div.style.display='block';
    div=get_object_by_id("generic_preview");
    div.innerHTML="<div style=\"float:right; border:1px solid;\"><a href=\"javascript:ajax_preview_close()\">Schliessen</a></div><p><b>Vorschau</b></p><div id=\"generic_preview_main\">"+ajax.responseText+"</div>";
    div.style.display='block';
    // alert("callback state="+ajax.readystate+" status="+ajax.status+" returninfo="+returninfo);
  }
}
function ajax_preview(dir,contentvar)
{
  q="action=make-preview"+"&text="+contentvar;
  ajaxcall(dir,q, ajax_preview_callback);
}
function ajax_kwpreview(dir,contentvar)
{
  q="action=make-kwpreview"+"&text="+contentvar;
  ajaxcall(dir,q, ajax_preview_callback);
}
function ajax_postcard_preview(dir,formname)
{
  oid=document.forms[formname].object_id.value;
  q="action=make-postcardpreview&object_id="+oid;
  q=q+"&bg_color="+encodeURIComponent(document.forms[formname].form_bg_color.value)
  q=q+"&font_color="+encodeURIComponent(document.forms[formname].form_font_color.value)
  q=q+"&border_color="+encodeURIComponent(document.forms[formname].form_border_color.value)
  q=q+"&font_face="+encodeURIComponent(document.forms[formname].form_font_face.value)
  q=q+"&sender_email="+encodeURIComponent(document.forms[formname].form_sender_email.value)
  q=q+"&recipient_name="+encodeURIComponent(document.forms[formname].form_recipient_name.value)
  q=q+"&recipient_email="+encodeURIComponent(document.forms[formname].form_recipient_email.value)
  q=q+"&headline="+encodeURIComponent(document.forms[formname].form_headline.value)
  q=q+"&layout="+encodeURIComponent(document.forms[formname].form_layout.value)
  q=q+"&message="+encodeURIComponent(document.forms[formname].form_message.value)

  ajaxcall(dir,q, ajax_preview_callback);
}
function ajax_get_callback()
{
  if (ajax.readyState==4 && ajax.status>199) {
    div=get_object_by_id("generic_preview_background");
    div.style.display='block';
    div=get_object_by_id("generic_preview");
    div.innerHTML="<div style=\"float:right; border:1px solid;\"><a href=\"javascript:ajax_preview_close()\">Schliessen</a></div><div id=\"generic_preview_main\">"+ajax.responseText+"</div>";
    div.style.display='block';
    // alert("callback state="+ajax.readystate+" status="+ajax.status+" returninfo="+returninfo);
  }
}
function ajax_get_to_preview_area(q)
{
  if (!XMLHttpRequest)
    fix_XMLHttpRequest();
  if (!ajax)
    ajax = new XMLHttpRequest();

  ajax.open("GET",q,true);
  ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//  ajax.setRequestHeader("Content-length", q.length);
  ajax.setRequestHeader("Connection", "close");
  ajax.onreadystatechange=ajax_get_callback;
  ajax.send(q);
}



/***************************************************************************
 * Find object positions
 ***************************************************************************/

function get_object_x(obj,relative) {
  if (typeof(obj)!="object") return false;
  var x=obj.offsetLeft;
  if (obj.offsetParent && !relative)
    x+=get_object_x(obj.offsetParent,relative);
  return x;
}

function get_object_y(obj,relative) {
  if (typeof(obj)!="object") return false;
  var y=obj.offsetTop;
  if (obj.offsetParent && !relative)
    y+=get_object_y(obj.offsetParent,relative);
  return y;
}

function get_scroll_x_offset()
{
  if (self.pageXOffset)
    return self.pageXOffset;
  if (document.documentElement && document.documentElement.scrollLeft) 
    return document.documentElement.scrollLeft;
  if (document.body)
    return document.body.scrollLeft;
  return 0;
}
function get_scroll_y_offset()
{
  if (IE) { // grab the x-y pos.s if browser is IE
    if (document.documentElement && document.documentElement.scrollTop) {
      return document.documentElement.scrollTop;
    } else {
      return document.body.scrollTop;
    }
  }
  return 0;
  if (window.pageYOffset)
    return window.pageYOffset;
  if (self.pageYOffset)
    return self.pageYOffset;
  return 0;
}

/***************************************************************************
 * Show mouse position relative to object "oname"
 ***************************************************************************/

//if (!IE) document.captureEvents(Event.MOUSEMOVE);

var mouseposmode = new Object();
mouseposmode.watch="";
mouseposmode.show="";
mouseposmode.flag=0;
mouseposmode.off=function () {
    document.onmousemove = "";
    this.show.innerHTML="Mausposition einblenden";
}
mouseposmode.startstop= function (watchid,showid) {
  this.flag=!this.flag;
  this.watch=get_object_by_id(watchid);
  this.show=get_object_by_id(showid);
  if (!this.flag) {
    this.off();
  } else {
    magnifier.off();
    document.onmousemove = this.doit;
  }
  return true;
}

mouseposmode.doit=function (e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    if (document.documentElement && document.documentElement.scrollTop) {
      mx=event.clientX + document.documentElement.scrollLeft;
      my=event.clientY + document.documentElement.scrollTop;
    } else {
      mx = event.clientX + document.body.scrollLeft;
      my = event.clientY + document.body.scrollTop;
    }
  } else {  // grab the x-y pos.s if browser is NS
    mx = e.pageX;
    my = e.pageY;
  }

  ix=get_object_x(mouseposmode.watch,0);
  iw=mouseposmode.watch.width;
  iy=get_object_y(mouseposmode.watch,0);
  ih=mouseposmode.watch.height;

  if (mx<ix || my<iy) {
    mouseposmode.show.innerHTML=" [Maus au&szlig;erhalb] ";
    return true;
  }
  rx=mx-ix;
  ry=my-iy;
  if (rx>iw || ry>ih) {
    mouseposmode.show.innerHTML=" [Maus au&szlig;erhalb] ";
    return true;
  }

  mouseposmode.show.innerHTML=" [Position "+rx+","+ry+"] ";
  return true;
}

/* quirksmode.org, renamed and with generic_directory support */
function cookie_set(name,value,days,path)
{
  var expires;
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    expires = "; expires="+date.toGMTString();
  }
  var expires = "";
  if (typeof(path)=='undefined') {
      path=$("#generic_directory").html();
      if (typeof(path)=='undefined' || path=='')
	path='/';
  }
  document.cookie = name+"="+value+expires+"; path="+path;
}

function cookie_get(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 cookie_delete(name) { cookie_set(name,"",-1); }

function rgb2color(r,g,b)
{
   var s = "0123456789ABCDEF";
   var o = '#';
   o+=s.substr( (r>>4)&15,1);
   o+=s.substr( r&15,1);
   o+=s.substr( (g>>4)&15,1);
   o+=s.substr( g&15,1);
   o+=s.substr( (b>>4)&15,1);
   o+=s.substr( b&15,1);
   return o;
}
function make_color(
	num, 
	     frequency1, frequency2, frequency3,
	     phase1, phase2, phase3,
	     center, width)
  {
    if (frequency1 == undefined) frequency1 = 2.4;
    if (frequency2 == undefined) frequency2 = 2.4;
    if (frequency3 == undefined) frequency3 = 2.4;
    if (phase1 == undefined) phase1 = 0;
    if (phase2 == undefined) phase2 = 2;
    if (phase3 == undefined) phase3 = 4;
    if (center == undefined)   center = 128;
    if (width == undefined)    width = 127;

    var red = Math.sin(num*frequency1 + phase1) * width + center;
    var grn = Math.sin(num*frequency2 + phase2) * width + center;
    var blu = Math.sin(num*frequency3 + phase3) * width + center;
    return rgb2color(red,grn,blu);
}


jQuery(document).ready(function() {
  var x;
  x=get_object_by_id('maginfo');
  if (x) {
    var y;
    y=get_object_style_by_id('maginfo');
    y.visibility="visible";
    x.innerHTML=" [Lupe ist aus] ";
  }
  x=get_object_by_id('mouseinfo');
  if (x) {
    y=get_object_style_by_id('mouseinfo');
    y.visibility="visible";
    x.innerHTML=" [Positionsanzeige ist aus] ";
  }
});
/* bundling js/imagetrail.js */
/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/
/* cleaned up and adapted to nforum: Uwe Ohse */


//image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var offsetfrommouse=[15,15];
//duration in seconds image should remain visible. 0 for always.
var displayduration=0;
// maximum image size.
var currentimageheight = 400;
// 
var overlaywidth=436;
var overlayheight=486;

if (document.getElementById || document.all){
  document.write('<div id="overlayimage" ');
  document.write('style="font-size: 0.75em; position: absolute; display:none;');
  document.write(' visibility: hidden; left: 0px; top: 0px; width: 0px;');
  document.write(' margin:0; padding:0; height: 0px; z-index: 200;">');
  document.write('</div>');

}

function gettrailobj(){
  if (document.getElementById)
    return document.getElementById("overlayimage").style
  else if (document.all)
    return document.all.overlayimage.style
}

function gettrailobjnostyle(){
  if (document.getElementById)
    return document.getElementById("overlayimage")
  else if (document.all)
    return document.all.overlayimage
}
function winheight() {
  if (self.innerHeight) {
    return window.innerHeight;
  } 
  else if (document.documentElement && document.documentElement.clientHeight)
  {
    // IE 6 Strict
    return document.documentElement.clientHeight;
  } 
  else {
    // IE, other versions
    return document.body.clientHeight;
  }
  return 600;
}
function winwidth() {
  if (self.innerHeight) {
    return window.innerWidth;
  } 
  else if (document.documentElement && document.documentElement.clientHeight)
  {
    // IE 6 Strict
    return document.documentElement.clientWidth;
  } 
  else {
    // IE, other versions
    return document.body.clientWidth;
  }
  return 800;
}

function showtrail(imagesrc,title,w,h){
  // make sure there is place enough for the overlay on the screen, so that
  // it does not grab the mouse.
/*
  ww=winwidth();
  wh=winheight();
  if (w+36 > ww/2) w=ww/2-36;
  if (h+100 > wh/2) h=wh/2-100;
*/
  if (h> 0){
    currentimageheight = h;
  }
  if (w> 0){
    currentimagewidth = w;
  }
  overlaywidth=currentimagewidth+16;
  overlayheight=currentimageheight+50;
  gettrailobj().width = overlaywidth+"px";
  gettrailobj().height = overlayheight+"px";

  document.onmousemove=followmouse;
  title=title.replace(/&/g,'&amp;');
  title=title.replace(/</g,'&lt;');
  title=title.replace(/>/g,'&gt;');

  newHTML = '<div style="padding: 5px; border: 1px solid #888;" class="row1">';
  newHTML = newHTML + '<h2 id="TTT">' + title + '</h2>';

  newHTML = newHTML + '<div align="center" style="padding: 8px 2px 2px 2px;"><img style="height:'+h+'px; width:'+w+'px;" src="' + imagesrc + '" border="0"></div>';
  newHTML = newHTML + '<span id="FFF">Vom Browser herunterskaliert auf '+w+'x'+h+' - das Original ist oft besser</span>';

  newHTML = newHTML + '</div>';

  gettrailobjnostyle().innerHTML = newHTML;

  gettrailobj().visibility="visible";
  gettrailobj().display="block";
  gettrailobj().height=h+50+"px";
  gettrailobj().width=w+16+"px";
}


function hidetrail(){
  gettrailobj().visibility="hidden"
  gettrailobj().display="none";
  document.onmousemove=""
  gettrailobj().left="-500px"
}

function my_get_scroll_x_offset()
{
  if (self.pageXOffset)
    return self.pageXOffset;
  if (document.documentElement && document.documentElement.scrollLeft)
    return document.documentElement.scrollLeft;
  if (document.body)
    return document.body.scrollLeft;
  return 0;
}
function my_get_scroll_y_offset()
{
  if (self.pageYOffset)
    return self.pageYOffset;
  if (document.documentElement && document.documentElement.scrollTop)
    return document.documentElement.scrollTop;
  if (document.body)
    return document.body.scrollTop;
  return 0;
}


function followmouse(e){
  var xcoord=offsetfrommouse[0]
  var ycoord=offsetfrommouse[1]

  if (!e) {
    e=window.event;
  }

  ww=winwidth();
  wh=winheight();

  if (IE) { // grab the x-y pos.s if browser is IE
    mx = event.clientX + document.body.scrollLeft;
    my = event.clientY + document.body.scrollTop;
    mx+=my_get_scroll_x_offset();
    my+=my_get_scroll_y_offset();
  } else {  // grab the x-y pos.s if browser is NS
    mx = e.pageX;
    my = e.pageY;
  }
//debug="       Mouse("+mx+","+my+") ";
//debug=debug+ "Scroll("+my_get_scroll_x_offset()+","+my_get_scroll_y_offset()+") ";
//debug=debug+ "Win("+ww+","+wh+") Off("+xcoord+","+ycoord+")";
  mx-=my_get_scroll_x_offset();
  my-=my_get_scroll_y_offset();

  // The different logic for x/y jumps 
  ly=my+offsetfrommouse[1];
  if (ly+overlayheight>wh)
    ly=wh-offsetfrommouse[1]-overlayheight;

  lx=mx+offsetfrommouse[0];
  if (lx+overlaywidth>ww)
    lx=mx-offsetfrommouse[0]-overlaywidth;
  lx+=my_get_scroll_x_offset();
  ly+=my_get_scroll_y_offset();

//debug=debug+ " Final("+lx+","+ly+")";
//  document.getElementById("TTT").innerHTML="<b>"+debug+"</b>";
//  document.getElementById("FFF").innerHTML="<b>"+debug+"</b>";


  gettrailobj().left=lx+"px";
  gettrailobj().top=ly+"px";
}
/* bundling js/versioned/jquery.smart_modal-20090414-uwe.js */
/**
modal_content => sm_content
modal_overlay => sm_olay
modal_close => sm_close
modal_title => sm_title
fn.modal* => fn.smart_modal*
modal_count => sm_count
**/
(function($) {
	//base function to call and setup everything
	$.fn.smart_modal=function(options){
		return this.each(function(){			
			if(this._sm) return; //if already a modal return
			if(typeof(options) != "undefined")	var params = $.extend({}, $.fn.smart_modal.defaults, options); //if some options are passed in merge them
			else var params = $.fn.smart_modal.defaults;
			if(typeof(sm_count) == "undefined") sm_count=0; //set the counter to 0
			sm_count++;
			this._sm=sm_count; //set what modal number this is
			H[sm_count] = {config:params,target_sm:this}; //add to hash var
			$(this).smart_modal_add_show(this); //add show & hide triggers
		});
	};
	$.fn.smart_modal_add_show=function(ele){ return $.smart_modal.show(ele); };
	//extra function so show & hide can be called
	$.fn.smart_modal_show=function(){
		return this.each(function(){
			$.smart_modal.open(this);
		});		
	};
	$.fn.smart_modal_hide=function(){
		return this.each(function(){
			$.smart_modal.hide(this, true);
		});		
	};
	//the default config vars
	$.fn.smart_modal.defaults = {show:false, hide:false, modal_styles:{display:"block", zIndex:1001}, resize:true, hide_on_overlay_click:true };
	//the over riden stuff
	$.smart_modal = {
		hash:{}, //the hash used to store all the configs & targets
		show:function(ele){
			var pos = ele._sm, h = H[pos];
			jQ(h.target_sm).click(function(){
				$.smart_modal.open(ele);
				return false;
			});
			return false;
		},
		
		hide:function(ele, force){
			var pos = ele._sm, h = H[pos];			
			if(h.config.hide_on_overlay_click) var idstr = "#sm_olay, .sm_close";
			else var idstr = ".sm_close";
			if(force) $.smart_modal.remove(ele);
			jQ(idstr).click(function(){
       	$.smart_modal.remove(ele);
				return false;
      });
		},
		remove:function(ele){
			var pos = ele._sm, h = H[pos];
			jQ("#sm_content").remove();
			jQ("#sm_olay").remove();							
			if(h.config.hide)	h.config.hide();
		},
		open:function(ele){
			var pos = ele._sm;
			var h = H[pos];			
			$.smart_modal.insert_overlay();
			$.smart_modal.insert_content_container();
			var smcontent = $.smart_modal.get_content($(h.target_sm));
			jQ("#sm_content").html(smcontent);			
			if(h.config.modal_styles) jQ("#sm_content").css(h.config.modal_styles);
			if(h.config.resize) $.smart_modal.resize_container();
      $.smart_modal.for_ie(jQ("#sm_olay"));	
			if(h.config.show) h.config.show();
			$.smart_modal.hide(ele); //add hiding
		},
		resize_container: function(){
			var max_width = 0, max_height=0;
			jQ('#sm_content *').load(function(){				
				jQ('#sm_content *').each(function(){					
					var tw = jQ(this).outerWidth(), th = jQ(this).outerHeight();
					if(tw > max_width) max_width = tw;
					max_height += th;
				});
				if(max_width >0 && max_height>0) jQ('#sm_content').css('width', (max_width+jQ('#sm_content .sm_close:first').outerWidth())+'px').css('height', (max_height)+'px').css('margin-left', '-'+(max_width/2)+'px');
				var off=jQ('#sm_content').offset();
				if (off.left<0)
				    jQ('#sm_content').css('margin-left', '-'+(max_width/2+off.left-50)+'px')
			});
			
		},
		insert_overlay:function(){
			if(!jQ('#sm_olay').length) jQ("body").append('<div id="sm_olay"></div>');
      jQ("#sm_olay").css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':1000,opacity:50/100});
		},
		insert_content_container:function(){
			if(!jQ('#sm_content').length) jQ("body").append('<div id="sm_content"></div>');
		},
		get_content:function(trig){
			c = "<div class='sm_close'><p>x</p></div>";
			if(trig.attr("rel")){ //if rel exists
				div_id = jQ('#'+trig.attr('rel'));
				div_class = jQ('.'+trig.attr('rel'));	
				if(div_id.length){ c += div_id.html(); }
				else if(div_class.length){ c += div_class.html();	}
			}else if(trig.attr('href')){ 
				// if it has a href but no rel then insert the href as image src
			        // or load content, if it doesn't look like an image.
				if(trig.attr('href').match(/.(gif|png|jpg|jpeg|bmp|tif)$/i)) {
                                       if(trig.attr('title')) {
                                               c +="<h3 class='sm_title'>"+trig.attr('title')
                                                 +"</h3><img src='"+trig.attr('href')+"' alt='"+trig.attr('title')+"' />";
                                       } else{
                                               c += "<img src='"+trig.attr('href')+"' alt='modal' />";
                                       }
				} else {
                                     $(".busywait-image").show(); // if something like that is here at all.
                                     $.ajax({
                                         url: trig.attr('href'),
                                         dataType: 'html',
                                         async: false,
                                         success: function(data,sta) {
                                           if (trig.attr('class'))
                                             jQ("#sm_content").addClass(trig.attr('class'));
                                           c += "<div id='sm_loaded_content'>"+data+"</div>";
                                         }
                                     });
                                     $(".busywait-image").hide();
                               }
			}else{ c = c + trig.html(); }
			return c;
		},
		for_ie:function(o){
			if(ie6&&$('html,body').css({height:'100%',width:'100%'})&&o){
				$('html,body').css({height:'100%',width:'100%'});
        i=$('<iframe src="javascript:false;document.write(\'\');" class="overlay"></iframe>').css({opacity:0});
        o.html('<p style="width:100%;height:100%"/>').prepend(i);
        o = o.css({position:'absolute'})[0];
			}
		}
	};
	var H=$.smart_modal.hash,	jQ = jQuery;
			ie6=$.browser.msie&&($.browser.version == "6.0");
})(jQuery);
/* bundling piwik/piwik.js */
/*
 * Piwik - Web Analytics
 *
 * JavaScript tracking client
 *
 * @link http://piwik.org
 * @source http://dev.piwik.org/trac/browser/trunk/js/piwik.js
 * @license http://www.opensource.org/licenses/bsd-license.php Simplified BSD
 */
if(!this.JSON2){this.JSON2={}}(function(){function d(f){return f<10?"0"+f:f}function l(n,m){var f=Object.prototype.toString.apply(n);if(f==="[object Date]"){return isFinite(n.valueOf())?n.getUTCFullYear()+"-"+d(n.getUTCMonth()+1)+"-"+d(n.getUTCDate())+"T"+d(n.getUTCHours())+":"+d(n.getUTCMinutes())+":"+d(n.getUTCSeconds())+"Z":null}if(f==="[object String]"||f==="[object Number]"||f==="[object Boolean]"){return n.valueOf()}if(f!=="[object Array]"&&typeof n.toJSON==="function"){return n.toJSON(m)}return n}var c=new RegExp("[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]","g"),e='\\\\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]',i=new RegExp("["+e,"g"),j,b,k={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},h;
function a(f){i.lastIndex=0;return i.test(f)?'"'+f.replace(i,function(m){var n=k[m];return typeof n==="string"?n:"\\u"+("0000"+m.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+f+'"'}function g(s,p){var n,m,t,f,q=j,o,r=p[s];if(r&&typeof r==="object"){r=l(r,s)}if(typeof h==="function"){r=h.call(p,s,r)}switch(typeof r){case"string":return a(r);case"number":return isFinite(r)?String(r):"null";case"boolean":case"null":return String(r);case"object":if(!r){return"null"}j+=b;o=[];if(Object.prototype.toString.apply(r)==="[object Array]"){f=r.length;for(n=0;n<f;n+=1){o[n]=g(n,r)||"null"}t=o.length===0?"[]":j?"[\n"+j+o.join(",\n"+j)+"\n"+q+"]":"["+o.join(",")+"]";j=q;return t}if(h&&typeof h==="object"){f=h.length;for(n=0;n<f;n+=1){if(typeof h[n]==="string"){m=h[n];t=g(m,r);if(t){o.push(a(m)+(j?": ":":")+t)}}}}else{for(m in r){if(Object.prototype.hasOwnProperty.call(r,m)){t=g(m,r);if(t){o.push(a(m)+(j?": ":":")+t)}}}}t=o.length===0?"{}":j?"{\n"+j+o.join(",\n"+j)+"\n"+q+"}":"{"+o.join(",")+"}";j=q;
return t}}if(typeof JSON2.stringify!=="function"){JSON2.stringify=function(o,m,n){var f;j="";b="";if(typeof n==="number"){for(f=0;f<n;f+=1){b+=" "}}else{if(typeof n==="string"){b=n}}h=m;if(m&&typeof m!=="function"&&(typeof m!=="object"||typeof m.length!=="number")){throw new Error("JSON.stringify")}return g("",{"":o})}}if(typeof JSON2.parse!=="function"){JSON2.parse=function(o,f){var n;function m(s,r){var q,p,t=s[r];if(t&&typeof t==="object"){for(q in t){if(Object.prototype.hasOwnProperty.call(t,q)){p=m(t,q);if(p!==undefined){t[q]=p}else{delete t[q]}}}}return f.call(s,r,t)}o=String(o);c.lastIndex=0;if(c.test(o)){o=o.replace(c,function(p){return"\\u"+("0000"+p.charCodeAt(0).toString(16)).slice(-4)})}if((new RegExp("^[\\],:{}\\s]*$")).test(o.replace(new RegExp('\\\\(?:["\\\\/bfnrt]|u[0-9a-fA-F]{4})',"g"),"@").replace(new RegExp('"[^"\\\\\n\r]*"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?',"g"),"]").replace(new RegExp("(?:^|:|,)(?:\\s*\\[)+","g"),""))){n=eval("("+o+")");
return typeof f==="function"?m({"":n},""):n}throw new SyntaxError("JSON.parse")}}}());var _paq=_paq||[],Piwik=Piwik||(function(){var m,w={},d=document,j=navigator,v=screen,I=window,h=false,C=[],e=I.encodeURIComponent,J=I.decodeURIComponent,E=unescape,H,D;function b(i){return typeof i!=="undefined"}function a(i){return typeof i==="function"}function n(i){return typeof i==="object"}function q(i){return typeof i==="string"||i instanceof String}function z(){var K,M,L;for(K=0;K<arguments.length;K+=1){L=arguments[K];M=L.shift();if(q(M)){H[M].apply(H,L)}else{M.apply(H,L)}}}function t(M,L,K,i){if(M.addEventListener){M.addEventListener(L,K,i);return true}if(M.attachEvent){return M.attachEvent("on"+L,K)}M["on"+L]=K}function g(L,O){var K="",N,M;for(N in w){if(Object.prototype.hasOwnProperty.call(w,N)){M=w[N][L];if(a(M)){K+=M(O)}}}return K}function B(){var i;g("unload");if(m){do{i=new Date()}while(i.getTime()<m)}}function k(){var K;if(!h){h=true;g("load");for(K=0;K<C.length;K++){C[K]()}}return true
}function x(){var K;if(d.addEventListener){t(d,"DOMContentLoaded",function i(){d.removeEventListener("DOMContentLoaded",i,false);k()})}else{if(d.attachEvent){d.attachEvent("onreadystatechange",function i(){if(d.readyState==="complete"){d.detachEvent("onreadystatechange",i);k()}});if(d.documentElement.doScroll&&I===I.top){(function i(){if(!h){try{d.documentElement.doScroll("left")}catch(L){setTimeout(i,0);return}k()}}())}}}if((new RegExp("WebKit")).test(j.userAgent)){K=setInterval(function(){if(h||/loaded|complete/.test(d.readyState)){clearInterval(K);k()}},10)}t(I,"load",k,false)}function f(){var i="";try{i=I.top.document.referrer}catch(L){if(I.parent){try{i=I.parent.document.referrer}catch(K){i=""}}}if(i===""){i=d.referrer}return i}function A(i){var L=new RegExp("^([a-z]+):"),K=L.exec(i);return K?K[1]:null}function y(i){var L=new RegExp("^(?:(?:https?|ftp):)/*(?:[^@]+@)?([^:/#]+)"),K=L.exec(i);return K?K[1]:i}function p(L,K){var O=new RegExp("^(?:https?|ftp)(?::/*(?:[^?]+)[?])([^#]+)"),N=O.exec(L),M=new RegExp("(?:^|&)"+K+"=([^&]*)"),i=N?M.exec(N[1]):0;
return i?J(i[1]):""}function s(P,M,L,O,K,N){var i;if(L){i=new Date();i.setTime(i.getTime()+L)}d.cookie=P+"="+e(M)+(L?";expires="+i.toGMTString():"")+";path="+(O||"/")+(K?";domain="+K:"")+(N?";secure":"")}function G(L){var i=new RegExp("(^|;)[ ]*"+L+"=([^;]*)"),K=i.exec(d.cookie);return K?J(K[2]):0}function r(i){return E(e(i))}function u(aa){var M=function(W,i){return(W<<i)|(W>>>(32-i))},ab=function(ah){var ag="",af,W;for(af=7;af>=0;af--){W=(ah>>>(af*4))&15;ag+=W.toString(16)}return ag},P,ad,ac,L=[],T=1732584193,R=4023233417,Q=2562383102,O=271733878,N=3285377520,Z,Y,X,V,U,ae,K,S=[];aa=r(aa);K=aa.length;for(ad=0;ad<K-3;ad+=4){ac=aa.charCodeAt(ad)<<24|aa.charCodeAt(ad+1)<<16|aa.charCodeAt(ad+2)<<8|aa.charCodeAt(ad+3);S.push(ac)}switch(K&3){case 0:ad=2147483648;break;case 1:ad=aa.charCodeAt(K-1)<<24|8388608;break;case 2:ad=aa.charCodeAt(K-2)<<24|aa.charCodeAt(K-1)<<16|32768;break;case 3:ad=aa.charCodeAt(K-3)<<24|aa.charCodeAt(K-2)<<16|aa.charCodeAt(K-1)<<8|128;break}S.push(ad);while((S.length&15)!==14){S.push(0)
}S.push(K>>>29);S.push((K<<3)&4294967295);for(P=0;P<S.length;P+=16){for(ad=0;ad<16;ad++){L[ad]=S[P+ad]}for(ad=16;ad<=79;ad++){L[ad]=M(L[ad-3]^L[ad-8]^L[ad-14]^L[ad-16],1)}Z=T;Y=R;X=Q;V=O;U=N;for(ad=0;ad<=19;ad++){ae=(M(Z,5)+((Y&X)|(~Y&V))+U+L[ad]+1518500249)&4294967295;U=V;V=X;X=M(Y,30);Y=Z;Z=ae}for(ad=20;ad<=39;ad++){ae=(M(Z,5)+(Y^X^V)+U+L[ad]+1859775393)&4294967295;U=V;V=X;X=M(Y,30);Y=Z;Z=ae}for(ad=40;ad<=59;ad++){ae=(M(Z,5)+((Y&X)|(Y&V)|(X&V))+U+L[ad]+2400959708)&4294967295;U=V;V=X;X=M(Y,30);Y=Z;Z=ae}for(ad=60;ad<=79;ad++){ae=(M(Z,5)+(Y^X^V)+U+L[ad]+3395469782)&4294967295;U=V;V=X;X=M(Y,30);Y=Z;Z=ae}T=(T+Z)&4294967295;R=(R+Y)&4294967295;Q=(Q+X)&4294967295;O=(O+V)&4294967295;N=(N+U)&4294967295}ae=ab(T)+ab(R)+ab(Q)+ab(O)+ab(N);return ae.toLowerCase()}function o(L,i,K){if(L==="translate.googleusercontent.com"){if(K===""){K=i}i=p(i,"u");L=y(i)}else{if(L==="cc.bingj.com"||L==="webcache.googleusercontent.com"||L.slice(0,5)==="74.6."){i=d.links[0].href;L=y(i)}}return[L,i,K]}function l(K){var i=K.length;
if(K.charAt(--i)==="."){K=K.slice(0,i)}if(K.slice(0,2)==="*."){K=K.slice(1)}return K}function F(ac,ay){var N=o(d.domain,I.location.href,f()),aQ=l(N[0]),a3=N[1],aE=N[2],aC="GET",M=ac||"",aU=ay||"",ao,ag=d.title,ai="7z|aac|ar[cj]|as[fx]|avi|bin|csv|deb|dmg|doc|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|ms[ip]|od[bfgpst]|og[gv]|pdf|phps|png|ppt|qtm?|ra[mr]?|rpm|sea|sit|tar|t?bz2?|tgz|torrent|txt|wav|wm[av]|wpd||xls|xml|z|zip",aA=[aQ],Q=[],at=[],ab=[],az=500,R,ad,S,T,ak=["pk_campaign","piwik_campaign","utm_campaign","utm_source","utm_medium"],af=["pk_kwd","piwik_kwd","utm_term"],a1="_pk_",V,a2,aW,an,Z=63072000000,aa=1800000,ap=15768000000,Y=d.location.protocol==="https",P=false,au={},aX=200,aK={},aV={},aH=false,aF=false,aD,av,W,aj=u,aG,am;function aY(a6){var a7;if(S){a7=new RegExp("#.*");return a6.replace(a7,"")}return a6}function aP(a8,a6){var a9=A(a6),a7;if(a9){return a6}if(a6.slice(0,1)==="/"){return A(a8)+"://"+y(a8)+a6}a8=aY(a8);if((a7=a8.indexOf("?"))>=0){a8=a8.slice(0,a7)
}if((a7=a8.lastIndexOf("/"))!==a8.length-1){a8=a8.slice(0,a7+1)}return a8+a6}function aB(a9){var a7,a6,a8;for(a7=0;a7<aA.length;a7++){a6=l(aA[a7].toLowerCase());if(a9===a6){return true}if(a6.slice(0,1)==="."){if(a9===a6.slice(1)){return true}a8=a9.length-a6.length;if((a8>0)&&(a9.slice(a8)===a6)){return true}}}return false}function a5(a6){var a7=new Image(1,1);a7.onLoad=function(){};a7.src=M+(M.indexOf("?")<0?"?":"&")+a6}function aM(a6){try{var a8=I.XDomainRequest?new I.XDomainRequest():I.XMLHttpRequest?new I.XMLHttpRequest():I.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null;a8.open("POST",M,true);a8.onreadystatechange=function(){if(this.readyState===4&&this.status!==200){a5(a6)}};a8.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");a8.send(a6)}catch(a7){a5(a6)}}function al(a8,a7){var a6=new Date();if(!aW){if(aC==="POST"){aM(a8)}else{a5(a8)}m=a6.getTime()+a7}}function aL(a6){return a1+a6+"."+aU+"."+aG}function O(){var a6=aL("testcookie");if(!b(j.cookieEnabled)){s(a6,"1");
return G(a6)==="1"?"1":"0"}return j.cookieEnabled?"1":"0"}function aw(){aG=aj((V||aQ)+(a2||"/")).slice(0,4)}function X(){var a7=aL("cvar"),a6=G(a7);if(a6.length){a6=JSON2.parse(a6);if(n(a6)){return a6}}return{}}function L(){if(P===false){P=X()}}function aT(){var a6=new Date();aD=a6.getTime()}function U(ba,a7,a6,a9,a8,bb){s(aL("id"),ba+"."+a7+"."+a6+"."+a9+"."+a8+"."+bb,Z,a2,V,Y)}function K(){var a7=new Date(),a6=Math.round(a7.getTime()/1000),a9=G(aL("id")),a8;if(a9){a8=a9.split(".");a8.unshift("0")}else{if(!am){am=aj((j.userAgent||"")+(j.platform||"")+JSON2.stringify(aV)+a6).slice(0,16)}a8=["1",am,a6,0,a6,"",""]}return a8}function i(){var a6=G(aL("ref"));if(a6.length){try{a6=JSON2.parse(a6);if(n(a6)){return a6}}catch(a7){}}return["","",0,""]}function ah(a8,bw,bx,ba){var bu,a7=new Date(),bg=Math.round(a7.getTime()/1000),bz,bv,bc,bn,br,bf,bp,bd,bt,bb=1024,bA,bj,bq=P,bl=aL("id"),bh=aL("ses"),bi=aL("ref"),bB=aL("cvar"),bo=K(),bk=G(bh),bs=i(),by=ao||a3,be,a6;if(aW){s(bl,"",-1,a2,V);s(bh,"",-1,a2,V);
s(bB,"",-1,a2,V);s(bi,"",-1,a2,V);return""}bz=bo[0];bv=bo[1];bn=bo[2];bc=bo[3];br=bo[4];bf=bo[5];if(!b(bo[6])){bo[6]=""}bp=bo[6];if(!b(ba)){ba=""}be=bs[0];a6=bs[1];bd=bs[2];bt=bs[3];if(!bk){bc++;bf=br;if(!an||!be.length){for(bu in ak){if(Object.prototype.hasOwnProperty.call(ak,bu)){be=p(by,ak[bu]);if(be.length){break}}}for(bu in af){if(Object.prototype.hasOwnProperty.call(af,bu)){a6=p(by,af[bu]);if(a6.length){break}}}}bA=y(aE);bj=bt.length?y(bt):"";if(bA.length&&!aB(bA)&&(!an||!bj.length||aB(bj))){bt=aE}if(bt.length||be.length){bd=bg;bs=[be,a6,bd,aY(bt.slice(0,bb))];s(bi,JSON2.stringify(bs),ap,a2,V,Y)}}a8+="&idsite="+aU+"&rec=1&r="+String(Math.random()).slice(2,8)+"&h="+a7.getHours()+"&m="+a7.getMinutes()+"&s="+a7.getSeconds()+"&url="+e(aY(by))+(aE.length?"&urlref="+e(aY(aE)):"")+"&_id="+bv+"&_idts="+bn+"&_idvc="+bc+"&_idn="+bz+(be.length?"&_rcn="+e(be):"")+(a6.length?"&_rck="+e(a6):"")+"&_refts="+bd+"&_viewts="+bf+(String(bp).length?"&_ects="+bp:"")+(String(bt).length?"&_ref="+e(aY(bt.slice(0,bb))):"");
var a9=JSON2.stringify(au);if(a9.length>2){a8+="&cvar="+e(a9)}for(bu in aV){if(Object.prototype.hasOwnProperty.call(aV,bu)){a8+="&"+bu+"="+aV[bu]}}if(bw){a8+="&data="+e(JSON2.stringify(bw))}else{if(T){a8+="&data="+e(JSON2.stringify(T))}}if(P){var bm=JSON2.stringify(P);if(bm.length>2){a8+="&_cvar="+e(bm)}for(bu in bq){if(Object.prototype.hasOwnProperty.call(bq,bu)){if(P[bu][0]===""||P[bu][1]===""){delete P[bu]}}}s(bB,JSON2.stringify(P),aa,a2,V,Y)}U(bv,bn,bc,bg,bf,b(ba)&&String(ba).length?ba:bp);s(bh,"*",aa,a2,V,Y);a8+=g(bx);return a8}function aO(a9,a8,bd,ba,a6,bg){var bb="idgoal=0",bc,a7=new Date(),be=[],bf;if(String(a9).length){bb+="&ec_id="+e(a9);bc=Math.round(a7.getTime()/1000)}bb+="&revenue="+a8;if(String(bd).length){bb+="&ec_st="+bd}if(String(ba).length){bb+="&ec_tx="+ba}if(String(a6).length){bb+="&ec_sh="+a6}if(String(bg).length){bb+="&ec_dt="+bg}if(aK){for(bf in aK){if(Object.prototype.hasOwnProperty.call(aK,bf)){if(!b(aK[bf][1])){aK[bf][1]=""}if(!b(aK[bf][2])){aK[bf][2]=""}if(!b(aK[bf][3])||String(aK[bf][3]).length===0){aK[bf][3]=0
}if(!b(aK[bf][4])||String(aK[bf][4]).length===0){aK[bf][4]=1}be.push(aK[bf])}}bb+="&ec_items="+e(JSON2.stringify(be))}bb=ah(bb,T,"ecommerce",bc);al(bb,az)}function aN(a6,ba,a9,a8,a7,bb){if(String(a6).length&&b(ba)){aO(a6,ba,a9,a8,a7,bb)}}function a0(a6){if(b(a6)){aO("",a6,"","","","")}}function ar(a9,ba){var a6=new Date(),a8=ah("action_name="+e(a9||ag),ba,"log");al(a8,az);if(R&&ad&&!aF){aF=true;t(d,"click",aT);t(d,"mouseup",aT);t(d,"mousedown",aT);t(d,"mousemove",aT);t(d,"mousewheel",aT);t(I,"DOMMouseScroll",aT);t(I,"scroll",aT);t(d,"keypress",aT);t(d,"keydown",aT);t(d,"keyup",aT);t(I,"resize",aT);t(I,"focus",aT);t(I,"blur",aT);aD=a6.getTime();setTimeout(function a7(){var bb=new Date(),bc;if((aD+ad)>bb.getTime()){if(R<bb.getTime()){bc=ah("ping=1",ba,"ping");al(bc,az)}setTimeout(a7,ad)}},ad)}}function ax(a6,a9,a8){var a7=ah("idgoal="+a6+(a9?"&revenue="+a9:""),a8,"goal");al(a7,az)}function aS(a7,a6,a9){var a8=ah(a6+"="+e(aY(a7)),a9,"link");al(a8,az)}function ae(a8,a7){var a9,a6="(^| )(piwik[_-]"+a7;
if(a8){for(a9=0;a9<a8.length;a9++){a6+="|"+a8[a9]}}a6+=")( |$)";return new RegExp(a6)}function aR(a9,a6,ba){if(!ba){return"link"}var a8=ae(at,"download"),a7=ae(ab,"link"),bb=new RegExp("\\.("+ai+")([?&#]|$)","i");return a7.test(a9)?"link":(a8.test(a9)||bb.test(a6)?"download":0)}function aJ(bb){var a9,a7,a6;while((a9=bb.parentNode)!==null&&b(a9)&&((a7=bb.tagName.toUpperCase())!=="A"&&a7!=="AREA")){bb=a9}if(b(bb.href)){var bc=bb.hostname||y(bb.href),bd=bc.toLowerCase(),a8=bb.href.replace(bc,bd),ba=new RegExp("^(javascript|vbscript|jscript|mocha|livescript|ecmascript):","i");if(!ba.test(a8)){a6=aR(bb.className,a8,aB(bd));if(a6){a8=E(a8);aS(a8,a6)}}}}function a4(a6){var a7,a8;a6=a6||I.event;a7=a6.which||a6.button;a8=a6.target||a6.srcElement;if(a6.type==="click"){if(a8){aJ(a8)}}else{if(a6.type==="mousedown"){if((a7===1||a7===2)&&a8){av=a7;W=a8}else{av=W=null}}else{if(a6.type==="mouseup"){if(a7===av&&a8===W){aJ(a8)}av=W=null}}}}function aI(a7,a6){if(a6){t(a7,"mouseup",a4,false);t(a7,"mousedown",a4,false)
}else{t(a7,"click",a4,false)}}function aq(a7){if(!aH){aH=true;var a8,a6=ae(Q,"ignore"),a9=d.links;if(a9){for(a8=0;a8<a9.length;a8++){if(!a6.test(a9[a8].className)){aI(a9[a8],a7)}}}}}function aZ(){var a6,a7,a8={pdf:"application/pdf",qt:"video/quicktime",realp:"audio/x-pn-realaudio-plugin",wma:"application/x-mplayer2",dir:"application/x-director",fla:"application/x-shockwave-flash",java:"application/x-java-vm",gears:"application/x-googlegears",ag:"application/x-silverlight"};if(j.mimeTypes&&j.mimeTypes.length){for(a6 in a8){if(Object.prototype.hasOwnProperty.call(a8,a6)){a7=j.mimeTypes[a8[a6]];aV[a6]=(a7&&a7.enabledPlugin)?"1":"0"}}}if(typeof navigator.javaEnabled!=="unknown"&&b(j.javaEnabled)&&j.javaEnabled()){aV.java="1"}if(a(I.GearsFactory)){aV.gears="1"}aV.res=v.width+"x"+v.height;aV.cookie=O()}aZ();aw();return{getVisitorId:function(){return(K())[1]},getVisitorInfo:function(){return K()},getAttributionInfo:function(){return i()},getAttributionCampaignName:function(){return i()[0]},getAttributionCampaignKeyword:function(){return i()[1]
},getAttributionReferrerTimestamp:function(){return i()[2]},getAttributionReferrerUrl:function(){return i()[3]},setTrackerUrl:function(a6){M=a6},setSiteId:function(a6){aU=a6},setCustomData:function(a6,a7){if(n(a6)){T=a6}else{if(!T){T=[]}T[a6]=a7}},getCustomData:function(){return T},setCustomVariable:function(a7,a6,ba,a8){var a9;if(!b(a8)){a8="visit"}if(a7>0){a9=[a6.slice(0,aX),ba.slice(0,aX)];if(a8==="visit"||a8===2){L();P[a7]=a9}else{if(a8==="page"||a8===3){au[a7]=a9}}}},getCustomVariable:function(a7,a8){var a6;if(!b(a8)){a8="visit"}if(a8==="page"||a8===3){a6=au[a7]}else{if(a8==="visit"||a8===2){L();a6=P[a7]}}if(!b(a6)||(a6&&a6[0]==="")){return false}return a6},deleteCustomVariable:function(a6,a7){if(this.getCustomVariable(a6,a7)){this.setCustomVariable(a6,"","",a7)}},setLinkTrackingTimer:function(a6){az=a6},setDownloadExtensions:function(a6){ai=a6},addDownloadExtensions:function(a6){ai+="|"+a6},setDomains:function(a6){aA=q(a6)?[a6]:a6;aA.push(aQ)},setIgnoreClasses:function(a6){Q=q(a6)?[a6]:a6
},setRequestMethod:function(a6){aC=a6||"GET"},setReferrerUrl:function(a6){aE=a6},setCustomUrl:function(a6){ao=aP(a3,a6)},setDocumentTitle:function(a6){ag=a6},setDownloadClasses:function(a6){at=q(a6)?[a6]:a6},setLinkClasses:function(a6){ab=q(a6)?[a6]:a6},setCampaignNameKey:function(a6){ak=q(a6)?[a6]:a6},setCampaignKeywordKey:function(a6){af=q(a6)?[a6]:a6},discardHashTag:function(a6){S=a6},setCookieNamePrefix:function(a6){a1=a6;P=X()},setCookieDomain:function(a6){V=l(a6);aw()},setCookiePath:function(a6){a2=a6;aw()},setVisitorCookieTimeout:function(a6){Z=a6*1000},setSessionCookieTimeout:function(a6){aa=a6*1000},setReferralCookieTimeout:function(a6){ap=a6*1000},setConversionAttributionFirstReferrer:function(a6){an=a6},setDoNotTrack:function(a6){aW=a6&&j.doNotTrack},addListener:function(a7,a6){aI(a7,a6)},enableLinkTracking:function(a6){if(h){aq(a6)}else{C.push(function(){aq(a6)})}},setHeartBeatTimer:function(a8,a7){var a6=new Date();R=a6.getTime()+a8*1000;ad=a7*1000},killFrame:function(){if(I.location!==I.top.location){I.top.location=I.location
}},redirectFile:function(a6){if(I.location.protocol==="file:"){I.location=a6}},trackGoal:function(a6,a8,a7){ax(a6,a8,a7)},trackLink:function(a7,a6,a8){aS(a7,a6,a8)},trackPageView:function(a6,a7){ar(a6,a7)},setEcommerceView:function(a9,a6,a8,a7){if(!b(a8)||!a8.length){a8=""}au[5]=["_pkc",a8];if(b(a7)&&String(a7).length){au[2]=["_pkp",a7]}if((!b(a9)||!a9.length)&&(!b(a6)||!a6.length)){return}if(b(a9)&&a9.length){au[3]=["_pks",a9]}if(!b(a6)||!a6.length){a6=""}au[4]=["_pkn",a6]},addEcommerceItem:function(ba,a6,a8,a7,a9){if(ba.length){aK[ba]=[ba,a6,a8,a7,a9]}},trackEcommerceOrder:function(a6,ba,a9,a8,a7,bb){aN(a6,ba,a9,a8,a7,bb)},trackEcommerceCartUpdate:function(a6){a0(a6)}}}function c(){return{push:z}}t(I,"beforeunload",B,false);x();H=new F();for(D=0;D<_paq.length;D++){z(_paq[D])}_paq=new c();return{addPlugin:function(i,K){w[i]=K},getTracker:function(i,K){return new F(i,K)},getAsyncTracker:function(){return H}}}()),piwik_track,piwik_log=function(b,f,d,g){function a(h){try{return eval("piwik_"+h)
}catch(i){}return}var c,e=Piwik.getTracker(d,f);e.setDocumentTitle(b);e.setCustomData(g);c=a("tracker_pause");if(c){e.setLinkTrackingTimer(c)}c=a("download_extensions");if(c){e.setDownloadExtensions(c)}c=a("hosts_alias");if(c){e.setDomains(c)}c=a("ignore_classes");if(c){e.setIgnoreClasses(c)}e.trackPageView();if(a("install_tracker")){piwik_track=function(i,k,j,h){e.setSiteId(k);e.setTrackerUrl(j);e.trackLink(i,h)};e.enableLinkTracking()}};/* bundling js/versioned//jquery.markitup-1.1.10-uwe.js */
// ----------------------------------------------------------------------------
// markItUp! Universal MarkUp Engine, JQuery plugin
// v 1.1.x
// Dual licensed under the MIT and GPL licenses.
// ----------------------------------------------------------------------------
// Copyright (C) 2007-2010 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ----------------------------------------------------------------------------
(function($) {
	$.fn.markItUp = function(settings, extraSettings) {
		var options, ctrlKey, shiftKey, altKey;
		ctrlKey = shiftKey = altKey = false;
	
		options = {	id:						'',
					nameSpace:				'',
					root:					'',
					previewInWindow:		'', // 'width=800, height=600, resizable=yes, scrollbars=yes'
					previewAutoRefresh:		true,
					previewPosition:		'after',
					previewTemplatePath:	'~/templates/preview.html',
					previewParserPath:		'',
					previewParserVar:		'data',
					resizeHandle:			true,
					beforeInsert:			'',
					afterInsert:			'',
					onEnter:				{},
					onShiftEnter:			{},
					onCtrlEnter:			{},
					onTab:					{},
					markupSet:			[	{ /* set */ } ]
				};
		$.extend(options, settings, extraSettings);

		// compute markItUp! path
		if (!options.root) {
			$('script').each(function(a, tag) {
				miuScript = $(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);
				if (miuScript !== null) {
					options.root = miuScript[1];
				}
			});
		}

		return this.each(function() {
			var $$, textarea, levels, scrollPosition, caretPosition, caretOffset,
				clicked, hash, header, footer, previewWindow, template, iFrame, abort;
			$$ = $(this);
			textarea = this;
			levels = [];
			abort = false;
			scrollPosition = caretPosition = 0;
			caretOffset = -1;

			options.previewParserPath = localize(options.previewParserPath);
			options.previewTemplatePath = localize(options.previewTemplatePath);

			// apply the computed path to ~/
			function localize(data, inText) {
				if (inText) {
					return 	data.replace(/("|')~\//g, "$1"+options.root);
				}
				return 	data.replace(/^~\//, options.root);
			}

			// init and build editor
			function init() {
				id = ''; nameSpace = '';
				if (options.id) {
					id = 'id="'+options.id+'"';
				} else if ($$.attr("id")) {
					id = 'id="markItUp'+($$.attr("id").substr(0, 1).toUpperCase())+($$.attr("id").substr(1))+'"';

				}
				if (options.nameSpace) {
					nameSpace = 'class="'+options.nameSpace+'"';
				}
				$$.wrap('<div '+nameSpace+'></div>');
				$$.wrap('<div '+id+' class="markItUp"></div>');
				$$.wrap('<div class="markItUpContainer"></div>');
				$$.addClass("markItUpEditor");

				// add the header before the textarea
				header = $('<div class="markItUpHeader"></div>').insertBefore($$);
				$(dropMenus(options.markupSet)).appendTo(header);

				// add the footer after the textarea
				footer = $('<div class="markItUpFooter"></div>').insertAfter($$);

				// add the resize handle after textarea
				if (options.resizeHandle === true && $.browser.safari !== true) {
					resizeHandle = $('<div class="markItUpResizeHandle"></div>')
						.insertAfter($$)
						.bind("mousedown", function(e) {
							var h = $$.height(), y = e.clientY, mouseMove, mouseUp;
							mouseMove = function(e) {
								$$.css("height", Math.max(20, e.clientY+h-y)+"px");
								return false;
							};
							mouseUp = function(e) {
								$("html").unbind("mousemove", mouseMove).unbind("mouseup", mouseUp);
								return false;
							};
							$("html").bind("mousemove", mouseMove).bind("mouseup", mouseUp);
					});
					footer.append(resizeHandle);
				}

				// listen key events
				$$.keydown(keyPressed).keyup(keyPressed);
				
				// bind an event to catch external calls
				$$.bind("insertion", function(e, settings) {
					if (settings.target !== false) {
						get();
					}
					if (textarea === $.markItUp.focused) {
						markup(settings);
					}
				});

				// remember the last focus
				$$.focus(function() {
					$.markItUp.focused = this;
				});
			}

			// recursively build header with dropMenus from markupset
			function dropMenus(markupSet) {
				var ul = $('<ul></ul>'), i = 0;
				$('li:hover > ul', ul).css('display', 'block');
				$.each(markupSet, function() {
					var button = this, t = '', title, li, j;
					if (button.title)
					    title=button.title;
					else
					    title = (button.key) ? (button.name||'')+' [Ctrl+'+button.key+']' : (button.name||'');
					key   = (button.key) ? 'accesskey="'+button.key+'"' : '';
					if (button.separator) {
						li = $('<li class="markItUpSeparator">'+(button.separator||'')+'</li>').appendTo(ul);
					} else {
						i++;
						for (j = levels.length -1; j >= 0; j--) {
							t += levels[j]+"-";
						}
						li = $('<li class="markItUpButton markItUpButton'+t+(i)+' '+(button.className||'')+'"><a href="" '+key+' title="'+title+'">'+(button.name||'')+'</a></li>')
						.bind("contextmenu", function() { // prevent contextmenu on mac and allow ctrl+click
							return false;
						}).click(function() {
							return false;
						}).bind("focusin", function(){
                            $$.focus();
						}).mousedown(function() {
							if (button.call) {
								eval(button.call)();
							}
							setTimeout(function() { markup(button) },1);
							return false;
						}).hover(function() {
								$('> ul', this).show();
								$(document).one('click', function() { // close dropmenu if click outside
										$('ul ul', header).hide();
									}
								);
							}, function() {
								$('> ul', this).hide();
							}
						).appendTo(ul);
						if (button.dropMenu) {
							levels.push(i);
							$(li).addClass('markItUpDropMenu').append(dropMenus(button.dropMenu));
						}
					}
				}); 
				levels.pop();
				return ul;
			}

			// markItUp! markups
			function magicMarkups(string) {
				if (string) {
					string = string.toString();
					string = string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,
						function(x, a) {
							var b = a.split('|!|');
							if (altKey === true) {
								return (b[1] !== undefined) ? b[1] : b[0];
							} else {
								return (b[1] === undefined) ? "" : b[0];
							}
						}
					);
					// [![prompt]!], [![prompt:!:value]!]
					string = string.replace(/\[\!\[([\s\S]*?)\]\!\]/g,
						function(x, a) {
							var b = a.split(':!:');
							if (abort === true) {
								return false;
							}
							value = prompt(b[0], (b[1]) ? b[1] : '');
							if (value === null) {
								abort = true;
							}
							return value;
						}
					);
					return string;
				}
				return "";
			}

			// prepare action
			function prepare(action) {
				if ($.isFunction(action)) {
					action = action(hash);
				}
				return magicMarkups(action);
			}

			// build block to insert
			function build(string) {
				var openWith 	= prepare(clicked.openWith);
				var placeHolder = prepare(clicked.placeHolder);
				var replaceWith = prepare(clicked.replaceWith);
				var closeWith 	= prepare(clicked.closeWith);
				if (replaceWith !== "") {
					block = openWith + replaceWith + closeWith;
				} else if (selection === '' && placeHolder !== '') {
					block = openWith + placeHolder + closeWith;
				} else {
					string = string || selection;						
					if (string.match(/ $/)) {
						block = openWith + string.replace(/ $/, '') + closeWith + ' ';
					} else {
						block = openWith + string + closeWith;
					}
				}
				return {	block:block, 
							openWith:openWith, 
							replaceWith:replaceWith, 
							placeHolder:placeHolder,
							closeWith:closeWith
					};
			}

			// define markup to insert
			function markup(button) {
				var len, j, n, i;
				hash = clicked = button;
				get();

				$.extend(hash, {	line:"", 
						 			root:options.root,
									textarea:textarea, 
									selection:(selection||''), 
									caretPosition:caretPosition,
									ctrlKey:ctrlKey, 
									shiftKey:shiftKey, 
									altKey:altKey
								}
							);
				// callbacks before insertion
				prepare(options.beforeInsert);
				prepare(clicked.beforeInsert);
				if (ctrlKey === true && shiftKey === true) {
					prepare(clicked.beforeMultiInsert);
				}			
				$.extend(hash, { line:1 });
				
				if (ctrlKey === true && shiftKey === true) {
					lines = selection.split(/\r?\n/);
					for (j = 0, n = lines.length, i = 0; i < n; i++) {
						if ($.trim(lines[i]) !== '') {
							$.extend(hash, { line:++j, selection:lines[i] } );
							lines[i] = build(lines[i]).block;
						} else {
							lines[i] = "";
						}
					}
					string = { block:lines.join('\n')};
					start = caretPosition;
					len = string.block.length + (($.browser.opera) ? n-1 : 0);
				} else if (ctrlKey === true) {
					string = build(selection);
					start = caretPosition + string.openWith.length;
					len = string.block.length - string.openWith.length - string.closeWith.length;
					len = len - (string.block.match(/ $/) ? 1 : 0);
					len -= fixIeBug(string.block);
				} else if (shiftKey === true) {
					string = build(selection);
					start = caretPosition;
					len = string.block.length;
					len -= fixIeBug(string.block);
				} else {
					string = build(selection);
					start = caretPosition + string.block.length ;
					len = 0;
					start -= fixIeBug(string.block);
				}
				if ((selection === '' && string.replaceWith === '')) {
					caretOffset += fixOperaBug(string.block);
					
					start = caretPosition + string.openWith.length;
					len = string.block.length - string.openWith.length - string.closeWith.length;

					caretOffset = $$.val().substring(caretPosition,  $$.val().length).length;
					caretOffset -= fixOperaBug($$.val().substring(0, caretPosition));
				}
				$.extend(hash, { caretPosition:caretPosition, scrollPosition:scrollPosition } );

				if (string.block !== selection && abort === false) {
					insert(string.block);
					set(start, len);
				} else {
					caretOffset = -1;
				}
				get();

				$.extend(hash, { line:'', selection:selection });

				// callbacks after insertion
				if (ctrlKey === true && shiftKey === true) {
					prepare(clicked.afterMultiInsert);
				}
				prepare(clicked.afterInsert);
				prepare(options.afterInsert);

				// refresh preview if opened
				if (previewWindow && options.previewAutoRefresh) {
					refreshPreview(); 
				}
																									
				// reinit keyevent
				shiftKey = altKey = ctrlKey = abort = false;
			}

			// Substract linefeed in Opera
			function fixOperaBug(string) {
				if ($.browser.opera) {
					return string.length - string.replace(/\n*/g, '').length;
				}
				return 0;
			}
			// Substract linefeed in IE
			function fixIeBug(string) {
				if ($.browser.msie) {
					return string.length - string.replace(/\r/g, '').length;
				}
				return 0;
			}
				
			// add markup
			function insert(block) {	
				if (document.selection) {
					var newSelection = document.selection.createRange();
					newSelection.text = block;
				} else {
					textarea.value =  textarea.value.substring(0, caretPosition)  + block + textarea.value.substring(caretPosition + selection.length, textarea.value.length);
				}
			}

			// set a selection
			function set(start, len) {
				if (textarea.createTextRange){
					// quick fix to make it work on Opera 9.5
					if ($.browser.opera && $.browser.version >= 9.5 && len == 0) {
						return false;
					}
					range = textarea.createTextRange();
					range.collapse(true);
					range.moveStart('character', start); 
					range.moveEnd('character', len); 
					range.select();
				} else if (textarea.setSelectionRange ){
					textarea.setSelectionRange(start, start + len);
				}
				textarea.scrollTop = scrollPosition;
				textarea.focus();
			}

			// get the selection
			function get() {
				textarea.focus();

				scrollPosition = textarea.scrollTop;
				if (document.selection) {
					selection = document.selection;	
					if ($.browser.msie) { // ie	
						var range = selection.createRange();
						var stored_range = range.duplicate();
						stored_range.moveToElementText(textarea);
						stored_range.setEndPoint('EndToEnd', range);
						var s = stored_range.text.length - range.text.length;
	
						caretPosition = s - (textarea.value.substr(0, s).length - textarea.value.substr(0, s).replace(/\r/g, '').length);
						selection = range.text;
					} else { // opera
						caretPosition = textarea.selectionStart;
					}
				} else { // gecko & webkit
					caretPosition = textarea.selectionStart;
					selection = textarea.value.substring(caretPosition, textarea.selectionEnd);
				} 
				return selection;
			}

			// open preview window
			function preview() {
				if (!previewWindow || previewWindow.closed) {
					if (options.previewInWindow) {
						previewWindow = window.open('', 'preview', options.previewInWindow);
						$(window).unload(function() {
							previewWindow.close();
						});
					} else {
						iFrame = $('<iframe class="markItUpPreviewFrame"></iframe>');
						if (options.previewPosition == 'after') {
							iFrame.insertAfter(footer);
						} else {
							iFrame.insertBefore(header);
						}	
						previewWindow = iFrame[iFrame.length - 1].contentWindow || frame[iFrame.length - 1];
					}
				} else if (altKey === true) {
					if (iFrame) {
						iFrame.remove();
					} else {
						previewWindow.close();
					}
					previewWindow = iFrame = false;
				}
				if (!options.previewAutoRefresh) {
					refreshPreview(); 
				}
				if (options.previewInWindow) {
					previewWindow.focus();
				}
			}

			// refresh Preview window
			function refreshPreview() {
 				renderPreview();
			}

			function renderPreview() {		
				var phtml;
				if (options.previewParserPath !== '') {
					$.ajax({
						type: 'POST',
						dataType: 'text',
						global: false,
						url: options.previewParserPath,
						data: options.previewParserVar+'='+encodeURIComponent($$.val()),
						success: function(data) {
							writeInPreview( localize(data, 1) ); 
						}
					});
				} else {
					if (!template) {
						$.ajax({
							url: options.previewTemplatePath,
							dataType: 'text',
							global: false,
							success: function(data) {
								writeInPreview( localize(data, 1).replace(/<!-- content -->/g, $$.val()) );
							}
						});
					}
				}
				return false;
			}
			
			function writeInPreview(data) {
				if (previewWindow.document) {			
					try {
						sp = previewWindow.document.documentElement.scrollTop
					} catch(e) {
						sp = 0;
					}	
					previewWindow.document.open();
					previewWindow.document.write(data);
					previewWindow.document.close();
					previewWindow.document.documentElement.scrollTop = sp;
				}
			}
			
			// set keys pressed
			function keyPressed(e) { 
				shiftKey = e.shiftKey;
				altKey = e.altKey;
				ctrlKey = (!(e.altKey && e.ctrlKey)) ? e.ctrlKey : false;

				if (e.type === 'keydown') {
					if (ctrlKey === true) {
						li = $("a[accesskey="+String.fromCharCode(e.keyCode)+"]", header).parent('li');
						if (li.length !== 0) {
							ctrlKey = false;
							setTimeout(function() {
								li.triggerHandler('mousedown');
							},1);
							return false;
						}
					}
					if (e.keyCode === 13 || e.keyCode === 10) { // Enter key
						if (ctrlKey === true) {  // Enter + Ctrl
							ctrlKey = false;
							markup(options.onCtrlEnter);
							return options.onCtrlEnter.keepDefault;
						} else if (shiftKey === true) { // Enter + Shift
							shiftKey = false;
							markup(options.onShiftEnter);
							return options.onShiftEnter.keepDefault;
						} else { // only Enter
							markup(options.onEnter);
							return options.onEnter.keepDefault;
						}
					}
					if (e.keyCode === 9) { // Tab key
						if (shiftKey == true || ctrlKey == true || altKey == true) {
							return false; 
						}
						if (caretOffset !== -1) {
							get();
							caretOffset = $$.val().length - caretOffset;
							set(caretOffset, 0);
							caretOffset = -1;
							return false;
						} else {
							markup(options.onTab);
							return options.onTab.keepDefault;
						}
					}
				}
			}

			init();
		});
	};

	$.fn.markItUpRemove = function() {
		return this.each(function() {
				var $$ = $(this).unbind().removeClass('markItUpEditor');
				$$.parent('div').parent('div.markItUp').parent('div').replaceWith($$);
			}
		);
	};

	$.markItUp = function(settings) {
		var options = { target:false };
		$.extend(options, settings);
		if (options.target) {
			return $(options.target).each(function() {
				$(this).focus();
				$(this).trigger('insertion', [options]);
			});
		} else {
			$('textarea').trigger('insertion', [options]);
		}
	};
})(jQuery);
/* bundling modules/autocomplete/autocomplete.js */
/*
 * jQuery Autocomplete plugin 1.2.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
 *
 * With small modifications by Alfonso Gómez-Arzola.
 * See changelog for details.
 *
 * modified by uwe@ohse.de for use in UF, after jquery-ui autocomplete was broken again.
 *
 */

;(function($) {

$.fn.extend({
	autocomplete: function(urlOrData, options) {
		var isUrl = typeof urlOrData == "string";
		options = $.extend({}, $.Autocompleter.defaults, {
			url: isUrl ? urlOrData : null,
			data: isUrl ? null : urlOrData,
			delay: isUrl ? $.Autocompleter.defaults.delay : 10,
			max: options && !options.scroll ? 10 : 150
		}, options);

		// if highlight is set to false, replace it with a do-nothing function
		options.highlight = options.highlight || function(value) { return value; };

		// if the formatMatch option is not specified, then use formatItem for backwards compatibility
		options.formatMatch = options.formatMatch || options.formatItem;

		return this.each(function() {
			new $.Autocompleter(this, options);
		});
	},
	result: function(handler) {
		return this.bind("result", handler);
	},
	search: function(handler) {
		return this.trigger("search", [handler]);
	},
	flushCache: function() {
		return this.trigger("flushCache");
	},
	setOptions: function(options){
		return this.trigger("setOptions", [options]);
	},
	unautocomplete: function() {
		return this.trigger("unautocomplete");
	}
});

$.Autocompleter = function(input, options) {

	var KEY = {
		UP: 38,
		DOWN: 40,
		DEL: 46,
		TAB: 9,
		RETURN: 13,
		ESC: 27,
		COMMA: 188,
		PAGEUP: 33,
		PAGEDOWN: 34,
		BACKSPACE: 8
	};

	// Create $ object for input element
	var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);

	var timeout;
	var previousValue = "";
	var cache = $.Autocompleter.Cache(options);
	var hasFocus = 0;
	var lastKeyPressCode;
	var config = {
		mouseDownOnSelect: false
	};
	var select = $.Autocompleter.Select(options, input, selectCurrent, config);
	
	var blockSubmit;
	
	// prevent form submit in opera when selecting with return key
	$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
		if (blockSubmit) {
			blockSubmit = false;
			return false;
		}
	});
	
	// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
	$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
		// a keypress means the input has focus
		// avoids issue where input had focus before the autocomplete was applied
		hasFocus = 1;
		// track last key pressed
		lastKeyPressCode = event.keyCode;
		switch(event.keyCode) {
		
			case KEY.UP:
				if ( select.visible() ) {
					event.preventDefault();
					select.prev();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.DOWN:
				if ( select.visible() ) {
					event.preventDefault();
					select.next();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEUP:
				if ( select.visible() ) {
  				event.preventDefault();
					select.pageUp();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEDOWN:
				if ( select.visible() ) {
  				event.preventDefault();
					select.pageDown();
				} else {
					onChange(0, true);
				}
				break;
			
			// matches also semicolon
			case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
			case KEY.TAB:
			case KEY.RETURN:
				if( selectCurrent() ) {
					// stop default to prevent a form submit, Opera needs special handling
					event.preventDefault();
					blockSubmit = true;
					return false;
				}
				break;
				
			case KEY.ESC:
				select.hide();
				break;
				
			default:
				clearTimeout(timeout);
				timeout = setTimeout(onChange, options.delay);
				break;
		}
	}).focus(function(){
		// track whether the field has focus, we shouldn't process any
		// results if the field no longer has focus
		hasFocus++;
	}).blur(function() {
	  var term=$(this).val();
	  if (term>'') {
	        var thing=$(this);
		var extraParams = {
			timestamp: +new Date()
		};
		$.each(options.extraParams, function(key, param) {
			extraParams[key] = typeof param == "function" ? param() : param;
		});
		$.ajax({
			// try to leverage ajaxQueue plugin to abort previous requests
			mode: "abort",
			// limit abortion to this input
			port: "autocomplete" + input.name,
			dataType: "json",
			type: "POST",
			url: options.url,
			data: $.extend({
				q: lastWord(term),
				limit: options.max
			}, extraParams),
			success: function(data) {
			    var d=data.pai_data;
			    if (d.length==1) {
				$(thing).val(d[0].value);
				$input.trigger("result", d[0].value);
			    }
			}
		});
	  }
	  hasFocus = 0;
		if (!config.mouseDownOnSelect) {
			hideResults();
		}
	}).click(function() {
		// show select when clicking in a focused field
		// but if clickFire is true, don't require field
		// to be focused to begin with; just show select
		if( options.clickFire ) {
		  if ( !select.visible() ) {
  			onChange(0, true);
  		}
		} else {
		  if ( hasFocus++ > 1 && !select.visible() ) {
  			onChange(0, true);
  		}
		}
	}).bind("search", function() {
		// TODO why not just specifying both arguments?
		var fn = (arguments.length > 1) ? arguments[1] : null;
		function findValueCallback(q, data) {
			var result;
			if( data && data.length ) {
				for (var i=0; i < data.length; i++) {
					if( data[i].name.toLowerCase() == q.toLowerCase() ) {
						result = data[i];
						break;
					}
				}
			}
			if( typeof fn == "function" ) fn(result);
			else $input.trigger("result", result && result.value);
		}
		$.each(trimWords($input.val()), function(i, value) {
			request(value, findValueCallback, findValueCallback);
		});
	}).bind("flushCache", function() {
		cache.flush();
	}).bind("setOptions", function() {
		$.extend(true, options, arguments[1]);
		// if we've updated the data, repopulate
		if ( "data" in arguments[1] )
			cache.populate();
	}).bind("unautocomplete", function() {
		select.unbind();
		$input.unbind();
		$(input.form).unbind(".autocomplete");
	});
	
	
	function selectCurrent() {
		var v = select.selected();

		if( !v )
			return false;
		previousValue = v;

		if ( options.multiple ) {
			var words = trimWords($input.val());
			if ( words.length > 1 ) {
				var seperator = options.multipleSeparator.length;
				var cursorAt = $(input).selection().start;
				var wordAt, progress = 0;
				$.each(words, function(i, word) {
					progress += word.length;
					if (cursorAt <= progress) {
						wordAt = i;
						return false;
					}
					progress += seperator;
				});
				words[wordAt] = v;
				// TODO this should set the cursor to the right position, but it gets overriden somewhere
				//$.Autocompleter.Selection(input, progress + seperator, progress + seperator);
				v = words.join( options.multipleSeparator );
			}
			v += options.multipleSeparator;
		}
		
		$input.val(v);
		hideResultsNow();
		$input.trigger("result", v);
		return true;
	}
	
	function onChange(crap, skipPrevCheck) {
		if( lastKeyPressCode == KEY.DEL ) {
			select.hide();
			return;
		}
		
		var currentValue = $input.val();
		
		if ( !skipPrevCheck && currentValue == previousValue )
			return;

		previousValue = currentValue;
		
		currentValue = lastWord(currentValue);
		if ( currentValue.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			if (!options.matchCase)
				currentValue = currentValue.toLowerCase();
			request(currentValue, receiveData, hideResultsNow);
		} else {
			stopLoading();
			select.hide();
		}
	};
	
	function trimWords(value) {
		if (!value)
			return [""];
		if (!options.multiple)
			return [$.trim(value)];
		return $.map(value.split(options.multipleSeparator), function(word) {
			return $.trim(value).length ? $.trim(word) : null;
		});
	}
	
	function lastWord(value) {
		if ( !options.multiple )
			return value;
		var words = trimWords(value);
		if (words.length == 1) 
			return words[0];
		var cursorAt = $(input).selection().start;
		if (cursorAt == value.length) {
			words = trimWords(value)
		} else {
			words = trimWords(value.replace(value.substring(cursorAt), ""));
		}
		return words[words.length - 1];
	}
	
	// fills in the input box w/the first match (assumed to be the best match)
	// q: the term entered
	// sValue: the first matching result
	function autoFill(q, sValue){
		// autofill in the complete box w/the first match as long as the user hasn't entered in more data
		// if the last user key pressed was backspace, don't autofill
		if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
			// select the portion of the value not typed by the user (so the next character will erase)
			$(input).selection(previousValue.length, previousValue.length + sValue.length);
		}
	};

	function hideResults() {
		clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		var wasVisible = select.visible();
		select.hide();
		clearTimeout(timeout);
		stopLoading();
		if (options.mustMatch) {
			// call search and run callback
			$input.search(
				function (result){
					// if no value found, clear the input box
					if( !result ) {
						if (options.multiple) {
							var words = trimWords($input.val()).slice(0, -1);
							$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
						}
						else {
							$input.val( "" );
							$input.trigger("result", null);
						}
					}
				}
			);
		}
	};

	function receiveData(q, data) {
		if ( data && data.length && hasFocus ) {
			stopLoading();
			select.display(data, q);
			autoFill(q, data[0].value);
			select.show();
		} else {
			hideResultsNow();
		}
	};

	function request(term, success, failure) {
		if (!options.matchCase)
			term = term.toLowerCase();
		var data = cache.load(term);
		// recieve the cached data
		if (data && data.length) {
			success(term, data);
		// if an AJAX url has been supplied, try loading the data now
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){

			var extraParams = {
				timestamp: +new Date()
			};
			$.each(options.extraParams, function(key, param) {
				extraParams[key] = typeof param == "function" ? param() : param;
			});

			$.ajax({
				// try to leverage ajaxQueue plugin to abort previous requests
				mode: "abort",
				// limit abortion to this input
				port: "autocomplete" + input.name,
				dataType: "json",
				type: "POST",
				url: options.url,
				data: $.extend({
					q: lastWord(term),
					limit: options.max
				}, extraParams),
				success: function(data) {
					cache.add(term, data.pai_data);
					success(term, data.pai_data);
				}
			});
		} else {
			// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
			select.emptyList();
			failure(term);
		}
	};

	function stopLoading() {
		$input.removeClass(options.loadingClass);
	};

};

$.Autocompleter.defaults = {
	inputClass: "ac_input",
	resultsClass: "ac_results",
	loadingClass: "ac_loading",
	minChars: 1,
	delay: 400,
	matchCase: false,
	matchSubset: true,
	matchContains: false,
	cacheLength: 100,
	max: 1000,
	mustMatch: false,
	extraParams: {},
	selectFirst: true,
	formatItem: function(row) { return row[0]; },
	formatMatch: null,
	autoFill: false,
	width: 0,
	multiple: false,
	multipleSeparator: " ",
	inputFocus: true,
	clickFire: false,
	highlight: function(value, term) {
		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
	},
    scroll: true,
    scrollHeight: 180
};

$.Autocompleter.Cache = function(options) {

	var data = {};
	var length = 0;
	
	function matchSubset(s, sub) {
		if (!options.matchCase) 
			s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (options.matchContains == "word"){
			i = s.toLowerCase().search("\\b" + sub.toLowerCase());
		}
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};
	
	function add(q, value) {
		if (length > options.cacheLength){
			flush();
		}
		if (!data[q]){ 
			length++;
		}
		data[q] = value;
	}
	
	function populate(){
		if( !options.data ) return false;
		// track the matches
		var stMatchSets = {},
			nullData = 0;

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( !options.url ) options.cacheLength = 1;
		
		// track all options for minChars = 0
		stMatchSets[""] = [];
		
		// loop through the array and create a lookup structure
		for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
			var rawValue = options.data[i];
			// if rawValue is a string, make an array otherwise just reference the array
			rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;

			var value = rawValue.value;
			if ( value === false )
				continue;

			var firstChar = value.charAt(0).toLowerCase();
			// if no lookup array for this character exists, look it up now
			if( !stMatchSets[firstChar] ) 
				stMatchSets[firstChar] = [];

			// if the match is a string
			var row = {
				value: value,
				data: rawValue,
				result: options.formatResult && options.formatResult(rawValue) || value
			};

			// push the current match into the set list
			stMatchSets[firstChar].push(row);

			// keep track of minChars zero items
			if ( nullData++ < options.max ) {
				stMatchSets[""].push(row);
			}
		};

		// add the data items to the cache
		$.each(stMatchSets, function(i, value) {
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			add(i, value);
		});
	}
	
	// populate any existing data
	setTimeout(populate, 25);
	
	function flush(){
		data = {};
		length = 0;
	}
	
	return {
		flush: flush,
		add: add,
		populate: populate,
		load: function(q) {
			if (!options.cacheLength || !length)
				return null;
			/* 
			 * if dealing w/local data and matchContains than we must make sure
			 * to loop through all the data collections looking for matches
			 */
			if( !options.url && options.matchContains ){
				// track all matches
				var csub = [];
				// loop through all the data grids for matches
				for( var k in data ){
					// don't search through the stMatchSets[""] (minChars: 0) cache
					// this prevents duplicates
					if( k.length > 0 ){
						var c = data[k];
						$.each(c, function(i, x) {
							// if we've got a match, add it to the array
							if (matchSubset(x.value, q)) {
								csub.push(x);
							}
						});
					}
				}				
				return csub;
			} else 
			// if the exact item exists, use it
			if (data[q]){
				return data[q];
			} else
			if (options.matchSubset) {
				for (var i = q.length - 1; i >= options.minChars; i--) {
					var c = data[q.substr(0, i)];
					if (c) {
						var csub = [];
						$.each(c, function(i, x) {
							if (matchSubset(x.name, q)) {
								csub[csub.length] = x;
							}
						});
						return csub;
					}
				}
			}
			return null;
		}
	};
};

$.Autocompleter.Select = function (options, input, select, config) {
	var CLASSES = {
		ACTIVE: "ac_over"
	};
	
	var listItems,
		active = -1,
		data,
		term = "",
		needsInit = true,
		element,
		list;
	
	// Create results
	function init() {
		if (!needsInit)
			return;
		element = $("<div/>")
		.hide()
		.addClass(options.resultsClass)
		.css("position", "absolute")
		.appendTo(document.body)
		.hover(function(event) {
		  // Browsers except FF do not fire mouseup event on scrollbars, resulting in mouseDownOnSelect remaining true, and results list not always hiding.
		  if($(this).is(":visible")) {
		    input.focus();
		  }
		  config.mouseDownOnSelect = false;
		    // console.debug(config.mouseDownOnSelect);
		});
	
		list = $("<ul/>").appendTo(element).mouseover( function(event) {
			if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
	            active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
			    $(target(event)).addClass(CLASSES.ACTIVE);            
	        }
		}).click(function(event) {
			$(target(event)).addClass(CLASSES.ACTIVE);
			select();
			if( options.inputFocus )
			  input.focus();
			return false;
		}).mousedown(function() {
			config.mouseDownOnSelect = true;
		}).mouseup(function() {
			config.mouseDownOnSelect = false;
		});
		
		if( options.width > 0 )
			element.css("width", options.width);
			
		needsInit = false;
	} 
	
	function target(event) {
		var element = event.target;
		while(element && element.tagName != "LI")
			element = element.parentNode;
		// more fun with IE, sometimes event.target is empty, just ignore it then
		if(!element)
			return [];
		return element;
	}

	function moveSelect(step) {
		listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
		movePosition(step);
        var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
        if(options.scroll) {
            var offset = 0;
            listItems.slice(0, active).each(function() {
				offset += this.offsetHeight;
			});
            if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
                list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
            } else if(offset < list.scrollTop()) {
                list.scrollTop(offset);
            }
        }
	};
	
	function movePosition(step) {
		active += step;
		if (active < 0) {
			active = listItems.size() - 1;
		} else if (active >= listItems.size()) {
			active = 0;
		}
	}
	
	function limitNumberOfItems(available) {
		return options.max && options.max < available
			? options.max
			: available;
	}
	
	function fillList() {
		list.empty();
		var max = limitNumberOfItems(data.length);
		for (var i=0; i < max; i++) {
			if (!data[i])
				continue;
			var formatted = data[i].label;
			if ( formatted === false )
				continue;
			//var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
			var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd");
			if (data[i].goodmatch)
			    li.addClass("ac_goodmatch");
		        li.attr('data-ac_value',data[i].value);
			$.data(li, "ac_data", data[i].value);
			li.appendTo(list)[0];
		}
		listItems = list.find("li");
		if ( options.selectFirst ) {
			listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
			active = 0;
		}
		// apply bgiframe if available
		if ( $.fn.bgiframe )
			list.bgiframe();
	}
	
	return {
		display: function(d, q) {
			init();
			data = d;
			term = q;
			fillList();
		},
		next: function() {
			moveSelect(1);
		},
		prev: function() {
			moveSelect(-1);
		},
		pageUp: function() {
			if (active != 0 && active - 8 < 0) {
				moveSelect( -active );
			} else {
				moveSelect(-8);
			}
		},
		pageDown: function() {
			if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
				moveSelect( listItems.size() - 1 - active );
			} else {
				moveSelect(8);
			}
		},
		hide: function() {
			element && element.hide();
			listItems && listItems.removeClass(CLASSES.ACTIVE);
			active = -1;
		},
		visible : function() {
			return element && element.is(":visible");
		},
		current: function() {
			return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
		},
		show: function() {
			var offset = $(input).offset();
			element.css({
				width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
				top: offset.top + input.offsetHeight,
				left: offset.left
			}).show();
            if(options.scroll) {
                list.scrollTop(0);
                list.css({
					maxHeight: options.scrollHeight,
					overflow: 'auto'
				});
				
                if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
					var listHeight = 0;
					listItems.each(function() {
						listHeight += this.offsetHeight;
					});
					var scrollbarsVisible = listHeight > options.scrollHeight;
                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
					if (!scrollbarsVisible) {
						// IE doesn't recalculate width when scrollbar disappears
						listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
					}
                }
                
            }
		},
		selected: function() {
			var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
			//return selected && selected.length && $.data(selected[0], "ac_data");
			if (!selected) return;
			if (!selected.length) return;
			if (!selected.length) return;
			var s0=selected[0];
			var d=$(s0).attr('data-ac_value');
			return d;
		},
		emptyList: function (){
			list && list.empty();
		},
		unbind: function() {
			element && element.remove();
		}
	};
};

$.fn.selection = function(start, end) {
	if (start !== undefined) {
		return this.each(function() {
			if( this.createTextRange ){
				var selRange = this.createTextRange();
				if (end === undefined || start == end) {
					selRange.move("character", start);
					selRange.select();
				} else {
					selRange.collapse(true);
					selRange.moveStart("character", start);
					selRange.moveEnd("character", end);
					selRange.select();
				}
			} else if( this.setSelectionRange ){
				this.setSelectionRange(start, end);
			} else if( this.selectionStart ){
				this.selectionStart = start;
				this.selectionEnd = end;
			}
		});
	}
	var field = this[0];
	if ( field.createTextRange ) {
		var range = document.selection.createRange(),
			orig = field.value,
			teststring = "<->",
			textLength = range.text.length;
		range.text = teststring;
		var caretAt = field.value.indexOf(teststring);
		field.value = orig;
		this.selection(caretAt, caretAt + textLength);
		return {
			start: caretAt,
			end: caretAt + textLength
		}
	} else if( field.selectionStart !== undefined ){
		return {
			start: field.selectionStart,
			end: field.selectionEnd
		}
	}
};

	$(".uf_autocomplete").live("focus",function() {
	    if ($(this).attr('uf_autocomplete_setup'))
		return;
	    $(this).attr('uf_autocomplete_setup',1);
	    var p;
	    p=$(this).attr("data-param");
	    if (p>'')
		p="&"+p;
	    $(this).autocomplete("ajax.php?action=autocomplete_q"+p, {
		max:50,
		scroll:true,
		matchContains:true,
		minChars:3
	    });
	});

})(jQuery);
/* bundling modules/snippet/snippet.jsa */
jQuery(document).ready(function() {
    jQuery(".snippet_more_link").live("click",function() {
	var rel=$(this).attr('data-object_id');
	var pa=$(this).parent();
	jQuery.pai_call("snippet_content&object_id="+rel,function(d) {
	    jQuery(".snippet_content",pa).html(d.pai_data);
	    jQuery(".snippet_more_link",pa).remove();
	});
	return false;
    });
});

/* bundling inline/ */

uf_growl=function(state,title,text,sticky) {
    var o={};
    var dur;
    if (state=='error') {
	o['type']='growl-error';
	dur=10000;
    } else if (state=='warning') {
	o['type']='growl-warning';
	dur=7000;
    } else if (state=='success' || state=='ok') {
	o['type']='growl-success';
	dur=5000;
    } else {
	o['type']='growl-info';
	dur=5000;
    }
    if (title) o['title']=title;
    if (text) o['text']=text;
    if (!text && !title)
	o['title']='Leere Benachrichtigung?';
    o['inEffectDuration']=300;
    o['duration']=dur;
    if (!$.browser.msie || parseInt($.browser.version)>6) {
	o['fixed']=true;
    }

    if (sticky)
	o['stay']=true;
    jQuery.noticeAdd(o);
}
uf_growl_error=function(title,text,sticky) {if (typeof sticky=='undefined') sticky=true; uf_growl('error',title,text,sticky); }
uf_growl_warning=function(title,text,sticky) { uf_growl('warning',title,text,sticky); }
uf_growl_success=function(title,text,sticky) {uf_growl('success',title,text,sticky); }
uf_growl_info=function(title,text,sticky) {uf_growl('info',title,text,sticky); }

    var user_id=0;
    var generic_object_id=0;

    $(document).ready(function() {
	$(".glossary_link").each(function() {
	    var word=$("span.word",this).text();
	    var x=$(this).attr('rel');
	    if (x) {
		$(this).attr('rel','');
		word=x;
	    }
	    $(this).attr('href','ajax.php?action=glossary_show&word='+word);
	    $(this).smart_modal();
	});

	// placeholders:
	// put the label of an input element into the input element, 
	// making sure to remove it if the input thing get's focused.
	// note: _might_ replace it with an solution which puts the 
	// label behind the input element, making the input element
	// transparent as long as needed.
	$('input[placeholder]').each(function() {
	    var t = !!("placeholder" in this);
	    if (!t && $(this).val()=='') {
		$(this).val($(this).attr('placeholder'));
		$(this).focus(function() {
		    var ph=$(this).attr('placeholder');
		    // remove the text from the input field.
		    if ($(this).val() == ph) {
			$(this).val('');
		    }
		});
		$(this).blur(function() {
		    if ($(this).val() == '')
			$(this).val( $(this).attr('placeholder') );
		});
	    }
	});
	$("form").submit(function() {
	    $('input[placeholder]').each(function() {
		var t = !!("placeholder" in this);
		if (!t) {
		    if ($(this).val() == $(this).attr('placeholder') )
			$(this).val( '' );
		}
	    });
	    return true;
	});

	$('label.placeholder').each(function(x) {
	    me=$(this).attr('id');
	    input=$(this).attr('for'); // the input field.
	    if (me && input) {
		text=$(this).text();       // the label text
		$("#"+input).val(text);
		$("#"+input).attr('labelid',me);
		$(this).hide();
		$("#"+input).focus(function() {
		    // remove the text from the input field.
		    labelid=$(this).attr('labelid');
		    if (this.value == $("#"+labelid).text()) {
			this.value='';
		    }
		});
		// if it's empty, insert the placeholder.
		$("#"+input).blur(function() {
		    labelid=$(this).attr('labelid');
		    if (this.value == '') {
			this.value=$("#"+labelid).text();
		    }
		});
	    }
	});

	/* init generic busy thing */
	var d=$("#generic_directory").html();
	var t="<img src='"+d+"styles/ajax-loader.gif' />";
	var x=jQuery('<div></div>')
	    .attr({
		id: 'generic_busywait'
	    }).addClass('generic_overlay')
	    .css({
		'display':'none',
		'margin':'0',
		'padding':'0',
		'padding-top':'30%',
		'position':'fixed',
		'background-color':'transparent',
		'top':'0',
		'left':'0',
		'right':'0',
		'bottom':'0',
		'border':'0',
		'height':'100%',
		'text-align':'center',
		'margin-top':'auto',
		'margin-buttom':'auto',
		'vertical-align':'middle',
		'z-index':'65535'
	    })
	    .html(t);
	    x.appendTo(document.body);

	$('.uf_smart_modal').smart_modal();

	generic_object_id=$('#generic_object_id').html();
	x=$('#generic_user_id');
	if (x) {
	    user_id=Number(x.html());
	}

	$('#adminfunctionscontent').hide();

	if (user_id>0) {
	    $('#adminfunctionshead a').click(function() {
		if ($('#adminfunctionscontent').is(':hidden')) {
		    $('#adminfunctionscontent').show();
		    $.ajax({
			url: '/ajax.php?action=adminfunctions&object_id='+generic_object_id,
			success: function(fn) {
			    $('#adminfunctionscontent').html(fn),
			    $('#adminfunctionscontent').show()
			},
			type: 'GET'
		    });
		} else {
		    $('#adminfunctionscontent').hide();
		}
		return false;
	    });
	}
    });

    jQuery("document").ready(function() {	
	$("#suchblock_extended a").attr('href',"ajax.php?action=search_form");
	$("#suchblock_extended a").addClass("ufmodal");
	/*
	$("#nono-this-is-not-good-q").autocomplete({
	    source: 'ajax.php?action=search_autocomplete_words',
	    minLength: 3
	});
	*/
    });

