function w(url)
{
    window.open(url, "page", "menubar=yes, location=yes, status=yes, toolbar=no, scrollbars=yes, resizable=yes");
    return false;
}


function mtrs(url)
{
    var fr = window.open(url, "mtrs", 'width=500, height=300, menubar=no, location=no, status=yes, toolbar=no, scrollbars=yes, resizable=yes');
	if (fr) fr.focus();
    return false;
}

function imgs(url)
{
    var fr = window.open(url, "imgs", 'width=500, height=200, menubar=no, location=no, status=yes, toolbar=no, scrollbars=yes, resizable=yes');
	if (fr) fr.focus();
    return false;
}

function lms(url)
{
    var fr = window.open(url, "lms", 'width=300, height=300, menubar=no, location=no, status=yes, toolbar=no, scrollbars=yes, resizable=yes');
	if (fr) fr.focus();
    return false;
}

function frms(url)
{
    var fr = window.open(url, "page", 'width=600, height=600, menubar=no, location=no, status=yes, toolbar=no, scrollbars=yes, resizable=yes');
	if (fr) fr.focus();
    return false;
}

function wi(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 to_cart(alert_report, alert_2_report, alert_3_report)
{
	// type_order1 - Obraz
	// type_order2 - Zaslání na CDROM
	var checking = true;
	var sw = document.getElementById('type_order2');
	if (sw) {
		if (sw.checked) checking = false;
	}

	if (checking) {

		// kontrola volby typu obrazu
		var pd = document.getElementById('padding_id').value;
		if (pd == '' || pd == 0 || pd == null) {
			window.alert(alert_report);
			return false;
		}

		// kontrola volby laminace
		var lam_id = document.getElementById('lam_id').value;
		if (lam_id == '' || lam_id == 0 || lam_id == null) {
			window.alert(alert_3_report);
			return false;
		}

		// kontrola volby rámu
		pt1 = document.getElementById('picture_type1').checked;
		if (pt1) {
			fr = document.getElementById('frame_id').value;
			if (fr == 0 || fr == '' || fr == null) {
				window.alert(alert_2_report);
				return false;
			}
		}
	}

	var el = document.getElementById('cart');
	el.value = '1';

	document.getElementById('product_form').submit();
	return true;
}


function types(url)
{
    var fr = window.open(url, "types", 'width=860, height=600, menubar=no, location=no, status=yes, toolbar=no, scrollbars=yes, resizable=yes');
	if (fr) fr.focus();
    return false;
}

function sws(id)
{
	var el = document.getElementById('thread' + id);
	if (el) {
		if (el.className == 'hid') {
			el.className = 'vis';
		} else {
			el.className = 'hid';
		}
	}
}

function conf_del_item(name, lang)
{
	if(lang == 'cs') {
		var result = confirm('Opravdu chcete poloku "' + name + '" smazat?');
		return result;
	}
	if(lang == 'en') {
		var result = confirm('Delete item "' + name + '"?');
		return result;
	}
	if (lang == 'de') {
		var result = confirm('Wollen Sie wirklich diesen Posten "' + name + '" löschen?');
		return result;
	}
}

function trim(hodnota)
{
	if(hodnota.charAt(0) == " ") {
		hodnota = hodnota.substring(1,hodnota.length);
		hodnota = trim(hodnota);
	}
	if(hodnota.charAt(hodnota.length-1) == " ") {
		hodnota = hodnota.substring(0,hodnota.length-1);
		hodnota=trim(hodnota);
	}
	return hodnota;
}

