function Validate(theForm, arr)
{
    for(var i = 0; i < theForm.length; i++)
    {
        if(arr[i])
        {
            if(!arr[i].Validate(theForm.elements[i]))
                return false
        }
    }
    return true;
}

function MeText(strName, fAllowEmpty)
{
    this.strName = strName
    this.fAllowEmpty = fAllowEmpty
    this.Validate = function(field)
    {
        if ((!this.fAllowEmpty) && (field.value == ""))
        {
            alert('Vložte prosím text do pole "' + this.strName + '".')
            field.focus()
            return false
        }
        return true
    }
}

function link(left1, main1)
{
	if (left1!='') 	parent.left.location.href = left1;
	if (main1!='') 	parent.main.location.href = main1;
}

function link1(main1, left1)
{
	if (main1!='') 	parent.main.location.href = main1;
	if (left1!='') 	parent.left.location.href = left1;
	return false;
}

function makeWindow(url)
{
	window.open(url, '', "toolbar=no,status=no,scrollbars=yes,resizable=yes,width=700,height=400");
}

function makeTreneri(url)
{
	window.open(url, '', "toolbar=no,status=no,scrollbars=yes,resizable=yes,width=400,height=400");
}

function soupiskaWindow(url,title)
{
	window.open(url, title, "toolbar=no,status=no,scrollbars=yes,resizable=no,width=600,height=450")
}

function previewWindow(url, title)
{
	window.open(url, title, "toolbar=no,status=no,scrollbars=yes,resizable=yes,width=800,height=600");
}

function magazinWindow(url, title)
{
	window.open(url, title, "toolbar=no,status=no,scrollbars=yes,resizable=yes,width=800,height=470");
}


function slavistaWindow(url, title)
{
	window.open(url, title, "toolbar=no,status=no,scrollbars=yes,resizable=no,width=800,height=470");
}

function change_color()
{
	document.aa.style.textColor = '#00FF00';
}

function check_language(F, O, code)
{
	for (i = 0; i < F.elements.length; i++)
	{
		if (F.elements[i].name != O.name)
		{
			if (F.elements[i].name.lastIndexOf("_") != -1)
			{
				if (F.elements[i].name.substring(F.elements[i].name.lastIndexOf("_")+1, F.elements[i].name.length) == code)
				{
					if (!O.checked)
					{
						F.elements[i].disabled = true;
						F.elements[i].style.backgroundColor = '#DCDCDC';
					}
					else
					{
						F.elements[i].disabled = false;
						F.elements[i].style.backgroundColor = '#FFFFFF';
					}
				}
			}
		}
	}
	return false;
}

function check_language_onLoad(F)
{
	var j = 0;
	code = new Array();
	O = new Array();
	
	for (var i = 0; i < F.elements.length; i++)
	{
		if (F.elements[i].type == 'checkbox' && F.elements[i].name.substring(0, F.elements[i].name.lastIndexOf("_")+1) == 'LANGUAGE_')
		{
			O[j] = F.elements[i];
			code[j] = F.elements[i].name.substring(F.elements[i].name.lastIndexOf("_")+1, F.elements[i].name.length);
			j++;
		}
	}
	
	for (var i = 0; i < F.elements.length; i++)
	{
		if (F.elements[i].name.substring(0, F.elements[i].name.lastIndexOf("_")+1) != 'LANGUAGE_')
		{
			if (F.elements[i].name.lastIndexOf("_") != -1)
			{
				for (var k = 0; k < j; k++)
				{
					if (F.elements[i].name.substring(F.elements[i].name.lastIndexOf("_")+1, F.elements[i].name.length) == code[k])
					{
						if (!O[k].checked)
						{
							F.elements[i].disabled = true;
							F.elements[i].style.backgroundColor = '#DCDCDC';
						}
						else
						{
							F.elements[i].disabled = false;
							F.elements[i].style.backgroundColor = '#FFFFFF';
						}
					}
				}
			}
		}
	}
	return false;
}

function checkMe(tf,pars)
{
	pole=pars.split(',');
	for(i=0;i<pole.length;i+=2)
	{
		if(eval('tf.'+pole[i]+'.value')=='')
		{
			alert(pole[(i+1)]+' je povinná položka.');
			eval('tf.'+pole[i]+'.focus()');
			return false;
		}
	}
	return true;
}


function hop(ts, stranka, what)
{
	val=ts.options[ts.selectedIndex].value;
	document.location=stranka+'?'+what+'='+val;
}

function hop2(ts, stranka, what)
{
	val=ts.options[ts.selectedIndex].value;
	document.location=stranka+'&'+what+'='+val;
}

function smazPolozku(ano,ne) {
	if (confirm('Opravdu smazat danou položku???'))
		document.location=ano;
}

function vyber(id) {
	eval('window.opener.formular.fotozgalerie.value='+id);
	eval('window.opener.formular.fotozgalerie.focus()');
	window.close();
}

function vyberWindow(url)
{
	window.open(url, '', "toolbar=no,status=no,scrollbars=yes,resizable=yes,width=700,height=400");
}

function chatWindow(url)
{
	window.open(url, '', "toolbar=no,status=no,scrollbars=no,resizable=no,width=750,height=550");
}

function hryWindow(url)
{
	window.open(url, '', "toolbar=no,status=no,scrollbars=no,resizable=no,width=421,height=230");
}

