﻿function jsOpenPop(pic,nHeig,nWid,skrol){
	    var nHeight = nHeig;
	    var nWidth = nWid;
	    var nXpos = (screen.availWidth - nWidth) / 2;
	    var nYpos = (screen.availHeight - nHeight) / 2;
	    var statusPopup = window.open(pic, 'popupWin','scrollbars='+skrol+',location=0,statusbar=0,menubar=0,resizable=0, top='+nYpos+',left='+nXpos+',screenY='+nYpos+',screenX='+nXpos+',height='+nHeight+',width='+nWidth);
        statusPopup.focus();
    }
    function jsOpenPop1(pic,nHeig,nWid,skrol){
	    var nHeight = nHeig;
	    var nWidth = nWid;
	    var nXpos = (screen.availWidth - nWidth) / 2;
	    var nYpos = (screen.availHeight - nHeight) / 2;
	    var statusPopup = window.open(pic, 'popupWin','scrollbars='+skrol+',location=1,statusbar=1,menubar=1,resizable=1, top='+nYpos+',left='+nXpos+',screenY='+nYpos+',screenX='+nXpos+',height='+nHeight+',width='+nWidth);
         statusPopup.focus();
    }
    function jsOpenPicture(pic){
	var nHeight = 607;
	var nWidth = 744;
	var nXpos = (screen.availWidth - nWidth) / 2;
	var nYpos = (screen.availHeight - nHeight) / 2;
	var statusPopup = window.open(pic, 'popupWin','scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0, top='+nYpos+',left='+nXpos+',screenY='+nYpos+',screenX='+nXpos+',height='+nHeight+',width='+nWidth);
    }
    
    

function showHideLayers() { 
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function findObj(n, d) { 
  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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// script for positioning layers in faktura1.aspx and faktura2.aspx - bojan 24.06.2005
ns4 = (document.layers) ? true : false
ie4 = (document.all) ? true : false

function init() {
    if (ns4) { document.captureEvents(Event.MOUSEMOVE); }
    document.onmousemove = mousemove;
}
function mousemove(e) {
    if (document.all) {
        scrollx = document.body.scrollLeft;
        scrolly = document.body.scrollTop;
    }
    else {
        scrollx = window.pageXOffset;
        scrolly = window.pageYOffset;
    }
    if (ns4) { var mouseX = e.pageX; var mouseY = e.pageY }
    if (ie4) { var mouseX = event.x + scrollx; var mouseY = event.y + scrolly }
}
function handle_div(name, distance, flag) {
    if (document.all) {
        scrollx = document.body.scrollLeft;
        scrolly = document.body.scrollTop;
    }
    else {
        scrollx = window.pageXOffset;
        scrolly = window.pageYOffset;
    }

    if (ns4) { var mouseX = e.pageX; var mouseY = e.pageY }
    if (ie4) { var mouseX = event.x + scrollx; var mouseY = event.y + scrolly }
    var w = document.getElementById(name).style.width;
    var h = document.getElementById(name).style.height;
    var h1 = parseInt(h);
    var w1 = parseInt(w);
    var f = parseInt(flag);

    if (f == 0) {//flag = 0 - left and up from mouse pointer handle_div(name, distance, flag) 

        var newleft = mouseX - w1 - distance;
        var newtop = mouseY - h1 - distance;
    }
    if (f == 1) {//flag = 1 - right and down from mouse pointer handle_div(name, distance, flag) 
        var newleft = mouseX + distance;
        var newtop = mouseY + distance;
    }
    if (f == 2) {//flag = 2 - right and up from mouse pointer handle_div(name, distance, flag) 
        var newleft = mouseX - w1 - distance;
        var newtop = mouseY + distance;
    }
    if (f == 3) {//flag = 3 - left and down from mouse handle_div(name, distance, flag)
        var newleft = mouseX + distance;
        var newtop = mouseY - h1 - distance;
    }
    document.getElementById(name).style.top = newtop;
    document.getElementById(name).style.left = newleft;
    document.getElementById(name).style.visibility = 'visible';
}
// end of script for positioning - bojan 24.06.2005

function changeImage(imgName, newImg) {
    if ((navigator.appName == 'Netscape' && parseFloat(navigator.appVersion) >= 3) || (parseFloat(navigator.appVersion) >= 4)) {
        eval('document.' + imgName + '.src = "' + newImg + '"');
    }
} 

