$(function(){
				
			var now = new Date(),
				days = 60 - (now.getDate() + days_from_jan_1(now.getMonth()+1)) + 2;
				hours =  23 - now.getHours(),
				minutes = 59 - now.getMinutes(),
				seconds = 60 - now.getSeconds();
				
				show_time(days, format_time(hours), format_time(minutes), format_time(seconds));
				tick_time(days, hours, minutes, seconds);


			$('#donate-message').dialog({
				autoOpen:false,
				show:'fold',
				hide:'fold',
				modal:true,
				width:600,
				height:450
			});
});

			function show_sendong(){
				$('#donate-message').dialog('open');
			}
			
			function days_from_jan_1(month){
				switch(month){
					case 1:
						return 0;
					case 2:
						return 31;
					default:
						return 29;
				}
			}
			
			function format_time(number){
				if (number < 10){ return "0"+number; } else{ return number;}
			}
			
			function tick_time(d, h, m, s){
				show_time(format_time(d), format_time(h), format_time(m), format_time(s));				
				remove_all();
						
				if (d == 0 && h == 0 && m == 0 && s == 0){
					$('#link').append("<a href='mylink.php'>Here is the link</a>");
					return 0;
				}
				
				if (s == 0){ 
					s = 60; 
					if (m == 0){
						m = 60;
						if (h == 0){
							h = 24;
							t = setTimeout('tick_time('+d+'-1, '+h+'-1, '+m+'-1, '+s+'-1)', 1000);
						}
						else {
							t = setTimeout('tick_time('+d+', '+h+'-1, '+m+'-1, '+s+'-1)', 1000);
						}
					}
					else {
						t = setTimeout('tick_time('+d+', '+h+', '+m+'-1, '+s+'-1)', 1000);
					}
				}
				else {
					t = setTimeout('tick_time('+d+', '+h+','+m+', '+s+'-1)', 1000);
				}
			}
			
			function remove_all(){
				$('#days-value').remove();
				$('#hours-value').remove();
				$('#minutes-value').remove();
				$('#seconds-value').remove();
			}
			
			function show_time(d, h, m, s){
				$('#days').append("<span id='days-value'>"+d+"</span>");
				$('#hours').append("<span id='hours-value'>"+h+"</span>");
				$('#minutes').append("<span id='minutes-value'>"+ m +"</span>");
				$('#seconds').append("<span id='seconds-value'>"+s+"</span>");
			}
