﻿imgInst = null;
overImg  = null;
imagesChc = new Array();
self.ElemTab = function(callerInst, dispId, src) {
    imgInst = document.getElementById(dispId);
    if (imgInst != null) {

        for (var i = 0; i < imagesChc.length; i++) {
            if (imagesChc[i].src.indexOf(src) >= 0) {
                imgInst.innerHTML = "";
                //					var addImg = document.createElement("img");
                imgInst.appendChild(imagesChc[i]);
                imgInst = null;
                //imgInst.src = imagesChc[i].src;
                return;
            }
        }
        callerInst.style.cursor = "pointer";
        if (overImg) {
            overImg.onload = null;
            overImg = null;
        }
        overImg = new Image();
        imagesChc.push(overImg);
        overImg.src = src;
        overImg.onload = onOverImgLoad;

    } else {
        imgInst = null;
    }
}


self.onOverImgLoad = function(){
	//alert(typeof(Image))
	if(imgInst!=null){
		//if(typeof(imgInst)==typeof(Image)){
			//imgInst.src = overImg.src;
		//}else{
			imgInst.innerHTML="";
			var addImg = document.createElement("img");
			imgInst.appendChild(overImg);
			imgInst=null;
		//}
	}
	imgInst = null;	
}
self.changeCss = function(elem,className){
	elem.className = className;
}



self.divOpen = function(callerId, divToOpenId){
	this.cId = callerId;
	this.oId = divToOpenId;
	this.intervalId = null;
	var c = document.getElementById(this.cId);
	var o = document.getElementById(this.oId);
	if(c==null||o==null)return;
	c.divObj = this;
	o.divObj = this;
	c.onmouseover = this.shovDiv;
	c.onmouseout = this.setCloselDiv;
	o.onmouseover = this.shovDiv;
	o.onmouseout = this.setCloselDiv;
}
divOpen.prototype.shovDiv = function(){
	document.getElementById(this.divObj.oId).style.display = "block";
	if(this.divObj.intervalId!=null){
		clearTimeout(this.divObj.intervalId);
		this.divObj.intervalId=null;
	}
}
divOpen.prototype.setCloselDiv = function(){
	if(this.divObj.intervalId!=null){
		clearTimeout(this.divObj.intervalId);
		this.divObj.intervalId=null;
	}
	this.divObj.intervalId = setTimeout("closelDiv('"+this.divObj.oId+"')",500);
}
self.closelDiv = function(id){
	document.getElementById(id).style.display = "none";
}


