function popup(param)
  {
    var wSirka = 700;
	var wVyska = 500;
    var vyska = screen.height;
    var sirka = screen.width;
    var levy = (sirka - wSirka)/2;
    var horni = (vyska - wVyska-50)/2;
    window.open('/'+param, '', "scrollbars= yes, width="+wSirka+", height="+wVyska+", left="+levy+", top="+horni);
  }

function popupadm(param)
  {
    var wSirka = 900;
	var wVyska = 600;
    var vyska = screen.height;
    var sirka = screen.width;
    var levy = (sirka - wSirka)/2;
    var horni = (vyska - wVyska-50)/2;
    window.open(''+param, '', "scrollbars= yes, width="+wSirka+", height="+wVyska+", left="+levy+", top="+horni);
  }


function validateEmail(email){
	if(window.RegExp){
		re = new RegExp("^[^@]+@[^.]+\..+$");
		if(!re.test(email)){
			alert("Formát emailové adresy není správný.");
			return false;
		}
	}
	return true;
}

function kontrola_zakaznik(){

    if((document.objednavka_zakaznik.Jmeno.value == "" || document.objednavka_zakaznik.Prijmeni.value == "")){alert("Vyplňte jméno a příjmení.");return false}
    if(document.objednavka_zakaznik.Ulice.value == ""){alert("Vyplňte ulici a číslo popisné.");return false}
    if(document.objednavka_zakaznik.Mesto.value == ""){alert("Vyplňte město.");return false}
    if(document.objednavka_zakaznik.Psc.value == ""){alert("Vyplňte PSČ.");return false}
    if(document.objednavka_zakaznik.Telefon.value == ""){alert("Vyplňte telefon.");return false}
	if(document.objednavka_zakaznik.Email.value == ""){alert("Vyplňte email.");return false}
    f=document.objednavka_zakaznik.Email.value;
	if(f != "") {
		if(validateEmail(f)==false){return false;}
	}

    if(document.objednavka_zakaznik.Podminky.checked == false) {alert("K objednání je třeba souhlasit s podmínkami nákupu.");return false}

  return true;
}

function switchErr(action){
	//window.alert('startin now ..');
	// SETUP
	var errBoxWidth = 420;
	var errBoxHeight = 220;
	// GET WINDOW SIZE
	var winW = 0;
	var winH = 0;
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    winW = window.innerWidth;
    winH = window.innerHeight;
  } else if( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight) ) {
    //IE 6+ in 'standards compliant mode'
    winW = document.documentElement.clientWidth;
    winH = document.documentElement.clientHeight;
  } else if( document.body && (document.body.clientWidth || document.body.clientHeight) ) {
    //IE 4 compatible
    winW = document.body.clientWidth;
    winH = document.body.clientHeight;
  }
  winW++;
  winH++;
  //window.alert(winW);
	//window.alert(winH);
	var boxMarginTop = Math.ceil((winH - errBoxHeight) / 2);
	//window.alert(boxMarginTop);
	var boxMarginLeft = Math.ceil((winW - errBoxWidth) / 2);
	//window.alert(boxMarginLeft);
	switch(action){
	  case 'show':
	    document.getElementById('web_all').style.height = winH + 'px';
			document.getElementById('web_all').style.position = 'absolute';
			document.getElementById('web_all').style.top = '0';
			document.getElementById('web_all').style.left = '0';
			document.getElementById('web_all').style.overflow = 'hidden';
			document.getElementById('web_cover').style.height = winH + 'px';
			document.getElementById('web_cover').style.display = 'block';
			document.getElementById('web_cover').style.visibility = 'visible';
			document.getElementById('err_box').style.visibility = 'visible';
			document.getElementById('err_box').style.display = 'block';
			document.getElementById('err_box').style.top = boxMarginTop+'px';
			document.getElementById('err_box').style.left = boxMarginLeft+'px';
	  return;
	  case 'hide':
	    //window.alert("Hidin' ..");
			document.getElementById('web_all').style.height = 'auto';
			document.getElementById('web_all').style.position = 'static';
			//document.getElementById('all').style.top = '0';
			//document.getElementById('all').style.left = '0';
			//document.getElementById('all').style.overflow = 'hidden';
			document.getElementById('web_cover').style.display = 'none';
			document.getElementById('err_box').style.display = 'none';
			document.getElementById('web_box').style.height = 'auto';
			//document.getElementById('err_box').style.display = 'block';
			//document.getElementById('err_box').style.top = boxMarginTop+'px';
			//document.getElementById('err_box').style.left = boxMarginLeft+'px';
			//document.getElementById('err_box').style. = '';
			//document.getElementById('err_box').style. = '';
			//document.getElementById('err_box').style. = '';
			//window.alert(winH);
			//document.getElementById('center').style.height = '600px';
			//document.getElementById('center').style.overflow = 'hidden';
	  return
	}

}


