function moveFooterIcons()
{
	var bfOffset = jQuery('.brand-flag').offset(),
		contentOffset = jQuery('#claim-holder').offset(), 
		contentLeft = contentOffset.left + jQuery('#claim-holder').width(),
		offset = (contentLeft - bfOffset.left);

	if (offset > 0)
	{
		jQuery('#footer-icons').css("right", (15 + offset));
	}
}

jQuery(function () {
	moveFooterIcons();

	jQuery(window).resize(moveFooterIcons);


	jQuery('.bubbleInfo').each(function () {
		var distance = 10;
		var time = 100;
		var hideDelay = 250;

		var hideDelayTimer = null;

		var beingShown = false;
		var shown = false;
		var trigger = jQuery('.trigger', this);
		var info = jQuery('.popup', this).css('opacity', 0);


		jQuery([trigger.get(0), info.get(0)]).mouseover(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			if (beingShown || shown) {
				// don't trigger the animation again
				return;
			} else {
				// reset position of info box
				beingShown = true;

				info.css({
					bottom: 60,
					left: -100,
					display: 'block'
				}).animate({
					bottom: '-=' + distance + 'px',
					opacity: 1
				}, time, 'swing', function() {
					beingShown = false;
					shown = true;
				});
			}

			return false;
		}).mouseout(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				info.animate({
					bottom: '-=' + distance + 'px',
					opacity: 0
				}, time, 'swing', function () {
					shown = false;
					info.css('display', 'none');
				});

			}, hideDelay);

			return false;
		});
	});
});


// get browser type
function getBrowserType()
{
	if (/Konqueror|KHTML/.test(navigator.userAgent) && !/Apple/.test(navigator.userAgent))
    {
    	return "KHTML";
    }
    
    if (/KHTML/.test(navigator.userAgent) && /Apple/.test(navigator.userAgent))
    {
    	return "Safari";
    }
    
    if (!!window.opera)
    {
    	return "Opera";
    }
    
    if (!!(window.attachEvent && !window.opera))
    {
    	return "MSIE";
    }
    
    if (/Gecko/.test(navigator.userAgent) && !/Konqueror|KHTML/.test(navigator.userAgent))
    {
    	return "Gecko";
    } 
}

function addFav()
{
	if (getBrowserType() == 'MSIE') {
		window.external.AddFavorite(location.href, document.title);
	} else if (window.sidebar) {
		window.sidebar.addPanel(document.title,location.href,"");
	} else {
		alert('Do oblíbených tuto stránku přidáte obvykle stisknutím Ctrl+D (Cmd+D pro Mac)');
	}
}

// #### funkce pro práci s obrazky

function zoom(URL,winName,features,popis) // otevírá náhledy obrázků v sekci pivo/baleni piva Gambrinus
{
  if (!popis) popis = '';
	okno=window.open('',winName,features);
	okno.document.write('<HTML><TITLE>'+popis+' - Gambrinus</TITLE><BODY style="margin:0; padding:0; font-family: Arial, Helvetica, sans-serif; color: white;">');
	okno.document.write('<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" style="font-size: 75%;">');
	okno.document.write('<a href="javascript:window.close()"><IMG SRC="'+URL+'" border="0" alt=":: zavřít okno ::" style="border: 4px solid #FFFFFF;"></a><br>'+popis);
	okno.document.write('<td><tr></table></BODY></HTML>');
	okno.document.close();
	okno.focus();
	okno.document.bgColor="#670216";

}

// #### funkce pro práci s obrázky ###

