function objLayer(frame, id, x, y, width, height) {
	/* Właściwości */
	if(ns4) {
		if(frame == null) this.css = eval('document.' + id);
		else this.css = eval('parent.' + frame + '.document.' + id);
	}
	else if(ie4) { 
		if(frame == null) this.css = eval(id + '.style');
		else this.css = eval('parent.' + frame + '.' + id + '.style');
	}
	
	this.xpos       = x;
	this.ypos       = y;
	this.css.left   = this.xpos;
	this.css.top    = this.ypos;
	this.width      = width;
	this.css.width  = this.width;
	this.height     = height;
	this.css.height = this.height;
	
	/* Metody */
	this.moveTo     = moveTo;
	this.clipTo     = clipTo;
	this.clipBy     = clipBy;
	this.clipValues = clipValues;
	this.showHide   = showHide;
}

/* Metody */
function moveTo(x, y) {
	this.xpos     = x;
	this.ypos     = y;
	this.css.left = this.xpos;
	this.css.top  = this.ypos;
}

function clipTo(t, r, b, l) {
	if (ns4) {
		this.css.clip.top    = t;
		this.css.clip.right  = r;
		this.css.clip.bottom = b;
		this.css.clip.left   = l;
	}
	else if (ie4) this.css.clip = "rect(" + t + "px " + r + "px " + b + "px " + l + "px)";
}

function clipBy(t, r, b, l) {
	if (ns4) {
		this.css.clip.top    = this.clipValues('t') + t;
		this.css.clip.right  = this.clipValues('r') + r;
		this.css.clip.bottom = this.clipValues('b') + b;
		this.css.clip.left   = this.clipValues('l') + l;
	}
	else if (ie4) this.css.clip = "rect(" + (this.clipValues('t') + t) + "px " + (this.clipValues('r') + r) + "px " + Number(this.clipValues('b') + b) + "px " + Number(this.clipValues('l') + l) + "px)";
}

function clipValues(which) {
	if (ns4) {
		if (which == "t") return this.css.clip.top;
		if (which == "r") return this.css.clip.right;
		if (which == "b") return this.css.clip.bottom;
		if (which == "l") return this.css.clip.left;
	}
	else if (ie4) {
		var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px");
		if (which == "t") return Number(clipv[0]);
		if (which == "r") return Number(clipv[1]);
		if (which == "b") return Number(clipv[2]);
		if (which == "l") return Number(clipv[3]);
	}
}

function showHide(which) {
	if(which == 's') this.css.visibility = show;
	else if(which == 'h') this.css.visibility = hide;
}

function preload(imgObj, imgSrc) {
	if(document.images) {
		eval(imgObj + ' = new Image()');
		eval(imgObj + '.src = "' + imgSrc + '"');
	}
}

function changeImage(layer, imgName, imgObj) {
	if(document.images) {
		if(document.layers && layer != null) eval('document.' + layer + '.document.images["' + imgName + '"].src = ' + imgObj + '.src');
		else document.images[imgName].src = eval(imgObj + ".src");
	}
}
