function Browser() {

  var ua, s, i;
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
  ua = navigator.userAgent;
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
  s = "Opera"
  if ((i = ua.indexOf(s)) >= 0) {
    this.isOP = true;
    return;
  }
}
var browser = new Browser();

function bookmarkMe(myUrl, myTitle)
{
        if(browser.isNS)
        {
            window.sidebar.addPanel(myTitle, myUrl, '');
        }
        else if(browser.isOP) // Opera
        {
            var bkmark = document.createElement('a');
            bkmark.setAttribute('rel','sidebar');
            bkmark.setAttribute('href', myUrl);
            bkmark.setAttribute('title', myTitle);
            bkmark.click();
        }
        else if(browser.isIE) // IE
        {
           window.external.AddFavorite(myUrl, myTitle);
        }
}

function setAsHomePage(myLink)
{
        if(browser.isIE)
        {
               // IE
               myLink.style.behavior='url(#default#homepage)';
               myLink.setHomePage(location.href);
        }
        else if(browser.isNS)
        {
               // Netscape / firefox browsers
               var msg = "Pro nastavení této stránky jako domovské, ";
               msg += "přeneste adresu na ikonu domovské stránky. ";
               alert(msg);
        }
        else if(browser.isOP)
        {
               // Opera
               var msg = "Pro nastavení této stránky jako domovské, ";
               msg += "přejděte do Nástroje - Nastavení ";
               msg += "a zvolte Použít stávající. ";
               alert(msg);

        }
        else
        {
               // Other browsers
               var msg = "Omlouvame se, ale Váš prohližeč ";
               msg += "nepodporuje skript pro uložení stránky jako domovské. ";
               msg += "Děkujeme za pochopení. ";
               alert(msg);

        }
}


function set_color_for_background(color)
                           {
                               var allTag = new Array();
                               var allTag = document.getElementsByTagName('div');

                               for (i=0; i<allTag.length;i++)
                               {
                                   if ( allTag[i].className == 'preview-wall-poster' )
                                   {
                                       allTag[i].style.backgroundColor = color;
                                   }
                               }
                           }

                           function set_color_for_text(color)
                           {
                               var allTag = new Array();
                               var allTag = document.getElementsByTagName('div');

                               for (i=0; i<allTag.length;i++)
                               {
                                   if ( allTag[i].className == 'preview-wall-poster' )
                                   {
                                       allTag[i].style.color = color;
                                   }
                               }
                           }

function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

function Counter(start,end,text,characters) {
  var startObj=getObject(start);
  var endObj=getObject(end);
  var longitude=characters - startObj.value.length;
  if(longitude <= 0) {
    longitude=0;
    text='<span class="disable"> '+text+' </span>';
    startObj.value=startObj.value.substr(0,characters);
  }
  endObj.innerHTML = text.replace("{CHAR}",longitude);
}

function track(string)
{
  var d = new Date();

  if (document.getElementById('toplist')) {
    var index_of_time;
    var y = document.getElementById('toplist');
    if ((index_of_time = y.src.indexOf("&time=")) != -1) {
      y.src = (y.src.substr(0, index_of_time))+'&time='+d.getTime();
    } else {
      y.src = y.src+'&time='+d.getTime();
    }
  }

  window._uacct = "UA-2118046-1";
  window.urchinTracker(true);

  window.pp_gemius_image.src = window.pp_gemius_host+d.getTime()+'/rexdot.gif?l=30&id=.FDrq7guyBM8w3mE5kHsinZ27AlZKEQXA0eo_bKGcWL.r7'+window.gemius_parameters();

  window.jQuery.get('/proxy.php?trackerTime='+d.getTime());
}

function runIt2(val) {
    if ($("#ajax-zmenit-vydani-spodek")) {
        jQuery.post( '/proxy.php?url=http://www.denik.cz/ajax-zmenit-vydani-spodek.html?val='+val, 'test',
            function(html){
                $("#ajax-zmenit-vydani-spodek").html(html);
            }
        )
    }
    if ($("#ajax-zmenit-vydani-vrsek")) {
        jQuery.post( '/proxy.php?url=http://www.denik.cz/ajax-zmenit-vydani-vrsek.html?val='+val, 'test',
            function(html){
                $("#ajax-zmenit-vydani-vrsek").html(html);
            }
        )
    }
    if ($("#ajax-okolni_deniky")) {
        jQuery.post( '/proxy.php?url=http://www.denik.cz/ajax-okolni_deniky.html?val='+val, 'test',
            function(html){
                $("#ajax-okolni_deniky").html(html);
            }
        )
    }
}

function runZpravyHasici(val) {
    if ($("#ajax-zpravy-hasici")) {
        jQuery.post( '/proxy.php?url=http://www.denik.cz/ajax-zpravy-hasici.html?val='+val, 'test',
            function(html){
                $("#ajax-zpravy-hasici").html(html);
            }
        )
    }
}

function runZpravyHasiciGo(val) {
    if ($("#ajax-zpravy-hasici")) {
        jQuery.post( '/proxy.php?url=http://www.denik.cz/ajax-zpravy-hasici-go.html?val='+val, 'test',
            function(html){
                $("#ajax-zpravy-hasici").html(html);
            }
        )
    }
}

function jdiNa(val) {
    location.href=(val);
}

function skrytMimoradnouZpravu(poutakId) {
    var vyprseni_cookie = 1; // Dny

    var date = new Date();
	date.setTime(date.getTime()+(vyprseni_cookie*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();

    document.cookie = "dmz_skryta="+poutakId+expires+"; path=/";
}