var popWin=null;
function WinOpen(ParObr,w,h,cesta,title,ext,bgcolor,scroll) //w - sirka,h - vyska obrazku,cesta - kde souboru,
{
	if (cesta == null) cesta = "_images";		//def hodnoty , pri zadani pouze cesty k obrazku JPG se otevre okno 600*400 px
    if (!w) w = 600;
    if (!h) h = 400;
    if (!title) title = "Náhled";
	if (!bgcolor) bgcolor = "white";
	if (!ext) ext = "jpg";
	if (!scroll) scroll = "yes"

	WinTit = title;
	 w+=20; h+=20;
	 if (popWin && !popWin.closed) popWin.close();
	var WinOpenZdr1 = "<html><head><title>"
	var WinOpenBody = "marginheight='0' marginwidth='0' leftmargin='0' topmargin='0'"
	var WinOpenZdr2 = "</title></head><body bgcolor='"+bgcolor+"' "+WinOpenBody+" onload='focus()' style='margin:0; padding:0'>"+
						"<div style='text-align:center'><a title='Kliknutím zavřete' href='javascript:self.close()'><img src='"+cesta+"/" +ParObr+"."+ext+"' border='0'></a></div></body></html>"
	 winFeatures="width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,Scrollbars="+scroll+"";
	 popWin = window.open('', "ImageWindow", winFeatures);
     popWin.document.write(WinOpenZdr1 + WinTit + WinOpenZdr2);
//popWin.document.write(w);
     popWin.document.close();
	 if (!popWin.opener) popWin.opener = self;
}

function WinOpenJustPath(ParObr,w,h,cesta,title,ext,bgcolor,scroll) //w - sirka,h - vyska obrazku,cesta - kde souboru,
{
	if (cesta == null) cesta = "_images";		//def hodnoty , pri zadani pouze cesty k obrazku JPG se otevre okno 600*400 px
    if (!w) w = 600;
    if (!h) h = 400;
    if (!title) title = "Náhled";
	if (!bgcolor) bgcolor = "white";
	if (!ext) ext = "jpg";
	if (!scroll) scroll = "yes"

	WinTit = title;
	 w+=20; h+=20;
	 if (popWin && !popWin.closed) popWin.close();
	var WinOpenZdr1 = "<html><head><title>"
	var WinOpenBody = "marginheight='0' marginwidth='0' leftmargin='0' topmargin='0'"
	var WinOpenZdr2 = "</title></head><body bgcolor='"+bgcolor+"' "+WinOpenBody+" onload='focus()' style='margin:0; padding:0'>"+
						"<div style='text-align:center'><a title='Kliknutím zavřete' href='javascript:self.close()'><img src='"+cesta+"' border='0'></a></div></body></html>"
	 winFeatures="width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,Scrollbars="+scroll+"";
	 popWin = window.open('', "ImageWindow", winFeatures);
     popWin.document.write(WinOpenZdr1 + WinTit + WinOpenZdr2);
//popWin.document.write(w);
     popWin.document.close();
	 if (!popWin.opener) popWin.opener = self;
}

// just new window
function newWin(URL) {
	okno=window.open(URL,'blank');
	okno.focus();
	return false;

}

// flasv TV

