$(document).ready(function(){
// 	$(".openpop").hover(function(e){
//                 clearTimeout(t);
// 		var obj=this;
//                 t=setTimeout(function(){
// 			$(obj).parent().children(".popup").toggle();
// 		},250);
// 	},function(e){
// 		clearTimeout(t);
// 	});
	var openforms=[];
	$(".openform").click(function(e){
		var ID=$(this).parent()[0].id.replace("tree","");
	  	openforms[ID]=true;
//	  console.debug(ID)
		if (!oldz[ID]) oldz[ID]=$(this).parent().css("z-index");
		$(this).parent().css("z-index","110");
		var obj=$("#form"+ID);//$(this).parent().children(".popupform");
		$(obj).toggle();
		$(".popupform").not(obj).hide();
	});
	$(".closepop").click(function(e){
		$(this.form).parent().parent().hide();
/*		var ID=$(this.form).parent()[0].id.replace("form","");
	  	openforms[ID]=false;
	//  console.debug(ID)
		var obj=$("#form"+ID);//$(this).parent().children(".popupform");
		$(obj).hide();*/
/*		$(this).parent().parent().parent().css("z-index",oldz[ID]);
		$(this).parent().parent().hide();*/
	});	
/*	$(".openpop").hover(function(e){
		$(this).parent().children(".popup").show();
	},function(e){
		$(this).parent().children(".popup").hide();
	});*/	
	var oldz=[];
	$(".tree img").hover(function(e){
		var ID=$(this).parent()[0].id.replace("tree","");
		if (!oldz[ID]) oldz[ID]=$(this).parent().css("z-index");
		$(this).parent().css("z-index","99");
		$(this).parent().children(".popup").show();
	},function(e){
		var ID=$(this).parent()[0].id.replace("tree","");
		//if (!openforms[ID]) 
		$(this).parent().css("z-index",oldz[ID]);
		$(this).parent().children(".popup").hide();
	});
	$("#gronjul").add("#output").add("#moreinfo").draggable();
	
	$("#moreinfo").hide();
	$(".openinfo").click(function(){
		$("#moreinfo").toggle();
		return false;
	})
	if (navigator.userAgent.indexOf("MSIE 6")!=-1) {
		jQuery("img").each(function() {
			var reg=/\.png$/;
			if (this.src.match(reg)) {
				var imgsrc=this.src;
				this.style.width=this.width+"px";
				this.style.height=this.height+"px";
				this.src = "/x.gif";
				this.runtimeStyle.backgroundImage = "none";
				this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imgsrc + "', sizingMethod='scale')";
			}
		});
	}

	
	
});
// function closePopNo(ID) {
// 	var obj=$("#form"+ID);//$(this).parent().children(".popupform");
// 	$(obj).hide();
// }