
	$(function() {
		// hover effect
		$('.hoverBg').each(function(key,obj) {
			$(obj).mouseover(function() {
				$(this).css({backgroundColor: '#8FAFD7', cursor: 'pointer' });
			});
			$(obj).mouseout(function() {
				$(this).css({backgroundColor: '#7F9EC6'});
			});
		});
		
		
		// sitemap hover
		
		$('.sitemap li a').each(function(key,obj)
		{
			$(obj).hover(function()
			{
				$(obj).addClass('activeSitemapLink');
			}, function() 
			{
				$(obj).removeClass('activeSitemapLink');
			});
		});
		
		// navigation hover
		
		$('.level_1').each(function(key,obj)
		{
			$(obj).hover(function()
			{
				if($(obj).hasClass('level_1'))
				{
					$(obj).removeClass('level_1');
					$(obj).addClass('level_1_hover');
				}
			}, function() 
			{
				if($(obj).hasClass('level_1_hover'))
				{
					$(obj).removeClass('level_1_hover');
					$(obj).addClass('level_1');
				}
			});
		});
		
		$('.level_2').each(function(key,obj)
		{
			$(obj).hover(function()
			{
				$(obj).removeClass('level_2');
				$(obj).addClass('level_2_hover');
			}, function() 
			{
				$(obj).removeClass('level_2_hover');
				$(obj).addClass('level_2');
			});
		});
		
		$('.#Sitelinks li').each(function(key,obj)
		{
			$(obj).hover(function()
			{
				$(obj).addClass('hover');
			}, function() 
			{
				$(obj).removeClass('hover');
			});
		});
	});

	function addBookmark(url,text) {
		if (window.sidebar) // Firefox 
		{
			window.sidebar.addPanel(text,url,"");
		} 
		
		else if( window.external) // IE 
		{
			window.external.AddFavorite(url,text);
		}
	}
	
	function hideBookmark() {
		if (!window.sidebar && !window.external) {
			$('.ProductDetailsFavorite').css({'display':'none'});
		}
	}
	
	function accordion(obj) {
		$(obj).blur();
		var liHeight  = 22;
		var liCount   = $('#NavigationProducts').children().length;
		var newHeight = liHeight * liCount;
		
		if(parseInt($('#NavigationProductsOuter').css('height')) > 0) {
			$('#NavigationProductsOuter').animate({'height':'0px'});
			$('.level_1_tmp').removeClass('level_1');
			$('.level_1_tmp').addClass('level_1_active');
			$('.level_1_tmp').removeClass('level_1_tmp');
			$('#NavigationProductHead').removeClass('level_1_active');
			$('#NavigationProductHead').addClass('level_1');
		}
		 else
		 {
			$('#NavigationProductsOuter').animate({'height':$($("#NavigationProductsOuter").children(":first")).attr("offsetHeight")},'slow');
			$('.level_1_active').addClass('level_1_tmp');
			$('.level_1_active').addClass('level_1');
			$('.level_1_active').removeClass('level_1_active');
			$('#NavigationProductHead').removeClass('level_1');
			$('#NavigationProductHead').removeClass('level_1_hover');
			$('#NavigationProductHead').addClass('level_1_active');
		 }
	}
	
