var getOffset={
	top:function(obj, pos){
		var total = obj.offsetTop;
		var parent = obj.offsetParent;
		while(parent != null){
			total += parent.offsetTop;
			parent = parent.offsetParent;
		}
		if(pos == "bottomLeft"){
			return (total + obj.offsetHeight)
		} else {
			return total;
		}
	},
	left:function(obj, pos){
		var total = obj.offsetLeft;
		var parent = obj.offsetParent;
		while(parent != null){
			total += parent.offsetLeft;
			parent = parent.offsetParent;
		}
		if(pos == "bottomLeft"){
			return (total + obj.offsetLeft)
		} else {
			return total;
		}
	}
}




function showBlockMenu(img){
	clearInterval(img.delayhide)
	img.dropMenu = document.getElementById(img.attributes.getNamedItem("dropID").value)

 	img.dropMenu.style.display = "block"
                     
 	img.dropMenu.style.top = getOffset.top(img, "bottomLeft") + "px"
 	// img.dropMenu.style.left = (getOffset.left(img, "bottomLeft") - (img.dropMenu.offsetWidth / 2) + (img.offsetWidth / 2)) + "px"
 	img.dropMenu.style.left = getOffset.left(img, "bottomLeft") + "px"
 	img.dropMenu.style.zIndex = 1000;
//alert(img.dropMenu.style.top)
//alert(img.dropMenu.style.top)
 	
 	img.dropMenu.onmouseout = function(e) {
	
		var e = (window.event) ? window.event  : e;
		var c = (e.relatedTarget) ? e.relatedTarget : ((e.type=="mouseover")? e.fromElement : e.toElement)
		while (c && c != this){
			try {
				c = c.parentNode
				} catch(e){
					c = this;
				}
				
		}	
	
		if(c != this)this.style.display = "none"
 		
	}
	
	img.onmouseout = function(e) {

			
		var e = (window.event) ? window.event  : e;
		var c = (e.relatedTarget) ? e.relatedTarget : ((e.type=="mouseover")? e.fromElement : e.toElement)
		var self = this;
		
		while (c && c != this.dropMenu){
			try {
				c = c.parentNode
				} catch(e){
					c = this.dropMenu;
				}
				
		}	

		if(c != this.dropMenu){
			this.delayhide = setTimeout(function() { self.dropMenu.style.display = "none" }, 500)
		}		
	}
}