		window.onload = function()
		{
			bscal.init('calend_from');
		}

		function check_date(inputStr)
		{
		
					var reg=/^(\d{4}-(01|02|03|04|05|06|07|08|09|10|11|12){1}-((0|1|2){1}\d{1})|(30|31){1})$/;
 
					if(reg.exec(inputStr) != null)
					{
						return true;
					}
					else
					{
						return false;
					}
					
		}
		
		String.prototype.replaceAll = function(search, replace){
  			return this.split(search).join(replace);
		}
		
		function check_req()
		{
		
					firstname = document.getElementById('firstname');		
					if (firstname.value == '')
					{
						alert('Please, type the firstname');
						if (firstname!=undefined) firstname.focus()

						return false;
					}
					
					lastname = document.getElementById('lastname');					
					if (lastname.value == '')
					{
						alert('Please, type the lastname');
						if (lastname!=undefined) lastname.focus()

						return false;
					}
					
					phone = document.getElementById('phone');					
					if (phone.value == '')
					{
						alert('Please, type the phone');
						if (phone!=undefined) phone.focus()

						return false;
					}
					
					
					email = document.getElementById('email');
					if (email.value == '')
					{
						alert('Please, type the email');
						if (email!=undefined) email.focus()

						return false;
					}

					if (email.value.indexOf('@')<=0)
					{
						alert('Please, type the valid email');
						if (email!=undefined) email.focus()

						return false;
					}
					
					calendfrom = document.getElementById('calend_from');

					if (check_date(calendfrom.value) == false)
					{
						alert('Please, enter the valid date');
						if (calendfrom != undefined) calendfrom.focus()
						return false;
					}

					calendto = document.getElementById('calend_to');
										
					if (check_date(calendto.value) == false)
					{
						alert('Please, enter the valid date');
						if (calendto != undefined) calendto.focus()
						return false;
					}
					
					dateto = calendto.value;
					dateto = dateto.replaceAll('-','');
					
					datefrom = calendfrom.value;
					datefrom = datefrom.replaceAll('-','');
					if (parseInt(dateto) <= parseInt(datefrom))
					{
						alert('Sorry, but check-out date must be more than check-in date');
						if (calendto != undefined) calendto.focus()
						return false;
					}
					
					
					country = document.getElementById('country');					
					if (country.selectedIndex == 0)
					{
						alert('Please, select the Country');
						return false;
					}
					
					numberrooms = document.getElementById('numberrooms');					
					if (numberrooms.selectedIndex == 0)
					{
						alert('Please, select the Number of rooms');
						return false;
					}

					adultsrooms = document.getElementById('adultsrooms');					
					if (adultsrooms.selectedIndex == 0)
					{
						alert('Please, select the Number of persons');
						return false;
					}
					
					roomrates = document.getElementById('roomrates');					
					if (roomrates.selectedIndex == 0)
					{
						alert('Please, select the Room rates');
						return false;
					}
					
					return true;
		}