// file jquery.formvalidation.1.1.5.js
/*
 * jQuery Form Validation plug-in version 1.1.5
 * Last Update : July 13, 2008
 * New features:
 * onError event
 * Add call back support - callback function is called when validation is error, return true form will be submited otherwise not.
 * Error list in the alert msg
 * Alias to field name
 * Select diff html attributes for validation rules instead off using custom html attributes
 *
 * Bug Fixed:
 * now support radio buttons
 * defval to work with LabelIn plugin
 * now support textarea
 *
 * Copyright (c) 2007 E-wave web design
 *   http://www.ewave.com.au/
 *
 * Licensed under the GPL license:
 *   http://www.gnu.org/licenses/gpl.html
 *
 * @requires jQuery v 1.2.1 or later
 * @name	formValidation
 * @usage		$('#form1').formValidation({
 *		newmask : /[0-9]{1}-[0-9]{1}/,	// 1-1
 *		err_class : "invalidInput"
 * });
 * 
 * HTML
 * <form id="form1">
 * <input id="input1" type="text" required="true" mask="email"></input>
 * <input id="input2" type="text" required="true" mask="email" equal="input2"></input>
 * <input type="submit" value="Submit>
 * </form>
 *
 * Description
 * Validate form fields accordiing to 4 keys
 * required - check that text field is not empty. checkbox checked, and select val is not empty
 * equal - checks that field value equal to another field with this id
 * mask - compre value to mask using reg exp
 * defval - ignore default value
 *
 * Prevent Submit and Display alert when not validate and change class of field to invalid class
 * 
 * @param String version
 * 	Plugin Version	
 * 
 * @param String err_class
 * 	invalid input class name	
 * 
 * @param String displayAlert
 * 	display alert when submit form is invalid	
 *  default true
 * 
 * @param String err_message
 * 	alert message	
 * 
 * @param reg-exp email
 * 	email pattern
 * 
 * @param reg-exp domain
 * 	domain pattern
 * 
 * @param reg-exp phone
 * 	phone pattern
 * 
 * @param reg-exp zip
 * 	zip pattern
 * 
 * @param reg-exp numeric
 * 	numeric pattern
 * 
 * @param reg-exp image
 * 	image file name pattern
 * 
 * @param reg-exp pdf
 * 	pdf file name pattern
 * 
 * @param alias, required, mask, equal, defval 
 * 	validation rules map to input attributes 
 * 
 */
