

/* ------------------------------------------------------------------------

(c) 99°

Alle Scripte in diesem Dokument unterliegen dem strengen Copyright der
Firma 99° und dürfen ohne deren Zustimmung nicht kopiert, vervielfältigt
oder verfremdet werden.

Für Fragen: www.99grad.de / 0611-4080919

------------------------------------------------------------------------ */


// ---------------------------------------------------------------------
// http://gettopup.com/documentation

try {
	TopUp.players_path = "fileadmin/templates/js/topup/players/";
	TopUp.images_path = "fileadmin/templates/js/topup/top_up/";

/*
TopUp.addPresets({
	".shaded": {
	 shaded: 1,
	 overlayClose: 1,
	 layout: 'dashboard',
	 resizable: 0,
	 group: 'images'
	}
});

TopUp.addPresets({
	".flv-video": {
	 shaded: 1,
	 overlayClose: 1,
	 layout: 'dashboard',
	 resizable: 0,
	 width: 950,
	 height: 550,
	 effect: 'appear',
	 ondisplay: function () { tell_flash( 'flash_banner', 'sound_leise', '' ); },
	 onclose: function () { tell_flash( 'flash_banner', 'sound_laut', '' ); }
	}
});
*/
} catch (e) {}


// ---------------------------------------------------------------------
// IE6 Warning, Spezielle CSS/JS-Dateien

$(function () {

	var is_msie = $.browser.msie;
	var vers = parseFloat($.browser.version);
	
	if (is_msie && $.cookies.get('ignore_ie6') != '2') {
		if (vers <= 6) {
			$.getScript('fileadmin/templates/ie6_warning/warning.js', function () {
				alert_ie6_warning("fileadmin/templates/ie6_warning/");
			});
		}
	}	

});
 

// ---------------------------------------------------------------------
// http://gsgd.co.uk/sandbox/jquery/easing/
// http://jqueryui.com/download
// http://docs.jquery.com/UI/Effects/Slide

var firstRun = true;

$( function () {
		
	if (SWFAddress) {
	
		SWFAddress._ignore_change = false;
		SWFAddress.onChange = function () {
			
			if (SWFAddress._ignore_change) return false;
			try {
				var str = SWFAddress.getValue();
				if (str.substr(0,1) == '/') str = str.substr(1);
				var parts = str.split('/');
				var url = parts.join("/");
				if (!url && !firstRun) url = $.currentURL();
				if (url) ajax_menue_func( false, url );
				firstRun = false;
			} catch (e) {}
		}
		
		SWFAddress.setValueSilently = function ( url ) {
			SWFAddress._ignore_change = true;
			SWFAddress.setValue( url );
			SWFAddress._ignore_change = false;
		}
	}
});


/*
options = Reference to the options passed in animate( what, options )
elem = the element or object that is animated. Here you could get the current value of num like this: obj.elem.num
prop = the current property that is being changed
startTime = the time the animation started
start = the initial value for the property at start (here: 0)
end = the final value at end (here: 1)
unit = the unit (i.e. "px")
now = the current value (same as first parameter "now" passed to funcion)
*/

// ---------------------------------------------------------------------
// http://gsgd.co.uk/sandbox/jquery/easing/
// http://jqueryui.com/download
// http://docs.jquery.com/UI/Effects/Slide




/* ------------------------------------------------------------------------ */
// I N I T 

$( function () {
	init_page();
} );