function getFlashObject(movieName)
{
  var bt = getBrowserType();
  
  if (bt == 'Safari')
  {
  	return document.getElementById(movieName);
  }
  if (window.document[movieName])
  {
      return window.document[movieName];
  }
  if(bt == "Opera"){
    return document.getElementById(movieName);
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName];
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
  	return document.getElementById(movieName);
  }
}
function playVideo(videoname){
  var flashTv = getFlashObject('tvplayer');
  flashTv.SetVariable('bgimg',''); // pozadi black
  flashTv.SetVariable('playVideoPath',videoname);
}
function playAudio(audioname){
  getFlashObject('tvplayer').SetVariable('playAudioPath',audioname);
}
function setTvBackground( fileName ) {
   getFlashObject('tvplayer').SetVariable('bgimg',fileName);
}
function getTvQuality() {
    var tvplayer;
    if(tvplayer =getFlashObject('tvplayer')){
	return tvplayer.GetVariable('quality');
    }
}
function setTvQuality( quality ) {
    getFlashObject('tvplayer').SetVariable('quality',quality);
}
function playNaEx(videoPath){
  var flashTv = getFlashObject('tvplayer');
  flashTv.SetVariable('playNaEx',videoPath);
  logPlayNaex('tv', videoPath);
}
function tv(stream, is_forced_video, will_be_age_check_shown) {
    var flashvars   = 'stream=' + stream;
    var locationVar = location.href;

    if (will_be_age_check_shown==1) {
        locationVar = location.href + 'age-check/';
        flashvars = flashvars + '&isOff=1';
        document.getElementById("tv").style.display = 'none';
    }

    if (is_forced_video==1) {
        locationVar = 'http://www.gambrinus.cz/' + Math.random() + '/';
    }

    flashvars = flashvars + '&location=' + locationVar;
    flash('/_swf/televizor20080205.swf?clear=1258','440','300',flashvars,'transparent','tvplayer','','<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW"><img src="/_clip/noflash-tv.png" alt="instalovat flash player" title="Kliknutím přejdete na stránky výrobce Adobe Flash Player" /></a>','');
}
function flash(file,width,height,flashvars,winmode,id,classs,alternative,will_be_age_check_shown) {
    
    if (will_be_age_check_shown==1) { // pro age check je reklama vypnuta
        return;
    }

	var shockmode = false;
	if(id!=''){
		id=" id=\""+id+"\"";
	}
	if(classs!=''){
		classs=' class="'+classs+'"';
	}
	var mimetype = 'application/x-shockwave-flash';

	if (navigator.mimeTypes) {
		if (navigator.mimeTypes[mimetype] != null) {
			if (navigator.mimeTypes[mimetype].enabledPlugin != null) {
				shockmode = true;
		      }
		}
	}

	if (!shockmode && navigator.appVersion.indexOf('MSIE') !=-1) {
		shockmode = true;
	}
	if (shockmode) {
		document.write("<object"+id+" type=\"application/x-shockwave-flash\" data=\""+file+"\""+classs+" width=\""+width+"\" height=\""+height+"\">");
		document.write("<param name=\"movie\" value=\""+file+"\" />");
		document.write("<param name=\"menu\" value=\"false\" />");
		document.write("<param name=\"wmode\" value=\""+winmode+"\" />");
		if(flashvars!=''){
			document.write("<param name=\"flashvars\" value=\""+flashvars+"\" />");
		}
		document.write(alternative);
		document.write("</object>");
	}
	else {
		document.write(alternative);
	}
}
function simpleflash(file,width,height,flashvars){
	if(!flashvars){
		flash(file,width,height,'','opaque','','','Nemáte Adobe Flash Player');
	}else{
		flash(file,width,height,flashvars,'opaque','','','Nemáte Adobe Flash Player');
	}
}
function turnOffVideo(){
 if (document.getElementById('tvplayer'))
 {
   getFlashObject('tvplayer').SetVariable('turnOff',1);
 }
}
function turnOnVideo(){
 if (document.getElementById('tvplayer'))
 {
   getFlashObject('tvplayer').SetVariable('turnOff',0);
 }
}

function playVideoOnce(videoname){
  var flashTv = getFlashObject('tvplayer');
  flashTv.SetVariable('playVideoOnce',videoname);
}
// popup video NaeX
function playNaeXpopup(path){
  logPlayNaex('popup', path);
  turnOffVideo();

  var popup = document.getElementById("popup");
  var width = 560;
  var height = 448;
  
	var html = '<div id="age_check"></div><div id="video_tab"><div class="container" style="width:'+width+'px;">';
	html+= '<embed src="http://www.gambrinus.cz/_swf/flvplayer.swf" width="'+width+'" height="'+height+'" allowfullscreen="true" flashvars="&displayheight='+height+'&file='+path+'/flvpop.flv&width='+width+'&location=http://www.gambrinus.cz/_swf/flvplayer.swf" />';
	html+='<a href="" onclick="stopNaeXpopup(); return false;">zavřít</a></div></div>';
	
	popup.innerHTML = html;

    self.scrollTo(0, 0);

	window.onresize=resizeLayer;
	resizeLayer();
	
	
}
function stopNaeXpopup(){
  turnOnVideo();

  var popup = document.getElementById("popup");
	popup.innerHTML = "";

}

// logo ...a zivot ma riz
function logo() {
flash('/_swf/logo.swf','250','64','','transparent','','logo','<img src="/_clip/a-zivot-ma-riz.gif" alt="" class="floatRight" />');
}

// vypisuje JAVA aplety v sekci HRY online

function java(co,wid,hei){
document.write('<applet code="'+co+'.class" width="'+wid+'" height="'+hei+'"></applet>');
}
function patnact(co,wid,hei){
document.write('<applet code="'+co+'.class" width="'+wid+'" height="'+hei+'"><param name="picsizeside" value="80"></applet>');
}

