﻿function showImg(url, width, height)
{

    width += 50;
    height+= 50;
    
    if(height + 50 > screen.height)
        height= screen.height- 200;

    if(width + 50 > screen.width)
        width = screen.width - 100;
        
    x = (screen.width  -  width) / 2;
    y = (screen.height - height) / 2;
    
    
    // PROBLEM s BASE ELEMENT
    // z detailu clanku <url>/clanek/ se prid i slozka clanek tzn. <url>/clanek/imgDetail.aspx
    // spravne ma byt <url>/imgDetail.aspx (ci alternativa) <url>/script/imgDetail.aspx    
    var a = window.open(url,"imgDialog","toolbar=yes,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width="+(width)+",height="+(height));
}

function showImg2(id, width, height)
{

       width += 50;
       height+= 50;
    
        if(height + 50 > screen.height)
            height= screen.height - 200;

        if(width + 50 > screen.width)
            width = screen.width - 100;
        
        x = (screen.width  -  width) / 2;
        y = (screen.height - height) / 2;
        
      /*  alert(width);
        alert(height);
        alert(x);
        alert(y);
        */
        
      
    
   // var  a = window.open("imgDetail.aspx?docid=" + id,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width="+(width)+",height="+(height));
  
  
  //  var  a = window.open("imgDetail.aspx?docid=" + id,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width=50,height=50");
  
    
   
   // zmena: velikost okna menime az v imgDetail
   
   var  a = window.open("/imgDetail.aspx?docid=" + id,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width=50,height=50");
  

/*  alert(width);
  alert(height);
  alert(x);
  alert(y);
  
   
   topX  = (screen.width  - 60) / 2;
   leftY = (screen.height - 60) / 2;
   
   
   var  a = window.open("imgDetail.aspx?docid=" + id,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=60,height=60,top="+topX+",left="+(leftY) );
   */
   
   
}


function imgBrowser(url, width, height)
{

    height = 829;
    
    if(height > screen.height)
        height= screen.height;

        
    x = (screen.width  -  width) / 2;
    y = (screen.height - height) / 2;
    
    var a = window.open(url,"imgBrowser","toolbar=yes,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width=871,height="+height);
    
}

function Kontrola(e)
{
    var key, chr, check;
    
    if (window.event)
    {
        key = e.keyCode;
    }
    else if (e.which)
    {
        key = e.which;
    }
    
    if ((key == 13) || (key == 27) || (key == 10) || (key == 3)) return true;
    
    chr = String.fromCharCode(key);
    check = /\d/;
    
    return check.test(chr);
}

function m2Img(node1, node2, node3) {
    var path = "mailto:" + node1 + "@" + node2 + "." + node3;
    location.href = path;
}


var hoverItems = new Array();

// Vola se v default.xsl - body.onload
function preloadImages(){
  for (i=0; i <= 23; i++) {
      hoverItems[i] = new Image();
      hoverItems[i].src = "design/img/map/"+i+".png";
  }
};     
      
      function change(i) {
          document.getElementById("PtacekIMG").src = hoverItems[i].src;
      }