if (!window.jQuery) {
	throw("jQuery must be referenced before using formValidation");
} else {
	
	(function() { 
		jQuery.fn.formValidation = function(settings, err_msgs) {
		var iForm = this;
		var err_list = '';
	
		settings = jQuery.extend({
			version			: '1.1.2',
			email			: /^([a-zA-Z0-9._-]{2,})+\@(([a-zA-Z0-9_-]{2,})+\.)[a-zA-Z0-9]{2,}/,
			domain			: /^(http:\/\/)([\w]+\.){1,}[A-Z]{2,4}\b/gi,
			phone			: /^\+[0-9]{1,3}\.[1-9]{1,2}\.[0-9]{6,}$/gi,
			zip				: /^[0-9]{4,}$/gi,
			numeric			: /^[0-9]+$/gi,
			image			: /[\w]+\.(gif|jpg|bmp|png|jpeg)$/gi,
			ewvt			: /[\w]+\.(htm|html|php|txt)$/gi,
			media			: /[\w]+\.(avi|mov|mpeg|wmv)$/gi,
			pdf				: /[\w]+\.(pdf)$/gi,
			enable			: false,
			err_list		: true,
			alias			: 'title',
			required		: 'required',
			mask			: 'mask',
			equal			: 'equal',
			defval			: 'defval',
			callback		: '',
			err_message		: "Please fill all required fields! (Marked with red background colour)\n",
			display_alert	: true	//onsubmit if invalid form display an error message
		}, settings);
		
		err_msgs = jQuery.extend({ 
			required	: 'bitte ausf&uuml;llen',
			mask		: 'falscher Syntax',
			equal		: 'is not equal to'
		}, err_msgs);

		if (settings.submit)
		{
			return submit2();
		}

		return iForm.submit( function () {
				submit2();
				return false;

			}).find('*').filter("input, select, textarea").each(function() {
			$(this).click(function() {
				isValid($(this));
			}).change(function() {
				isValid($(this));
			}).keyup(function() {
				isValid($(this));
			}).focus(function() {
				isValid($(this));
			}).blur(function() {
				isValid($(this));
			});
		});

		function submit2()
		{
			settings['enable'] = true;
			err_list = '';
			var frm = true;
			$(iForm).find('*').filter("input, select, textarea").each(function() {
				ret = isValid($(this));
				if (!ret)
				{
					frm = ret;
				}
			});

			if (frm) {
				// form validation ok and callback function defined
				if (typeof settings['callback_ok'] == 'string' && eval('typeof ' + settings['callback_ok']) == 'function') {
					//call external validation function
					frm = eval(settings['callback_ok'] + '()');
				} else {
					frm = callback_ok();
				}
				
			} else if (settings['display_alert']) {
				if (typeof settings['callback_error'] == 'string' && eval('typeof ' + settings['callback_error']) == 'function') {
					// error validation and display alert on
					frm = eval(settings['callback_error'] + '("' + err_list + '")'); //call external validation function
				} else {
					frm = callback_error(err_list);
				}
				//alert(settings['err_message'] + err_list);	// display message
			}

			return frm;
		}
		
		function isValid(obj) { // check if field is valid
			if (!settings['enable'])
				return true;
				
			if (required(obj) && mask(obj) && equal(obj)) {
				if (obj.attr('errorclass'))
					obj.removeClass(obj.attr('errorclass'));
				return true;
			} else {
				if (obj.attr('errorclass'))
					obj.addClass(obj.attr('errorclass'));
					
				return false;
			} 
		}
		//field is required
		function required(obj) {						
			if (!(obj.attr(settings['required']) == "true"))	//if not required return true
				return true;
				
			if(obj.is("input[type=checkbox]") || obj.is('input[type=radio]')) {		//if checkbox and checked	
				if (obj.attr('checked'))
					return true;
			} else if((obj.is("input") || obj.is("select") || obj.is("textarea")) && (!obj.is("button"))) // if not empty
				if (obj.val() != '' && (!(defval(obj))))
					return true;
			
			if (settings['err_list'])	
				err_list += '<li><strong>' + obj.attr(settings['alias']) + '</strong> - ' + err_msgs['required'] + '</li>';
				
			return false;
		}
		//compare field to mask provided in the extend array
		function mask(obj) { 
			tname = obj.attr('mask');	//read mask name from input field
			if (tname == undefined || obj.val() == '')
				return true;
	
			tmask = settings[obj.attr(settings['mask'])];	// get mask pattern from settings
			
			ret = tmask.test(obj.val());			//test reg exp
			ret1 = tmask.exec(obj.val());		
			if (ret)
				return true;
	
			if (settings['err_list'])
				err_list += '<li><strong>' + obj.attr(settings['alias']) + '</strong> - ' + err_msgs['mask'] + '</li>';
			
			return false;				
		}
		//copare field to another field read from the equal attribute
		function equal(obj) { 
			tname = obj.attr(settings['equal']);		//get comparison field
			tval = $('form#' + settings.form + ' input[name=' + tname + ']').val();
			
			if (tname == undefined)
				return true;
			
			if (tval == obj.val())
				return true;
			
			if (settings['err_list'])	
				err_list += '<li>"' + obj.attr(settings['alias']) + '" ' + err_msgs['equal'] + ' ' + $('#'+tname).attr('alias') + '</li>';
			return false;
		}
		//compare field with defval attr, make sure that val was altered
		function defval(obj) { 
			tdefval = obj.attr(settings['defval']);		//get comparison field
			tval = obj.val();
			
			if (tdefval == undefined)
				return false;
			
			if (tval != tdefval)
				return false;
	
			return true;
		}
		
		function callback_ok() {
			if (typeof(settings['forms']) == "undefined")
				var str = $("form#" + settings['form']).serialize();
			else
			{
				var str = $(settings['forms']).serialize();
			}
			var msgType = new Array('OK', 'INFO', 'ERROR', 'FATALERROR');

			$.ajax({
			  type: "POST",
			  url: "/?output=json&language=" + settings['language'] + settings['request_params'],
			  data: str,
			  cache: false,
			  dataType: 'json',
			  success: function(msg) {
				
				if (msg.success && typeof(settings['ok_box']) == "undefined")
				{
			    	$("form#" + settings['form']).slideToggle("slow");
			    }
				else if (msg.success && typeof(settings['ok_code']) != "undefined")
				{
					eval(settings['ok_code']);
				}

			    
			    msgOutput = new Array();
			    if (msg.msg)
			    {
				   	for(i=0; i<msg.msg.length; i++)
				   	{
				   		text = "";
				   		
				   		if (msg.msg[i].status == "OK")
				   		{
				   			text = msg.msg[i].msg;
				   		}
				   		else 
				   		{
				   			text = "<li>";
				   			if (msg.msg[i].title)
				   				text = text + "<strong>" + msg.msg[i].title + "</strong> - ";
				   			text = text + msg.msg[i].msg + "</li>";
				   		}
				   		
				   		if (msgOutput[msg.msg[i].status])
				   			msgOutput[msg.msg[i].status] = msgOutput[msg.msg[i].status] + text + "";
				   		else
				   			msgOutput[msg.msg[i].status] = text + "";
				   	}
				}
				
				for(i=0; i<msgType.length; i++)
				{
					if (!msgOutput[msgType[i]])
					{
						$("div#MsgBox" + settings['form'] + " div." + msgType[i] + " div").html();
						$("div#MsgBox" + settings['form'] + " div." + msgType[i]).fadeOut('slow');
					}
					else
					{
						$("div#MsgBox" + settings['form'] + " div." + msgType[i] + " div").html(msgOutput[msgType[i]]);
						$("div#MsgBox" + settings['form'] + " div." + msgType[i]).fadeIn('slow');
					}
				}
			  },
			  error: function(msg) {
			  	$("div#MsgBox" + settings['form'] + " div.FATALERROR div").html("Das Formular konnte nicht abgesendet werden. Bitte probieren Sie es zu einem sp&auml;teren Zeitpunkt noch einmal. Vielen Dank.");
				$("div#MsgBox" + settings['form'] + " div.FATALERROR").fadeIn('slow');
				$("div#MsgBox" + settings['form'] + " div.OK").fadeOut('slow');
				$("div#MsgBox" + settings['form'] + " div.INFO").fadeOut('slow');
				$("div#MsgBox" + settings['form'] + " div.ERROR").fadeOut('slow');
			  }
			});
		}
		
		function callback_error(err_list)
		{
			if (typeof(settings['form']) == "undefined")
				alert("undefinied form field");

			$("div#MsgBox" + settings['form'] + " div.ERROR div").html(err_list);
			$("div#MsgBox" + settings['form'] + " div.ERROR").fadeIn('slow');
			
			$("div#MsgBox" + settings['form'] + " div.OK").fadeOut('slow');
			$("div#MsgBox" + settings['form'] + " div.INFO").fadeOut('slow');
			$("div#MsgBox" + settings['form'] + " div.FATALERROR").fadeOut('slow');
							
			return false;
		}
	}
	})(jQuery); 
}

