function replyTo(forumId, nadpis)
 {
  var replyInput = document.getElementById("parentId");
  replyInput.value = forumId;
  
  var replyInput = document.getElementById("nadpis");
  replyInput.value = "Reply to: "+nadpis;
  
  window.location = String(window.location).replace(/\#.*$/, "") + "#replyForm";
 }
	
	// Only allows certain keys to be used in the date field
function TimeDigitsOnly(event) {    
	var KeyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;	   
	
   	return ((KeyCode == 8) // backspace
        || (KeyCode == 9) // tab
        || (KeyCode == 37) // left arrow
        || (KeyCode == 39) // right arrow
        || (KeyCode == 46) // delete       
        || ((KeyCode > 47) && (KeyCode < 59)) // 0 - 9        
   );
}

function IsValidTime(object) {
	
	var timeStr = object.value;
// Checks if time is in HH:MM:SS AM/PM format.
// The seconds and AM/PM are optional.
	var dateF = new Date();
	var timePat = /^(\d{1,2}):(\d{2})?$/;
	//var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?$/;
	var matchArray = timeStr.match(timePat);
	if (matchArray == null) {
		alert("Wrong time format! Use: HH:MM:SS");
	 	object.value = dateF.getHours()+":"+dateF.getMinutes();//+":"+dateF.getSeconds();
	 	return false;
	}
	
	hour = matchArray[1];
	minute = matchArray[2];
	second = matchArray[4];
	
	if (second=="") { second = null; }
	
	if (hour < 0  || hour > 11) {
		alert("Hours must be between 0 and 23!");
		if (hour >11) hour = 11; else hour = 0;	
	}
	
	if (minute<0 || minute > 59) {
		alert("Minutes must be between 0 and 59!");
		if (minute >59) minute = 59; else minute = 0;	
	}
/*
	if (second != null && (second < 0 || second > 59)) {
		alert("Seconds must be between 0 and 59!");
		if (second >59) second = 59; else second = 0;
		
	}*/
	object.value = hour+":"+minute+(second == null ? "" : ":"+second);
return false;
}

function Check(form)
{


  if (form.arival.value == form.departure.value) {
 	alert("Arrival date can't be same as departure date!")
 	return false;
  }
  
  if (form.arival.value == form.departure.value) {
 	alert("Arival date can not be same as departure date!")
 	return false;
  }

  if(form.lastname.value == "")
  {
    alert("LAST NAME is missing!");
    form.lastname.focus();
    return false;
  }
  
  if(form.country.value == "")
  {
    alert("COUNTRY is missing!");
    form.country.focus();
    return false;
  }

  if(form.email.value == "")
  {
    alert("E-MAIL address is missing!");
    form.email.focus();
    return false;
  }
  if(form.rp1.value == "0")
   {if(form.rp2.value == "0")
    {if(form.rp3.value == "0")
     {if(form.rp4.value == "0")
  {
    alert("Please enter number of person!");
    form.rp1.focus();
    return false;
  }}}}
  
  if(form.rn1.value == "0")
   {if(form.rn2.value == "0")
    {if(form.rn3.value == "0")
     {if(form.rn4.value == "0")
  {
    alert("Please choose number of room!");
    form.rp1.focus();
    return false;
  }}}}

  if(form.am.value == "1")
   {if(form.ad.value == "1")
    {if(form.ay.value == "2004")
   {
    alert("Please input your arrival date!");
    form.am.focus();
    return false;
  }}}

  if(form.dm.value == "1")
   {if(form.dd.value == "1")
    {if(form.dy.value == "2004")
   {
    alert("Please input your departure date!");
    form.dm.focus();
    return false;
  }}}
  
  	if(form.captcha.value == "")
  {
    alert("Control code is missing!");
    form.lastname.focus();
    return false;
  }
  
  
  return true;
}

function mail() { win = window.open('../mailform/email.html',
'view', 'width=680,height=520,top=50,left=50,status=no,menubar=no,scrollbars=no');
win.focus(); }

function view() {
win = window.open('../view/view.html', 'view', 'width=680,height=520,top=50,left=50,status=no,menubar=no,scrollbars=no');
win.focus();
}

function galerie() { win =
window.open('../galerie/galerie.html','galerie','width=820,height=710,top=5,left=100,status=no,menubar=no,scrollbars=no');
win.focus(); }

function okoli() {
win = window.open('../okoli/okoli.html','okoli', 'width=850,height=700,top=5,left=100,status=no,menubar=no,scrollbars=yes');
win.focus();
}

function cenik() {
win = window.open('/price_list.php','cenik', 'width=700,height=700,top=5,left=10,status=no,menubar=no,scrollbars=yes');
win.focus();
}