<!--
	var dostop = 0;
	var Start = new Date();
	function timer_start() { 
		dostop = 0;
  		for (var i = 1; i <= 100; i++ ) {
			if ( document.getElementById( "timer"+i )) {
	     			var params = document.getElementById( "timer"+i ).title.split( "_" );
	      			var time = parseInt( params[1] );
	      			var type = params[3];
	      			timer( "timer"+i, time, type );
    			}
  		}
	}
                                                                                                                                                            
	function timer( timer, time, type ) {
  		var Now = new Date();
  		var t = time - Math.floor( ( Now.getTime() - Start.getTime() ) / 1000 );
  		if ( t > 0 ) {
    			var h = Math.floor( t / 3600 );
    			var m = Math.floor( ( t - h * 3600 ) / 60 );
    			var s = t - h * 3600 - m * 60;
    			if ( type == 1 || type == 3) {
      				if ( h == 0 ) h = "";
      				else h = h + ":";
      				if ( m == 0 && h == 0 ) m = "";
      				else m = m + ":";
      				if ( s == 0 && m == 0 && h == 0 ) s = "00";
      				else s = s + "";
        			if ( s < 10 ) s = "0" + s;
      				document.getElementById( timer ).firstChild.nodeValue = h + m + s;
      			}
        		else if ( type == 2 ) {
      				if ( m < 10 ) m = "0" + m;
      				if ( s < 10 ) s = "0" + s;
      				document.getElementById( timer ).firstChild.nodeValue = h + ":" + m + ":" + s;
      			}
        		if(dostop != 1) window.setTimeout( 'timer( "'+timer+'", "'+time+'", "'+type+'" )', 100 );
        	}
  		else {
    			if ( type == 1 )
    			{
        			document.getElementById( timer ).firstChild.nodeValue= "00";
        			document.location.reload();
    			}
    			else if ( type == 2 ) document.getElementById( timer ).firstChild.nodeValue= "Angekommen";
    			else if ( type == 3 ) document.getElementById( timer ).firstChild.nodeValue= "jetzt";
    		}
	}
	
	var ZeitString, DatumsString = "";

	function ZeitDatum() 
	{
		// aktuelles Datum
		Tag = Jetzt.getDate();
		Monat = Jetzt.getMonth()+1;
		
		Jahr = Jetzt.getFullYear();
		DatumsString = Tag;
		DatumsString += ((Monat<10) ? ".0" : ".") + Monat;
		DatumsString += "." + Jahr;
	
		//aktuelle Uhrzeit
		Stunden = Jetzt.getHours();
		Minuten = Jetzt.getMinutes();
		Sekunden = Jetzt.getSeconds();
		ZeitString = Stunden;
		ZeitString += ((Minuten < 10) ? ":0" : ":") + Minuten;
		ZeitString += ((Sekunden < 10) ? ":0" : ":") + Sekunden;
		document.getElementById('date').innerHTML = DatumsString + ' ' + ZeitString;
		Jetzt.setSeconds(Sekunden + 1);
		setTimeout("ZeitDatum()", 1000);
	}
	
	if (window && window.innerWidth)
	{
		fensterbreite = window.innerWidth;
	} 
	else if (document && document.body && document.body.offsetWidth)
	{
		fensterbreite = document.body.offsetWidth;
	}
	
	function createRequestObject() {
	var ro;
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
	ro = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
	ro = new ActiveXObject("Microsoft.XMLHTTP");
	}

	return ro;
	}
	
	var http = createRequestObject();
	
	function sndReq(url) {
	http.open('get', url);
	http.onreadystatechange = handleResponse;
	http.send(null);
	}
	
	function handleResponse() {
		if(http.readyState == 4){
			var response = http.responseText;
			if(response.indexOf('|' != -1)) {
				update = response.split('|@|');
				if(update[0] == "cats")
				{
					document.getElementById(update[1]).innerHTML = update[2];
					document.getElementById(update[3]).style.visibility = update[4];
					document.getElementById(update[5]).href = "javascript:" + update[6] + "cat('" + update[1] + "');";
					document.getElementById(update[7]).src = "images/"+update[8]+".gif";
				}
				if(update[0] == "truppen")
				{
					dostop = 1;
					document.getElementById('showtruppen').innerHTML = update[1];
					document.getElementById('truppen').style.visibility = 'visible';
					Start = new Date();
					Now = new Date();
					window.setTimeout('timer_start()', 300);
				}
				if(update[0] == "cancel")
				{
					sndReq('truppen.php?pa=1&show='+update[1]);
				}
				if(update[0] == "plantdetails")
				{
					document.getElementById('plantinfo').innerHTML = update[1];
				}
				if(update[0] == "werbung")
				{
					document.getElementById('werbungdiv').innerHTML = update[1];
				}
			}
		}
	}
	
	function showcat(cat)
	{
		sndReq('cats.php?action=showcat&asyn=1&cat='+cat);
	}
	function hidecat(cat)
	{
		sndReq('cats.php?action=hidecat&asyn=1&cat='+cat);
	}
	function openlink(url)
	{
		sndReq(url);
	}
	
	function fbuild()
	{
		if(document.getElementById('fbuild').checked == 0)
		{
			sndReq('fbuild.php?action=disable');
			alert("deaktiviert");
		}
		else
		{
			sndReq('fbuild.php?action=enable');
			alert("aktiviert");
		}
	}
	function pcombo()
	{
		if(document.getElementById('pcombo').checked == 0)
		{
			sndReq('pcombo.php?action=disable');
			alert("deaktiviert");
		}
		else
		{
			sndReq('pcombo.php?action=enable');
			alert("aktiviert");
		}
// 		window.setTimeout("sndReq('cats.php?action=showcat&asyn=1&cat=plants')", 500);
	}
	
	function shownotes()
	{
		document.getElementById('notes').style.visibility = 'visible';
	}
	function hidenotes()
	{
		document.getElementById('notes').style.visibility = 'hidden';
	}
	function updatenotes()
	{
		var notes = document.getElementById('notestext').value;
		
		
		sndReq('notes.php?text='+escape(notes));
	}
	
	function canceltruppen(id, show)
	{
		sndReq('building6.php?pa=1&action=cancel&show='+show+'&id='+id);
	}
	
	function showtruppen(show)
	{
		sndReq('truppen.php?pa=1&show='+show);
	}
	function hidetruppen()
	{
		document.getElementById('truppen').style.visibility = 'hidden';
		window.scrollTo(0, 0);
	}
	
	function getplantdetails(coordx, coordy)
	{
		sndReq('plantdetails.php?coordx='+coordx+'&coordy='+coordy);
	}
	
	function werbung()
	{
		var amount = document.werbungform.amount.value;
		var weight = document.werbungform.weight.value;
		sndReq('werbung.php?amount='+amount+'&weight='+weight);
	}
	
	function plant_sellall()
	{
		if(document.getElementById('plant_sellall').checked == 0)
		{
			sndReq('p_sellall.php?action=disable');
			//alert("deaktiviert");
		}
		else
		{
			sndReq('p_sellall.php?action=enable');
			//alert("aktiviert");
		}
	}
	
	function init()
	{
		timer_start();
		Jetzt = new Date(year, month, day, hour, min, sec);
		ZeitDatum();
	}
	//-->
