function PrevPage(){
	history.go(-1);
}
function WriteLayer(ID,parentID,sText) { 
 if (document.layers) { 
   var oLayer; 
   if(parentID){ 
	 oLayer = eval('document.' + parentID + '.document.' + ID + '.document'); 
   }else{ 
	 oLayer = document.layers[ID].document; 
   } 
   oLayer.open(); 
   oLayer.write(sText); 
   oLayer.close(); 
 } 
 else if (parseInt(navigator.appVersion)>=5&&navigator. 
appName=="Netscape") { 
   document.getElementById(ID).innerHTML = sText; 
 } 
 else if (document.all) document.all[ID].innerHTML = sText 
}

function MakeInt(str){
	//remove leading zeros, if any
	while(str.length > 1 && str.substring(0,1) == '0'){
		str = str.substring(1,str.length);
	}
	var val = parseInt(str);
	if(isNaN(val) || val==''){ val=0; }
	return val;
}

function SumInt(v1,v2){
	return parseInt(v1)+parseInt(v2);
}

function DoM2_2(alias,domain){
	window.location = 'mai'+'lto'+':'+alias+'@'+domain;
}

function openWin(p_url,p_width,p_height){
	window.open(p_url,'newWin','width='+p_width+',height='+p_height+',scrollbars=no,top=50,left=50');
}

function openScrollWin(p_url,p_width,p_height){
	w = window.open(p_url,'newWin','width='+p_width+',height='+p_height+',scrollbars=yes,top=50,left=50');
	w.focus();
}

function ToggleVisibility(id,visible_style){
	v = GetControldisplayValue(id);
	if(v=='none'){
		SetControldisplayValue(id,visible_style);
	} else {
		SetControldisplayValue(id,'none');
	}
}

function GetControldisplayValue(id)
{
	res = '';
	if (document.layers)
	{
		res = document.layers[id].display;
	}
	else if (document.all)
	{
		res = document.all[id].style.display;
	}
	else if (document.getElementById)
	{
		res = document.getElementById(id).style.display;
	}
	return res;
}

function SetControldisplayValue(id,displayvalue)
{
	if (document.layers)
	{
		document.layers[id].display = displayvalue;
	}
	else if (document.all)
	{
		document.all[id].style.display = displayvalue;
	}
	else if (document.getElementById)
	{
		document.getElementById(id).style.display = displayvalue;
	}
}
function isValidEmail(emailAddress) {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    return re.test(emailAddress);
}




function CountDownTimer(year, month, day, hour, minute, format, alertmessageonzero){
	CountDownTimer.aantal++;
	
	this.div = 'jscountdown_' + CountDownTimer.aantal;
	this.year = year-2000;
	this.month = month;
	this.day = day;
	this.hour = hour;
	this.minute = minute;
	this.format = format;
	this.alertmessageonzero = alertmessageonzero;
	
	this.countdown = function (year, month, day, hour, minute) {
		//Recursive call, keeps the clock ticking.
		var thisObj = this;
	    window.setTimeout( function(){ thisObj.countdown(year, month, day, hour, minute) }, 1000);
		
		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;
		
		var str = '';
		
		switch(this.format)
		      {
		      case 0:
		           //The simplest way to display the time left.
		           str = 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 = 's'; hps = 's'; mps = 's'; sps = 's';
		           //ps is short for plural suffix.
		           if(days == 1) dps ='';
		           if(hours == 1) hps ='';
		           if(minutes == 1) mps ='';
		           if(seconds == 1) sps ='';
		           
		           str = days + ' day' + dps + ' ';
		           str += hours + ' hour' + hps + ' ';
		           str += minutes + ' minute' + mps + ' and ';
		           str += seconds + ' second' + sps;
		           
		           break;
		      case 2:
		      case 3:
		           //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;
		           
		           str = days + 'd ';
		           str += ((hours<10)?'0':'') + hours + ':';
		           str += ((minutes<10)?'0':'') + minutes;
		           if(this.format==3){
		        	   str += ':';
		        	   str += ((seconds<10)?'0':'') + seconds + '';
		           }
		           break;
		      default: 
		           str = Time_Left + ' seconds';
		      }
		
		document.all[this.div].innerHTML = str;

	}
	
	html_code = '<div id="' + this.div + '">COUNTDOWN ' + CountDownTimer.aantal + '</div>';
	document.write(html_code);
	this.countdown(this.year, this.month, this.day, this.hour, this.minute);
	
}
CountDownTimer.aantal = 0;

// voorbeeldgebruik:
// new CountDownTimer(yyyy,mm,dd, hh,ii, format, '');
// (format: 2 = zonder seconden, 3 = met seconden)