function init_page () {

	//$('.jqcb select').prepend('<option value="">Alle Anzeigen</option>');
	$('select').comboBox( {lockTitle:true, useMouseEnter:true} );
	$('.tx_zvmgallery_area_form, .zvmgallery_thumbview').css({visibility:'visible'});


	var pid = $('meta[name=pid]').attr('content');
	
	// #######  Spezielle JS für die Startseite
	if (pid == 68) {
		
	}
	
	
	// #######  tt_news: Click auf Bild öffnet Lightbox und: Automatisches überblenden der Bilder
	
	$('a.shaded').click( function () {
		var arr = [];
		$(this).parent().find('a.shaded').each( function () {
			arr.push( {full: $(this).attr('href'), img:$(this).find('img').attr('src'), ref:$(this) } );
		});
		zvmlightbox.display( arr, $(this).parent('.images').data('cnt') );
		return false;
	});
	
	var news_cnt = 0;
	$('.news-list-item .images').each( function () {
		var _this = $(this);
		_this.data('cnt', 0);
		var imgs = $(this).find('a.shaded');
		var anz = imgs.length;
		
		imgs.css({opacity:0});
		$(imgs[0]).css({opacity:1});
		
		if (anz <= 1) return;
		var cnt = 1;
		var lv = 1;
		
		setTimeout( function () {
			setInterval( function() {
				$(imgs[cnt]).css({'z-index':lv++, opacity:0}).stop(true,true).animate({opacity:1}, {duration:1500});
				_this.data('cnt', cnt);
				cnt++;
				if (cnt >= anz) cnt = 0;
			}, 5000);
		}, (news_cnt++*1000) );
		
	});
	
	
	// #######  Glossar FCE mit Akkordeon-Effekt
	/*
	$('.fce_glossar_box .title').unbind().click( function () {
		var _this = $(this);
		$('.fce_glossar_box .title').each( function () {
			if ($(this)[0] != _this[0]) $(this).parent().find('.infos').slideToggle( false );
		});
		$('.fce_glossar_box .title h1').animate( {color:'#8c5926'}, 200, 'linear' );
		$('.fce_glossar_box .title').removeClass('selected').stop(true, true).animate( {'background-color':'#eee6dc'}, 200, 'linear' );
		
		if (!$(this).parent().find('.infos').is(':visible')) {
			$(this).addClass('selected').stop(true,true).animate( {'background-color':'#d4e9d6'}, 200, 'linear' );
			$(this).find('h1').animate( {color:'#73b07a'}, 200, 'linear' );
		}
		
		$(this).parent().find('.infos').slideToggle();
	});
	*/
	
	
	// #######  Gallery: Thumbnails mit Content-Slider zu Detailansicht

	
	$('.zvmgallery_thumbview .item a').unbind().click( function () {
	
		if ($(this).hasClass('weblink')) return true;
		if ($('.content_spreader').is(':animated')) return false;
		
		var obj = $(this);
		var url = obj.attr('href');
		var img = obj.parent().parent().find('.image').parent();
		
		$('.zvmgallery_thumbview .item').stop( true, true );
		$('.zvmgallery_thumbview .item').fadeTo( 'fast', 0.1 );
		img.stop( true, true );
		img.fadeTo( 'fast', 1.0 );
		img.find('.image').showPreloader();
		
		if (!$('.content_shifter').exists()) {
			$('#contentbox').wrapInner('<div class="content_spreader" />');
			$('.content_spreader').append('<div class="content_shifter"></div><div class="clear_div"></div>');
		}
		
		SWFAddress.setValueSilently( 'details/' );
		
		$.m_ajax({
			'url':		url,
			'targets':	{'.contentbox_inner':'.content_shifter'},
			'id':		'gallery',
			'success':	function ( data ) {
							img.find('.image').hidePreloader();
							$( '.content_shifter' ).css('padding-top', Math.max(0,$(window).scrollTop()-130) );
							$( '.content_spreader' ).stop(true,true).animate( {left:-860}, {duration:1000, easing:'easeInOutQuad'} );
							$( '.projecttext' ).stop(true,true).hide().delay(500).slideDown();
							$( '.content_shifter .link_back' ).show().click( function () {
								SWFAddress.setValue( 'select/' );
								return false;
							});
						}
				});
		
		return false;
	});
	
	$('.zvmgallery_thumbview .item').unbind().mouseenter( function () {
			$(this).find('.image').stop( true, true );
			$(this).find('.image').fadeTo( 'fast', 0.5 ); 
		}).mouseleave( function () {	
			$(this).find('.image').stop( true, true );
			$(this).find('.image').fadeTo( 'slow', 1 ); 
		});
		
	
	$('.fce_bildbox').unbind();
	$('.fce_bildbox').click( function () {
		var url = $('head base').attr('href') + $(this).find('.col_left a').attr('href');
		document.location = url;
	}).mouseenter( function () {
		$(this).css('background-color', '#f1f1Ea');
	}).mouseleave( function () {
		$(this).css('background-color', 'transparent');
	}).each( function ( i ) {
		$(this).css('opacity', 0).delay(i*500).fadeInRemoveFilter({duration:500});
	});
	
	$('.zvmgallery_thumbview .item').each( function(i) {
		$(this).css('opacity', 0).stop(true,true).delay(i*200).fadeInRemoveFilter({duration:1000});
	});


	// #######  Gallery: Falls man direkt auf Detailseite gelandet ist: Zurück-Button ausblenden
	
	if ($.currentURL().indexOf('#') > 0) $('.zvmgallery_jqthumbs a.link_back').show();


	// #######  Navigation: Ajax

	$('.navi_main ul li a').unbind().click( ajax_menue_func );
	$('.navi_sub ul li a').unbind().click( ajax_menue_func );
	
	$('.navi_main ul li a').rolloverColor();
	$('.navi_sub ul li a').rolloverColor();
	
	
	// #######  Formhandler: Eingabefelder bei focus heller machen
	
	$('.formhandler_form input, .formhandler_form textarea').rolloverColor({'background-color':'#fff', color:'#333'}).unbind('mouseleave mouseenter');
	

	
}


