// DynLayer Clip Methods

// provides layer clipping functionality

// 19990531



// Copyright (C) 1999 Dan Steinman

// Distributed under the terms of the GNU Library General Public License

// Available at http://www.dansteinman.com/dynapi/



function DynLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {

	if (is.ie) {

		if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft)

		else if (is.ie4) this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0)

	}

}

function DynLayerClipTo(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 (is.ns) {

		this.css.clip.top = t

		this.css.clip.right = r

		this.css.clip.bottom = b

		this.css.clip.left = l

	}

	else if (is.ie) this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"

}

function DynLayerClipBy(t,r,b,l) {

	this.clipTo(this.clipValues('t')+t,this.clipValues('r')+r,this.clipValues('b')+b,this.clipValues('l')+l)

}

function DynLayerClipValues(which) {

	if (is.ie) var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px")

	if (which=="t") return (is.ns)? this.css.clip.top : Number(clipv[0])

	if (which=="r") return (is.ns)? this.css.clip.right : Number(clipv[1])

	if (which=="b") return (is.ns)? this.css.clip.bottom : Number(clipv[2])

	if (which=="l") return (is.ns)? this.css.clip.left : Number(clipv[3])

}

DynLayer.prototype.clipInit = DynLayerClipInit

DynLayer.prototype.clipTo = DynLayerClipTo

DynLayer.prototype.clipBy = DynLayerClipBy

DynLayer.prototype.clipValues = DynLayerClipValues

