/**
 *		Jumpmenu    
 */
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
/**
 *		Nieuw browser scherm openen   
 */
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
/**
 *		Veilingprijs animatie  
 */

function animateVeilingPrice(priceStart, priceStop) {
	var priceDelta = (priceStart - priceStop) / 20;
	animateVeilingPriceStep(priceStart, priceStop, priceDelta);
}

function animateVeilingPriceStep(priceStart, priceStop, priceDelta) {
	var priceEl = document.getElementById('veiling_price');
	if(priceEl == null) return;

	priceStart = Math.max(priceStart - 1, priceStop);
	priceEl.innerHTML = "&euro; " + priceStart.toFixed(2).replace('.', ',');

	if(priceStart > priceStop) {
		setTimeout("animateVeilingPriceStep("  + priceStart + ", " + priceStop + ", " + priceDelta + ");", 125);
	}
}
/**
 *		Printen van een pagina 
 */
function printen() 
{
	window.print()
}
/**
 *		SWAP image 
 */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/**
 *		GOTO url 
 */
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

/**
 *		Opvragen breedte scherm en naar server sturen  
 */
function GetScreen(width,height) {
	var url = document.URL
	document.write('<form name="form_breedte" method="post">');
	document.write('<input type="hidden" name="width" value="' + width + '">');
	document.write('<input type="hidden" name="height" value="' + height + '">');
	document.write('<input type="hidden" name="urlvar" value="' + url + '">');
	document.write('</form>');
	document.form_breedte.submit();
}

/**
 *		Tijd nog te gaan tot einde veiling   
 */
function countdown_clock(year, month, day, hour, minute, format)
         {
         //I chose a div as the container for the timer, but
         //it can be an input tag inside a form, or anything
         //who's displayed content can be changed through
         //client-side scripting.
         html_code = '<div id="countdown"></div>';
         
         document.write(html_code);
         
         countdown(year, month, day, hour, minute, format);                
         }
         
function countdown(year, month, day, hour, minute, format)
         {
         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth();                  
         
         //Convert both today's date and the target date into miliseconds.                           
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 
         Target_Date = (new Date(year, month - 1, day, hour, minute, 00)).getTime();                  
         
         //Find their difference, and convert that into seconds.                  
         Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
         
         if(Time_Left < 0)
            Time_Left = 0;
         
         switch(format)
               {
               case 0:
                    //The simplest way to display the time left.
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
                    break;
               case 1:
                    //More datailed.
                    days = Math.floor(Time_Left / (60 * 60 * 24));
                    Time_Left %= (60 * 60 * 24);
                    hours = Math.floor(Time_Left / (60 * 60));
                    Time_Left %= (60 * 60);
                    minutes = Math.floor(Time_Left / 60);
                    Time_Left %= 60;
                    seconds = Time_Left;
                    
                    dps = 'DAGEN'; hps = ''; mps = ''; sps = '';
                    //ps is short for plural suffix.
                    if(days == 0) dps ='';
                    if(days == 1) dps ='DAG';
                    if(days == 0) days ='';
                    if(hours <= 9) hps ='0';
                    if(minutes <= 9) mps ='0';
                    if(seconds <= 9) sps ='0';
                    
                    document.all.countdown.innerHTML = ': ' + days + ' ' + dps + ' ';
                    document.all.countdown.innerHTML += hps + hours + ':' ;
                    document.all.countdown.innerHTML += mps + minutes + ':' ;
                    document.all.countdown.innerHTML += sps + seconds ;
                    break;
               default: 
                    document.all.countdown.innerHTML = Time_Left + ' ';
               }
               
         //Recursive call, keeps the clock ticking.
         setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 1000);
         }
