/* compressed file mootools_customs.js */ 
var loadingHTML = "Loading...";
window.addEvent("domready",function(){

$$(".LabelInside input").addEvent("change",function(e){
        if ($(e.target).get("value") !== "") {
            e.target.getParent(".LabelInside").getChildren("label")[0].setStyle("display","none");
        } else {
            e.target.getParent(".LabelInside").getChildren("label")[0].setStyle("display","inline");
        }
    });
$$(".LabelInside input").addEvent("focus",function(e){
        $$(".LabelInside input").each(function(el){el.removeClass("focus")});
            e.target.addClass("focus")
            .getParent(".LabelInside").getChildren("label")[0].setStyle("display","none");
       
    });
$$(".LabelInside input").addEvent("keyup",function(e){
        $$(".LabelInside input").each(function(el){el.removeClass("focus")});
        if ($(e.target).get("value") !== "") {
            e.target.addClass("focus")
            .getParent(".LabelInside").getChildren("label")[0].setStyle("display","none");
        } else {
            e.target.addClass("focus")
            .getParent(".LabelInside").getChildren("label")[0].setStyle("display","inline");
        }
    });
$$(".LabelInside input").addEvent("blur",function(e){
        $$(".LabelInside input").each(function(el){el.removeClass("focus")});
        if ($(e.target).get("value") !== "") {
            e.target.getParent(".LabelInside").getChildren("label")[0].setStyle("display","none");
        } else {
            e.target.getParent(".LabelInside").getChildren("label")[0].setStyle("display","inline");
        }
    });
$$(".LabelInside input").each(function(el){
            if ($(el).get("value") !== "") {
            el.getParent(".LabelInside").getChildren("label")[0].setStyle("display","none");
        } else {
            el.getParent(".LabelInside").getChildren("label")[0].setStyle("display","inline");
        }

});
    if ($$(".FocusOnStart").length>0) $$(".FocusOnStart")[0].focus();


	Request.implement({
		sendx:function(param){
			if ($chk(this.options.update)) {
				this.options.update.set("html",loadingHTML);
			}
			if ($chk($('divReqLoading'))) {
			if($('divReqLoading').get("numReq") == null) $('divReqLoading').store("numReq",0);
				$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()+1);
				$('divReqLoading').fade(1);
				this.addEvent("complete",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
				this.addEvent("success",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
				this.addEvent("cancel",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
				this.addEvent("failure",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
			}	
			return this.send(param);
		}
	});
	Request.implement({
		postx:function(param){
			if ($chk(this.options.update)) {
				this.options.update.set("html",loadingHTML);
			}
			if ($chk($('divReqLoading'))) {
			if($('divReqLoading').retrieve("numReq",0) == null) $('divReqLoading').store("numReq",0);
				$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()+1);
				$('divReqLoading').fade(1);
				this.addEvent("complete",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
				this.addEvent("success",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
				this.addEvent("cancel",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
				this.addEvent("failure",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
			}	
			return this.post(param);
		}
	});
	Element.implement({
		loadx:function(param){
			if ($chk($('divReqLoading'))) {
			if($('divReqLoading').retrieve("numReq",0) == null) $('divReqLoading').store("numReq",0);
				var req= this.get("load");
				$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()+1);
				$('divReqLoading').fade(1);
				req.addEvent("complete",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
				req.addEvent("success",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
				req.addEvent("cancel",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
				req.addEvent("failure",function(){
					$('divReqLoading').store("numReq",$('divReqLoading').retrieve("numReq",0).toInt()-1);
					if ($('divReqLoading').retrieve("numReq",0) <= 0)$('divReqLoading').fade(0);
				});
			}	
			this.set("html",loadingHTML);
			return this.load(param);
		}
	});


                    Element.implement({
			_overlay:null,
                        overlay:function(options){
                            if (!$type(this._overlay)) {
                                this._overlay = new Overlay(this,options);
                                this._overlay.start();
                            } else {
                                  this._overlay.start(options);
                            }
                        },
                        overlayClose:function(){
                            if ($type(this._overlay)) {
                                this._overlay.stop();
                                delete(this._overlay);
                            }
                        }

                    });
                    Overlay = new Class({
                            Implements:[Chain,Options],
                            options: {
                                noborder: false,
                                dialogPadding:0,
                                dialogBGColor:"FFF",
                                size: {
                                    width: 100,
                                    height: 100
                                },
                                location: {
                                    top:null,
                                    left:null
                                },
                                title:"",
                                noDrag:true,
                                modular:false,
                                onClose:$empty,
                                onBeforeClose:$empty,
                                onBeforeLoad:$empty,
                                onLoad:$empty,
                                onResize:$empty

                            },
                            active:false,
                            style:false,
                            element:null,
                            elementLastHTML:"",
                            resizeTimer:null,
                            outerContainer:null,
                            innerContainer:null,
                            titleBarContainer:null,
                            titleBarText:null,
                            titleBarX:null,

                             initialize: function(element,options){
                                 this.element = element;
                                this.setOptions(options);

                             },
                             start:function(options){
                                 if (this.active) return;
                                 this.active=true;
                                this.setOptions(options);
                                (this.options.onBeforeLoad).bind(this.element)();
                                this.drawElements();
                                this.storeStyle();

                                this.innerContainer.wraps(this.element);

                                this.outerContainer.wraps(this.innerContainer);
                                this.element.setStyle("display","block");
                                this.applySizes();
                                this.applyPosition();

                                (this.options.onLoad).bind(this.element)();
                                 this.elementLasScrollSize =this.innerContainer.getScrollSize();
                                 var last = this.elementLasScrollSize;;
                                window.addEvent("resize",this.windowResize.bind(this));
                                this.resizeTimer = this.checkForResize.periodical(50,this);
                             },
                             stop:function() {
                                 if (!this.active )return;
                                 this.active=false;
                                 $clear( this.resizeTimer);
                                this.options.onBeforeClose.call(this.element);
                                this.revertStyle();
                                this.element.replaces(this.outerContainer);
                                window.removeEvent("resize",this.windowResize.bind(this));
                                this.options.onClose.call(this.element);


                             },
                             checkForResize:function(){
                                 var current = this.innerContainer.getScrollSize();
                                 var last = this.elementLasScrollSize;
                                if ( last.x != current.x || last.y != current.y ) {
                                        this.elementLasScrollSize = current;
                                        this.applySizes();
                                        this.applyPosition();
                                 }
                             },
                             drawElements:function() {
                                 if (!$type(this.outerContainer))
                                     this.outerContainer = new Element("div",{"class":"OverlayContainer"});
                                 if (!$type(this.innerContainer))
                                     this.innerContainer = new Element("div",{"class":"OverlayInnerContainer"}).inject(this.outerContainer);
                                 if (!this.options.noborder){
                                     if (!$type(this.titleBarContainer))
                                         this.titleBarContainer = new Element("div",{"class":"OverlayTop","style":"position:absolute;top:0px;left:0px;"}).inject(this.outerContainer,"top");
                                     if (!$type(this.titleBarText))
                                         this.titleBarText = new Element("div",{"class":"OverlayTitle","style":"position:absolute:top:0px;left:0px;","html":this.options.title}) .inject(this.titleBarContainer);
                                     if (!$type(this.titleBarX))
                                         this.titleBarX = new Element("div",{"class":"OverlayClose","style":"position:absolute:top:0px;right:0px;"}).addEvent("click",this.stop.bind(this)).inject(this.titleBarContainer);
                                 } else {
                                       this.outerContainer.setStyle("border",0);
                                     if ($type(this.titleBarContainer) == "element")
                                         this.titleBarContainer.destroy();
                                     if ($type(this.titleBarText) == "element")
                                         this.titleBarText.destroy();
                                     if ($type(this.titleBarX) == "element")
                                         this.titleBarX.destroy();
                                 }
                             },
                             applySizes:function(){
                                      this.innerContainer.set("style","position:absolute;bottom:0px;left:0px;overflow:auto;display:block;");
                                      this.outerContainer.set("style","position:absolute;");
                                 var d = this.element.measure(function(){
                                    return this.getComputedSize();
                                });
                                 if (d.totalHeight== 0 ||          d.totalWidth== 0 )
                                     {
                                    //     this.element.setStyles({"width":"100%","height":"100%"});
                                         var d = this.innerContainer.measure(function(){
                                              return this.getComputedSize();
                                            });
                                     }
                                 var w = window.getSize();
                                 var yScrollBar=0;
                                 var xScrollBar=0;
                                 if (w.y > (d.totalHeight + (!$type(this.titleBarContainer)?0:this.titleBarContainer.getSize().y))) {
                                      this.innerContainer.setStyle("height",(d.totalHeight + (!$type(this.titleBarContainer)?0:this.titleBarContainer.getSize().y)));
                                      this.innerContainer.setStyle("overflow-y","hidden");
                                 } else {
                                      this.innerContainer.setStyle("height",(w.y - (!$type(this.titleBarContainer)?0:this.titleBarContainer.getSize().y)));
                                      yScrollBar=25;
                                      this.innerContainer.setStyle("overflow-y","scroll");
                                 }
                                 if (w.x > (d.totalWidth + yScrollBar)) {
                                      this.innerContainer.setStyle("width",(d.totalWidth + yScrollBar));
                                      this.innerContainer.setStyle("overflow-x","hidden");
                                 } else {
                                      this.innerContainer.setStyle("width",(w.x ));
                                      xScrollBar = 25;
                                      this.innerContainer.setStyle("overflow-x","scroll");
                                 }
                                      this.outerContainer.setStyle("width",(this.innerContainer.getComputedSize().totalWidth));
                                      this.outerContainer.setStyle("height",(parseInt(this.innerContainer.getComputedSize().totalHeight) +(!$type(this.titleBarContainer)?0:this.titleBarContainer.getSize().y)  ));

                                 if ($type(this.titleBarContainer) == "element") {
                                        this.titleBarContainer.setStyle("width",this.innerContainer.getStyle("width"));
                                         this.titleBarText.setStyle("width",this.innerContainer.getStyle("width") -25 );
                                 }

                             },
                             applyPosition:function(){
                                 var d = this.outerContainer.getSize();
                                 var w = window.getSize();
                                 if ($type(this.options.location.left) != "number") {
                                     this.outerContainer.setStyles({
                                         "left":(w.x/2),
                                         "margin-left":(d.x / -2)
                                     });

                                 } else {
                                      this.outerContainer.setStyles({
                                         "left":this.options.location.left,
                                         "margin-left":0
                                     });
                                 }
                                 if ($type(this.options.location.top) != "number") {
                                     this.outerContainer.setStyles({
                                         "top":(w.y/2),
                                         "margin-top":(d.y /-2)
                                     });
                                 }else {
                                      this.outerContainer.setStyles({
                                         "top":this.options.location.top,
                                         "margin-top":0
                                     });
                                 }
                                 this.outerContainer.setStyles({
                                         'position':"fixed",
					"z-index":9999
                                     });
                             },
                             storeStyle:function(){
                                 this.style = this.element.get("style");
                             },
                             revertStyle:function(){
                                 this.element.set("style",this.style);
                             },
                             windowResize:function(){

                                this.applySizes();
                                this.applyPosition();
                             }



                        });

                
	/*
window.addEvent("resize",function(e){
	$$('.OverlayContainer').each(function(element){
		if (!element.retrieve("dragged",false)) element.morph({
			top:(window.getSize().y/2),
			left:(window.getSize().x/2)
		});
	});
});
	Element.implement({
		overlay:function(){
			var closeButtonHTML ="X";
			var dialogPadding =16;
			var dialogBGColor ="white";
			var paramDefault= {
			noborder:false,
			};
			
			
			var param = arguments[0];
			if (!$chk(param)) param= {};
			param = $merge(paramDefault,param);
			
			var target;
			target = this;

			if ($chk(param.noborder)) {
				dialogPadding = 0;
			}
			
			if (target.retrieve("overlayOpen",false)) return;
		

			var container = new Element("div",{class:"OverlayContainer"}).store("overlays",target).wraps(target);

	    
	        
			var styleBefore = target.getStyles("position","top","left","bottom","right","width","height","margin","padding","background","border","display","visibility","z-index");
			if (styleBefore.width == target.getParent().getStyles('width').width) {
				styleBefore.width ="auto";
			}
			target.store("overlayBefore",styleBefore);
			if (!$chk(param.noborder)) {
	
				var divTop = new Element("div",{class:"OverlayTop",style:"position:absolute:top:0px;left:0px;"}).inject(container,"top");
				var buttonClose = new Element("div",{class:"OverlayClose",style:"position:absolute;top:0px;right:0px;"}).set("html",'<img src="/images/close_admin.gif">').addEvent("click",function(e){
						this.getParent(".OverlayContainer").retrieve("overlays").overlayClose();
					}).inject(divTop,"top");
		
				var divTitle = new Element("div",{class:"OverlayTitle",style:"position:absolute;top:0px;left:0px;"}).inject(divTop,"top");
		
				if ($chk(param.title)) {
					divTitle.set("html",param.title);
				}
			}
				
			if ($chk(param.onBeforeLoad)) {
				param.onBeforeLoad();
			}


			if ($chk(param.onBeforeClose)) {
				target.addEvent("overlayOnBeforeClose",param.onBeforeClose);
			}
			if ($chk(param.onClose)) {
				target.addEvent("overlayOnClose",param.onClose);
			}

			target.getChildren(".OverlayClose").each(function(){
				e.addEvent("click",function(e){
					this.getParent().overlayClose();
				});
			});


			var dimensionsFinal = target.setStyles({position:"absolute",display:"block"}).getSize();
			target.setStyles({position:"relative"});
			if (!$chk(param.noborder)) 	divTitle.setStyles({width:(dimensionsFinal.x)});
			
			container.setStyles({
				position:"fixed",
				top:this.getPosition().y,
				left:this.getPosition().x,
				width:0,
				height:0,
				display:"inline",
				padding:dialogPadding,
			});
			if ($chk(param.location)) {
				container.setStyles({
					position:"fixed",
					top:param.location.top,
					left:param.location.left,
					width:0,
					height:0,
					display:"inline",
					padding:dialogPadding,
					"z-index":9999
				}).morph({
					width:dimensionsFinal.x,
					height:dimensionsFinal.y,
				}).store("dragged",true);
    		
			} else {
				container.morph({
					top:(window.getSize().y / 2),
					left:(window.getSize().x / 2),
					"margin-top":(dimensionsFinal.y / -2),
					"margin-left":(dimensionsFinal.x / -2),
					width:dimensionsFinal.x,
					height:dimensionsFinal.y,
					"z-index":9999
				});
				
			}
			container.fade(1);
			target.morph({
				display:"inline"
			});
			if ($chk(param.onLoad)) {
				param.onLoad();
			}
			new Drag(container,{
				handle:divTitle,
			    onComplete: function(container){
        			container.store("dragged",true);
    			}
			});
			target.store("overlayOpen",true);
		},
		overlayClose:function(){
			if (!this.retrieve("overlayOpen",false)) return ;

			this.fireEvent("overlayOnBeforeClose");
			this.setStyles(this.retrieve("overlayBefore"));
			this.getChildren(".OverlayTop").each(function(e){e.dispose();});
			this.replaces(this.getParent(".OverlayContainer"));
			this.store("overlayOpen",false);

			this.fireEvent("overlayOnClose");
			if ($chk(this)) {
				this.removeEvents("overlayOnClose");
				this.removeEvents("overlayOnBeforeClose");
				
			}
		}
	});*/
	$$(".justValidate").each(function(element){
		new FormCheck(element);
	});
     
	$$(".FlexibleInformationElement").each(function(element){
		//alert(element.getChildren('div')[0].getChildren('.FlexibleInformationElementHead')[0]);
		if($chk(element.getChildren('div')[0].getChildren('.FlexibleInformationElementHead')[0])){
			if($chk(element.getChildren('div')[0].getChildren('.FlexibleInformationElementHead')[0].getChildren('.FlexibleInformationElementHeadRight')[0])){
				element.getChildren('div')[0].getChildren('.FlexibleInformationElementHead')[0].getChildren('.FlexibleInformationElementHeadRight')[0].addEvent('click',function(){
					if ($chk(this.getParent('.FlexibleInformationElement').get('id'))) {
						new Request({"method":"post","data":{"type":"FIE","id":this.getParent('.FlexibleInformationElement').get('id')},"url":siteconf_link}).send();
					}
					this.slide("toggle");
				}.bind(($chk(element.getChildren('.FlexibleInformationElementBody')[0])?element.getChildren('.FlexibleInformationElementBody')[0]:element.getChildren('div')[1].getChildren('.FlexibleInformationElementBody')[0])));
			}
		}
	});
	
/*		$$('.Typography a').each(function(el){
			if (el.get('href',"").match(/(.*(m4v|flv)$)/)){
				el.addEvent('click',function(e){
					if ($chk($('embedVideoOverlay'))) $('embedVideoOverlay').overlayClose();
					var c = new Element('div',{'id':'embedVideoOverlay'}).inject($$('body')[0]);
					var f = new Element('div',{'class':'flowplayer','style':'width:600px;height:400px;'}).inject(c);
					new Element('a',{'id':'embedVideo','style':'width:600px;height:380px;'}).inject(f);
					flowplayer_stream_external('embedVideo',this.get('href'));
					var s=new Element('span',{'style':'text-align:center;'}).inject(c);
					new Element('a',{'href':this.get('href')}).set('html',"Download").inject(s);
					
					
					
					
					
					c.overlay({'title':'Video',onClose:function(e){this.nix()}});
					e.stop();
				})
			}
		});
	*/
	
});
   function formcheckNickname(el){
    if (!el.value.test(/^[A-Za-z0-9.-_]{4,20}$/)) {
        el.errors.push("Erlaubt sind 4 bis 20 Zeichen. Als Zeichen sind Buchstaben von a bis Z, Zahlen von 0 bis 9 sowie die Zeichen . - _ zulässig");
        return false;
    } else {
        return true;
    }
}
function startOverlayVideo(id) {
	if (typeof(flowplayer)=='undefined') {
		var s = new Element('script').set("type","text/javascript").set('src',site_full_url+"/js/flowplayer-3.1.1.min.js").inject($$('head')[0],"bottom");
	}
	var elName = 'videoOverlay'+id;
	if (!$chk($(elName))) {
		 new Element("div",{id:elName,style:"min-width:500px;"}).inject($$('body')[0]).load(site_full_url+"/embvideo/"+id).overlay({onClose:function(){this.dispose()}});
	}
}

function ResizeTextArea(txtBox)
{
nCols = txtBox.cols;
sVal = txtBox.value;
nVal = sVal.length;
nRowCnt = 1;
nCharCnt=0;

for (i=0;i<nVal;i++)
{ if (sVal.charAt(i) == "\n") { nRowCnt +=1; nCharCnt=0;} else { nCharCnt +=1;}
if (nCharCnt > nCols){ nRowCnt +=1; nCharCnt=0;}  }

//if (nRowCnt < (nVal / nCols)) { nRowCnt = 1 + (nVal / nCols); }
txtBox.rows = nRowCnt;
} 
function flowplayer_stream_external(id,url) {
	 flowplayer(id, site_full_url+"/swf/flowplayer.commercial-3.1.1.swf",{        // supply the configuration 
     key: flowplayerKey ,
    clip: { 
        scaling:'fit',
		 autoPlay: false ,
        url: url  
    }, 
   canvas: { 
    // use a wicked backgound color 
    backgroundColor: '#000000' 
}  ,
    onError:function(c,m) {
    alert(c + ' ' + m);
	}
    ,
    plugins: {            // load one or more plugins 
        controls: {            // load the controls plugin 
            url: site_full_url+'/swf/flowplayer.controls-3.1.1.swf',    // always: where to find the Flash object 
             timeColor: '#202774',
      buttonOverColor: '#86878d',
      buttonColor: '#bdbdbd',
      progressGradient: 'medium',
      durationColor: '#1f266f',
      bufferColor: '#6d6f7e',
      backgroundGradient: [0.8,0.2,0.8],
      bufferGradient: 'none',
      backgroundColor: '#000000',
      sliderColor: '#9e9e9e',
      progressColor: '#c2c4d6',
      sliderGradient: 'none',
	  opacity:1.0,
            tooltips: {                // this plugin object exposes a 'tooltips' object 
                buttons: true, 
                fullscreen: 'Enter Fullscreen mode' 
            } 
        }  
    }
});
}

;
