<!--

function RemoveSpecialChars(Buffer){
	var SearchArray=new Array('Ü','ü','Ä','ä','Ö','ö','ß',' ');var ReplaceArray=new Array('Ue','ue','Ae','ae','Oe','oe','ss','-');var KillStringArray=new Array('&','/','\\','!','§','%','(',')','|','?','"','$','=','[',']','@','/\s/','´','`','€');
	for (i=0;i<8;i++) Buffer=ReplaceIt(Buffer,SearchArray[i],ReplaceArray[i]);
	for (i=0;i<20;i++) Buffer=ReplaceIt(Buffer,KillStringArray[i],'');
	return Buffer
}
function ReplaceIt(string,suchen,ersetzen){ausgabe = "" + string;while (ausgabe.indexOf(suchen)>-1){pos= ausgabe.indexOf(suchen);ausgabe = "" + (ausgabe.substring(0, pos) + ersetzen + ausgabe.substring((pos + suchen.length), ausgabe.length));}return ausgabe}
function TextCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = maxlimit - field.value.length;
}
function MM_openBrWindow(theURL,winName,features) {window.open(theURL,winName,features);}
function CheckSelectedCategory(obj)
{
	if(obj.options[obj.selectedIndex].value=='')
		obj.selectedIndex=0;
}
function ToggleVisibility(id){var obj=document.getElementById(id);if(obj.className=="Hidden"){obj.className="Visible";}else{obj.className="Hidden";}
}

function SetClass(ID,ClassName){if(document.getElementById(ID,ClassName)){var Obj=document.getElementById(ID);Obj.className=ClassName;}}
function ToggleCSS(id,Element,First, Second) {
		if(document.getElementById(id))
		{
			var obj = document.getElementById(id);
			if (obj.style[Element]==First) {
	          obj.style[Element]=Second;
	        } else {
	           obj.style[Element]=First;
	        }
		}
}
function confirmation(Message){return confirm(Message);}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function JumpUrl(Target,URL){
  eval(Target+".location='"+URL+"'");
}

function CheckNumber(obj)
{
	if(parseInt(obj.value)<1 || isNaN(obj.value))
	{
		document.forms.ArtikelKaufen.Submit.disabled=true; 
	}
	else
		document.forms.ArtikelKaufen.Submit.disabled=false; 
}
// Start Module Gallery
function GalleryChange(Direction,PlayOrNot,Timer)
{
	Counter=GalleryAr.length;Description='';
	if(typeof(Timer)=='undefined')
		Timer=6000;
	if(is_ie){document.all.Bild.filters.blendTrans.Apply();document.all.Bild.src = GalleryAr[n]['Path'];document.all.Bild.filters.blendTrans.Play();}else{document.all.Bild.src = GalleryAr[n]['Path'];}
	if(Direction<0)
		(n>0) ? n-- : n=GalleryAr.length-1;
	else
		(n<GalleryAr.length-1) ? n++ : n=0;
	(n==0)?ViewCounter=GalleryAr.length:ViewCounter=n;
	document.getElementById("CounterTxt").innerHTML='('+(ViewCounter)+' von '+ Counter + ')';
	if(GalleryAr[n]['Description'].length>0){Description='<div class="Comment">'+GalleryAr[n]['Description']+'</div>'};
	if(GalleryAr[n]['Headline'].length>0){Description='<strong style="margin-top:0">'+GalleryAr[n]['Headline']+Description+'</strong>';
	document.getElementById("GalleryDescription").innerHTML=Description}
	else{	document.getElementById("GalleryDescription").innerHTML='';}
	if(PlayOrNot==true)
	{
		GalleryPlay=window.setTimeout('GalleryChange(1,true)',Timer);
	}
	else if(GalleryPlay)
	{window.clearTimeout(GalleryPlay);}
 }
 function GalleryStop(){window.clearTimeout(GalleryPlay);}
// End Module Gallery
 function GetRadio(feld){var obj=document.getElementsByName(feld);for (i=0;i<obj.length;i++){if (obj[i].checked) return obj[i].value;}return null;}
function Klick(ID,Name){
	var obj = document.getElementById(ID);
	obj.value=Name;
	obj.disabled=true;
    return true;
}

/*** Start DynamicRow ***/
/*
 * jQuery autoResize (textarea auto-resizer)
 * @copyright James Padolsey http://james.padolsey.com
 * @version 1.04
 */

