function w(url)
{
    window.open(url, "page", "menubar=yes, location=yes, status=yes, toolbar=no, scrollbars=yes, resizable=yes");
    return false;
}

function wf(url, width, height)
{
	width += 50; height += 50;
	window.open(url, 'foto', 'width='+width+', height='+height+', toolbar=no, location=no, resizable=yes, scrollbars=yes, top=100, left=100');
	return false; 
}

function change_js_input()
{
    var el = document.getElementById('js_input');
    el.value = 1;
    return true;
}

// ankety
function set_poll(poll_id)
{
    var el = document.getElementById('poll');
    el.value = poll_id;
}

function send_poll()
{
    var el = document.getElementById('pollform');
    el.submit();

    return true;
}


function test_search_value()
{
	var el = document.getElementById('search');
	if (el.value == 'hledaný výraz ...') el.value = '';
	return false;
}


function AddFavorite(linkObj,addUrl,addTitle)
{
	if (document.all && !window.opera)
	{
		window.external.AddFavorite(addUrl,addTitle);
		return false;
	}
	else if (window.opera && window.print)
	{
		linkObj.title = addTitle;
		return true;
	}
	else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
	{
		if (window.confirm('Přidat oblíbenou stránku jako nový panel?'))
		{
			window.sidebar.addPanel(addTitle,addUrl,'');
			return false;
		}
	}
	window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.');
	return false;
}


function check_form()
{
	var items = '';
	var i = 0;
	var error = false;
	var a;
	var report = '';
	var var_name = '';

	if (document.getElementById('required_items')) {
		items = document.getElementById('required_items');
		items = items.split(';');
	} else items = new Array('jmeno', 'telefon', 'email', 'termin', 'pocet_osob');

	for (i = 0; i < items.length; i ++) {
		var_name = items[i];
		if (document.getElementById(var_name)) a = document.getElementById(var_name).value;
		if (!a || a == '+420' || a == '@') {
			error = true;
			if (var_name == 'firma') report += 'Není zadána firma!\n';
			if (var_name == 'osoba') report += 'Není zadána kontaktní osoba!\n';
			if (var_name == 'jmeno') report += 'Není zadáno jméno!\n';
			if (var_name == 'telefon' || a == '+420') report += 'Není zadán telefon!\n';
			if (var_name == 'email' || a == '@') report += 'Není zadán e-mail!\n';
			if (var_name == 'termin') report += 'Není zadán termín!\n';
			if (var_name == 'pocet_osob') report += 'Není zadán počet osob!\n';
		}
	}

	if (error) {
		alert(report);
		return false;
	}

	var el = document.getElementById('js_value');
	el.value = 1;
	return true;
}

