//Resize and Clip V1.21
//7th April 2003
//karl@core10.co.uk

function ProtoLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {
	if (ie) {
		if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft)
		else if (ie4) this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0)
	}
}
function ProtoLayerClipBy(t,r,b,l) {
	this.clipTo(this.clipValues('t')+t,this.clipValues('r')+r,this.clipValues('b')+b,this.clipValues('l')+l)
}
function ProtoLayerClipTo(t,r,b,l) {
	if (t==null) t = this.clipValues('t')
	if (r==null) r = this.clipValues('r')
	if (b==null) b = this.clipValues('b')
	if (l==null) l = this.clipValues('l')
	if (ns4) {
		this.css.clip.top = t
		this.css.clip.right = r
		this.css.clip.bottom = b
		this.css.clip.left = l
	}
	else  this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}

function ProtoLayerClipValues(which) {
	if (ie) var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px")
	if (which=="t") return ns? this.css.clip.top : Number(clipv[0])
	if (which=="r") return ns? this.css.clip.right : Number(clipv[1])
	if (which=="b") return ns? this.css.clip.bottom : Number(clipv[2])
	if (which=="l") return ns? this.css.clip.left : Number(clipv[3])
}
ProtoLayer.prototype.clipInit = ProtoLayerClipInit
ProtoLayer.prototype.clipTo = ProtoLayerClipTo
ProtoLayer.prototype.clipBy = ProtoLayerClipBy
ProtoLayer.prototype.clipValues = ProtoLayerClipValues

function ProtoLayerResize(w,h){
	this.w = this.css.width = w;
	this.h = this.css.height = h;
	if(!this.noclip)this.clipTo(0,w,h,0);
}

ProtoLayer.prototype.resizeTo=ProtoLayerResize;