
var cmomentview = Class.extend({
	
	mouseX : 0,
	mouseY : 0,
	RegImg : /jpeg|jpg|gif|png|bmp/i,
	
	divID  : 'platform',
	platform : null,
	
	driftX : 15,
	driftY : 25,
	
	imgMaxW : 250,
	imgMaxH : 200,

	init:
		function () {
				if (!document.getElementById(this.divID)) {
						this.platform = document.createElement("div");
						this.platform.setAttribute('id', this.divID);
						this.platform.style.cssText = "position: absolute; width: 100px; height: 100px; font-size: 14px; color:#FFFFFF; background-color:#000000; padding-left:1px; padding-top: 1px;";
						document.body.appendChild(this.platform);
				} else {
						this.platform.style.display = "";
				}
		},

	show:
		function (obj, title) {
			
				if (momentedit)
					if (momentedit.editing) {
						this.platform.style.display = "none";
					} else {
				this.init();
				src = "";
				ext = "";
				
				if (obj.localName == 'IMG' || obj.tagName == 'IMG') {
						ext = obj.src.match(/^.*\.(\w+)/ )[1];
				} else {
						if (obj.innerHTML.match(/^.*\.(\w+)/ )) {
								ext = obj.innerHTML.match(/^.*\.(\w+)/ )[1];
						} else ext = "";
						
				}
				
				if (ext.match(this.RegImg)) {
						this.platform.innerHTML = '';
						img = document.createElement("img");
						src = obj.src && !title? src = obj.src : obj.title;
						img.setAttribute("src", src);
						img.setAttribute("align", "center");
						imgresize(img, this.imgMaxW, this.imgMaxH);
						this.ReSize(img.width + 1, img.height +1);
						this.platform.appendChild(img);
				} else this.hide();
					}
					
		},
		
	PaintImage:
		function () {
			//alert(myAjax.answer);	
		},
		
	ReSize:
		function (width, height) {
				this.platform.style.width  = width + "px";
				this.platform.style.height = height + "px";
		},
	
	hide:
		function () {
			if (this.platform) {
					this.platform.style.display = "none";
			}
		},
		
	setXY:
		function () {
			if (this.platform) {
				
				left = String(this.mouseX + this.driftX);
				
				maxWidth = mynavigator.IE ? document.body.clientWidth : window.innerWidth;
				maxHeight = mynavigator.IE ? document.documentElement.clientHeight : window.innerHeight;
				
				if (parseInt(left) + parseInt(this.platform.style.width) + 20 >= maxWidth) {
						left = maxWidth - parseInt(this.platform.style.width) - (mynavigator.IE ? 2 : 18);
				}

				if (mynavigator.Opera) {
						this.platform.style.left = left + "px";
						if (parseInt(this.platform.style.width) + parseInt(this.platform.style.left) + 20 >= maxWidth) {
								left = maxWidth - parseInt(this.platform.style.width) - 18;
						}	
					
						this.platform.style.left = left + "px";
				} else this.platform.style.left = left + "px";
				
				///***натуральное положенеи курсора над документом***///
				
				naturalTop = mynavigator.IE ? event.clientY : momentview.mouseY - document.documentElement.scrollTop;
				
				topY = String(this.mouseY + this.driftY);

				if ((naturalTop + parseInt(this.platform.style.height) + 20) >= maxHeight) {
						topY = this.mouseY - parseInt(this.platform.style.height) - this.driftY;
				}
				
				this.platform.style.top = topY + "px";
				//window.document.title = window.innerWidth;
				//window.document.title = "x="+this.mouseX+"&y="+this.mouseY+"pX="+this.platform.style.width+"pY="+this.platform.style.height + "N="+naturalTop;
			}
			
		}
	
});




var momentview = new cmomentview();	

<!-- MOUSe

	if (!mynavigator.IE) document.captureEvents(Event.MOUSEMOVE)
			document.onmousemove = getMouseXY;

	var tempX = 0;
	var tempY = 0;

	function getMouseXY(e) {
		
			if (mynavigator.IE) { // grab the x-y pos.s if browser is IE
					if (document.body) {
						tempX = event.clientX + document.documentElement.scrollLeft;
						tempY = event.clientY + document.documentElement.scrollTop;
					}
			} else {  // grab the x-y pos.s if browser is NS
					tempX = e.pageX;
					tempY = e.pageY;
			}  
		
			if (tempX < 0){tempX = 0;}
			if (tempY < 0){tempY = 0;}  
			momentview.mouseX = tempX;
			momentview.mouseY = tempY;
			momentview.setXY();
		return true;
	}
	
//  End -->

