﻿korekceProhlizecu();

function korekceProhlizecu() {
    if ($.browser.opera) {
        var version = $.browser.version.substr(0,2);
        if ((version == "7.") || (version == "8.") || (version == "9.")) {
            $("html").css("overflow-x", "auto");
            $("html").css("overflow-y", "auto");
            $("html").css("height", "101%");
        }
    }
};

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;

    var baseElements = document.getElementsByTagName("base");
    var base;
    if (baseElements.length > 0) {
        base = baseElements[0].href;
    }
    else {
        base = "";
    }
    
    var ImgUrl=base+"imgDetail.aspx?docID="+url;

    var a = window.open(ImgUrl,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,left="+x+",top="+y+",resizable=yes,width=50,height=50");      
};

function showImg2(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;

    window.open(url,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,left="+x+",top="+y+",resizable=yes,width=20,height=20");
};


function browser() {
  var userAgent = navigator.userAgent.toLowerCase();
  if(userAgent.indexOf("msie") != -1){
    return "ie";
  }
  else if(userAgent.indexOf("firefox") != -1){
    return "firefox";
  }
  else if(userAgent.indexOf("opera") != -1){
    return "opera";
  }
  else return "other";
};

function remanipulator(width, height)
{
    if(height + 50 > screen.height)
        height= screen.height - 200;
    if(width + 50 > screen.width)
        width = screen.width - 100;

    posX = (screen.width  -  width) / 2;
    posY = (screen.height - height) / 2;

    window.moveTo(posX,posY);

    if(browser()=="ie"){
        window.resizeTo(width-42,height-35);
    }
    else if(browser()=="firefox"){
        window.resizeTo(width-40,height+0);
    }
    else if(browser()=="opera"){
        window.resizeTo(width-40,height+0);
    }
    else {
        window.resizeTo(width,height);
    }
};

function validateDsc() {

    if (document.getElementById("dsc_pname").value.length == 0) {
        alert("Vyplňte Vaše jméno!");
        document.getElementById("dsc_pname").focus();
        return false;
    }

    if (document.getElementById("dsc_ptitle").value.length == 0) {
        alert("Vyplňte předmět!");
        document.getElementById("dsc_ptitle").focus();
        return false;
    }

    if (document.getElementById("dsc_ptext").value.length == 0) {
        alert("Vyplňte text příspěvku!");
        document.getElementById("dsc_ptext").focus();
        return false;
    }

    if (document.getElementById("captcha").value == "") {
        alert("Opište text z obrázku.");
        document.getElementById("captcha").focus();
        return false;
    }

    return true;
};


function showImgBrowser(link) {
    window.open(link, '_blank', 'scrolling=yes,width=1000,height=720,toolbar=no,location=no,directories=no,status=no,menubar=no');
};