
function GetImagePath () {
	var imgpath = this.src;
	return this.path = imgpath.substring(imgpath.lastIndexOf(this.protocol), imgpath.lastIndexOf('/')+1);
}
ImageObject.prototype.getImagePath = GetImagePath;

function GetImageType () {
	return this.type = this.src.substring(this.src.lastIndexOf('.')+1);
}
ImageObject.prototype.getImageType = GetImageType;


function GetHeight(){
	if (this.image) {
		return this.height = this.image.height;
	}
}
ImageObject.prototype.getHeight = GetHeight;

function GetWidth(){
	if (this.image) {
		return this.width = this.image.width;
	}
}
ImageObject.prototype.getWidth = GetWidth;

function GetImagePos() {
	if (document.all) {
		if (!document.getElementById) {
			temp = document.all[this.id];
		}
		else {
			var temp = document.getElementById(this.id);
		}

		while(temp) {
			if (temp.offsetParent) {
				this.x += temp.offsetLeft;
				if (temp.offsetTop) {
					this.y += parseInt(temp.offsetTop);
				}
			}
			temp = temp.offsetParent;
		}
	}
	else if (document.layers)  {
		if (this.image) {
			this.y = this.image.y; 
			this.x = this.image.x; 
		}
	}

	else if (document.getElementById && navigator.appCodeName == "Mozilla") {
		var temp = document.getElementById(this.id);			
		
		while(temp) {
			if (temp.offsetParent) {
				this.x += temp.offsetLeft;
				if (temp.offsetTop) {
					this.y += parseInt(temp.offsetTop);
				}
			}
			temp = temp.offsetParent;
		}
	}
	else if (document.getElementById) {
		this.y = document.getElementById(this.id).offsetTop; 
		this.x = document.getElementById(this.id).offsetLeft; 
	}
	
	return this.x,this.y;	
}
ImageObject.prototype.getImagePos = GetImagePos;


 
function SetSrc (string) {
	return this.image.src = this.path+string;
}
ImageObject.prototype.setSrc = SetSrc;



function ImageObject(id,parent) {
	this.id = id;
	this.parent = parent;

	if (this.parent && document.layers) {
		this.image     = this.parent.document.images[this.id];
	}
	else {
		this.image     = document.images[this.id];
	}
	this.src       = this.image.src;

	this.protocol  = window.location.protocol;
	this.path      = this.getImagePath();
	this.type      = this.getImageType();

	this.y=0;
	this.x=0;	
	this.getImagePos();

	this.width  = this.getWidth();
	this.height = this.getHeight();

}



/*




function PreloadImages(imglist) {
	var list = imglist.split("&");
	var preload_img=new Array;

	for (i=0;i<list.length;i++) {
		preload_img[i]     = new Image;
		preload_img[i].src = list[i];
	}
}


*/