﻿
function showImg(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;
    
    var a = window.open("imgDetail.aspx?imgid=" + id,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width="+(width)+",height="+(height));
}




function toggleFilter()
{
    try {
    s = $("madv");
    fa= $("filtrAdvance");
    a = $('fArrow');
    
	if	(s.value == "1") {
		fa.style.display = "none";
		s.value = "0";
		a.innerHTML = ">>";
	}
	else
	{
		fa.style.display = "block";
		s.value = "1";
		a.innerHTML = "<<";
	}
	} catch(e){}
}

function _$() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}




	  function checkNews()
      {
			var x = $("nemail").value;	
			if (x != null)
			{			
				var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
				if (!filter.test(x))
				{		
					alert('Chybný formát!');
					return false;
				}
			}					
        return true;
      }

      
function actualResultsAjax(id)
{
    if(id == 0)
        return false;

    url = "results.aspx?docid=" + id;

    $.get(url,{async:true},function(xml)
    {
        $("div#defaultRightContent").html(xml);
        init();
    });

  
  return false;
}

function init() {
	 stripeTableById('defaultRightContent');
	}

function stripeTable(t) {
	var i, odd = true;

	for(q = 0; q < t.childNodes.length; q++)
	 if(t.childNodes[q].tagName == "TABLE")
	   t = t.childNodes[q];

	for (i=0; i<t.rows.length; i++) {
		t.rows[i].className += odd ? ' odd' : ' even';
		odd = !odd;
		}
	}
function stripeTableById(id) {
	var t = document.getElementById(id);
	if (t) stripeTable(t);
	}