// Globale Parameter definieren
var globalVars=new Array();
var selector=new String();

$(document).ready(function() {
	
	//
	// DOM-Manipulationen Anfang
	//
	
		// IE6-Helper
		if($.browser.msie && $.browser.version=='6.0')
		{
			// Hover-Indikator
			$('div.angebote ul li').hover(
				function() {
					$(this).addClass('hover');
				},
				function() {
					$(this).removeClass('hover');
				}
			);
		}
	
	//
	// DOM-Manipulationen Ende
	//
	
	//
	// jQuery Corner Initialisierung
	//
	$('div.sub_navigation a').addClass('rounded');
	if($.browser.msie) $('.rounded').corners('3px transparent');
	else $('.rounded').corners('4px transparent');
	
	//
	// jQuery-Tools Anfang
	//
	
		// Overlay-Initialisierung für Einzelbilder
		selector='div.content a.img_enlarge';
		if($(selector).length>0)
		{
			$('body').append('<div id="overlay_single" class="overlay"> <div class="info"></div> <img class="progress" src="assets/site/images/ajax-loader.gif"> </div>');
			$(selector).overlay({
				target: 'div#overlay_single',
				effect: 'default', // default | apple
				expose: {
					color: 'black',
					loadSpeed: 200,
					opacity: 0.7
				},
				speed: 200
			}).gallery({
				speed: 200,
				autohide: false,
				opacity: 0.7,
				template: '<p class="caption">${title}</p>'
			});
		}
	
		// Overlay-Initialisierung für Galerien
		selector='div.content p.img_list_box.img_enlarge a';
		if($(selector).length>0)
		{
			$('body').append('<div id="overlay_gallery" class="overlay"> <a class="prev"></a> <a class="next"></a> <div class="info"></div> <img class="progress" src="assets/site/images/ajax-loader.gif"> </div>');
			$(selector).overlay({
				target: 'div#overlay_gallery',
				effect: 'default', // default | apple
				expose: {
					color: 'black',
					loadSpeed: 200,
					opacity: 0.7
				},
				speed: 200
			}).gallery({
				speed: 200,
				autohide: false,
				opacity: 0.7,
				template: '<p class="caption">${title}</p> <p class="position">Bild ${index} von ${total}</p>'
			});
		}
		
	//
	// jQuery-Tools Ende
	//
	
	
	//
	// E-Mails entschlüsseln
	//
		$('a[href^=mailto:]').each(function() {
			this.href=this.href.split("?")[0].replace("ANTI[at]SPAMBOT", "@");
			$(this).html($(this).html().replace("TOBMAPS]ta[ITNA", "@"));
		});

	//
	// SmoothScroll Anfang
	//
	
		$('a[href*=#]').click(function() {

			// Abbrechen falls der Link zu einer Scrollable-Navigation gehört
			if($(this).parent().parent().parent().attr('id')=='scrollable_navigation')	return;

			// duration in ms
			var duration=1000;

			// easing values: swing | linear
			var easing='swing';

			// get / set parameters
			var newHash=this.hash;
			var target=$(this.hash).offset().top;
			var oldLocation=window.location.href.replace(window.location.hash, '');
			var newLocation=this;

			// make sure it's the same location		
			if(oldLocation+newHash==newLocation)
			{
				// animate to target and set the hash to the window.location after the animation
				$('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function() {

					// add new hash to the browser location
					window.location.href=newLocation;
				});

				// cancel default click action
				return false;
			}
		});
		
	//
	// SmoothScroll Ende
	//
});

