/**
 * @author Samsung
 */


function ImageLayer(id){
   
	this.imageObj = id; 
	this.fgImageObj = null;
	this.fgImageVSpace ="";
	this.fgImageHSpace ="";
	this.fgImagewidth ="";
	this.fgImageHeight ="";
	this.fgImageSrc ="";
	
	this.fgImageFlag = false;
	this.bgimage = "";
	Layer.call(this,id);		
}

ImageLayer.prototype = new Layer(); 

ImageLayer.prototype.GetObjectId = function()
{
	return this.imageObj;
}

ImageLayer.prototype.SetBgImage = function(bgImage)
{
	if(this.bgimage !=bgImage)
    $("#"+this.imageObj).css("background-image", 'url('+bgImage+')');
    this.bgimage = bgImage;
}

ImageLayer.prototype.SetImage = function(bgImage)
{
	if (bgImage) {	
    	$("#"+this.imageObj).css("background-image", 'url('+bgImage+')');
	}
}

ImageLayer.prototype.SetColor = function(color)
{
	if (color) {	
		$("#" + this.imageObj).css("background-color", color);
	}
}


ImageLayer.prototype.AppendFgImage = function(img_id, h_space, v_space, w, h, img_src)
{
    this.fgImageObj = img_id;
	
	this.fgImageHSpace = h_space;
	this.fgImageVSpace = v_space;
	this.fgImagewidth = w;
	this.fgImageHeight =h;
}

ImageLayer.prototype.SetFgImage = function(img_src){

	if(img_src.length > 0)
	{
		if(this.fgImageFlag == false)
		{
			var HtmlStr = "<img id='"+this.fgImageObj+"' hspace='"+this.fgImageHSpace+"' vspace='"+this.fgImageVSpace+"' width='"+this.fgImagewidth+"' height='"+this.fgImageHeight+"' />";
			$(HtmlStr).appendTo("#"+this.imageObj);
			
			this.fgImageFlag=true;
		}
		
		this.fgImageSrc = img_src;
	   	$("#"+this.fgImageObj).attr("src",img_src);		
	}
	else
	{
		if(this.fgImageFlag == true)
		{
			$("#"+this.fgImageObj).remove();
			this.fgImageFlag=false;
		}
	}

 }
ImageLayer.prototype.visibleObj=function()
{
    //alert("ImageLayer.prototype.visibleObj()");
    $("#"+this.imageObj).css("visibility","visible");
}

ImageLayer.prototype.hiddenObj=function(){
   // alert("ImageLayer.prototype.hiddenObj()");
   $("#"+this.imageObj).css("visibility","hidden");
}

ImageLayer.prototype.visibleFgObj=function()
{
    //alert("ImageLayer.prototype.visibleFgObj()");
    if(this.fgImageObj)
    {
        $("#"+this.fgImageObj).css("visibility","visible");
    }
}

ImageLayer.prototype.hiddenFgObj=function(){
   // alert("ImageLayer.prototype.hiddenFgObj()");
	if (this.fgImageObj) {
        $("#"+this.fgImageObj).css("visibility","hidden");
    }
}

ImageLayer.prototype.SetOnMouseOverCallbackFunc = function(func){
	if(WndMgr.MouseClickEnable==false)
	{
		return;	
	}
	if(this.imageObj != null)
	{
		alert("ImageLayer.SetOnMouseOverCallbackFunc() set on image_layer");
		
		this.onMouseOverCallbackFunc = func;
		this.EnableOnMouseOver();			
	}
	
}
ImageLayer.prototype.SetOnMouseOutCallbackFunc = function(func){
	if(WndMgr.MouseClickEnable==false)
	{
		return;	
	}
	if(this.imageObj != null)
	{
		alert("ImageLayer.SetOnMouseOutCallbackFunc() set on image_layer");
		
		this.onMouseOutCallbackFunc = func;
		this.EnableOnMouseOut();			
	}
}
ImageLayer.prototype.EnableOnMouseOver = function(){
	var object = this.imageObj;
	var this_ = this;
	document.getElementById(object).onmouseover = function(){this_.onMouseOverCallbackFunc(this_);};
}
ImageLayer.prototype.DisableOnMouseOver = function(){
	var object = this.imageObj;
	document.getElementById(object).onmouseover = null;
}
ImageLayer.prototype.EnableOnMouseOut = function(){
	var object = this.imageObj;
	var this_ = this;
	document.getElementById(object).onmouseout = function(){this_.onMouseOutCallbackFunc(this_);};
}
ImageLayer.prototype.DisableOnMouseOut = function(){
	var object = this.imageObj;
	document.getElementById(object).onmouseout = null;
}