// JavaScript Document
function confirmLink(theLink,question,ajaxlink,ajaxdest) {
	var htmllink='';
	if ( typeof(theLink.href) != 'undefined' ) {
		htmllink = theLink.href + '&confirmed=1';
	}
	$.ajax({
		type: "GET",
		url: webroot+"/admin/ajax/",
		data: {"ajax": "_scripts/ajax/confirmLink","question": question, "htmllink": htmllink, "ajaxlink": ajaxlink,"ajaxdest": ajaxdest},
		cache: false,
		success: function(html) {
			$('#dialog-thumbwrapper').html(html);
		}
	});
	return false;
}

function Dialog(header,content) {
	$('#dialog-thumbwrapper').html('<div id="dialog" title="'+header+'"><p>'+content+'</p></div>');
	$("#dialog").dialog({
		bgiframe: true,
		modal: true,
		buttons: {
			Ok: function() {
				$(this).dialog('close');
			}
		}
	});
	return false;
}

function CountDown(seconds,element,zerolink) {
seconds = seconds-1;
zbytek=seconds;
hodin=Math.floor(zbytek/3600);
zbytek=zbytek-(hodin*3600);
minut=Math.floor(zbytek/60);
vterin=zbytek-(minut*60);
top.document.getElementById(element).innerHTML=hodin+'h '+minut+'m '+vterin+'s';
if (seconds==0) {document.location.href=zerolink;}
window.setTimeout("CountDown("+seconds+",'"+element+"','"+zerolink+"');",1000);
}

function ShowSaveContentButton(destination,name,value) {
parent.document.getElementById(destination).innerHTML='<input type="submit" id="'+name+'" name="'+name+'" value="'+value+'" />';
return true;
}

function show_date_time()
{
var now = new Date();
var hours = now.getHours();
var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
var den = now.getDate();
var mesic = now.getMonth()+1;
var rok = now.getFullYear();
var timeValue =( den + "." + mesic + "." + rok + " <br /> " + hours + minutes + seconds);
document.getElementById("aktcas").innerHTML=timeValue;
window.setTimeout("show_date_time();",1000);
}

function AddFavorite(linkObj,addUrl,addTitle)
{
  if (document.all && !window.opera)
  {
    window.external.AddFavorite(addUrl,addTitle);
    return false;
  }
  else if (window.opera && window.print)
  {
    linkObj.title = addTitle;
    return true;
  }
  else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
  {
    if (window.confirm('Přidat oblíbenou stránku jako nový panel?'))
    {
      window.sidebar.addPanel(addTitle,addUrl,'');
      return false;
    }
  }
  window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.');
  return false;
}