	var countercode;
	
	function showOptions() {
		if(typeof $('idCounterOptions') != 'undefined') $('idCounterOptions').style.display = 'block';
	}
	
	function fncSwitch(id) {
		countercode = countercode.replace(/style=\d/g, 'style='+id);
		$('countercode').innerHTML = countercode;	
		for(var i=0; i<=3; i++) {
			$('button['+i+']').checked = false;
		}
		$('button['+id+']').checked = true;
	}
	
	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 fncOnline() { ajaxOnline.Open(); }