function okno(url) {
window.open(url,"","menubar=no,resizable=yes,status=yes,scrollbars=yes,location=yes,toolbar=yes");
}
// JavaScript Document
function cenik (string)
{
okno=window.open("data/ceniky/"+string,"_blank","width=800,height=600,status=no,directories=no");
}

/* SEND 2 FRIEND */
//zde je nutne vzdy nastavit server s cestou k adresari, ktery obsahuje send2friend
//bez koncoveho lomitka, napr. http://www.vlado.cz/hruska

function send2friend(name, script) {
  
  attrbts = "height=350,width=460,status=yes,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,top=50,left=50'";
  okenko = window.open(script + 'send2friend/send2friend.php?' + name, "PEJA", attrbts);
  
  if (okenko) {
     return false;
  } 
  return true;
  
}
/* definujte homepage */
var homepage = "http://www.ujezd.net";

/********************************  NEMENIT ************************************/

/** registrace fce, ktera se spusti po nacteni stranky v prohlizeci */
addEvent(window,'load',initie);
addEvent(window,'load',bannerIt);


/** fce init se spusti po nacteni stranky a skryje tlacitka tech
    fci, ktere dany prohlizec nepodporuje. V podstate budou obe fce ukryty
    ve vsech prohlizecich krom IE, protoze je nepodporuji */
function initie() {
  if (checkBrowser("msie") && !document.addEventListener) { 
      var h = getElement("homepage").className = 'visible';  
      var f = getElement("favorites").className = 'visible';  
  }
} 

/** funkce rozpozna velikost prohlizece a pokud mezi pravym okrajem obsahu a
  * jeho pravou stranou bude dostatek mista, potom prida class *wide-window*
  * do tagu body, tedy <body class="wide-window"
  */
function bannerIt() {

 if (!getElement('banner')) {
    return -1;
 }
  
  var bannerWidth = getElement('banner').offsetWidth;
  var windowWidth = document.body.offsetWidth;
  var containerWidth = getElement('conteiner').offsetWidth;
  
  //alert("window: " + windowWidth + " banner: " + bannerWidth + " container: " + containerWidth);  
  
  var offset = ((location.href.indexOf('index.php') != -1) || 
               (location.href.lastIndexOf('/')+1 == location.href.length))? 35 : 170;
  
  if (windowWidth - (bannerWidth + containerWidth + offset) > 0) {
    document.body.className = " wide-window"; 
  }

  //alert(document.body.className + " / " + offset);
  
  return 1;
  

}  


/** fce ulozi adresu aktualniho dokumentu do oblibenych s popiskem title u IE*/
function addFavorite(addUrl, addTitle) {
  if (document.all) {
    window.external.AddFavorite(addUrl, addTitle);
    return false;
  } 
  return false;
}

/** fce, ktera v IE nastavi domacistranku u IE*/
function setAsHomepage() {
   if (checkBrowser("msie")) {
     document.body.style.behavior='url(#default#homepage)';
     document.body.setHomePage(homepage);
   } 
}

/** fce pro rozpoznani prohlizece */
function checkBrowser(string) {
  var detect = navigator.userAgent.toLowerCase();
  var place = detect.indexOf(string) + 1;
  return place;
}

/** fce nalezeni elementu */
function getElement(id) {
  if(document.getElementById) return document.getElementById(id);
  if(document.all) return document.all(id);
  return document.layers[id];
}

/** fce vytiskne stranku */
function printMe() {
  window.print();
}

/** fce registruje funkce na udalosti objektu */
function addEvent(obj, evType, fn) {
  if(obj.addEventListener) {
	  obj.addEventListener(evType,fn,true);
		return true;
	} else if(obj.attachEvent) {
	  var r = obj.attachEvent("on"+evType,fn);
		return r;
	}
  return false;
}