function view(co){
	klublayerView=!klublayerView;
	if(klublayerView==true) {
	  if(historylayerView==true)
	    viewHistory('historyLayer');
	  if(archivlayerView==true)
	    viewArchiv('archivLayer');
	  if(legendlayerView==true)
	    viewLegend('legendLayer');
	}
	if (document.getElementById) {
		obj=document.getElementById(co);
		obj.style.display=(klublayerView?'':'none');
	}else{
	 	document.layers[co].visibility=(klublayerView?"show":"hide");
	}
}

function viewHistory(co){
	historylayerView=!historylayerView;
	if(historylayerView==true) {
	  if(klublayerView==true)
	    view('klubLayer');
	  if(archivlayerView==true)
	    viewArchiv('archivLayer');
	  if(legendlayerView==true)
	    viewLegend('legendLayer');
	} else {
	  if(legendlayerView==true)
	    viewLegend('legendLayer');
	}
	if (document.getElementById) {
		obj=document.getElementById(co);
		obj.style.display=(historylayerView?'':'none');
	}else{
	 	document.layers[co].visibility=(historylayerView?"show":"hide");
	}
}

function viewLegend(co){
	legendlayerView=!legendlayerView;
	if (document.getElementById) {
		obj=document.getElementById(co);
		obj.style.display=(legendlayerView?'':'none');
	}else{
	 	document.layers[co].visibility=(legendlayerView?"show":"hide");
	}
}

function viewArchiv(co){
	archivlayerView=!archivlayerView;
	if(archivlayerView==true) {
	  if(klublayerView==true)
	    view('klubLayer');
	  if(historylayerView==true)
	    viewHistory('historyLayer');
	  if(legendlayerView==true)
	    viewLegend('legendLayer');
	}
	if (document.getElementById) {
		obj=document.getElementById(co);
		obj.style.display=(archivlayerView?'':'none');
	}else{
	 	document.layers[co].visibility=(archivlayerView?"show":"hide");
	}
}

function viewFixtures(co){
	fixtureslayerView=!fixtureslayerView;
	if (document.getElementById) {
		obj=document.getElementById(co);
		obj.style.display=(fixtureslayerView?'':'none');
	}else{
	 	document.layers[co].visibility=(fixtureslayerView?"show":"hide");
	}
}

function okynko() { 
	window.open('reklama.html', 'reklama', 'toolbar=no,status=no,scrollbars=no,resizable=no,width=300,height=276'); 
}

function LoginHlaska() {
	var lf;
	lf = document.getElementById("loginName");
	alert('Nejste přihlášen!\nPro přihlášení použijte formulář v levé horní části.');
	lf.focus();
	return false;
}

function LoginHlaskaEn() {
	var lf;
	lf = document.getElementById("loginName");
	alert('You are not logged in!\nFor login use form in left top part.');
	lf.focus();
	return false;
}

	
//----------------------------------------------------------------------
// JavaScript code to operate the control buttons for the PTViewer.
//
// You need to include this code only once on your HTML page,
// regardless of how many PTViewers you embed in your page.
//----------------------------------------------------------------------
var isNav = false;
var isIE = false;
var handCursor;

// Figure out which browser is running.

if ((navigator.appName.indexOf("Netscape") != -1) &&
    (parseInt(navigator.appVersion) >= 4)) {
  isNav = true;
} else if ((navigator.appName.indexOf("Microsoft") != -1) &&
           (parseInt(navigator.appVersion) >= 4)) {
  isIE = true;
} else {
}

if (isIE) {
  handCursor = 'hand';
} else {
  handCursor = 'pointer';
}

function ZoomIn(t)
//----------------------------------------------------------------------
// Zoom in on the PTViewer applet. 
//----------------------------------------------------------------------
{
  obj = document.getElementById(t);
  obj.stopAutoPan();
  obj.startAutoPan(0, 0, 1.0 / 1.03);
}

function ZoomOut(t)
//----------------------------------------------------------------------
// Zoom out on the PTViewer applet. 
//----------------------------------------------------------------------
{
  obj = document.getElementById(t);
  obj.stopAutoPan();
  obj.startAutoPan(0, 0, 1.03);
}

function StopZoom(t)
{
  obj = document.getElementById(t);
  obj.stopAutoPan();
}

function Help(t)
{
  var x, y;
  var w;

  if (isNav) {
    x = window.screenX + 20;
    y = window.screenY + 20;
    w = window.setTimeout(
          'window.open("http://www.fh-furtwangen.de/~dersch/PTVJ/doc.html",' +
          '"PTViewerHelp",' +
          '",screenX=' + x + ',screenY=' + y +
          ',resizable=yes,scrollbars=yes")', 0);
  } else {
    w = window.setTimeout(
          'window.open("http://www.fh-furtwangen.de/~dersch/PTVJ/doc.html",' +
          '"PTViewerHelp",' +
          '",screenX=' + x + ',screenY=' + y +
          ',resizable=yes,scrollbars=yes")', 0);
  }
  return;
}

function Info(t)
{
  alert(t.getAppletInfo());
  return;
}

//PTViewer END

//----------------------------------------------------------------------
// Oprava automatickeho odhlasovaní
//----------------------------------------------------------------------
function RefreshConn()
{
    var dtNow;
    dtNow = new Date();
    strTimestamp = dtNow.getTime();
    if(document.all != null)
        document.all('ImageRefresh').src = "frame_reload.asp?&timestamp=" + strTimestamp;
    else
        document.getElementById('ImageRefresh').src = "frame_reload.asp?&timestamp=" + strTimestamp;
    nID = setTimeout("RefreshConn()", 300000); 
}

