<!--//
function runClock(obj, lid, redirectURL, counter, display, refreshUrl)
{
	var names = new Array('dagen', 'uren', 'minuten', 'seconden');

	if (counter == 25)
	{
		display = getUrlSync(refreshUrl);
		counter = 0
	}
	
	display = display - 1;
	
	if (display > 0) {
		days = Math.floor (display / 86400);
		display_left = display - (days * 86400);

		hours = Math.floor (display_left / 3600);
		display_left = display_left - (hours * 3600);
		
		minutes = Math.floor (display_left / 60);
		secs = display_left - (minutes * 60);
	
		time_field = '';
		if (days > 0) { time_field = days + ' ' + names[0] + ' '; }
		if (hours > 0) { time_field += hours + ' ' + names[1] + ' '; }
		if (minutes > 0) { time_field += minutes + ' ' + names[2] + ' '; }
		time_field += secs + ' ' + names[3] + ' ';

		document.getElementById(obj).innerHTML = '&nbsp;' + time_field + '&nbsp;';
		
		theTime = window.setTimeout("runClock('" + obj + "','" + lid + "','" + redirectURL + "', " + (counter + 1) + ", " + display + ", '" + refreshUrl + "')", 1000);
	} else {
		document.getElementById(obj).innerHTML = 'Veiling is afgelopen';
		if (display == 0) {
			document.location = redirectURL;
		}
	}
}

function runClockEN(time_left_close) {
	display = display - 1;
	if (display > 0) {
		days = Math.floor (display / 86400);
		display_left = display - (days * 86400);

		hours = Math.floor (display_left / 3600);
		display_left = display_left - (hours * 3600);
		
		minutes = Math.floor (display_left / 60);
		secs = display_left - (minutes * 60);
	
		time_field = '';
		if (days > 0) { time_field = days + ' ' + names[0] + ' '; }
		if (hours > 0) { time_field += hours + ' ' + names[1] + ' '; }
		if (minutes > 0) { time_field += minutes + ' ' + names[2] + ' '; }
		if ((days == 0) && (hours == 0) && (minutes == 0)) {
			document.getElementById("clock").innerHTML = time_left_close; 
		}
		document.form.test.value = time_field;
		theTime = window.setTimeout("runClockEN('" + time_left_close + "')", 1000);
	} else {
		document.form.test.value = 'The auction is closed';
		document.getElementById("clock").innerHTML = ' ';
		if (display == 0) {
			document.location = redirect_url;
		}
	}
}

function getUrlSync(url)
{
	xmlHttp = GetXmlHttpObject();
	if (xmlHttp==null) 
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	xmlHttp.open("GET", url, false);
	xmlHttp.send(null);
	
	return xmlHttp.responseText
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function PopWindow(mypage,myname,w,h,scroll){
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';

	window.open(mypage,myname,settings);
}
function expMenu(id) {
	var itm = null;
	if (document.getElementById) {
		itm = document.getElementById(id);
	} else if (document.all) {
		itm = document.all[id];
	} else if (document.layers) {
		itm = document.layers[id];
	}
	if (!itm) {
		// do nothing
	} else if (itm.style) {
		if (itm.style.display == "none") { itm.style.display = ""; }
		else { itm.style.display = "none"; }
	} else { itm.visibility = "show"; }
}
//-->