/*
	Auth:  casper houdé
	Version: 1.0	
*/

(function($){  
 	$.fn.vogelvlucht = function(options) {
 		var config = {  
				mapname: "map"
			, 	imagemap: "imagmap"
		}; 
		var options = $.extend(config, options);  
		
		return $(this).each(function() { 
			
			$(this).css("top", "100px");
			l = (($(document).width() - parseInt($(this).css("width"))) / 2);
			$(this).css("left", l + "px");
			
			$(".jScrollPaneContainer").hide();
			$(".kolom6").hide();
			$(".kolom3").hide();
			
			$(this).find(".m").hide();
			
			$(this).show();
			
			$(this).find(".closeVlucht").click(function() {
				$("#vogelvlucht").hide();
				$(".jScrollPaneContainer").show();
				$(".kolom6").show();
				$(".kolom3").show();
			});
			
			$(".close").click(function() {
				$(this).parentsUntil("div").parent("div").hide();
			});
			
			var vogel = this;
			$(this).find("#" + options.mapname + " area").hover(
				function() {
					$("#" + $(this).attr("rel")).show();
				}, function() {
					$("#" + $(this).attr("rel")).hide();
				}
			);
			$(this).find("#" + options.mapname + " area").click(function(e) {
				//$(vogel).find("#" + options.imagemap).
				r = $(this).attr("rel");
				
				$(".popvlucht").css("left", (e.pageX + 5) + "px");
				$(".popvlucht").css("top", (e.pageY + 5) + "px");
				$(".popvlucht").hide();
				$("#pop" + r).show();
				
				return false;
			});
			$(this).find("#imagmap").mouseover(function(e) {
				
			});
		});
		
	}
})(jQuery);

	//$("#imagmap").click(function(e){
	//	v = $('#coords').val();
	//	if(v != "") {
	//		v += ",";
	//	}
	//	
	//	v += (e.pageX - this.offsetLeft) +','+ (e.pageY - this.offsetTop);
	//	$('#coords').val(v);
	//})

