// <!--
// The name of the pop-up-window.
var popwindow
// The height of the pop-up-window (pixels)
var popwindowwidth=230
// The width of the pop-up-window (pixels)
var popwindowheight=200
// Distance to the top margin of the big window
var popwindowtop=480
// The URL of the HTML-file that contains the content of the pop-up-window
var popwindowURL="helmalert.htm"

// Standstill-time (seconds)
var waitingtime=4
var waitingtimeback=1
// Configure the speed of the pop-up-window
var pause=20
var pauseback=1
var step=40
var popwindowleft=-popwindowwidth-50
var popwindowleftback=-popwindowwidth+50
var marginright
var pagecenter
var timer

waitingtime= waitingtime*1000
waitingtimeback = waitingtimeback*1000

function helmalert() {
//bWindow=window.open("helmalert.htm","Helm",'width=2,height=2,toolbar=0,locationbar=0,directories=0,status=0,scrollbars=0,resize=1,menubar=0');
	popwindow = window.open(popwindowURL, "popwindow", "width=0,height=0,toolbar=no,resizable=yes,width="+popwindowwidth+",height="+popwindowheight+",top="+popwindowtop+",left="+(-popwindowwidth)+"");
	if (document.all) {
		marginright = screen.width+50	//-250
		marginrightback = screen.width-(popwindowwidth+60)	//-250
	}
	if (document.layers) {
		marginright = screen.width+50	//-250
		marginrightback = screen.width-(popwindowwidth+60)	//-250
		//marginrightback = screen.width-300	//-250
	}
	pagecenter=Math.floor(marginright/2)-Math.floor(popwindowwidth/2)
	movewindow()
}

function movewindow() {
		if (popwindowleft<=pagecenter) {
			popwindow.moveTo(popwindowleft,popwindowtop)
			popwindowleft+=step
			timer= setTimeout("movewindow()",pause)
		}
		else {
			clearTimeout(timer)
			timer= setTimeout("movewindow2()",waitingtime)
		}
}

function movewindow2() {
		if (popwindowleft<=marginright) {
			popwindow.moveTo(popwindowleft,popwindowtop)
			popwindowleft+=step
			timer= setTimeout("movewindow2()",pause)
		}
		else {
			clearTimeout(timer)
			timer= setTimeout("movewindow3()",waitingtimeback)
		}
}


function movewindow3() {
	//alert("back to left:  marginright: "+ marginright + ", popwindowleft: " + popwindowleft + ", popwindowleftback: " + popwindowleftback + " popwindowleft+popwindowleftback: " +popwindowleft+popwindowleftback)
	//window.status = "back to left:  marginright: "+ marginright + ", pw_left: " + popwindowleft + ", pw_leftback: " + popwindowleftback + " pw_left+pw_leftback: " +popwindowleft+popwindowleftback + " pagecenter: " + pagecenter

		if (popwindowleft+popwindowleftback>marginrightback) {
			popwindow.moveTo(popwindowleft+popwindowleftback,popwindowtop)
			popwindowleftback-=step
			timer= setTimeout("movewindow3()",pauseback)
		}
		else {
			clearTimeout(timer)
			//popwindow.close()
		}
}

// -->
