function odeslatrezcis()
{
	sHodnota1=document.getElementById("rezcis").value;
	if (sHodnota1=='')  {
		alert("Je třeba vyplnit REZERVAČNÍ ČÍSLO !");
		document.getElementById("rezcis").focus();
		return (false);
	}
}
function odeslatcastku()
{
	sHodnota1=document.getElementById("castka").value;
	if (sHodnota1=='')  {
		alert("Je třeba vyplnit ČÁSTKU !");
		document.getElementById("castka").focus();
		return (false);
	}
}

//vymazani zadanych dat formulare
function VymazForm(_form) {
    field=document.getElementById(_form)
    for (i = 0; i < field.length; i++) {
        field[i].checked = false;
        if (field[i].type!="reset" && field[i].type!="submit" && field[i].type!="button")
            field[i].value = "";
    }
}

function kvalita(typ,size) {
var win_size_x=480; //horizontální velikost okna
var win_size_y=130; //vertikální velikost okna
var win_pos_x=(screen.width-win_size_x)/2; //horizontální pozice okna
var win_pos_y=(screen.height-win_size_y)/2; //vertikální velikost okna
window.open("http://"+location.hostname+"/pages/popup-kvalita.html?typ="+typ+"&size="+size,'kvalita','scrollbars=no,resizable=yes,location=no,directories=no,width='

+ win_size_x + ',height=' + win_size_y + ',top=' + win_pos_y + ',left=' + 
win_pos_x );
return false;
}

function odroluj(_Kam)
{
	if (document.getElementById(_Kam)!=null)
	{
		document.getElementById(_Kam).scrollIntoView();
	}

}

function puzzle() {
	window.open("http://www.vidiadesign.cz/script/pampeliska/games/puzzle/","Puzzle", "height=500px, width=774px, top=50px, left=50px, status=no, toolbar=no, location=no, scrollbars=no, resizable=no, dependent=yes");
}


function jencisla(udalost) {
    var charCode = (udalost.which) ? udalost.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    return true;
}

function isBlank(val){
	if(val==null){return true;}
	for(var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
		}
	return true;
	}


function isNumeric(val){return(parseFloat(val,10)==(val*1));}


function LTrim(str){
	if (str==null){return null;}
	for(var i=0;str.charAt(i)==" ";i++);
	return str.substring(i,str.length);
}

function RTrim(str){
	if (str==null){return null;}
	for(var i=str.length-1;str.charAt(i)==" ";i--);
	return str.substring(0,i+1);
}

function Trim(str){return LTrim(RTrim(str));}


function isDate(a){
  var dat = new String(a); 
  ok=true;
  if (dat.length>0) {
    var firstTecka = dat.indexOf(".");
    var lastTecka = dat.lastIndexOf(".");
    if ((firstTecka==-1) || (lastTecka==-1) || (lastTecka<=firstTecka)) ok=false;
    else {
      var den=dat.substring(0,firstTecka);
      if (den.substring(0,1)=="0") den=dat.substring(1,firstTecka)
      var mesic=dat.substring(firstTecka+1,lastTecka);
      if (mesic.substring(0,1)=="0") mesic=dat.substring(firstTecka+2,lastTecka)
      var rok=dat.substring(lastTecka+1,dat.length);
      if (!isNumeric(den) || !isNumeric(mesic) || !isNumeric(rok)) ok=false;
	  if (rok.length==2) rok="20"+rok
	  if (mesic < 1 || mesic > 12) ok=false;
	  if (den < 1 || den > 31) ok=false;
	  if ((mesic==4 || mesic==6 || mesic==9 || mesic==11) && den==31) ok=false;
	  if (mesic == 2) { // check for february 29th
		var isleap = (rok % 4 == 0 && (rok % 100 != 0 || rok % 400 == 0));
		if (den > 29 || (den==29 && !isleap)) ok=false;
      }	  
	}
  }	  
return ok;
}


function isEmail(argvalue) {

	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(argvalue);
}


function isRC(argvalue) {
	ok=true;
	vzor=/^[0-9]{6}\/[0-9]{3,4}$/;
	ok=vzor.test(argvalue);
	if (argvalue.substr(0, 2)>53 && argvalue.replace("/", "") % 11 >0) ok=false;
return ok;
}


function isURL(argvalue) {

  if (argvalue.indexOf(" ") != -1)
    return false;
  else if (argvalue.indexOf("http://") == -1)
    return false;
  else if (argvalue == "http://")
    return false;
  else if (argvalue.indexOf("http://") > 0)
    return false;

  argvalue = argvalue.substring(7, argvalue.length);
  if (argvalue.indexOf(".") == -1)
    return false;
  else if (argvalue.indexOf(".") == 0)
    return false;
  else if (argvalue.charAt(argvalue.length - 1) == ".")
    return false;

  if (argvalue.indexOf("/") != -1) {
    argvalue = argvalue.substring(0, argvalue.indexOf("/"));
    if (argvalue.charAt(argvalue.length - 1) == ".")
      return false;
  }

  if (argvalue.indexOf(":") != -1) {
    if (argvalue.indexOf(":") == (argvalue.length - 1))
      return false;
    else if (argvalue.charAt(argvalue.indexOf(":") + 1) == ".")
      return false;
    argvalue = argvalue.substring(0, argvalue.indexOf(":"));
    if (argvalue.charAt(argvalue.length - 1) == ".")
      return false;
  }

  return true;

}

function winH() {
   if (window.innerHeight)
      /* NN4 a kompatibilní prohlížeče */
      return window.innerHeight;
   else if
   (document.documentElement &&
   document.documentElement.clientHeight)
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerHeight */
      return document.documentElement.clientHeight;
   else if
   (document.body && document.body.clientHeight)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientHeight;
   else
      return null;
}

function winW() {
   if (window.innerWidth) 
      /* NN4 a kompatibilní prohlížeče */
      return window.innerWidth;
   else if
   (document.documentElement &&
   document.documentElement.clientWidth) 
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerHeight */
      return document.documentElement.clientWidth;
   else if
   (document.body && document.body.clientWidth)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientWidth;
   else
      return null;
}

function ukryj_help(_co) {
	if(document.getElementById) document.getElementById(_co).style.display='none';
}

function zobraz_help(e,_co) {
	OBJ=document.getElementById(_co)
	if (document.all && !window.opera) {  
		zleva = event.clientX +10;
		zhora = event.clientY +10;
	}
	else {		   
		zleva = e.pageX - document.documentElement.scrollLeft +10;
		zhora = e.pageY - document.documentElement.scrollTop +10;    
	}

	OBJ.style.left="0px";
	OBJ.style.top="0px";

	maxvyska=winH();
	maxsirka=winW();  

    if (document.getElementById(_co).style.display=='none')
		{
			OBJ.style.display='block';
			sirka=OBJ.offsetWidth;
			vyska=OBJ.offsetHeight;

			if (zhora+vyska>maxvyska) {zhora=maxvyska-vyska-5}; 
			if (zleva+sirka>maxsirka) {zleva=maxsirka-sirka-5}; 
			if (zleva<=0) {zleva=5};
			if (zhora<=0) {zhora=5};

			OBJ.style.left=zleva + document.documentElement.scrollLeft + "px";
			OBJ.style.top=zhora + document.documentElement.scrollTop + "px";
		}
		
}


function printpreview()
{
  if(document.all) {
/*
    var OLECMDID = 7;
    var PROMPT = 1; // 2 DONTPROMPTUSER
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(OLECMDID, PROMPT);
    WebBrowser1.outerHTML = "";
*/
    window.print();
  } else {
    window.print();
  }
}


