		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()
		{
					title = document.getElementById('title');		
					if (title.value == '')
					{
						alert('Please, type the title');
						if (title!=undefined) title.focus()
						return false;
					}
		
					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))
					{
						alert('Please, enter the valid date');
						if (calendfrom != undefined) calendfrom.focus()
						return false;
					}
					
					calendto = document.getElementById('calend_to');					
					if (!check_date(calendto.value))
					{
						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 Date to must be more than Date from');
						if (calendto != undefined) calendto.focus()
						return false;
					}
					
					numtourist = document.getElementById('numtourist');					
					if (numtourist.value == '')
					{
						alert('Please, type the Num of tourist');
						if (numtourist!=undefined) numtourist.focus()
						return false;
					}
					
					language = document.getElementById('language');					
					if (language.value == '')
					{
						alert('Please, type the Language');
						if (language!=undefined) language.focus()
						return false;
					}
					
					return true;
		}