function ajax_menue_func ( ref, url ) {
	
	if (url == '/details/' || url == 'details/') return false;
	
	if (url == '/select/' || url == '/' || url == 'select/') {
		$( '.content_spreader' ).stop(true,true).animate( {left:0}, {duration:1000, easing:'easeInOutQuad'} );
		$('.zvmgallery_thumbview .item').stop(true,true).delay(1200).fadeTo( 'fast', 1 );
		$( '.projecttext' ).stop(true,true).slideUp();
		return false;
	}
		
	if (!url) {
		var url = $(this).attr('href');
		var tg = $(this).attr('target');
		if (tg && tg != '_self') return true;
	}
	
	SWFAddress.setValueSilently( '/'+url );
		
	var old_height = $('#contentbox').css({'height':'auto'}).height();


	// Fader-DIV verwenden, falls IE im Einsatz ist - sonst sieht Typo und PNGs beim Faden Scheisse aus.
	var use_fader = ($.browser.msie && $.browser.version.substr(0,1)<10);
	
	if ($.browser.msie || use_fader) {
		remove_ie_fader();
		$('#contentbox').wrap('<div class="contentbox_wrap">');
		$('.contentbox_wrap').append('<div class="ie_fader"></div>');
		$('.ie_fader').stop(true,true).css({'opacity':0, height:$('#contentbox').height() }).animate({'opacity':1}, {duration:500});
	} else {
		$('#contentbox').animate({'opacity':0});
	}
	
	function remove_ie_fader () {
		if ($('.contentbox_wrap').exists()) {
			$('.ie_fader').remove();
			$('#contentbox').unwrap();
		}
	}
	
	//$('#contentbox').animate({'opacity':0});
	
	var iv = setTimeout( function () {
		$('.grad').showPreloader( {offsetX:-18, offsetY:30, radius:38, pause:1000} );
	}, 1500);
	
	$.m_ajax( {
				url: 		url, 
				targets:	{'#contentbox':'#contentbox', '.navi_sub':'.navi_sub', '.navi_main':'.navi_main'}, 
				success: 	function( data, html_data ) {

					$('.t3page').removeAttr('class').attr('class', html_data.attr('class') );
					$("body").attr('class', html_data.attr('class'));
					$('meta[name=pid]').removeAttr('content').attr('content', $.metaTagValue('pid', data) );
					
					init_page();
					$('.grad').hidePreloader();
					clearTimeout( iv );
					
					var new_height = $('#contentbox').css({'height':'auto'}).height();
					
					if ($.browser.msie || use_fader) {
						$('.ie_fader').stop(true,true).css({'opacity':1, height:new_height}).animate({'opacity':0}, {complete:function(){
							remove_ie_fader();
							$('#contentbox').css({'height':'auto'});
						}});
					} else {
						$('#contentbox').stop(true, true).css({'height':old_height}).fadeInRemoveFilter().animate({'height':new_height}, {duration:500, easing:'easeInOutQuint', complete:function(){
							$('#contentbox').css({'height':'auto'});
						}});
					}
					
	}});
	return false;
}



/* ------------------------------------------------------------------------ */
// EIGENE PLUG-INS für jQuery

// http://www.queness.com/post/112/a-really-simple-jquery-plugin-tutorial
// http://matthiasschuetz.com/jquery-tutorial-eigenes-tooltip-plugin-erstellen

/*

$.metaTagValue('pid');				->	gibt Wert eines Meta-Tags zurück
$.reqVars();						->	alle GET-Vars als Object holen, z.B. aus www.99grad.de/?test=hallo&...
$.reqVars('test');					->	GET-Var 'test' zurückgeben
$.stripTags(html, ['h2'], false );	->	HTML-Tags entfernen: code, allowed-tags-Array, allow-invers 
$.stripNL(html);					->	Tabs und Umbrüche entfernen (IE6-Problem)
$.htmlentitiesdecode( html );		->	Decode HTML
$.getAllTags(html, 'b', true );		->	HTML-Tags holen: code, tag-name, include-tag
$.gaTrackPage( title );				->	Seiten-Titel an Google Analytics senden, falls Tracking-ID im Quelltext gefunden wurde
$.execScripts(html, debug);			->	JavaScript in HTML-Code ausführen
$.isNumeric( str );					->	Gibt true zurück, wenn str eine Zahl ist
$.noCacheURL( url );				->	Hängt einen noCache=... an die URL, damit Seite beim Laden nicht gecached wird

$(sel).exists();							-> 	Existiert das Element?
$(element).rolloverColor({color:'#000'});	->	Ändert bei RollOver die Textfarbe, z.B. für Menüs

*/


