function loadContent(url, parentId, el) {
	
	if (!document.getElementById("greenContent")) {
		// Prepend #greenContent to body to avoid z-index problems in ie7.
		//jQuery("<div />").attr("id", "greenContent").css({display:'none'}).appendTo("#content");
		jQuery("<div />").attr("id", "greenContent").css({display:'none'}).prependTo("body");
	}
	
	var coords = jQuery(el).attr('coords').split(','); 

	var verticalDelta = 0;
	if (parentId != 'subwelcome') {
		verticalDelta = 15;
	}
	if(jQuery("#greenContent:visible").length > 0) {
		jQuery("#greenContent")
			.fadeOut(200, function() {
				jQuery("#greenContent")
					.css({
						top: jQuery("#"+parentId).position().top+parseInt(coords[1])+verticalDelta+"px", 
						left: (jQuery("#"+parentId).offset().left - 350 + jQuery('#'+parentId).width()/2) +"px"
					})
					.load(url+" #greenContent > div" , null ,loadCallBack)
			});
			
	}
	else {
		jQuery("#greenContent")
			.css({
				top: jQuery("#"+parentId).position().top+parseInt(coords[1])+verticalDelta+"px", 
				left: (jQuery("#"+parentId).offset().left - 350 + jQuery('#'+parentId).width()/2) +"px"
			})
			.load(url+" #greenContent > div" , null ,loadCallBack);
	}
}
 
function loadCallBack(responseText, textStatus, XMLHttpRequest) {
	jQuery.ajax({
		complete: function() {
			jQuery("#greenContent").show().css("top", jQuery("#greenContent").position().top-jQuery("#greenContent").height()+"px").hide();
			jQuery("#greenContent")
				.fadeIn()
				.mouseenter(function() {
						jQuery(document).unbind("click");
				})
				.mouseleave(function() {
					jQuery(document).click(function() {
						jQuery("#greenContent").fadeOut();
					});
				});
		}
	});
}
 
function showTree(id, parentId){
	jQuery("#"+id).css({
		position: "absolute", 
		top : jQuery("#"+parentId).position().top+30+"px", 
		left : jQuery("#"+parentId).position().left+jQuery("#"+parentId).width()+30+"px"
	});
	jQuery("#"+id).fadeTo(1000, 1, function() {
		jQuery("#"+id).fadeIn(1500, function() { 
			jQuery("#"+id+"map area[onclick*='show2Tree']").click();
			jQuery('#'+id+'map area').each(function() {
				if (jQuery(this).attr('class') != '') {
					var subid = 'sub'+jQuery(this).attr('class');
					show2Tree(subid,id,this);
				}
			});
		});
	});
}

function showSingle(id, parentId){
	jQuery("#"+id).css({
		position: "absolute", 
		top : jQuery("#"+parentId).position().top+100+"px", 
		left : jQuery("#"+parentId).position().left+jQuery("#"+parentId).width()+30+"px"
	});
	jQuery("#"+id).fadeIn(1000);
}
 
function show2Tree(id, parentId, el){
	var coords = jQuery(el).attr('coords').split(','); 
	jQuery("#"+id).css({
		position: "absolute", 
		top : jQuery("#"+parentId).position().top+parseInt(coords[1])+"px", 
		left : jQuery("#"+parentId).position().left+jQuery("#"+parentId).width()+30+"px"
	});
	jQuery("#"+id).fadeIn(1500);
}
 
 
function loadNews(url, parentId, el){
	
	if (!document.getElementById("greenContent")) {
		// Prepend #greenContent to body to avoid z-index problems in ie7.
		//jQuery("<div />").attr("id", "greenContent").css({display:'none'}).appendTo("#content");
		jQuery("<div />").attr("id", "greenContent").css({display:'none'}).prependTo("body");
	}
	jQuery("#greenContent").fadeOut(500, function() {
		jQuery("#greenContent")
			.css({
				top: '21px',// jQuery("#"+parentId).position().top+jQuery("#"+parentId).height()+"px", 
				left: jQuery("#"+parentId).offset().left-370+"px"
			})
			.load(url+" #greenContent > div" , null ,loadNewsCallBack)});
}
 
function loadNewsCallBack(responseText, textStatus, XMLHttpRequest) {
	jQuery.ajax({
		complete: function() {
			jQuery("#greenContent").fadeIn();
		}
	});
}
 
jQuery(document).ready(function(){

	setTimeout(function() {
		showSingle('subwelcome', 'b_netzt_logo');
	},500);

	setTimeout(function() {
		showTree('submoeglichkeiten','moeglichkeiten');
	},1000);
	
	setTimeout(function() {
		showTree('subfirma','firma');
	},1500);
	
	jQuery(document).click(function() {
		jQuery("#greenContent").fadeOut();
	});
});
