Event.observe( window, 'load', function( e ) {
		$A( document.getElementsByClassName('ext_karte') ).each( function(a){
			Event.observe( a, 'click', function(e){
				window.open( a.href, 'ext_karte', 'height=512,width=443,location=no,menubar=no,resizable=yes,status=no,toolbar=no,top=100,left=100');
				Event.stop(e);
			});
		});
		$A( document.getElementsByClassName('ext_geschenk') ).each( function(a){
			Event.observe( a, 'click', function(e){
				window.open( a.href, 'ext_karte', 'height=528,width=443,location=no,menubar=no,resizable=yes,status=no,toolbar=no,top=100,left=100');
				Event.stop(e);
			});
		});
		$A( document.getElementsByClassName('ext_zoom') ).each( function(a){
			Event.observe( a, 'click', function(e){
				window.open( a.href, 'ext_karte', 'height=585,width=717,location=no,menubar=no,resizable=yes,status=no,toolbar=no,top=100,left=100');
				Event.stop(e);
			});
		});
		$A( document.getElementsByClassName('counted') ).each( function( ta ){
			var ta = ta;
			var c = document.getElementById( ta.id+'_counter' );
			if( c ) {
				c.max=parseInt( c.innerHTML );
				update_counter = function(e){
					var l = ta.value.length;
					if( l > c.max ) {
						c.innerHTML = c.max;
						ta.value = ta.value.substring(0,c.max);
					}
					else if ( l == c.max ) {
						c.innerHTML = c.max;
					}
					else {
						c.innerHTML = c.max-l;
					}
				}
				update_counter();
				$A( new Array('keyup','keydown','focus','blur','change','click') ).each( function( en ) {
					Event.observe( ta, en, update_counter);
				});
			}
		});
});
