// JavaScript Document
function showBookTour(divId)
{
	document.getElementById(divId).style.display = "block";
}


function filedCheck(fId, fVal)
{
	var fieldVal = document.getElementById(fId).value;
	if(fieldVal == fVal)
	{
		document.getElementById(fId).value = '';
	}
	else if(fieldVal == '')
	{
		document.getElementById(fId).value = fVal;
	}
}	


function filedValueCheck(val, fId)
{
		
	if(isNaN(val))
	{
		alert('Please enter correct information');
		document.getElementById(fId).select();
		
	}	
}

function filedValueCheckTel(val, fId)
{
	
	if(val != 'Coun' && val != 'City' && val != 'Phone')
	{
		
		if(isNaN(val))
		{
			alert('Please enter correct information');
			document.getElementById(fId).select();
		}
	}
	else
	{
		document.getElementById(fId).value = val;
	}	
}


function checkForm()
{
			
	var y_name = rm_trim(document.getElementById('txtName').value);
	if(y_name == '')
	{
		alert('Please enter your name');
		document.getElementById('txtName').focus();
		return false;
	}else{
		
		if(!isNaN(y_name)){
			alert('Please enter your correct name');
			document.getElementById('txtName').focus();
			return false;
		}
		
	}
	
	var no_adult = rm_trim(document.getElementById('nOPAdult').value);
	if(no_adult == '')
	{
		alert('Please enter number of person');
		document.getElementById('nOPAdult').focus();
		return false;
	}
	else
	{
		if(isNaN(no_adult))
		{
			alert('Please enter correct information');
			document.getElementById('nOPAdult').select();
			return false;
		}else{
			
			if(no_adult < 1 ){
				alert('No. of adult should be grater than 0');
				document.getElementById('nOPAdult').select();
				return false;			
			}
		}
	}
	
	var no_child = rm_trim(document.getElementById('nOPChild').value);
	if(no_child != '')
	{
		if(isNaN(no_child))
		{
			alert('Please enter correct information');
			document.getElementById('nOPChild').select();
			return false;
		}
	}
	
	var email_val = rm_trim(document.getElementById('txtEmail').value);
	if(email_val == '')
	{
		alert('Please enter email id');
		document.getElementById('txtEmail').focus();
		return false;
	}else{
		
		if(!isEmail(email_val)){
			alert('Please enter correct information');
			document.getElementById('txtEmail').select();
			return false;
		}
	}
	
	var trip_month = document.getElementById('tripMonth').value;
	if(trip_month == 'MM')
	{
		alert('Please select month for trip');
		document.getElementById('tripMonth').focus();
		return false;
	}
	
	var trip_day = document.getElementById('tripDay').value;
	if(trip_day == 'DD')
	{
		alert('Please select day for trip');
		document.getElementById('tripDay').focus();
		return false;
	}
	
	var trip_year = document.getElementById('tripYear').value;
	if(trip_year == 'YYYY')
	{
		alert('Please select year for trip');
		document.getElementById('tripYear').focus();
		return false;
	}
	
	if(trip_month != '' && trip_day != '' && trip_year != ''){
		
		var d = new Date();
	
		var date_val = d.getDate();
		var month_val = d.getMonth()+1;
		var year_val = d.getFullYear();
		
		if(year_val == trip_year){
						
			if(trip_month < month_val){
				alert('Please select correct Trip Date.');
				return false;
			}else{
				
				if(trip_month == month_val){
					
					if(trip_day < date_val || trip_day == date_val){
						alert('Please select correct Trip Date.');
						return false;
					}
				}
			}			
		}
		
	}
	
	var day_in_hand = rm_trim(document.getElementById('dayHand').value);
	if(day_in_hand == '')
	{
		alert('Please enter days in hand');
		document.getElementById('dayHand').focus();
		return false;
	}
	else
	{		
		if(isNaN(day_in_hand))
		{
			alert('Please enter correct information');
			document.getElementById('dayHand').select();
			return false;
			
		}else{
			
			if(day_in_hand < 1 ){
				alert('Days in hand should be grater than 0');
				document.getElementById('nOPAdult').select();
				return false;			
			}
		}		
	}
	
	
	if(document.getElementById('country').value == '')
	{
		alert('Please select country');
		document.getElementById('country').focus();
		return false;
	}
	
	var msg_val = rm_trim(document.getElementById('message').value);
	if(msg_val == '')
	{
		alert('Please enter some comment');
		document.getElementById('message').focus();
		return false;
	}	
	
	var captcha_val = rm_trim(document.getElementById('txtNumber').value);
	if(captcha_val == '')
	{
		alert('Please enter Verification Code');
		document.getElementById('txtNumber').focus();
		return false;
	}
	
}


function checkEmailId(emId)
{	
	if(emId != ''){
		
		if(!isEmail(emId))
		{			
			alert('Please enter correct email id');
			document.getElementById('txtEmail').select();			
		}
	}	
}