/*
 * ZONES.SK - JavaScript Funkcie
 */

/* Inicializacia Facebook Connect */
function FacebookInit(id)
{
  window.fbAsyncInit = function() {
    FB.init({
      appId  : id,
      status : true, // check login status
      cookie : true, // enable cookies to allow the server to access the session
      xfbml  : true  // parse XFBML
    });
  };

  (function() {
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/sk_SK/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
  }());
}
 
function bookmarksite()
{
  var url = document.location.href;
  var title = document.title;
  
  if (window.sidebar) // optimalizacia pre firefox
    window.sidebar.addPanel(title, url, "");
  else if(window.opera && window.print){ // optimalizacia pre opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
  }
  else if(document.all)// optimalizacia pre IE
  window.external.AddFavorite(url, title);
}
function NoveOkno(odkaz)
{
return window.open(odkaz.href, "_blank");
}
function Vytlacit()
{
	setTimeout("window.print();", 150);
}
function Zvyrazni_tr(a, farba){
	a.style.background = farba;
} 
function Zvyrazni_tr_off(a)
{
	a.style.background = "";
}

// odpocitavac
var timerID = null;
var timerRunning = false;
function showtime() 
{
	today = new Date();
	BigDay = new Date("march 13, 2012 9:00")
	msPerDay = 24 * 60 * 60 * 1000 ;
	timeLeft = (BigDay.getTime() - today.getTime());
	e_daysLeft = timeLeft / msPerDay;
	daysLeft = Math.floor(e_daysLeft);
	e_daysLeft = timeLeft / msPerDay;
	daysLeft = Math.floor(e_daysLeft);
	e_hrsLeft = (e_daysLeft - daysLeft)*24;
	hrsLeft = Math.floor(e_hrsLeft);
	minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
	hrsLeft = hrsLeft;
	e_minsLeft = (e_hrsLeft - hrsLeft)*60;
	secLeft = Math.floor(e_hrsLeft);
	secLeft = Math.floor((e_minsLeft - minsLeft)*60);
	secLeft = secLeft;
	Temp3='Do začiatku <strong>externej maturity 2012</strong> zostáva už len '+daysLeft+' dní, '+hrsLeft+' hodín, '+minsLeft+' minút a '+secLeft+' sekúnd!'

	document.getElementById("pocitadlo").innerHTML=Temp3;

	timerID = setTimeout("showtime()",1000);
	timerRunning = true;
}
var timerID = null;
var timerRunning = false;

function stopclock () 
{
	if(timerRunning)
		clearTimeout(timerID);
	timerRunning = false;
}
function stopClock() 
{
    stopclock();    
    return;
}
function startclock () 
{
	stopclock();
	showtime();
}
function Reklama(zoneid)
{
   var m3_u = (location.protocol=='https:'?'https://ad.zones.sk/www/delivery/ajs.php':'http://ad.zones.sk/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid="+zoneid);
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
}
