var Core={
	popup:function(url,width,height) {
		x = (screen.width-width) / 2;
		y = (screen.height - height) / 2;
		newwindow=window.open(url,"screenshot",'resizable=0, status=0, toolbar=0, location=0, scrollbars=no,height='+height+',width='+width+',left='+x+',top='+y);
		if (window.focus) {newwindow.focus()}
		return false;
	},
    getStatistic:function () {
            var comment = false;
                postData= "";
                new ajax('/ajax/statistic.xml', {method: 'post', postBody: postData, onComplete: function(request) {
                    Core.onCompleteRequest(request);
                }});
    },
    onCompleteRequest: function(request,f) {
        if (request.status == 200) {
            var doc = new xml(request.responseText);
			var	root=doc.getDocumentElement();
			var products=root.childNodes[0];
			var total=root.childNodes[1].getAttribute("value");
			$("total_value").innerHTML=total;
			for(var i=0;i<products.childNodes.length;i++) {
				var child=products.childNodes[i];
				$("product_"+child.getAttribute("id")).innerHTML=child.getAttribute("players")+" players";
			}
        } else {
            alert("An unknown error occured");
        }
    }


}