	var countercode;
	var lastid = 0;
	function showOptions() {
		if(typeof $('idCounterOptions') != 'undefined') $('idCounterOptions').style.display = 'block';
	}
	
	function fncSwitch(id) {
		if(id == -1) id = lastid;
		tmpid = id;
		
		if($('button[online]').checked) {
			id = id+'&amp;amp;on=true';
		}
		
		countercode = countercode.replace(/style=\d(&amp;amp;on=true)?/g, 'style='+id);
		$('countercode').innerHTML = countercode;	
		
		for(var i=0; i<=3; i++) {
			$('button['+i+']').checked = false;
		}
		id = tmpid;
		$('button['+id+']').checked = true;
		if(id != -1) lastid = id;
	}
	
	function fncCheckDate() {
		var temp = new Date();
		temp = temp.getFullYear()+'-'+(temp.getMonth()+1)+'-'+temp.getDate();
		if(temp != now) location.reload();
	}	
	
	function cb_online() {
		var req = ajaxOnline.GetData();

		if(req != null) {
			var ret = eval(req);
			if(typeof ret != "undefined") {
				if(ret[4] == now) {
					$("idVisits").innerHTML = ret[0];
					$("idPi").innerHTML = ret[1];
					$("idAvgtime").innerHTML = ret[2];
					$("idPiUser").innerHTML = ret[3];
					$("idOnline").innerHTML = ret[5];
					$("idSumVisits").innerHTML = ret[6];
					$("idSumPi").innerHTML = ret[7];
					if(typeof $("idPVisits") != "undefined") $("idPVisits").innerHTML = ret[8];
					if(typeof $("idPPi") != "undefined") $("idPPi").innerHTML = ret[9];
					if(typeof $("idPVisits_percent") != "undefined") $("idPVisits_percent").innerHTML = ret[10];
					if(typeof $("idPPi_percent") != "undefined") $("idPPi_percent").innerHTML = ret[11];
				}
			}
		}
	}

	function cb_last() {
		var req = ajaxLast.GetData();
		
		if(req != null) {
			$("lastVisitors").innerHTML = req;
		}
	}
	
	function fncOnline() { ajaxOnline.Open(); }
	function fncLast() { ajaxLast.Open(); }