var WW_imgArray		= new Array();

function WW_img(name,pos){
	this.name 	= name;
	this.layer 	= null;
	this.frame 	= null;
	if (typeof(pos)=="object")
		this.layer=pos;
	if (typeof(pos)=="string")
		this.frame=pos;
	this.setSrc	= WW_imgSetSrc;
	this.getX		= WW_imgGetX;
	this.getY		= WW_imgGetY;
	this.getObj	= WW_imgGetObj;
	this.obj		= null;
	this.id 		= WW_imgArray.length;
	this.ok			= false;
	WW_imgArray[this.id] = this;
	WW_addSuperInitFunction("WW_imgArray["+this.id+"].getObj()");
	return this;
}

function WW_multiImg(names,pos){
	var nr = names.length;
	images = new Array(nr);
	for (var i=0; i<nr; i++)
		images[i]= new WW_img(names[i],pos);
	return images;	
}

function WW_imgGetObj(){
	if (this.layer!=null)
		this.obj = this.layer.doc.images[this.name];
	else
		if (this.frame!=null)
			this.obj = top.frames[this.frame].document.images[this.name];
		else{
			if (NN)
				this.obj = document.images[this.name];
			else
				this.obj = document.all[this.name];
		}
	if (this.obj)	this.ok=true;	
	//auskommentiert da diese Fehlermeldung anscheinend fälschlich ausgeloest wurde (quasi überall)
	else 
    WW_debug("WW_imgGetObj: image '"+this.name+"' not found.");
}			

function WW_imgSetSrc(filename){
	if (!this.ok) return false;
	this.obj.src = filename;
} 


function WW_imgGetX(){
	if (!this.ok) return false;
	if (NN)
   	return this.obj.x;
 	if (IE)
		if (this.frame!=null)
			return WW_offsetX(top.frames[this.frame].document.all[this.name]);
		else
			return WW_offsetX(document.all[this.name]);
}

function WW_imgGetY(){
	if (!this.ok) return false;
	if (NN)
   	return this.obj.y;
	if (IE)
		if (this.frame!=null)
			return WW_offsetY(top.frames[this.frame].document.all[this.name]);
		else
			return WW_offsetY(document.all[this.name]);
}



