﻿function mExt(jmeno, url, tlp, predmet, trida)
{
	if (predmet == "1") predmet = 'Dotaz';
	if (predmet == "2") predmet = 'Informace';

document.write ("<a hr" + "ef='' onclick='mExtClick(\"" + jmeno + "\",\"" + url + "\",\"" + tlp + "\",\"" + predmet + "\"); return false;' class=\"" + trida + "\">" + jmeno + "<span></span>" + "@" + "<span></span>" + url + "<span></span>" + "." + tlp + "</a>");
}

function mExtClick(jmeno, url, tlp, predmet)
{
	location.href = "mailto:" + jmeno + "@" + url + "." + tlp + "?subject=" + predmet;
}

function mExtArea(jmeno, url, tlp, predmet, n1, n2, n3, n4)
{
	document.write ("<area shape='rect' coords='" + n1 + "," + n2 + "," + n3 + "," + n4 + "' hr" + "ef='mailto:" + jmeno + "@" + url + "." + tlp + "?subject=" + predmet + "'");
}

function getkey(e)
{ 
  var code; 
  if (!e)
    var e = window.event;
  if (e.keyCode)
    code = e.keyCode;
  else
    if (e.which)
      code = e.which;
  return code; 
} 

function numeric(eX)
{
  test=getkey(eX);
  if (test<48 || test>57)
    return false;
}

function okno($width, $height, $foto) 
{
    $left = screen.width / 2 - $width / 2;
    $top = screen.height / 2 - $height / 2;
    okno1 = window.open($foto, "", "width=" + $width + ", height=" + $height + ", left=" + $left + ", top=" + $top + ", menubar=no, toolbar=no, directories=no, status=no, resizable=yes, copyhistory=no");
}

function pOver($id)
{
    var obj = document.getElementById($id);
    obj.style.color = '#fcdc76';
    obj.style.backgroundColor = '#db9d25';
    obj.style.backgroundImage = 'url()';
}

function pOut($id)
{
    var obj = document.getElementById($id);
    obj.style.color = '#966609';
    obj.style.backgroundImage = 'url(/obr/menubox_middle.png)';
}

function getWindowWidth()
{
    var $width;
    if (window.innerWidth) 
    {
        $width = window.innerWidth;
    }
    else
    {
        $width = document.documentElement.offsetWidth;
    }
    return $width;
}

function getWindowHeight()
{
    var $height;
    if (window.innerHeight) 
    {
        $height = window.innerHeight;
    }
    else
    {
        $height = document.documentElement.offsetHeight;
    }
    return $height;
}


function ChangeHeight()
{
    var $width = getWindowWidth();

    if ($width > 900)
    {
	    document.getElementById('divka').style.display = 'inline';
    }
    else
    {
        document.getElementById('divka').style.display = 'none';
    }
    
    var $tProdukty = document.getElementById('tProdukty');
    
    if ($width < 1300)
    {
        $tProdukty.style.width = '800px';
    }
    if ($width < 1200)
    {
        $tProdukty.style.width = '600px';
    }
    if ($width < 1010)
    {
        $tProdukty.style.width = '400px';
    }
    if ($width < 810)
    {
        $tProdukty.style.width = '200px';
    }
    if ($width > 1300)
    {
        $tProdukty.style.width = '1000px';
    }
    
}

function tVyhledat_Click()
{
    $t = document.getElementById('patka_tVyhledat');
    if ($t.value == ' Zadejte hledaný výraz')
    {
        $t.value = '';
        $t.style.color = '#966609';
    }
}

function tVyhledatBlur_Click()
{
    $t = document.getElementById('patka_tVyhledat');
    if ($t.value == '')
    {
        $t.value = ' Zadejte hledaný výraz';
        $t.style.color = '#cda21d';
    }
}

function Vyhledat(eX)
{
    test=getkey(eX);
    if (test==13)
        {
        var x = document.getElementById ('patka_tVyhledat');
        if (x.value.length <= 2)
        {
            alert('Pro vyhledávání zadejte alespoň 3 znaky');
            return false;
        }
        else
        {
            location.href='/Default.aspx?str=' + x.value + '&sort=' + $sort;
        }
    }
    else
    {
        return true;
    }
}

function ShowMailInput()
{
    document.getElementById('mailInput').style.display = 'inline';
    document.getElementById('aMailInput').style.display = 'none';
}

function tblMouseOver($id)
{
    document.getElementById('tblSeznam' + $id).style.backgroundColor = '#e5e5e5';
    document.getElementById('tblSeznam' + $id).style.border = '10px solid #e5e5e5';
}

function tblMouseOut($id)
{
    /*document.getElementById('tblSeznam' + $id).style.backgroundColor = '#f2f2f2';
    document.getElementById('tblSeznam' + $id).style.border = '10px solid #f2f2f2';*/
    document.getElementById('tblSeznam' + $id).style.backgroundColor = '#ffffff';
    document.getElementById('tblSeznam' + $id).style.border = '10px solid #ffffff';
}

//White background
function tblMouseOverW($id)
{
    document.getElementById('tblSeznam' + $id).style.backgroundColor = '#e5e5e5';
    document.getElementById('tblSeznam' + $id).style.border = '10px solid #e5e5e5';
}

function tblMouseOutW($id)
{
    document.getElementById('tblSeznam' + $id).style.backgroundColor = '#ffffff';
    document.getElementById('tblSeznam' + $id).style.border = '10px solid #ffffff';
}

function tblMouseOverS($id)
{
    document.getElementById('tblSeznam' + $id).style.backgroundColor = '#e5e5e5';
    document.getElementById('tblSeznam' + $id).style.border = '3px solid #ffffff';
}

function tblMouseOutS($id)
{
    /*document.getElementById('tblSeznam' + $id).style.backgroundColor = '#f2f2f2';
    document.getElementById('tblSeznam' + $id).style.border = '3px solid #f2f2f2';*/
    document.getElementById('tblSeznam' + $id).style.backgroundColor = '#ffffff';
    document.getElementById('tblSeznam' + $id).style.border = '3px solid #ffffff';
}

function Lexikon_Click($id)
{
    if (document.getElementById('LexikonPopis' + $id).style.display == 'none' || document.getElementById('LexikonPopis' + $id).style.display == '')
    {
        document.getElementById('LexikonPopis' + $id).style.display = 'block';
    }
    else
    {
        document.getElementById('LexikonPopis' + $id).style.display = 'none';
    }
}