// Erweiterung der Funktionen für den Typ $('id').plugin();

(function($){
	$.fn.extend({
	
		'copyProtectImage': function ( opt ) {
			var def = {transparent:'fileadmin/templates/imgs/trans.gif' };
			var opt = $.extend( def, opt);
			return this.each( function () {
				if ($(this).parent().nodeName() == 'a') $(this).parent().bind("contextmenu", function(e) { e.preventDefault(); });
				$(this).wrap('<span />');
				$(this).parent().prepend('<span style="position:absolute;"><img src="'+opt.transparent+'" width="'+$(this).width()+'" height="'+$(this).height()+'"></span>');
			});
		},
		
		'exists': function () {
			//return $(this).length>0;
			return $($(this).selector).length>0;
		},
		'nodeName': function () {
			return $(this)[0].nodeName.toLowerCase();
		},
		'slideToggle': function ( bShow ) {
			return this.each( function () {
				var el = $(this), height = el.data('originalHeight'), visible = el.is(':visible');
				if (bShow == undefined) bShow = !visible;
				if (bShow != visible) {
					if (!height) {
						height = el.show().height();
						el.data('originalHeight', height);
						if (!visible) el.hide().css({height:0});
					}
					if (bShow) {
						el.hide().css({height:0});
						el.stop(true, true).show().animate({height:height}, {duration:500, easing:'easeInOutQuint'} );
					} else {
						el.stop(true, true).animate({height:0}, {duration:500, easing:'easeInOutQuint', complete:function () { 
							el.hide(); 
						}});
					}
				}
			});
		},
		
		'fadeInRemoveFilter': function ( opt ) {
			var def = {duration:500, easing:'linear' };
			var opt = $.extend( def, opt);
			return this.each( function () {
				var el = $(this);
				el.animate({'opacity':1}, {duration:opt.duration, easing:opt.easing, complete:function(){
					var el = $(this)[0];
					if (el.style.filter && el.style.removeAttribute) el.style.removeAttribute('filter');
				}});
			});
		},
		
		'rolloverColor': function ( opt ) {
			
			var def = { color:'#777A66', duration: 400, durationOut: 100, 'background-color': false };
			var opt = $.extend( def, opt);
			$(this).resetRolloverColor();
			
			return this.each( function () {	
				$(this).data('col', $(this).css('color') );
				$(this).data('bgcol', $(this).css('background-color') );
				$(this).unbind('mouseenter focus').bind( 'mouseenter focus', function () {
					var obj = {};
					if (opt.color) obj['color'] = opt.color;
					if (opt['background-color']) obj['background-color'] = opt['background-color'];
					$(this).stop(true,true).animate(obj, opt.duration);
				}).unbind('mouseleave focusout').bind('mouseleave focusout', function () {
					var obj = {};
					if (opt.color) obj['color'] = $(this).data('col');
					if (opt['background-color']) obj['background-color'] = $(this).data('bgcol');
					$(this).stop(true,true).animate(obj, opt.durationOut);
				});
			});
		},
		
		'resetRolloverColor': function () {	
			return this.each( function () {
				$(this).removeAttr('style');
			});
		},
		
		'callFlashFunction': function ( func, params ) {
			return this.each( function () {
				$(this)[0][func].apply( this, params );
			});
		}
		
	});
})(jQuery);



// Erweiterung der Funktionen für Typ $.plugin();