// Otevreni pop up okna - dokument
var docWin=null;
function DocOpen(DocName,w,h,idw) //DocName - jmeno souboru,w - sirka,h - vyska,idw - identifikator okna
{
	if (!idw) cesta = "Gambrinus";		//def hodnota
	 w+=2; h+=2;
	winFeatures="width="+w+",height="+h+",toolbar=no,location=no,"+
	"directories=no,status=no,menubar=no,resizable=no,scrollbars=no";
	docWin = "";
	docWin = window.open(DocName, idw, winFeatures);
	window.open(DocName, idw, winFeatures);
}

//definice her ------- nevyherni ---------
function gambballs_nevyherni(){
  if (!arguments[0]) cid = 111;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/gambballs/src/"+cid,520,500,"GambBalls");
}
function fotbalek_nevyherni(){
  if (!arguments[0]) cid = 174;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/fotbalek-nevyherni/src/"+cid,800,500,"Fotbalek");
}
function rockinvaders_nevyherni() {
  if (!arguments[0]) cid = 297;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/rock-invaders/src/"+cid,610,550,"RockInvaders");
}
function rockinvaders_vyherni() {
  if (!arguments[0]) cid = 306;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/rock-invaders_ii/src/"+cid,610,550,"RockInvaders");
}
function rockinvaders_vyherni_2() {
  if (!arguments[0]) cid = 307;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/rock-invaders_iii/src/"+cid,610,550,"RockInvaders");
}
function pivris_nevyherni() {
  if (!arguments[0]) cid = 298;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/pivris-nevyherni/src/"+cid,500,400,"Pivris");
}
function gjack_nevyherni() {
  if (!arguments[0]) cid = 299;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/g-jack_nevyherni/src/"+cid,640,480,"GJack");
}
function matchball_nevyherni() {
  if (!arguments[0]) cid = 300;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/matchball_nevyherni/src/"+cid,600,450,"MatchBall");
}
function otvirej_nevyherni() {
  if (!arguments[0]) cid = 301;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/otvirej_nevyherni/src/"+cid,640,360,"Otvirej");
}
function driblovani_nevyherni() {
  if (!arguments[0]) cid = 302;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/driblovani_nevyherni/src/"+cid,750,330,"Driblovani");
}
function prime_kopy_nevyherni() {
  if (!arguments[0]) cid = 303;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/prime-kopy_nevyherni/src/"+cid,750,330,"PrimeKopy");
}
function brankari_nevyherni() {
  if (!arguments[0]) cid = 304;
  else cid = arguments[0];
  DocOpen("/souteze/online-hry/_flash/brankari_nevyherni/src/"+cid,750,330,"PrimeKopy");
}

function paintball_nevyherni() {  // otevira paintball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/online-hry/_flash/paintball_nevyherni/src/"+cid,"xxx","width=750,height=550,resizezable=no,scrolling=no");
}
function vanocni_hra_nevyherni() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/online-hry/_flash/vanocni-hra_nevyherni/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}
function odhazovani_nevyherni() {
  if (!arguments[0]) return;
  else cid = arguments[0];
  window.open("/souteze/online-hry/_flash/odhazovani_nevyherni/src/"+cid,"xxx","width=600,height=370,resizezable=no,scrolling=no");
}

//definice her ------- o ceny ---------
function gjack_2007_11() {
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2007-11_vanocni-promo/src/"+cid,"xxx","width=750,height=480,resizezable=no,scrolling=no");
}
function driblovani() {  // otevira driblovani
	if (!arguments[0]) return;
	cid =  arguments[0];
  DocOpen("/souteze/souteze-o-ceny/2007-08_driblovani/src/"+cid,750,330,"Driblovani");
}
function matchball() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2007-10_Arakain/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}
function crl_matchball() {  // otevira matchball pre Cesku rockovu ligu
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2007-07_MMiG/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}
function prime_kopy() {  // otevira fot. hru - Prime kopy
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2007-11_prime-kopy/src/"+cid,"xxx","width=750,height=330,resizezable=no,scrolling=no");
}
function borec() {  // otevira driblovani - Ukaz jaky jsi borec
	if (!arguments[0]) return;
	cid =  arguments[0];
	DocOpen("/souteze/souteze-o-ceny/2008-03_driblovani/src/"+cid,580,450,"Driblovani");
}
function puzzle_kalendar() {  // otevira Puzzle
	if (!arguments[0]) return;
	cid =  arguments[0];
	DocOpen("/souteze/souteze-o-ceny/2008-12_puzzle/src/"+cid,725,400,"Puzzle");
}