// file jquery.autogrow.js
/* 
 * Auto Expanding Text Area (1.2.2)
 * by Chrys Bader (www.chrysbader.com)
 * chrysb@gmail.com
 *
 * Special thanks to:
 * Jake Chapa - jake@hybridstudio.com
 * John Resig - jeresig@gmail.com
 *
 * Copyright (c) 2008 Chrys Bader (www.chrysbader.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 *
 * NOTE: This script requires jQuery to work.  Download jQuery at www.jquery.com
 *
 */
 
(function(jQuery) {
		  
	var self = null;
 
	jQuery.fn.autogrow = function(o)
	{	
		return this.each(function() {
			new jQuery.autogrow(this, o);
		});
	};
	

    /**
     * The autogrow object.
     *
     * @constructor
     * @name jQuery.autogrow
     * @param Object e The textarea to create the autogrow for.
     * @param Hash o A set of key/value pairs to set as configuration properties.
     * @cat Plugins/autogrow
     */
	
	jQuery.autogrow = function (e, o)
	{
		this.options		  	= o || {};
		this.dummy			  	= null;
		this.interval	 	  	= null;
		this.line_height	  	= this.options.lineHeight || parseInt(jQuery(e).css('line-height'));
		this.min_height		  	= this.options.minHeight || parseInt(jQuery(e).css('min-height'));
		this.max_height		  	= this.options.maxHeight || parseInt(jQuery(e).css('max-height'));;
		this.textarea		  	= jQuery(e);
		
		if(this.line_height == NaN)
		  this.line_height = 0;
		
		// Only one textarea activated at a time, the one being used
		this.init();
	};
	
	jQuery.autogrow.fn = jQuery.autogrow.prototype = {
    autogrow: '1.2.2'
  };
	
 	jQuery.autogrow.fn.extend = jQuery.autogrow.extend = jQuery.extend;
	
	jQuery.autogrow.fn.extend({
						 
		init: function() {			
			var self = this;			
			this.textarea.css({overflow: 'hidden', display: 'block'});
			this.textarea.bind('focus', function() { self.startExpand() } ).bind('blur', function() { self.stopExpand() });
			this.checkExpand();	
		},
						 
		startExpand: function() {				
		  var self = this;
			this.interval = window.setInterval(function() {self.checkExpand()}, 400);
		},
		
		stopExpand: function() {
			clearInterval(this.interval);	
		},
		
		checkExpand: function() {
			
			if (this.dummy == null)
			{
				this.dummy = jQuery('<div></div>');
				this.dummy.css({
												'font-size'  : this.textarea.css('font-size'),
												'font-family': this.textarea.css('font-family'),
												'width'      : this.textarea.css('width'),
												'padding'    : this.textarea.css('padding'),
												'line-height': this.line_height + 'px',
												'overflow-x' : 'hidden',
												'position'   : 'absolute',
												'top'        : 0,
												'left'		 : -9999
												}).appendTo('body');
			}
			
			// Strip HTML tags
			var html = this.textarea.val().replace(/(<|>)/g, '');
			
			// IE is different, as per usual
			if ($.browser.msie)
			{
				html = html.replace(/\n/g, '<BR>new');
			}
			else
			{
				html = html.replace(/\n/g, '<br>new');
			}
			
			if (this.dummy.html() != html)
			{
				this.dummy.html(html);	
				
				if (this.max_height > 0 && (this.dummy.height() + this.line_height > this.max_height))
				{
					this.textarea.css('overflow-y', 'auto');	
				}
				else
				{
					this.textarea.css('overflow-y', 'hidden');
					if (this.textarea.height() < this.dummy.height() + this.line_height || (this.dummy.height() < this.textarea.height()))
					{	
						this.textarea.animate({height: (this.dummy.height() + this.line_height) + 'px'}, 100);	
					}
				}
			}
		}
						 
	 });
})(jQuery);

