//-----------------------------------------------------------------------------------
//
//  Script
//	by Felix Baltruschat - http://www.wortbildton.de
//	01/23/08
//
//	For more information on this script, visit:
//	http://www.wortbildton.de
//
//	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
//
//
// -----------------------------------------------------------------------------------
if(jQuery) (function($){
		$(document).ready(function(){
			// Link Formating
			$("a:not([@href*=http://www.d-velop-nord.de])").not("[href^=#]").not("[@href*=http://d-velop-nord.de]").not("[@href*=http://www.")
			.addClass("exLink")
			.attr({ target: "_blank" });
			
			$("a[@href$=pdf]").addClass("pdf");
			$("a[@href$=zip]").addClass("zip");

			
			var naviDir = 'http://www.gosch.de/wp-content/themes/default_de/images/navi/';
			var overLink = null;
			var stopEvent = false;		
			$("div#hoverNavi ul").css('display', 'none');
			$('#hoverNavi').css('opacity',0.85);
			$("div.nav a").mouseout(function(){
					var elementName = toNiceLink($(this).attr("title").toLowerCase());
					if($('#'+elementName+'_sub').length > 0 && elementName){
						$('#hoverNavi').css('display', 'none');
						overLink.removeClass();
						$('#'+elementName+'_sub').css('display', 'none');
					}
			}).mouseover(function(){
				var elementName = toNiceLink($(this).attr("title").toLowerCase());
				overLink = $(this);
				if($('#'+elementName+'_sub').length > 0){
					overLink.attr("href","#");
					$('#hoverNavi').css('left',overLink.position().left);
					$('#hoverNavi').css('display', 'block');
					overLink.addClass('hover');
					$('#'+elementName+"_sub").css('display', 'block');
					$("#hoverNavi").mouseover(function(){
							$('#hoverNavi').css('display', 'block');
							$("div#hoverNavi ul").css('display', 'none');
							overLink.addClass('hover');
							$('#'+elementName+"_sub").css('display', 'block');
					}).mouseout(function(){
							overLink.removeClass();
							$('#hoverNavi').css('display', 'none');
							$('#'+elementName+"_sub").css('display', 'none');
					});
				}
			});
						
		});
		
		function toNiceLink(string){
			var l = string.split(' ');
			var out = '';
			for(var i=0;i<l.length;i++){
				if(i == (l.length-1)){
						out += l[i];
				}else{
					out += l[i]+'-';
				}
			}
			 out=out.replace(/\u00fc/g, "ue;");
			 out=out.replace(/\u00f6/g, "oe");
			 out=out.replace(/\u00e4/g, "ae");
			 out=out.replace(/\u00df/g, "ss");
			return out;
		}
		
})(jQuery);