function vanocni_hra_2008() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2008-12_vanocni-hra/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}
function matchball_2009_03() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2009-03_matchball/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}
function matchball_2009_08() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2009-08_matchball/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}
function matchball_2009_09() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2009-09_matchball/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}

function matchball_2010_08() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2010-08_matchball/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}
function matchball_2010_09() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2010-09_matchball/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}

function neviditelny_matchball() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/neviditelny_matchball/src/"+cid,"xxx","width=600,height=450,resizezable=no,scrolling=no");
}

function guitarhero_2009_07() {  // otevira matchball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2009-07_guitar-hero/src/"+cid,"xxx","width=650,height=400,resizezable=no,scrolling=no");
}
function paintball_2009_08() {  // otevira paintball
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2009-08_paintball/src/"+cid,"xxx","width=750,height=550,resizezable=no,scrolling=no");
}
function gjack_2009_11() {
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2009_11_egypt/src/"+cid,"xxx","width=750,height=480,resizezable=no,scrolling=no");
}
function jack_test() {
	if (!arguments[0]) return;
	cid =  arguments[0];
	window.open("/souteze/souteze-o-ceny/2007-07_G-jack/src/"+cid,"xxx","width=750,height=480,resizezable=no,scrolling=no");
}
//////////////////////////////

function excelent_hospody () {
 window.open ("/excelent/hospody/","hospody");
}


function playNaexFromList(url, type, id)
{
	if (type == 'tv')
	{
		playNaEx(url);
	} else { // popup
		playNaeXpopup(url);
		self.scrollTo(0, 0);
	}
	
	var ajax = new EasyAjax("GET", "aid="+id, "/smallapp/ajax/updateview");
    //ajax.onLoading("loading");
    ajax.onSuccess("getUpdateStatus");
    ajax.doRequest();
}

function getUpdateStatus(json)
{
	var res = eval("("+json+")");
	
	if (res.status == "ALL_OK")
	{
		document.getElementById('zh_'+res.id).innerHTML = res.cnt;
	}
}

function sendToFriend()
{
	var data;
	data = "&aid=" + document.getElementById("aid").value;
	data += "&url=" + document.getElementById("url").value;
	data += "&name=" + document.getElementById("name").value;
	data += "&emailfrom=" + document.getElementById("emailfrom").value;
	data += "&emailto=" + document.getElementById("emailto").value;
	data += "&text=" + document.getElementById("text").value;
	data += "&robot=" + document.getElementById("protirobotum").value;
	
	var ajax = new EasyAjax("POST", data, "/smallapp/ajax/sendtofriend");
	ajax.onLoading("loadingSendToFriend");
	ajax.onSuccess("getSendToFriendStatus");
    ajax.doRequest();
}

// future control.modal object. will be created in naex article.phtml
// used to close modal window
var sendToFriendModal = null; 

function getSendToFriendStatus(json)
{
	var res = eval("("+json+")");
	switch (res.status)
	{
		case 'ALL_OK':
			document.getElementById('result').innerHTML = "Odesláno.";
			sendToFriendModal.close();
			break;
		case 'ERROR_EMAIL_FROM':
			document.getElementById('result').innerHTML = "Špatná e-mailová adresa odesílatele!";
			break;
		case 'ERROR_EMAIL_TO':
			document.getElementById('result').innerHTML = "Špatná e-mailová adresa příjemce!";
			break;
		case 'ERROR_SEND':
			document.getElementById('result').innerHTML = "Chyba při odesílání zprávy.";
			break;
		case 'ERROR_NAME':
			document.getElementById('result').innerHTML = "Položku Jméno musíš vyplnit!";
			break;
		case 'ERROR_ROBOT':
			document.getElementById('result').innerHTML = "Spambot!";
			break;
	}
}
function loadingSendToFriend()
{
	document.getElementById('result').innerHTML = "Momentík...";
}