(function($){
	$.extend({
	
		
		'isIE': function ( vers ) {
			if (!vers) return $.browser.msie;
			return ($.browser.msie && $.browser.version.split('.')[0] == vers);
		},
		
		'metaTagValue': function ( id, data ) {
				if (!data) var data = $('head').html();
				var val = data.split("<meta name=\""+id+"\" content=\"")[1].split("\"")[0];
				return val;
			},
			
		'currentURL': function () {
			return window.location.href;
		},
		
		'reqVars': function ( id, url) {
			if (!url) url = $.currentURL();
			var paramsRaw = (url.split("?", 2)[1] || "").split("#")[0].split("&") || [];
			var _params = {};
			for (var i = 0; i < paramsRaw.length; i++){
				var single = paramsRaw[i].split("=");
				if (single[0]) _params[unescape(single[0])] = unescape(single[1]);
			}
			return id ? _params[id] : _params;
		},
		
		'stripTags': function ( html ) {
			if(arguments.length < 2) {
				html=html.replace(/<\/?(?!\!)[^>]*>/gi, '');
			} else {
				var allowed = arguments[2] == undefined ? true : arguments[2];				
				var specified = arguments[1];
				if(allowed){
					html=html.replace(new RegExp('</?[^('+specified.join('|')+'|/)][^>]*>', 'gi'), '');
				} else{
					html=html.replace(new RegExp('</?[('+specified.join('|')+')][^>]*>', 'gi'), '');
				}
			}
				
			return $.trim( html );
		},
		
		'stripNL': function ( data ) {
			if (!data) return '';
			return data.split("\t").join("").split("\r").join("").split("\n").join("");
		},
		
		'htmlentitiesdecode': function ( str ) {
			if (!$("<div />").html(str)) return '';
			return $("<div />").html(str).text();
		},
		
		'getAllTags': function  ( source, tagname, include_tag ) {
			var arr = [];
			while(source.indexOf("<"+tagname) > -1 || source.indexOf("</"+tagname) > -1) {
				var s = source.indexOf("<"+tagname);
				var s_e = source.indexOf(">", s);
				var e = source.indexOf("</"+tagname, s);
				var e_e = source.indexOf(">", e);
				
				var str = include_tag ? source.substring(s,e_e+1) : source.substring(s_e+1, e);
				
				if (tagname == "script" && (str.indexOf("gaJsHost") > -1 || str.indexOf("_getTracker") >-1 || str.indexOf("only_execute_once") >-1 )) {
					// ignorieren, weil Page-Tracker-Script von Google
				} else {
					if ($.trim(str)) arr.push( str );
				}
				
				source = source.substring(0, s) + source.substring(e_e+1);
			}
			return arr;	
		},
		
		'execScripts': function ( source, debug ) {
			var sc = $.getAllTags(source, "script");
			for (var i = 0; i < sc.length; i++) {
				try {
					eval( sc[i] );
				} catch (e) {
					if (debug) {
						alert( e );
						alert( sc[i] );
					}
					return false;
				}
			}
			return true;
		},
		
		'isNumeric': function ( input ) {
			return (input - 0) == input && input.length > 0;
		},
		
		'noCacheURL': function ( url ) {
			return url;
			return url + (url.indexOf('?') > 0 ? '' : '?') + '&nocache='+Math.floor(Math.random()*10000);
		},
		
		'gaTrackPage': function ( title ) {
			if (!title) title = document.title.split(': ')[1];
			try { 
				var gaid = $( 'body' ).html().split('_getTracker("')[1].split('"')[0];
				var pageTracker = _gat._getTracker( gaid );
				_gat._anonymizeIp();
				pageTracker._trackPageview( title );
			} catch (e) {}

		},
		
		'm_ajax': function ( obj ) {
			if (!obj.id) obj.id = '';
			try {
				$('body').data('m_ajax_loader_'+obj.id).abort();
			} catch (e) {}
			var n = $.ajax({ 	url: $.noCacheURL(obj.url), 
						success: function (data) {
							if (!data) return false;
							document.title = $.htmlentitiesdecode( $.getAllTags(data, 'title')[0] );

							// Aus dem Body-Tag ein DIV machen, sonst kann man die Klasse nicht lesen!
							var body2div = $.stripNL($.getAllTags(data, 'body', true)[0]).split("<body").join("<div").split("</body").join("</div");
							var html_data = $(body2div);
							//var html_data = $($.stripNL($.getAllTags(data, 'body')[0]));

							for (var target in obj.targets) {
								var o = html_data.find( target );
								var div = obj.targets[target] === true ? target : obj.targets[target];
								$( div ).html( o.html() );
							}

							if (obj.execScripts !== false) $.execScripts( data );
							$.gaTrackPage();
							if (obj.success) obj.success( data, html_data );
						}
				});
			$('body').data('m_ajax_loader_'+obj.id, n );

		}
		
	});
})(jQuery);


// Preloader-Effekt

