function K_IconOverlay(imageUrl,point,scale,bounds,color)
{
	this.imageUrl=imageUrl;
	this.point=point;
	this.scale=scale?scale:1;
	this.bounds=bounds;
	this.color=color;
	this.icon=new Object();
	this.icon.iconSize=new GSize(this.scale*8,this.scale*8);
}
K_IconOverlay.prototype = new GOverlay();
K_IconOverlay.prototype.initialize=function(a)
{
	this.map=a;
	this.div=document.createElement("img");
	a.getPane(G_MAP_MARKER_PANE).appendChild(this.div);
	GEvent.bindDom(this.div,"load",this,this.setClip);
	this.div.style.display="none";
	this.div.src=this.imageUrl;
	this.div.style.position="absolute";
	if(document.all)
	{
		this.div.unselectable="on";
		this.div.onselectstart=function(){return false};
		this.div.galleryImg="no";
		this.div.style.filter="progid:DXImageTransform.Microsoft.Chroma(color='#"+this.color+"')";		
	}
	else
	{
		this.div.style.MozUserSelect="none";
	}
	this.div.style.border="0";
	this.div.style.padding="0";
	this.div.style.margin="0";
	color=(this.color)?this.color:"FFFFFF";
	//this.div.style.cursor=document.all?"hand":"pointer";
	this.div.oncontextmenu=function(){return false};
	//GEvent.bindDom(this.div,"mousedown",this,this.onMouseDown);
};
K_IconOverlay.prototype.setClip=function()
{
	this.div.style.display='';
	this.currentSize=new GSize(this.div.offsetWidth,this.div.offsetHeight);
	if(this.bounds)
	{
		this.div.style.clip="rect("+((this.currentSize.height-this.bounds.maxY)*this.scale)+"px "+(this.bounds.maxX*this.scale)+"px "+((this.currentSize.height-this.bounds.minY)*this.scale)+"px "+(this.bounds.minX*this.scale)+"px)";
		this.icon.iconSize=new GSize(this.scale*(this.bounds.maxX-this.bounds.minX),this.scale*(this.bounds.maxY-this.bounds.minY));
	}
	else
		this.icon.iconSize=new GSize(this.scale*this.currentSize.width,this.scale*this.currentSize.height);
	this.div.width=(this.currentSize.width*this.scale);
	this.div.height=(this.currentSize.height*this.scale);
	this.div.style.display='';
	this.redraw(true);
}
K_IconOverlay.prototype.remove=function()
{
	this.div.parentNode.removeChild(this.div);
};
K_IconOverlay.prototype.copy=function()
{
	return new K_IconOverlay(this.imageUrl,this.point,this.scale,this.bounds,this.color);
};
K_IconOverlay.prototype.redraw=function(a)
{
	if(!a)return;
	if(!this.currentSize)return;
	var c=this.map.fromLatLngToDivPixel(this.point);
	if(this.bounds)
	{
		this.div.style.left=(c.x-(this.bounds.maxX+this.bounds.minX)/2*this.scale)+"px";
		this.div.style.top=(c.y-(this.currentSize.height*2-this.bounds.maxY-this.bounds.minY)/2*this.scale)+"px";
	}
	else
	{
		this.div.style.left=(c.x-this.currentSize.width*this.scale/2)+"px";
		this.div.style.top=(c.y-this.currentSize.height*this.scale/2)+"px";
	}
};
K_IconOverlay.prototype.onMouseDown=function(a)
{
	if(document.all)
	{
		window.event.cancelBubble=true;
		window.event.returnValue=false
	}
	else
	{
		a.cancelBubble=true;
		a.preventDefault();
		a.stopPropagation()
	}
	//GEvent.trigger(this,"click",this);
};
K_IconOverlay.prototype.openInfoWindowHtml=function(html)
{
	this.map.openInfoWindowHtml(this.point,html);
}

function K_HtmlMarker(icon,point,html)
{
	this.icon=icon;
	this.point=point;
	this.icon.point=point;
	this.html=html;
}
K_HtmlMarker.prototype = new GOverlay();
K_HtmlMarker.prototype.initialize=function(a)
{
	this.map=a;
	this.icon.initialize(a);
	GEvent.bindDom(this.icon,"mousedown",this,this.onMouseDown);
	this.div=document.createElement("span");
	this.div.align="left";
	this.div.style.position="absolute";
	this.div.style.cursor="default";
	this.div.style.width="40px";
	this.div.innerHTML=this.html;
	a.getPane(G_MAP_MARKER_PANE).appendChild(this.div);
	//GEvent.bind(this.icon,"click",this,this.onMouseDown);
};
K_HtmlMarker.prototype.remove=function(){this.icon.remove();if(this.div&&this.div.parentNode){this.div.parentNode.removeChild(this.div)}};
K_HtmlMarker.prototype.copy=function()
{
	return new K_HtmlMarker(this.icon.copy(),this.point,this.html)
};
K_HtmlMarker.prototype.redraw=function(a)
{
	this.icon.redraw(a);
	if(!a)return;
	var c=this.map.fromLatLngToDivPixel(this.point);
	iconSize=this.icon.icon.iconSize?this.icon.icon.iconSize:new GSize(8,8);
	this.div.style.left=(c.x+iconSize.width/2)+"px";
	this.div.style.top=(c.y-this.div.offsetHeight/2)+"px";
};
K_HtmlMarker.prototype.onMouseDown=function(a)
{
	if(document.all)
	{
		window.event.cancelBubble=true;
		window.event.returnValue=false
	}
	else
	{
		a.cancelBubble=true;
		a.preventDefault();
		a.stopPropagation()
	}
	//GEvent.trigger(this,"click",this);
};
K_HtmlMarker.prototype.openInfoWindowHtml=function(html)
{
	this.map.openInfoWindowHtml(this.point,html);
}