function postScore(score) {
	var attachment = {'media': [{'type':'image', 'src':'http://www.pilsner-urquell.cz/images/vanoce/fbimg2.jpg', 'href':'http://www.pilsner-urquell.cz/cz/Pilsner-Urquell-Vanoce-2009.html'}], 'name':'Tipněte si, v jakém sudu se skrývá chmelová šiška.','href':'http://www.pilsner-urquell.cz/cz/Pilsner-Urquell-Vanoce-2009.html','description':'Vánoční hra Pilsner Urquell 2009'};

	FB_RequireFeatures(["Connect"], function() {
		FB.init("2c67862ee6577c47ed1d67c473dca4ec", "/files/fb/xd_receiver.html");
/*
		window.onresize = null;
		if (navigator.appName == "Opera") {
			document.getElementById("flashcontent").style.visibility="hidden";
		} else {
			document.getElementById("flashcontent").style.width="1px";
			document.getElementById("flashcontent").style.height="1px";
		}
*/
		FB.Connect.streamPublish('Nahrál(a) jsem ' + score + ' ' + points2text(score, "bod", "body", "bodů") + ' ve Vánoční hře Pilsner Urquell o 50l sudy a další výhry. Hrajte taky!', attachment);
	});
//	startTimer();
}

function postScoreFromHtml(score) {
	$("img.ajaxLoad", "#resultBuble").css({"top":"1px"});
	var attachment = {'media': [{'type':'image', 'src':'http://www.pilsner-urquell.cz/images/vanoce/fbimg2.jpg', 'href':'http://www.pilsner-urquell.cz/cz/Pilsner-Urquell-Vanoce-2009.html'}], 'name':'Tipněte si, v jakém sudu se skrývá chmelová šiška.','href':'http://www.pilsner-urquell.cz/cz/Pilsner-Urquell-Vanoce-2009.html','description':'Vánoční hra Pilsner Urquell 2009'};

	FB_RequireFeatures(["Connect"], function() {
		FB.init("2c67862ee6577c47ed1d67c473dca4ec", "/files/fb/xd_receiver.html");
		FB.Connect.streamPublish('Nahrál(a) jsem ' + score + ' ' + points2text(score, "bod", "body", "bodů") + ' ve Vánoční hře Pilsner Urquell o 50l sudy a další výhry. Hrajte taky!', attachment);
	});
	startTimerHtml();
}

function startTimer() {
	setInterval(
		function() {
			if (!document.getElementById('RES_ID_fb_pop_dialog_table')) {
				window.onresize = setSize;
				if (navigator.appName == "Opera") {
					document.getElementById("flashcontent").style.visibility="visible";
				} else {
					document.getElementById("flashcontent").style.width="100%";
					document.getElementById("flashcontent").style.height="700px";
				}
			}
		}, 500);
}

function startTimerHtml() {
	setInterval(
		function() {
			if (!document.getElementById('RES_ID_fb_pop_dialog_table')) {
				$("img.ajaxLoad", "#resultBuble").css({"top":"-10000px"});
			}
		}, 500);
}
function points2text(count, varA, varB, varC) {
	if(count == 1) {
		return varA;
	} else if(count > 1 && count < 5) {
		return varB;
	} else if(count >= 5) {
		return varC;
	} else if (count == 0) {
		return varC;
	}
}