(function($){
	$.fn.extend({
		'showPreloader': function ( opt ) {
		
			var def = {offsetX:0, offsetY:0, radius:20, pause:0 };
			var opt = $.extend( def, opt);
			
			return this.each( function () {
				var str = '';
				var numDots = 10;			
				for (var i = 0; i < numDots; i++) {
					str += '<span>°</span>';
				}
				
				var pos = $(this).offset();
				var dim = {w:$(this).width(), h:$(this).height() };
				
				$('.dots_preloader').remove();
				$('body').append('<div class="dots_preloader">'+str+'</div>');
				$('.dots_preloader').data( 'prefs', opt );
				
				var f = {'position':'absolute', 'left':0, 'top':0, 'font':'20px Arial', 'color':'#fff', 'text-shadow':'0 0 10px #000'};
				$('.dots_preloader span').css( f );
				
				var cnt = 0;
				$('.dots_preloader span').each( function () {
					//$(this).css('opacity',0);
					$(this).fadeOut(0).delay(50*cnt++).fadeIn('slow').delay(1200*cnt).pulsate({delay:cnt*5});
				});
				
				$({num:0}).stop(true,true).animate({num:100}, {
					duration: 3000,
					easing: 'easeOutQuint',
					step: function ( now, obj ) {
						$('.dots_preloader')._showPreloaderStep( { numDots:numDots, now:now, left:pos.left, top:pos.top, h:dim.h, w:dim.w } );
						
					}
				});
			});
		
		},
		
		'_showPreloaderStep': function ( obj ) {
			var opt = $('.dots_preloader').data( 'prefs', opt );
			$.each( $(this).find('span'), function( i, val ) {
				var tx = opt.offsetX + obj.left + obj.w/2 + (opt.radius+100-obj.now) * Math.sin( (360/obj.numDots*i + obj.now*2)/(180/Math.PI) );
				var ty = opt.offsetY + obj.top + obj.h/2 + (opt.radius+100-obj.now) * Math.cos( (360/obj.numDots*i + obj.now*2)/(180/Math.PI) );
				$(this).css({'top':Math.round(ty),'left':Math.round(tx)});
				$('body').data('plStep', obj.now);
			});
		},
		
		'hidePreloader': function () {
			return this.each( function () {
			
				var pos = $(this).offset();
				var dim = {w:$(this).width(), h:$(this).height() };
				var numDots = 10;
				var now = $('body').data('plStep');
				$({num:(now ? now : 100)}).stop(true,true).animate({num:0}, {
					duration: 500,
					easing: 'easeInQuad',
					step: function ( now, obj ) {
						$('.dots_preloader')._showPreloaderStep( { numDots:numDots, now:now, left:pos.left, top:pos.top, h:dim.h, w:dim.w } );
					},
					complete: function () { $('.dots_preloader').remove(); }
				});
				
			});
		},
		'pulsate': function ( opt ) {
			
			var def = { speed:100, scale: 0.8, alpha: 0.2, delay:0 };
			var opt = $.extend( def, opt);
			
			return this.each( function(){
				
				var img = $(this);
			
				var is_div = img.html().length > 0;
				var orig = is_div ? {} : {w:img.attr('width'), h:img.attr('height') };
				
				if (!orig.w && !is_div) {
					img.load( function () { img.pulsate( obj ) } );
					return this;
				}
				
				var cnt = -opt.delay;
				var timer = setInterval( function () {
					if (cnt++ > opt.speed/2) cnt = 0;
					if (cnt < 0) return;
					var f = 0.5 + 0.5 * Math.sin( 90+(360/opt.speed*cnt)/(180/Math.PI) );
					if (opt.scale !== false) {
						img.attr( {	'width':	orig.w + ((orig.w * opt.scale)-orig.w)*f, 
									'height':	orig.h + ((orig.h * opt.scale)-orig.h)*f	
									});
					}
					img.css( 'opacity', opt.alpha + (1-opt.alpha)*f );
					if ( !img.position().top ) {clearInterval( timer );}
				}, 10);
			});
		},
		
		'pulsateColor': function ( opt ) {
			var def = { color:'#fff', 'background-color': false, durationIn: 400, durationOut: 100, pause:1000 };
			var opt = $.extend( def, opt);
			return this.each( function () {
				var c = {'col':$(this).css('color'), 'bgcol':$(this).css('background-color')};
				$(this).data('_col', c );
				$(this).delay(opt.pause).animate({color:(opt.color ? opt.color : c.col), 'background-color':(opt['background-color'] ? opt['background-color'] : c.bgcol)}, {duration:opt.durationIn}).delay(opt.durationIn).animate({color:c.col, 'background-color':c.bgcol}, {duration:opt.durationOut, complete:function(){
					$(this).delay(opt.pause).pulsateColor( opt );
				}});
				
			});
		}
		
	});
})(jQuery);


$( function () {
	return;
	var pp = 0;
	$('.centerbox').click( function(){ 
		pp++;
		if (pp%2 == 1) {
			$('body').showPreloader();
		} else {
			$('body').hidePreloader();
		}
	});
});


// Combo-Box

