function ShowImageGif(name, width, height)
{
	window.open("images_gif.html?"+name,"",	"toolbar=no,scrollbars=no,location=no,status=no,width="+width+",height="+height+",resizable=0,screenX=50,screenY=50");
}

function ShowImageJpg(name, width, height)
{
	window.open("images_jpg.html?"+name,"",	"toolbar=no,scrollbars=no,location=no,status=no,width="+width+",height="+height+",resizable=0,screenX=50,screenY=50");
}

function ShowImageSlides(name, width, height)
{
	window.open("images_slides.html?"+name,"",	"toolbar=no,scrollbars=no,location=no,status=no,width="+width+",height="+height+",resizable=0,screenX=50,screenY=50");
}


function ShowImage(name, width, height)
{
	window.open("images.html?"+name,"",	"toolbar=no,scrollbars=no,location=no,status=no,width="+width+",height="+height+",resizable=0,screenX=50,screenY=50");
}

function go(href)
{
    window.location.href = href;
}

function get(id)
{
    return document.getElementById(id);
}

function over(link)
{
    link.style.backgroundColor = '#DFC093';
}

function out(link, color)
{
    link.style.backgroundColor = color;
}

// example: <a href=\"javascript:kalendarPopUp('INPUT_NAME', 'form1');\">[kalendář]</a>
function kalendar_popup(inp, tform)
{
    matches = /^[0-9]+\.([0-9]+)\.([0-9]+)$/.exec(document.forms[tform][inp].value);
    with (window.open("kalendar_popup.php?opener_form_name="+ tform +"&opener_input_name="+ inp + (matches != null ? "&kalpop_rok="+ matches[2] +"&kalpop_mesic=" + matches[1] : ""), "kalendar", "width=180,height=140,resizable=1")) {
        focus();
    }
}



var focus_changing = false;

function dateCheck(f, notice)
{
    string = f.value;
    if (string) {
        re = /^(3[01]|0*[1-9]|[12][0-9])\.(0*[1-9]|1[012])\.(\d{4})$/;
        if (re.test(string) == true) {
            return true;
        } else {
            if (!focus_changing) {
                focus_changing = true;
                f.focus();
                if (notice == true) {
                    alert("Neplatné datum");
                }
                focus_changing = false;
            }
            return false;
        }
    }
}

// Focus into field f, display message s and return false
function focus_alert(s, f) {
	f.focus();
	alert(s);
	return false;
}

// Check fields in the form
// s is warning message, f is pointer to <form>, next arguments are names of mandatory fields
// example of use: <form onSubmit="return form_correct('Fill-in all marked fields!', this, 'name', 'password');">
function form_correct(s, f) {
	for (i=2; i < arguments.length; i++) {
		if (f[arguments[i]].value == '') {
			return focus_alert(s, f[arguments[i]]);
		}
	}
	return true;
}

function displaySwitch(id) {
    get(id).style.display = (get(id).style.display == 'none' ? 'inline' : 'none');
    if (window.event != undefined) {
        window.event.returnValue = false;
    }
    return true;
}
