/* Copyright © 2000-2006 Dennis Bekkering 
 * Comeniusstraat 61 
 * 1065 BH Amsterdam 
 * The Netherlands. 
 * All rights reserved 
 */ 
 
window.njmTimer;
function runNjmTimer(e) {
	window.njmTimer=e;
	runThread();
}

function runThread() {
	var d = new Date();
	
	window.njmTimer.innerHTML= fillZero (d.getHours())+ ":" + fillZero (d.getMinutes());
	setTimeout('runThread()',10000);
}

function fillZero(no) {
	if(no<10) {
		return '0'+ no;
	}
	return no;
}

function njmScheduleClickableBlockClick(e,xevent,x,y) {
	
	if( xevent.srcElement!=e ) {
		return ;
	}
	searchComponent(x).value = xevent.offsetX;
	searchComponent(y).value = xevent.offsetY;

	dynamicSubmitCall(e,xevent);
}

function njmScheduleClickableBlockLoad() {
	//alert(arguments[0].outerHTML);
}

function njmScheduleBlockOver(messageText) {
	messageText.style.display='';
	messageText.parentNode.style.border='1px solid #f5821f';
	
	messageText.parentNode.style.zIndex=1000;
	//alert(messageText.getAttribute('direction'));
	if(!messageText.borderHiderAdded ) {
		if( messageText.getAttribute('direction') == 'ru') {
			messageText.innerHTML+='<div style="background-color:#ffda8c;position:absolute;bottom:0px;left:-1px;height:17px;width:1px;overflow:hidden" ></div>';
		}
		else if( messageText.getAttribute('direction') == 'lu') {
			messageText.innerHTML+='<div style="background-color:#ffda8c;position:absolute;bottom:0px;left:190px;height:17px;width:1px;overflow:hidden" ></div>';
		}
		else if( messageText.getAttribute('direction') == 'rd') {
			messageText.innerHTML+='<div style="background-color:#ffda8c;position:absolute;top:0px;left:-1px;height:17px;width:1px;overflow:hidden" ></div>';
		}
		else {
			messageText.innerHTML+='<div style="background-color:#ffda8c;position:absolute;top:0px;left:190px;height:17px;width:1px;overflow:hidden" ></div>';
		}
	}
	
	if( messageText.getAttribute('direction') == 'ru') {
		//alert('set border');
		messageText.parentNode.style.borderRight='none';
	}
	else if( messageText.getAttribute('direction') == 'lu') {
		//alert('set border');
		messageText.parentNode.style.borderLeft='none';
	}
	else if( messageText.getAttribute('direction') == 'rd') {
		//alert('set border');
		messageText.parentNode.style.borderRight='none';
	}
	else {
		//alert('set border');
		messageText.parentNode.style.borderLeft='none';
	}
	
	
	messageText.borderHiderAdded=true;
	
}
function njmScheduleBlockOut(messageText) {
	messageText.style.display='none';
	messageText.parentNode.style.border='none';
	messageText.parentNode.style.zIndex=0;
}
var njmRoot;
function njmRootLoad(e){
	njmRoot=e;
	onresize = njmResize; 
	njmResize();
	document.body.style.background="#fff3da";
}

function njmTestRootLoad(e){
	njmRoot=e;
	onresize = njmResize; 
	njmResize();
	document.body.style.background="#fff3da";
}

function njmResize(){
	//return;
	var bh = document.body.clientHeight;
	var bw = document.body.clientWidth;
	//alert(bh);
	//var njmw = njmRoot 
	var l = ( bw - 800 ) / 2;
	var t = ( bh - 600 ) / 2;
	if(l>0) {
		njmRoot.style.left = l;
	}
	if(t>0) {
		njmRoot.style.top = t;
	}
	
}