function sendProfileToFriend()
{
        var data;
        //data = "&aid=" + document.getElementById("aid").value;
        data += "&url=" + document.getElementById("url").value;
        data += "&param=" + document.getElementById("param").value;
        data += "&name=" + document.getElementById("name").value;
        data += "&emailfrom=" + document.getElementById("emailfrom").value;
        data += "&emailto=" + document.getElementById("emailto").value;
        data += "&text=" + document.getElementById("text").value;
        data += "&robot=" + document.getElementById("protirobotum").value;

        var ajax = new EasyAjax("POST", data, "/smallapp/ajax/sendtofriend");
        ajax.onLoading("loadingSendToFriend");
        ajax.onSuccess("getSendToFriendStatus");
        ajax.doRequest();
}

function hide_big_flash()
{
	createCookie("MosaicBigFlash","true",1);
	document.getElementById("big_flash").style.display = "none";
	document.getElementById("small_flash").style.display = "block";
	document.getElementById("small_flash").style.zIndex = 900;
}

function start_big_flash()
{
	var checked = readCookie("MosaicBigFlash");
//	checked = null;
	if(checked == null || checked == "false") {
		document.getElementById("big_flash").style.display = "block";
	} else {
		document.getElementById("small_flash").style.display = "block";
		document.getElementById("small_flash").style.zIndex = 900;
	}
}
//start_big_flash();

/******** COOKIE METHODS FROM AGE-CHECK *********************/
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

/***************** ONLINE CHAT AJAX */
function sendQuestion()
{
	var data;
	data += "&q=" + document.getElementById("otazka").value;
	data += "&j=" + document.getElementById("jmeno").value;
	data += "&cid=" + document.getElementById("chatid").value;
	
	var ajax = new EasyAjax("POST", data, "/studio-gambrinus/online-chat/add-question/");
    ajax.onLoading("loadingSendQuestion");
    ajax.onSuccess("getSendQuestionStatus");
    ajax.doRequest();
}

function loadingSendQuestion()
{
	document.getElementById('result').innerHTML = "Momentík...";
}

function getSendQuestionStatus(json)
{
	var res = eval("("+json+")");
	switch (res.status)
	{
		case 'ALL_OK':
			document.getElementById('result').innerHTML = "Odesláno.";
			document.getElementById("otazka").value = '';
			break;
		case 'ERROR_SEND':
			document.getElementById('result').innerHTML = "Chyba při odesílání otázky.";
			break;
		case 'ERROR_NAME':
			document.getElementById('result').innerHTML = "Položku Jméno musíš vyplnit!";
			break;
		case 'ERROR_QUEST':
			document.getElementById('result').innerHTML = "Položku Otázka musíš vyplnit!";
			break;
	}
}

function logPlayNaex(type, ident)
{
	if ("undefined" != typeof Ajax)
	{
		new Ajax.Request('/smallapp/naex/log-play-naex-js/', {
			method: 'post',
			parameters: {type: type, ident: ident},
			onSuccess: function(transport){}
		});
	}
	
	//return false;
}


/******************** popup div stuff */
function hidePopupDiv()
{
	createCookie("vyskakovacMostHK","true",1);
	document.getElementById('vyskakovac').style.display = 'none';
}

function saveScore()
{
	var sc = "&sc1=" + document.getElementById("score1").value;
	sc += "&sc2=" + document.getElementById("score2").value;
	
	var ajax = new EasyAjax("POST", sc, "/smallapp/ajax/soutez-o-vysledky/");
    //ajax.onLoading("loadingSendQuestion");
    ajax.onSuccess("getSaveScoreStatus");
    ajax.doRequest();
}

function getSaveScoreStatus(json)
{
	document.getElementById('vyskakovac').style.display = 'none';
//	var res = eval("("+json+")");
//	switch (res.status)
//	{
//		case 'ALL_OK':
//			document.getElementById('vyskakovac').innerHTML = "Vysledek ulozen.";
//			break;
//		case 'ERROR':
//			document.getElementById('result').innerHTML = "Chyba při odesílání otázky.";
//			break;
//	}
}

function setAgecheckExternal(checked)
{
	if (checked !== undefined && checked)
	{
		createCookie("GambrinusAgeCheck","true",1);
	} else {
		createCookie("GambrinusAgeCheck","false",1);
	}
}

/***************** claim-footer tooltip */


