jQuery.noConflict();
(function($) { 
  $(function() {
		$(document).ready(function(){	
			$("#nav_main ul").prepend('<li id="currentTime"><strong><noscript></noscript></strong></li>');
			$("#nav_main li").each(function(index){
				 $(this).addClass('count'+index);															
			})
															 
			var currentTime = '';	
			var now = new Date();
			var day = now.getDay();
			var week = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
                          			
				if (now) {
					currentTime = week[day] + ', ' + t2(now.getDate()) + '.' + (t2(now.getMonth()+1)) + '.' + t4(now.getYear()) + ' ' + t2(now.getHours()) + ':' + t2(now.getMinutes());
				}
				
				function t4(y) { //y2k-BUGFIX fuer Browser
					return (y < 1000 ? y+1900 : y);
				}
				
				function t2(v) {
					return (v < 10 ? '0'+v : v);
				}
			
			$('li#currentTime strong noscript').replaceWith('');
			
			$('li#currentTime strong').replaceWith('<strong>'+currentTime+'</strong>');
			
			setTimeString = function(){ 
				var currentTime = '';	
				var now = new Date();
				var day = now.getDay();
				var week = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
				
				if (now) {
					currentTime = week[day] + ', ' + t2(now.getDate()) + '.' + (t2(now.getMonth()+1)) + '.' + t4(now.getYear()) + ' ' + t2(now.getHours()) + ':' + t2(now.getMinutes());
				}
				
				function t4(y) { //y2k-BUGFIX fuer Browser
					return (y < 1000 ? y+1900 : y);
				}
				
				function t2(v) {
					return (v < 10 ? '0'+v : v);
				}
				
				$('li#currentTime strong noscript').replaceWith('');
				
				$('li#currentTime strong').replaceWith('<strong>'+currentTime+'</strong>');
			}
			/* replace all 30secs */
			window.setInterval(setTimeString, 30000);
		});

  });
})(jQuery);