(function(a){a.fn.autoResize=function(j){var b=a.extend({onResize:function(){},animate:true,animateDuration:150,animateCallback:function(){},extraSpace:20,limit:1000},j);this.filter('textarea').each(function(){var c=a(this).css({resize:'none','overflow-y':'hidden'}),k=c.height(),f=(function(){var l=['height','width','lineHeight','textDecoration','letterSpacing'],h={};a.each(l,function(d,e){h[e]=c.css(e)});return c.clone().removeAttr('id').removeAttr('name').css({position:'absolute',top:0,left:-9999}).css(h).attr('tabIndex','-1').insertBefore(c)})(),i=null,g=function(){f.height(0).val(a(this).val()).scrollTop(10000);var d=Math.max(f.scrollTop(),k)+b.extraSpace,e=a(this).add(f);if(i===d){return}i=d;if(d>=b.limit){a(this).css('overflow-y','');return}b.onResize.call(this);b.animate&&c.css('display')==='block'?e.stop().animate({height:d},b.animateDuration,b.animateCallback):e.height(d)};c.unbind('.dynSiz').bind('keyup.dynSiz',g).bind('keydown.dynSiz',g).bind('change.dynSiz',g)});return this}})(jQuery);
/*** Ende DynamicRow ***/
//-->
/*** Start Tooltip***/
this.Tooltip = function(){
	$("a.Tooltip").each(function(){
		$(this).append('<img src="/Umwelt/Image/Icons/Infoi.gif" width="16" height="16" style="margin-left:4px"alt="Information" class="Tooltip" title="'+ $(this).attr('Title') +'"/>');
	})
	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("img.Tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='Tooltip'>"+ this.t +"</p>");
		$("#Tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#Tooltip").remove();
    });	
	
	$("img.Tooltip").mousemove(function(e){
		$("#Tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
	$("a.Tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='Tooltip'>"+ this.t +"</p>");
		$("#Tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#Tooltip").remove();
    });	
	$("a.Tooltip").mousemove(function(e){
		$("#Tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			

};
/*** Ende Tooltip***/
/*** Start CharCounter ***/
/**
 *
 * jquery.charcounter.js version 1.2
 * requires jQuery version 1.2 or higher http://tomdeater.com/jquery/character_counter/
 * Copyright (c) 2007 Tom Deater (http://www.tomdeater.com)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 */
 
(function($) {
	/**
	 * attaches a character counter to each textarea element in the jQuery object
	 * usage: $("#myTextArea").charCounter(max, settings);
	 */
	
	$.fn.charCounter = function (max, settings) {
		max = max || 100;
		settings = $.extend({
			container: "<span></span>",
			classname: "charcounter",
			format: "(noch %1 Zeichen möglich)",
			pulse: true,
			delay: 0
		}, settings);
		var p, timeout;
		
		function count(el, container) {
			el = $(el);
			if (el.val().length > max) {
			    el.val(el.val().substring(0, max));
			    if (settings.pulse && !p) {
			    	pulse(container, true);
			    };
			};
			if (settings.delay > 0) {
				if (timeout) {
					window.clearTimeout(timeout);
				}
				timeout = window.setTimeout(function () {
					container.html(settings.format.replace(/%1/, (max - el.val().length)));
				}, settings.delay);
			} else {
				container.html(settings.format.replace(/%1/, (max - el.val().length)));
			}
		};
		
		function pulse(el, again) {
			if (p) {
				window.clearTimeout(p);
				p = null;
			};
			el.animate({ opacity: 0.1 }, 100, function () {
				$(this).animate({ opacity: 1.0 }, 100);
			});
			if (again) {
				p = window.setTimeout(function () { pulse(el) }, 200);
			};
		};
		
		return this.each(function () {
			var container;
			if (!settings.container.match(/^<.+>$/)) {
				// use existing element to hold counter message
				container = $(settings.container);
			} else {
				// append element to hold counter message (clean up old element first)
				$(this).next("." + settings.classname).remove();
				container = $(settings.container)
								.insertAfter(this)
								.addClass(settings.classname);
			}
			$(this)
				.unbind(".charCounter")
				.bind("keydown.charCounter", function () { count(this, container); })
				.bind("keypress.charCounter", function () { count(this, container); })
				.bind("keyup.charCounter", function () { count(this, container); })
				.bind("focus.charCounter", function () { count(this, container); })
				.bind("mouseover.charCounter", function () { count(this, container); })
				.bind("mouseout.charCounter", function () { count(this, container); })
				.bind("paste.charCounter", function () { 
					var me = this;
					setTimeout(function () { count(me, container); }, 10);
				});
			if (this.addEventListener) {
				this.addEventListener('input', function () { count(this, container); }, false);
			};
			count(this, container);
		});
	};

})(jQuery);
/*** Ende CharCounter ***/
