function worldClock(zone, region){
var dst = 0
var time = new Date()
var gmtMS = time.getTime() + (time.getTimezoneOffset() * 60000)
var gmtTime = new Date(gmtMS)
var day = gmtTime.getDate()
var month = gmtTime.getMonth()
var year = gmtTime.getYear()
if(year < 1000){
year += 1900
}
var monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", 
				"September", "October", "November", "December")
var monthDays = new Array("31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
if (year%4 == 0){
monthDays = new Array("31", "29", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
}
if(year%100 == 0 && year%400 != 0){
monthDays = new Array("31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
}

var hr = gmtTime.getHours() + zone
var min = gmtTime.getMinutes()
var sec = gmtTime.getSeconds()

if (hr >= 24){
hr = hr-24
day -= -1
}
if (hr < 0){
hr -= -24
day -= 1
}
if (hr < 10){
hr = " " + hr
}
if (min < 10){
min = "0" + min
}
if (sec < 10){
sec = "0" + sec
}
if (day <= 0){
if (month == 0){
	month = 11
	year -= 1
	}
	else{
	month = month -1
	}
day = monthDays[month]
}
if(day > monthDays[month]){
	day = 1
	if(month == 11){
	month = 0
	year -= -1
	}
	else{
	month -= -1
	}
}

var startDST = new Date()
var endDST = new Date()
startDST.setMonth(2)
startDST.setHours(1)
startDST.setDate(31)
var dayDST = startDST.getDay()
startDST.setDate(31-dayDST)
endDST.setMonth(9)
endDST.setHours(0)
endDST.setDate(31)
dayDST = endDST.getDay()
endDST.setDate(31-dayDST)
var currentTime = new Date()
currentTime.setMonth(month)
currentTime.setYear(year)
currentTime.setDate(day)
currentTime.setHours(hr)
if(currentTime >= startDST && currentTime < endDST){
	dst = 1
}

	
if (dst == 1){
	hr -= -1
	if (hr >= 24){
	hr = hr-24
	day -= -1
	}
	if (hr < 10){
	hr = " " + hr
	}
	if(day > monthDays[month]){
	day = 1
	if(month == 11){
	month = 0
	year -= -1
	}
	else{
	month -= -1
	}
	}
}
return "Server time: <b>" + hr + ":" + min + ":" + sec + "</b> (GMT+1)"
}

function worldClockZone(){
document.getElementById("clock").innerHTML = worldClock(1, "Europe")
setTimeout("worldClockZone()", 1000)
}

onload_functions.push('worldClockZone()');

javascript_countdown = function () {
	data = new Object();
	data.output_element_id = 'javascript_countdown_time';
	data.time_left = 10; //number of seconds for countdown
	data.keep_counting = 1;
	var no_time_left_message = 'You can vote!';
 
	function countdown() {
		if(data.time_left < 2) {
			data.keep_counting = 0;
		}
 
		data.time_left = data.time_left - 1;
	}
 
	function add_leading_zero(n) {
		if(n.toString().length < 2) {
			return '0' + n;
		} else {
			return n;
		}
	}
 
	function format_output() {
		//var hours, minutes, seconds;
		data.seconds = data.time_left % 60;
		data.minutes = Math.floor(data.time_left / 60) % 60;
		data.hours = Math.floor(data.time_left / 3600);
 
		data.seconds = add_leading_zero( data.seconds );
		data.minutes = add_leading_zero( data.minutes );
		data.hours = add_leading_zero( data.hours );
 
		return data.hours + ':' + data.minutes + ':' + data.seconds;
	}
 
	function show_time_left() {
		document.getElementById(data.output_element_id).innerHTML = format_output();//time_left;
	}
 
	function no_time_left() {
		document.getElementById(data.output_element_id).innerHTML = no_time_left_message;
	}
 
	return {
		count: function () {
			countdown();
			show_time_left();
		},
		timer: function () {
			javascript_countdown.count();
 
			if(data.keep_counting) {
				setTimeout("javascript_countdown.timer();", 1000);
			} else {
				no_time_left();
			}
		},
		//Kristian Messer requested recalculation of time that is left
		setTimeLeft: function (t) {
			data.time_left = t;
			if(data.keep_counting == 0) {
				javascript_countdown.timer();
			}
		},
		init: function (t, element_id) {
			data.output_element_id = element_id;
			data.time_left = t;
			javascript_countdown.timer();
		}
	};
}();
javascript_countdown2 = function () {
	data2 = new Object();
        data2.output_element_id = 'javascript_countdown_time';
        data2.time_left = 10; //number of seconds for countdown
        data2.keep_counting = 1;
        var no_time_left_message = 'You can vote!';

        function countdown2() {
                if(data2.time_left < 2) {
                        data2.keep_counting = 0;
                }

                data2.time_left = data2.time_left - 1;
        }

        function add_leading_zero2(n) {
                if(n.toString().length < 2) {
                        return '0' + n;
                } else {
                        return n;
                }
        }

        function format_output2() {
                //var hours, minutes, seconds;
                data2.seconds = data2.time_left % 60;
                data2.minutes = Math.floor(data2.time_left / 60) % 60;
                data2.hours = Math.floor(data2.time_left / 3600);

                data2.seconds = add_leading_zero2( data2.seconds );
                data2.minutes = add_leading_zero2( data2.minutes );
                data2.hours = add_leading_zero2( data2.hours );

                return data2.hours + ':' + data2.minutes + ':' + data2.seconds;
        }

        function show_time_left2() {
                document.getElementById(data2.output_element_id).innerHTML = format_output2();//time_left;
        }

        function no_time_left2() {
                document.getElementById(data2.output_element_id).innerHTML = no_time_left_message;
        }

        return {
                count: function () {
                        countdown2();
                        show_time_left2();
                },
                timer: function () {
                        javascript_countdown2.count();

                        if(data2.keep_counting) {
                                setTimeout("javascript_countdown2.timer();", 1000);
                        } else {
                                no_time_left2();
                        }
                },
                //Kristian Messer requested recalculation of time that is left
                setTimeLeft: function (t) {
                        data2.time_left = t;
                        if(data2.keep_counting == 0) {
                                javascript_countdown2.timer();
                        }
                },
                init: function (t, element_id) {
                        data2.output_element_id = element_id;
                        data2.time_left = t;
                        javascript_countdown2.timer();
                }
        };
}();

javascript_countdown3 = function () {
	data3 = new Object();
        data3.output_element_id = 'javascript_countdown_time';
        data3.time_left = 10; //number of seconds for countdown
        data3.keep_counting = 1;
        var no_time_left_message = 'You can vote!';

        function countdown3() {
                if(data3.time_left < 2) {
                        data3.keep_counting = 0;
                }

                data3.time_left = data3.time_left - 1;
        }

        function add_leading_zero3(n) {
                if(n.toString().length < 2) {
                        return '0' + n;
                } else {
                        return n;
                }
        }

        function format_output3() {
                //var hours, minutes, seconds;
                data3.seconds = data3.time_left % 60;
                data3.minutes = Math.floor(data3.time_left / 60) % 60;
                data3.hours = Math.floor(data3.time_left / 3600);

                data3.seconds = add_leading_zero3( data3.seconds );
                data3.minutes = add_leading_zero3( data3.minutes );
                data3.hours = add_leading_zero3( data3.hours );

                return data3.hours + ':' + data3.minutes + ':' + data3.seconds;
        }

        function show_time_left3() {
                document.getElementById(data3.output_element_id).innerHTML = format_output3();//time_left;
        }

        function no_time_left3() {
                document.getElementById(data3.output_element_id).innerHTML = no_time_left_message;
        }

        return {
                count: function () {
                        countdown3();
                        show_time_left3();
                },
                timer: function () {
                        javascript_countdown3.count();

                        if(data3.keep_counting) {
                                setTimeout("javascript_countdown3.timer();", 1000);
                        } else {
                                no_time_left3();
                        }
                },
                //Kristian Messer requested recalculation of time that is left
                setTimeLeft: function (t) {
                        data3.time_left = t;
                        if(data3.keep_counting == 0) {
                                javascript_countdown3.timer();
                        }
                },
                init: function (t, element_id) {
                        data3.output_element_id = element_id;
                        data3.time_left = t;
                        javascript_countdown3.timer();
                }
        };
}();


