function ComplexCustomOverlay(point, text, url){
	this._point = point;
	this._text = text;
	this._url  = url;
}  
ComplexCustomOverlay.prototype = new BMap.Overlay(); 
ComplexCustomOverlay.prototype.initialize = function(map){
	this._map = map;
	var div = this._div = document.createElement("div");
	div.style.position = "absolute";
	div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
	div.style.backgroundColor = "#6633FF";
	div.style.border = "1px solid #330099";
	div.style.color = "white";
	div.style.height = "18px";
	div.style.padding = "2px";
	div.style.lineHeight = "18px";
	div.style.whiteSpace = "nowrap";
	div.style.MozUserSelect = "none";
	div.style.fontSize = "12px"
	div.appendChild(document.createTextNode(this._text));
	var arrow = this._arrow = document.createElement("div");
	arrow.style.background = "url(/img/arrow.png) no-repeat";
	arrow.style.position = "absolute";
	arrow.style.width = "11px";
	arrow.style.height = "10px";
	arrow.style.top = "22px";
	arrow.style.left = "10px";
	arrow.style.overflow = "hidden";
	div.appendChild(arrow);

	div.onmouseover = function(){
		this.style.backgroundColor = "#99CC99";
		this.style.borderColor = "#006633";
		arrow.style.backgroundPosition = "0px -20px";
	}
	div.onmouseout = function(){
		this.style.backgroundColor = "#6633FF";
		this.style.borderColor = "#330099";
		arrow.style.backgroundPosition = "0px 0px";
	}
	var url = this._url
	div.onclick = function(){
		new_win = window.open(url,'_blank','width=600,height=500,toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
		if(!new_win) location.href=url;
	}
	map.getPanes().labelPane.appendChild(div);

	return div;
}
ComplexCustomOverlay.prototype.draw = function(){
	var map = this._map;
	var pixel = map.pointToOverlayPixel(this._point);
	this._div.style.left = pixel.x - parseInt(this._arrow.style.left) + "px";
	this._div.style.top  = pixel.y - 30 + "px";
}
