function CLayerAbstraction(layerName){

	this.layer = MM_findObj(layerName);

	if(!this.layer) return false;

	this.layerName = layerName;



	this.get_absolute_top = get_absolute_top;

	this.get_absolute_left = get_absolute_left;



	this.get_offset_top = get_offset_top;

	this.get_offset_left = get_offset_left;



	this.get_absolute_width = get_absolute_width;

	this.get_absolute_height = get_absolute_height;



	this.get_client_width = get_client_width;

	this.get_client_height = get_client_height;

	this.get_clip_rec = get_clip_rec;

}



function get_offset_top(){

	var b = this.layer;

	if(NS) return b.top;

	return b.offsetTop;

}



function get_offset_left(){

	var b = this.layer;

	if(NS) return b.left;

	return b.offsetLeft;

}







function get_absolute_top(){

	var b = this.layer;

	if(NS) return b.pageY;



	T = b.offsetTop;

	if(NS6)

	while ((b = b.parentNode) != null )

		if(b.style && b.style.position && b.offsetTop) T += b.offsetTop;



	if(IE)

	while ((b = b.parentElement) != null )

		if(b.style && b.style.position && b.offsetTop) T += b.offsetTop;



	return T;

}



function get_absolute_left(){

	var b = this.layer;

	if(NS) return b.pageX;



	T = b.offsetLeft;

	if(NS6)

	while ((b = b.parentNode) != null )

		if(b.style && b.style.position && b.offsetLeft) T += b.offsetLeft;



	if(IE)

	while ((b = b.parentElement) != null )

		if(b.style && b.style.position && b.offsetLeft) T += b.offsetLeft;



	return T;

}



function get_absolute_width(){  // Връща истинската широчина която се е получила на обекта без значение колко е зададена.

	var b = this.layer;

	if(IE || NS6) return b.scrollWidth;

	if(NS) return b.document.width;

}



function get_absolute_height(){  // Връща истинската височина която се е получила на обекта без значение колко е зададена.

	var b = this.layer;

	if(IE) return Math.max(b.clientHeight, b.scrollHeight);

	if(NS6) return b.scrollHeight;

	if(NS) return b.document.height;

}



function get_client_width(){//Връща широчината на видимата зона.

	var b = this.layer;

	if(NS) return b.clip.width;

	if(IE || NS6) {

		this.get_clip_rec();

		return (this.clip_right - this.clip_left);

	}

}



function get_client_height(){//Връща височината на видимата зона.

	var b = this.layer;

	if(NS) return b.clip.height;

	if(IE || NS6) {

		this.get_clip_rec();

		return (this.clip_bottom - this.clip_top);

	}

}



function get_clip_rec(){

	var b = this.layer;

	if(NS){

		this.clip_top = b.clip.top;

		this.clip_left = b.clip.left;

		this.clip_bottom = b.clip.bottom;

		this.clip_right = b.clip.right;

	} else {

		var s = b.style.clip;

		if(s && b.style.position=="absolute"){

			s = s.slice(5);

			s = s.split(" ", 4);



			this.clip_top = parseInt(s[0]);

			this.clip_left = parseInt(s[3]);

			this.clip_bottom = parseInt(s[2]);

			this.clip_right = parseInt(s[1]);

		} else {

			this.clip_top = 0;

			this.clip_left = 0;

			this.clip_bottom = this.get_absolute_height();

			this.clip_right = this.get_absolute_width();

		}

	}

}



function set_clip_rec(){

	var b = this.layer;

	if (NS) {

		b.clip.top = this.clip_top;

		b.clip.left = this.clip_left;

		b.clip.bottom = this.clip_bottom;

		b.clip.right = this.clip_right;

	} else {

  	b.style.clip ='rect(' + this.clip_top + ' ' + this.clip_right + ' ' + this.clip_bottom + ' ' + this.clip_left + ')';

  }

}