(function($){
	$.fn.extend({
		'comboBox': function ( opt ) {

			var allRefs = this;
			var levelCnt = 100;
			
			var def = {lockTitle:false, useMouseEnter:false, durationClose:500, durationOpen:500};
			var opt = $.extend( def, opt);
			
			var maxWidth = function ( sel ) {
				var w = 0;
				$(sel).each( function () {
					w = Math.max($(this).width(), w);
				});
				return w;
			}
			
			var closeAll = function () {
				$('.jqcb .selbox').stop(true,true).slideUp( opt.durationClose );
			}
			
			var closeOne = function ( sel ) {
				$(sel).stop(true,true).slideUp( opt.durationClose );
			}
			
			var updateAll = function () {
				allRefs.each( function () {
					var ref = $(this).data('orig');
					if (ref) {
						$(ref).parent().find('.selbox li').removeClass('selected');
						var s = ref.find( ':selected' );
						if ($(s).data('li')) {
							$(s).data('li').addClass('selected');
						}
						var v = !opt.lockTitle ? $(s).html() : ref.find('[value=""]').html();
						$(ref).parent().find('.cur .text').html( v ? v : '&nbsp;' );
					}
				});
				
			}
			
			return this.each( function () {
			
				var orig = $(this);
				
				if (orig.data('orig')) {
					orig.parent().find('.selbox, .cur').remove();
					orig.unwrap();
				}
				
				orig.data('orig', orig);
				
				orig.wrap('<div class="jqcb" />');
				orig.css({display:'none'});
				orig.parent().append('<div class="selbox"></div><div class="cur"><div class="text"></div></div>');
				
				var cur = orig.parent().find('.cur');
				var selbox = orig.parent().find('.selbox');
				cur.css({width:orig.width()});
				cur.addClass( orig.attr('class') );
				
				var lng = orig.find('option').length;
				orig.find('option').each( function ( i, ref ) {
					var str = $(this).html();
					if ($(this).attr('value')) {
						var cls = '';
						if (i == 0) cls += ' first';
						if (i == lng-1) cls += ' last';

						var li = $('<li class="'+cls+'">' + str + '</li>' ).data('ori',$(ref)).appendTo(selbox).click( function () {
							cur.find('.text').html( $(this).html() );
							closeAll();
							orig.find('option').removeAttr('selected');
							$(this).data('ori').attr('selected', true);
							updateAll();
							orig.change();
						}).rolloverColor({'background-color':'#dddddd', color:false});
						$(ref).data('li', $(li));
					}
				});
				
				selbox.wrapInner('<ul />');	
				selbox.width( Math.max( maxWidth(selbox.find('li'))+50, orig.parent().width() ) );
				selbox.hide();

				cur.unbind().bind('click'+ (opt.useMouseEnter ? ' mouseenter' : ''), function () {
					var isOpen = selbox.is(':visible');
					var pos = cur.position();
					pos.top += cur.height();
					pos.left = Math.min( pos.left, $(window).width()-selbox.width() );
					closeAll();
					if (!isOpen) selbox.css({left:pos.left,top:pos.top,'z-index':levelCnt++}).stop(true,true).slideDown( opt.durationOpen );
					cur.addClass('opened');
				});
				
				// geöffnete ComboBoxen bei RollOut nach einer Sekunde automatisch schliessen
				var iv = false;
				orig.parent().unbind('mouseleave').mouseleave( function () {
					if (iv) clearTimeout(iv);
					iv = setTimeout( function () { 
						closeOne( selbox ); 
						cur.removeClass('opened');
					}, 200 );
				}).mouseenter( function () {
					if (iv) clearTimeout(iv);
				});
				
				updateAll();
			});
		
		}
	})
})(jQuery);

// PNG-FIX für IE6+
// http://jquery.andreaseberhard.de/pngFix/

// Cookies-Support

/**
 * Copyright (c) 2005 - 2010, James Auldridge
 * All rights reserved.
 *
 * Licensed under the BSD, MIT, and GPL (your choice!) Licenses:
 *  http://code.google.com/p/cookies/wiki/License
 *
 */
