(function($){
	$(document).ready(function(){
		
		//Volltextsuche
		$("#searchparams #website").click(function () {
			$("#ajaxSearch_form").attr("action","en/searchresults.html");
			$("#search form").focus();
	  });
	
		$("#searchparams #product-db").click(function () {
			$("#ajaxSearch_form").attr("action","en/searchresults-products.html");
			$("#search form").focus();
	  });
		
		// Kontakt-Formular vorbelegen
		// var myDepartment = $(document).getUrlParam("did");
		// $("#department").selectOptions(myDepartment);		
		
		// Metanav
		$('#metanav ul li:last-child').addClass('last');


		// Search-Box
	  $("#ajaxSearch_input").focus(function () {
			$(this).attr("value","Search");
			$("#searchparams").animate({ opacity: "show" }, "fast");
			searchparams();
			$(this).select(); // Update				
	  });
	
		$.fn.wait = function(time, type) {
	        time = time || 10000;
	        type = type || "fx";
	        return this.queue(type, function() {
	            var self = this;
	            setTimeout(function() {
	                $(self).dequeue();
	            }, time);
	        });
	    };

    function searchparams() {
	    $("#searchparams").wait().fadeOut(800)
    };

		// Lightbox
	  $('a[@rel*=lightbox]').lightBox({
		overlayBgColor: '#333333',
		txtImage: 'Picture',
		txtOf: 'of',
		imageLoading: '/assets/templates/default/images/lightbox-ico-loading.gif',
		imageBtnClose: '/assets/templates/default/images/lightbox-btn-close-en.gif',
		imageBtnPrev: '/assets/templates/default/images/lightbox-btn-prev.gif',
		imageBtnNext: '/assets/templates/default/images/lightbox-btn-next.gif'
	   });
	

		// Search-Box: Button-Mouse-Over
		$("#ajaxSearch_submit").mouseover(function () {
			$(this).attr("src","/assets/templates/default/images/btn_search_hover.gif");
	  });
		$("#ajaxSearch_submit").mouseout(function () {
			$(this).attr("src","/assets/templates/default/images/btn_search.gif");
	  });

		// Gallery: Add Zoom Image
		$("ul.gallery li a img").after("<div class='zoom'><span>+</span></div>");
				
	});
})(jQuery);
