function elcImg(img,group) {
	img.onload = '';
	this.obj = img;
	this.name = img.name;
	this.defaultSrc = img.src;
	this.initObj(img);
	this.state = 0;	
 	if (img.src.lastIndexOf("_on.") > -1) this.state = 1;
}

elcImg.prototype.initObj = function(img){
	this.type = img.src.substring((img.src.lastIndexOf(".") + 1), img.src.length);
	this.path = this.defaultSrc.substring(0,this.defaultSrc.lastIndexOf("/")+1);
	this.base = img.src.substring((img.src.lastIndexOf("/") + 1), img.src.lastIndexOf((img.src.lastIndexOf("_on.") > -1) ? "_" : "."));
	this.off = (this.base + '.' + this.type);
	this.onImg = new Image();
	this.onImg.src = this.path + this.base + "_on." + this.type;
	this.offImg = new Image();
	this.offImg.src = this.path + this.base + '.' + this.type;
}

elcImg.prototype.setOn = function(){
	if (this.state != 1) {
		this.obj.src = this.onImg.src;
		this.state = 1;
	}
}

elcImg.prototype.setOff = function(){
	if (this.state != 0) {
		this.obj.src = this.offImg.src;
		this.state = 0;
	}
}

elcImg.prototype.setSrc = function(url){
	this.obj.src = url;
	this.defaultSrc = url;
	this.initObj(this.obj);
}
