var x,y,a,b,timer,timer_on,thisbox,isbox,urlimg
var posleftvorher

var box


if (document.all) {
	var left_pos=".pixelLeft=";
	var top_pos=".pixelTop=";
	var doc="";
	var stl=".style";
}

if (document.layers) {
	var left_pos=".left=";
	var top_pos=".top=";
	var doc="document.";
	var stl="";
}

function openbox(thisbox) {
	isbox = thisbox
		if(document.layers) {
			box = document.popupbox
			box.visibility="visible"
			document.popupbox.document.write("<img src='"+thisbox+"' />")
			document.popupbox.document.close()
			document.popupbox.left=x+25
			document.popupbox.top=y
		}

		if(document.all) {
			box = document.all.popupbox.style
			box.visibility="visible"
			popupbox.innerHTML="<img src='"+thisbox+"' />"
			eval(doc+"popupbox"+stl+left_pos+(x+25))
			eval(doc+"popupbox"+stl+top_pos+y)
			
			//Detect IE5.5+
				version=0
				if (navigator.appVersion.indexOf("MSIE")!=-1){
					temp=navigator.appVersion.split("MSIE")
					version=parseFloat(temp[1])
				}
				
				if (version>=5.5) { //NON IE browser will return 0
					timer=setTimeout("openbox(isbox)",3000)
					timer_on=1
				} else {
					timer=setTimeout("openbox(isbox)",40)
					timer_on=1
				}

				
		}
		      //Firefox
//			  	if(navigator.userAgent.indexOf('Firefox') != -1) {
				//var versionindex=navigator.userAgent.indexOf("Firefox")+8
					//if (parseInt(navigator.userAgent.charAt(versionindex))>=1){
      					if(document.getElementById) {
      						box = document.getElementById('popupbox');
      						box.style.visibility='visible';
      						box.innerHTML = "<img src='"+thisbox+"' />";
      						box.style.left = x + 'px';
      						box.style.top = y + 'px';
							
							if (timer_on != 1) {
								timer=setTimeout("openbox(isbox)",40)
							}
							
							
      					}
					//}
//	  			}
}

//Sulkijalihas

	function closebox(){
			clearTimeout(timer);
			box.visibility="hidden";
			box.style.visibility='hidden';
	}



function handlerMM(e) // works on IE6,FF,Moz,Opera7
{ 
  if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)
 
  if (e)
  { 
    if (e.pageX || e.pageY)
    { // this doesn't work on IE6!! (works on FF,Moz,Opera7)
      x = e.pageX;
      y = e.pageY + 20;
      algor = '[e.pageX]';
      if (e.clientX || e.clientY) algor += ' [e.clientX] '
    }
    else if (e.clientX || e.clientY)
    { // works on IE6,FF,Moz,Opera7
      // Note: I am adding together both the "body" and "documentElement" scroll positions
      //       this lets me cover for the quirks that happen based on the "doctype" of the html page.
      //         (example: IE6 in compatibility mode or strict)
      //       Based on the different ways that IE,FF,Moz,Opera use these ScrollValues for body and documentElement
      //       it looks like they will fill EITHER ONE SCROLL VALUE OR THE OTHER, NOT BOTH 
      //         (from info at http://www.quirksmode.org/js/doctypes.html)
      x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
      y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop + 20;
      algor = '[e.clientX]';
      if (e.pageX || e.pageY) algor += ' [e.pageX] '
    }
  }
}

if (document.layers){
	document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;