function PDFAdd(id, download)
{
	var params = new Array();

	params["fnc_success"] = (download == "YES" ?  "PDFCallbackSuccess" : "PDFCallbackMessage");
	params["get"] = "";
	params["post"] = {
		modul: 'Site',
		method: 'setPDF',
		download: download,
		html: document.getElementById(id).innerHTML,
		title: document.title,
		url: document.URL,
		output: "json"
	};
	
	SendRequest(params);
};

function PDFCallbackMessage(data)
{
	$('#ContentMain').before('<div id="pdfMessage" style="height: 0px; overflow: hidden; background-color: #eeffee; color: #00aa00;"><div id="pdfMessageInner" style="padding: 10px;">' + data.msg[0].msg + '</div></div>');
	$('#pdfMessage').animate({'height':document.getElementById('pdfMessageInner').offsetHeight});
	window.setTimeout("PDFCallbackMessageHide()",2500);
}

function PDFCallbackMessageHide()
{
	$('#pdfMessage').animate({'height':'0px'});
}

function PDFCallbackSuccess(data)
{
	document.location.href = data.msg[0].url;
};

function SendRequest(params)
{
	$.ajax({
		type: "POST",
		url: "/request.php?" + jQuery.param(params['get']),
		data: jQuery.param(params['post']),
		cache: false,
		dataType: 'json',
		queryString: querySt(),
		success: function (data) {
			if (data.success)
			{
				eval(params["fnc_success"]+"(data);")
			}
			else
			{
				ShowDialog('Fehlermeldung', 'Es ist ein Fehler aufgetreten. Kontaktieren Sie bitte den Webmaster. Vielen Dank.');
			}
		},
		error: function(data) {
			ShowDialog('Fehlermeldung', 'Es ist ein interner schwerer Fehler aufgetreten. Kontaktieren Sie bitte den Webmaster. Vielen Dank.');
		}
	});
};


function CloseDialog()
{
	var main = document.getElementById('MsgDialog');
	e = document.getElementById('overlay');
	main.removeChild(e);
	var e = document.getElementById('diadiv');
	main.removeChild(e);
};

function ShowDialog(title, content)
{
	data = '<h2>' + title + '</h2><p>' + content + '</p><div class="close"></div><div class="close"></div>';

	var main = document.getElementById('MsgDialog');

	var newdiv = document.createElement('div');
	newdiv.className = 'modal';
	newdiv.innerHTML = data;
	main.appendChild(newdiv);

	var api = $("div.modal").overlay({
		api: true,
		expose: {
			color: '#333',
			loadSpeed: 200,
			opacity: 0.9
		}
	});

	api.load();
};

function querySt() {
	return window.location.search.substring(1);
}
