//////////////////////////////////////////////////////////////
// CLIPPING.						                        //
//----------------------------------------------------------//

window.onerror = function() { return true; }

function clipRect(a1, a2, a3, a4) {
	this.clipTop	= 0;
	this.clipRight	= 0;
	this.clipBottom	= 0;
	this.clipLeft	= 0;
	if (typeof(a1) == 'string') {
		var val;
		var i;
		var a = a1.substring(5, a1.length-1).split(' ');
		for (i = 0; i < 4; ++i) {
			val = parseInt(a[i]);
 			a[i] = val;
 		}
 		this.clipTop	= a[0];
 		this.clipRight	= a[1];
 		this.clipBottom	= a[2];
 		this.clipLeft	= a[3];
	} else if (typeof(a1) == 'number' && typeof(a2) == 'number' && typeof(a3) == 'number' && typeof(a4) == 'number') {
		this.clipTop	= a1;
		this.clipRight	= a2;
		this.clipBottom	= a3;
		this.clipLeft	= a4;
	}
}

clipRect.prototype.clipTop 		= 0;
clipRect.prototype.clipRight 	= 0;
clipRect.prototype.clipBottom 	= 0;
clipRect.prototype.clipLeft		= 0;

//----------------------------------------------------------//

function setClip(clipString) {
	if (navigator.isIE || navigator.ns5) {
		this.styleObj.clip = clipString;
	} else {
		var rect = new clipRect(clipString);
		// alert(rect.clipTop);
		this.styleObj.clip.top 		= rect.clipTop;
		this.styleObj.clip.right 	= rect.clipRight;
		this.styleObj.clip.bottom 	= rect.clipBottom;
		this.styleObj.clip.left 	= rect.clipLeft;
	}
}

newStyle.prototype.setClip = setClip;

//----------------------------------------------------------//

// FOR MENU LAYER WITH CLIPPING //

function scrollMenu(id,t,r,b,l) {
	elmID = "menu" + id;

	elm = document.getElementById(elmID);
	styleObj = new newStyle(elm);
	
	clipStr = 'rect(' + t + ' ' + r + ' ' + b + ' ' + l + ')';

	styleObj.setClip(clipStr);
}

//----------------------------------------------------------//
