// JavaScript Document
var left = (screen.width-240)/2;
var top = (screen.height-220)/2;

function detaljnije(id){
  window.open ("detaljno.php?id="+id+"","PEGAZ TROT","toolbar=no, location=no, directories=no, status=no, scrollbars=no, resizable=no, copyhistory=no, width=280, height=185, left="+left+", top="+top+"");
}


function sh(polje, polje2) {
  if(!polje) return false;
  var novaprom = document.getElementById(polje);
  if(novaprom.style.display == 'block') {
	novaprom.style.display = 'none';
	document.getElementById(polje2).style.marginBottom = '5px';
  }
  else {
	novaprom.style.display = 'block';
	document.getElementById(polje2).style.marginBottom = '0px';
  }
}

//IE5+/Win, Firefox, Netscape 6+, Opera 7+, Safari, Konqueror 3, IE5/Mac, iCab 3

var addBookmarkObj = {
  linkText:'Bookmark This Page',
  addTextLink:function(parId){
    var a=addBookmarkObj.makeLink(parId);
    if(!a) return;
    a.appendChild(document.createTextNode(addBookmarkObj.linkText));
  },
  addImageLink:function(parId,imgPath){
    if(!imgPath || isEmpty(imgPath)) return;
    var a=addBookmarkObj.makeLink(parId);
    if(!a) return;
    var img = document.createElement('img');
    img.title = img.alt = addBookmarkObj.linkText;
    img.src = imgPath;
    a.appendChild(img);
  },
  makeLink:function(parId) {
    if(!document.getElementById || !document.createTextNode) return null;
    parId=((typeof(parId)=='string')&&!isEmpty(parId))
      ?parId:'addBookmarkContainer';
    var cont=document.getElementById(parId);
    if(!cont) return null;
    var a=document.createElement('a');
    a.href=location.href;
    if(window.opera) {
      a.rel='sidebar'; // this makes it work in Opera 7+
    } else {
      // this doesn't work in Opera 7+ if the link has an onclick handler,
      // so we only add it if the browser isn't Opera.
      a.onclick=function() {
        addBookmarkObj.exec(this.href,this.title);
        return false;
      }
    }
    a.title=document.title;
    return cont.appendChild(a);
  },
  exec:function(url, title) {
    // user agent sniffing is bad in general, but this is one of the times 
    // when it's really necessary
    var ua=navigator.userAgent.toLowerCase();
    var isKonq=(ua.indexOf('konqueror')!=-1);
    var isSafari=(ua.indexOf('webkit')!=-1);
    var isMac=(ua.indexOf('mac')!=-1);
    var buttonStr=isMac?'Command/Cmd':'CTRL';

    if(window.external && (!document.createTextNode ||
      (typeof(window.external.AddFavorite)=='unknown'))) {
        // IE4/Win generates an error when you
        // execute "typeof(window.external.AddFavorite)"
        // In IE7 the page must be from a web server, not directly from a local 
        // file system, otherwise, you will get a permission denied error.
        window.external.AddFavorite(url, title); // IE/Win
    } else if(isKonq) {
      alert('You need to press CTRL + B to bookmark our site.');
    } else if(window.opera) {
      void(0); // do nothing here (Opera 7+)
    } else if(window.home || isSafari) { // Firefox, Netscape, Safari, iCab
      alert('You need to press '+buttonStr+' + D to bookmark our site.');
    } else if(!window.print || isMac) { // IE5/Mac and Safari 1.0
      alert('You need to press Command/Cmd + D to bookmark our site.');    
    } else {
      alert('In order to bookmark this site you need to do so manually '+
        'through your browser.');
    }
  }
}

function isEmpty(s){return ((s=='')||/^\s*$/.test(s));}

function dss_addEvent(el,etype,fn) {
  if(el.addEventListener && (!window.opera || opera.version) &&
  (etype!='load')) {
    el.addEventListener(etype,fn,false);
  } else if(el.attachEvent) {
    el.attachEvent('on'+etype,fn);
  } else {
    if(typeof(fn) != "function") return;
    if(typeof(window.earlyNS4)=='undefined') {
      // to prevent this function from crashing Netscape versions before 4.02
      window.earlyNS4=((navigator.appName.toLowerCase()=='netscape')&&
      (parseFloat(navigator.appVersion)<4.02)&&document.layers);
    }
    if((typeof(el['on'+etype])=="function")&&!window.earlyNS4) {
      var tempFunc = el['on'+etype];
      el['on'+etype]=function(e){
        var a=tempFunc(e),b=fn(e);
        a=(typeof(a)=='undefined')?true:a;
        b=(typeof(b)=='undefined')?true:b;
        return (a&&b);
      }
    } else {
      el['on'+etype]=fn;
    }
  }
}

dss_addEvent(window,'load',addBookmarkObj.addTextLink);

// to make multiple links, do something like this:
/*
dss_addEvent(window,'load',function(){
  var f=addBookmarkObj.addTextLink;
  f();
  f('otherContainerID');
});
*/

// below is an example of how to make an image link with this
// the first parameter is the ID. If you pass an empty string it defaults to
// 'addBookmarkContainer'.
/*
dss_addEvent(window,'load',function(){
  addBookmarkObj.addImageLink('','/images/add-bookmark.jpg');
});
*/

function createRequestObject() { 
   var req; 

   if(window.XMLHttpRequest){ 
      // Firefox, Safari, Opera... 
      req = new XMLHttpRequest(); 
   } else if(window.ActiveXObject) { 
      // Internet Explorer 5+ 
      req = new ActiveXObject("Microsoft.XMLHTTP"); 
   } else { 
      // There is an error creating the object, 
      // just as an old browser is being used. 
      alert('Problem creating the XMLHttpRequest object'); 
   } 
   return req; 
} 

// Make the XMLHttpRequest object 
var http = createRequestObject(); 

function sendRequest(tabela, q)
{ 
// Open PHP script for requests 
http.open('get', 'opis.php?id='+q+'&m='+tabela); 
http.onreadystatechange = handleResponse; 
http.send(null); 
}

function handleResponse() { 
   if(http.readyState == 4 && http.status == 200){ 
      // Text returned FROM the PHP script 
      var response = http.responseText; 
      if(response) { 
         // UPDATE ajaxTest content 
         document.getElementById("detaljno").style.display="block";
         document.getElementById("detaljno").innerHTML = response; 
      } 
   } 
}


function pegaz(velicina)
{
var sadrzaj1 = "<!-- Start banner exchange with PegazTROT.com -->\n";
var sadrzaj11 = "<a href=\"http://www.pegaztrot.com/\"><img src=\"http://www.pegaztrot.com/slike/pegaztrot";
var sadrzaj2 = ".gif\" border=0 alt=\"International web portal Pegaz TROT\"></a>\n";
var sadrzaj22 = "<!-- End banner exchange with PegazTROT.com -->";
var nova = sadrzaj1 + sadrzaj11 + velicina + sadrzaj2 + sadrzaj22;
var polje = document.getElementById("kodtext");
polje.innerHTML = nova;

document.getElementById("kodtext").style.display="block";
}

