function MM_findObj(n, d) { //v4.0
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document;
    n = n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n];
  for (i=0;!x&&i<d.forms.length;i++)
       x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
       x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById)
       x=document.getElementById(n);
  return x;
}

function MM_preloadImages() { //v3.0
  var d = document;
  if(d.images){
    if(!d.MM_p) d.MM_p = new Array();
    var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
    for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){
           d.MM_p[j] = new Image;
           d.MM_p[j++].src = a[i];
        }
  }
}

function otvori_krstozbor(broj) {
    adresa = "operations.php?page=krstozbori/krstozbor.php&krstozbor_broj="+broj;
    if(screen.width < 1000) adresa = adresa + "&visina=455&sirina=600&rezolucija=0";
    else if(screen.width < 1050) adresa = adresa + "&visina=480&sirina=675&rezolucija=1";
    else adresa = adresa + "&visina=590&sirina=800&rezolucija=2";
    window.open(adresa,"_self");
    return false;
}

function namesti_select(obj,vrednost){
    for (i=0;i<obj.length;i++){
        if (obj.options[i].value == vrednost) {
            obj.selectedIndex = i;
            break;
        }
    }
}

function validen_email(obj) {
    s = obj.value;
    var m = s.match(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/); //e-mail
    if (m == null) {
        alert("Ве молиме внесете валиден e-mail.");
        obj.select();
        obj.focus();
        return false;
    }
    return true;
}

function validen_integer(s){
    var m = s.match(/^\s*[-\+]?\d+\s*$/);
    return (m == null) ? false : true;
}


//ZA UPATSTVOTO
var ie = document.all ? 1 : 0
var ns = document.layers ? 1 : 0

if(ns){doc = "document."; sty = ""}
if(ie){doc = "document.all."; sty = ".style"}

var initialize = 0
var topColor = "#ccccff"
var subColor = "#ddddff"
var ContentInfo

function ReplaceContent(layerName){
  if(ie){document.all[layerName].innerHTML = ContentInfo}
  if(ns){
    with(document.layers[layerName].document){
       open();
       write(ContentInfo);
       close();
    }
  }
}

function Activate(){initialize=1}
function deActivate(){initialize=0}

function EnterContent(layerName, TTitle, TContent){
ContentInfo =
'<table border="0" width="400" cellspacing="0" cellpadding="0">'+
'<tr><td width="100%" bgcolor="#000000">'+
'  <table border="0" width="100%" cellspacing="1" cellpadding="0">'+
'    <tr><td width="100%" bgcolor='+topColor+'>'+
'      <table border="0" width="95%" cellspacing="0" cellpadding="0" align="center">'+
'        <tr><td width="100%"><font class="sreden_font">'+TTitle+'</font></td></tr>'+
'      </table></td></tr>'+
'    <tr><td width="100%" bgcolor='+subColor+'>'+
'      <table border="0" width="95%" cellpadding="0" cellspacing="1" align="center">'+
'        <tr><td width="100%"><font class="small_font">'+TContent+'</font></td></tr>'+
'      </table></td></tr>'+
'  </table></td></tr>'+
'</table>';

ReplaceContent(layerName)
}
// KRAJ UPATSTVO