var jaaulde=window.jaaulde||{};jaaulde.utils=jaaulde.utils||{};jaaulde.utils.cookies=(function(){var resolveOptions,assembleOptionsString,parseCookies,constructor,defaultOptions={expiresAt:null,path:'/',domain:null,secure:false};resolveOptions=function(options){var returnValue,expireDate;if(typeof options!=='object'||options===null){returnValue=defaultOptions;}else
{returnValue={expiresAt:defaultOptions.expiresAt,path:defaultOptions.path,domain:defaultOptions.domain,secure:defaultOptions.secure};if(typeof options.expiresAt==='object'&&options.expiresAt instanceof Date){returnValue.expiresAt=options.expiresAt;}else if(typeof options.hoursToLive==='number'&&options.hoursToLive!==0){expireDate=new Date();expireDate.setTime(expireDate.getTime()+(options.hoursToLive*60*60*1000));returnValue.expiresAt=expireDate;}if(typeof options.path==='string'&&options.path!==''){returnValue.path=options.path;}if(typeof options.domain==='string'&&options.domain!==''){returnValue.domain=options.domain;}if(options.secure===true){returnValue.secure=options.secure;}}return returnValue;};assembleOptionsString=function(options){options=resolveOptions(options);return((typeof options.expiresAt==='object'&&options.expiresAt instanceof Date?'; expires='+options.expiresAt.toGMTString():'')+'; path='+options.path+(typeof options.domain==='string'?'; domain='+options.domain:'')+(options.secure===true?'; secure':''));};parseCookies=function(){var cookies={},i,pair,name,value,separated=document.cookie.split(';'),unparsedValue;for(i=0;i<separated.length;i=i+1){pair=separated[i].split('=');name=pair[0].replace(/^\s*/,'').replace(/\s*$/,'');try
{value=decodeURIComponent(pair[1]);}catch(e1){value=pair[1];}if(typeof JSON==='object'&&JSON!==null&&typeof JSON.parse==='function'){try
{unparsedValue=value;value=JSON.parse(value);}catch(e2){value=unparsedValue;}}cookies[name]=value;}return cookies;};constructor=function(){};constructor.prototype.get=function(cookieName){var returnValue,item,cookies=parseCookies();if(typeof cookieName==='string'){returnValue=(typeof cookies[cookieName]!=='undefined')?cookies[cookieName]:null;}else if(typeof cookieName==='object'&&cookieName!==null){returnValue={};for(item in cookieName){if(typeof cookies[cookieName[item]]!=='undefined'){returnValue[cookieName[item]]=cookies[cookieName[item]];}else
{returnValue[cookieName[item]]=null;}}}else
{returnValue=cookies;}return returnValue;};constructor.prototype.filter=function(cookieNameRegExp){var cookieName,returnValue={},cookies=parseCookies();if(typeof cookieNameRegExp==='string'){cookieNameRegExp=new RegExp(cookieNameRegExp);}for(cookieName in cookies){if(cookieName.match(cookieNameRegExp)){returnValue[cookieName]=cookies[cookieName];}}return returnValue;};constructor.prototype.set=function(cookieName,value,options){if(typeof options!=='object'||options===null){options={};}if(typeof value==='undefined'||value===null){value='';options.hoursToLive=-8760;}else if(typeof value!=='string'){if(typeof JSON==='object'&&JSON!==null&&typeof JSON.stringify==='function'){value=JSON.stringify(value);}else
{throw new Error('cookies.set() received non-string value and could not serialize.');}}var optionsString=assembleOptionsString(options);document.cookie=cookieName+'='+encodeURIComponent(value)+optionsString;};constructor.prototype.del=function(cookieName,options){var allCookies={},name;if(typeof options!=='object'||options===null){options={};}if(typeof cookieName==='boolean'&&cookieName===true){allCookies=this.get();}else if(typeof cookieName==='string'){allCookies[cookieName]=true;}for(name in allCookies){if(typeof name==='string'&&name!==''){this.set(name,null,options);}}};constructor.prototype.test=function(){var returnValue=false,testName='cT',testValue='data';this.set(testName,testValue);if(this.get(testName)===testValue){this.del(testName);returnValue=true;}return returnValue;};constructor.prototype.setOptions=function(options){if(typeof options!=='object'){options=null;}defaultOptions=resolveOptions(options);};return new constructor();})();(function(){if(window.jQuery){(function($){$.cookies=jaaulde.utils.cookies;var extensions={cookify:function(options){return this.each(function(){var i,nameAttrs=['name','id'],name,$this=$(this),value;for(i in nameAttrs){if(!isNaN(i)){name=$this.attr(nameAttrs[i]);if(typeof name==='string'&&name!==''){if($this.is(':checkbox, :radio')){if($this.attr('checked')){value=$this.val();}}else if($this.is(':input')){value=$this.val();}else
{value=$this.html();}if(typeof value!=='string'||value===''){value=null;}$.cookies.set(name,value,options);break;}}}});},cookieFill:function(){return this.each(function(){var n,getN,nameAttrs=['name','id'],name,$this=$(this),value;getN=function(){n=nameAttrs.pop();return!!n;};while(getN()){name=$this.attr(n);if(typeof name==='string'&&name!==''){value=$.cookies.get(name);if(value!==null){if($this.is(':checkbox, :radio')){if($this.val()===value){$this.attr('checked','checked');}else
{$this.removeAttr('checked');}}else if($this.is(':input')){$this.val(value);}else
{$this.html(value);}}break;}}});},cookieBind:function(options){return this.each(function(){var $this=$(this);$this.cookieFill().change(function(){$this.cookify(options);});});}};$.each(extensions,function(i){$.fn[i]=this;});})(window.jQuery);}})();




