// JavaScript Document


// Top level javascript navigation
// ----------------------------------------------------------------------------
// Required for I.E. 6 only!
<!--//--><![CDATA[//><!--

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

sfHover = function() {
	var sfEls = document.getElementById("country").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


//--><!]]>


$(document).ready(function(){
	// ___ Location Map Hover _____________________________________________________________________
	//Alle p-tags der Klasse "loc" raussuchen
	$('.loc p').each(function(index) {
		//id des p-tags
		var loc_id = $(this).attr("id");
		//klasse des p-tags
		var loc_class = $(this).attr("class");
		//alert(loc_id);
		
		//wenn die klasse nicht more ist, also es nicht mehrere filialen in einem land gibt
		if (loc_class != "loc_more") {
			//inhalt des p-tags speichern
			var loc_html = $(this).html();
			//inhalt des p-tags in das span-tag-konstukt fuer den hover einfuegen
			var span_loc = '<span class="span_loc" id="span_loc_'+loc_id+'"><em>'+loc_html+'</em></span>';
		} else {
			//hier passiert das gleiche wie oben, nur das mehrere filialen eines landes in span-tags unterteilt sind
			
			//alert(loc_class+" "+loc_id);
			
			var loc_more_cntry = $("strong", this).html();
			//alert(loc_more_cntry);
			
			$("span", this).each(function(index) {
				var loc_id = $(this).attr("id");
				var loc_html = $(this).html();
				//alert(loc_id);
				
				var span_loc = '<span class="span_loc" id="span_loc_'+loc_id+'"><em><strong>'+loc_more_cntry+'</strong><br />'+loc_html+'</em></span>';
				$('#worldmap').prepend(span_loc);
				//alert(span_loc);
			});
		}
		//das erzeugte span-konstrukt jeweils in das karten-div hängen
		$('#worldmap').prepend(span_loc);
		
		//den inhalt der span tags verstecken
		$('#worldmap .span_loc em').hide();
	});
	
	$('#worldmap .span_loc').mouseover(function(){
		//bei mouseover den inhalt anzeigen
		$("em", this).show();
	});
	
	$('#worldmap .span_loc').mouseout(function(){
		//auf mouseout den inhalt verstecken
		$("em", this).hide();
	});
	
});