function change_disp( div_name ){	
	setNone ( 'div_colorHomes' ) ;
	setNone ( 'div_colorInn' ) ;
	setNone ( 'div_soundHomes' ) ;
	setBlock ( div_name );	
}

function _afterCalendar(){
	checkDates();	
}

function checkDates(){

	var strCheckIn = '';
	var strCheckOut = '';

	switch (curObjectId){
		case 'CheckIn':
			strCheckIn = 'CheckIn' ;
			strCheckOut = 'CheckOut' ;
			break;
		case 'CheckOut':
			strCheckIn = 'CheckIn' ;
			strCheckOut = 'CheckOut' ;
			break;
		
		case 'ArrivalDateInn':
			strCheckIn = 'ArrivalDateInn' ;
			strCheckOut = 'DepartureDateInn' ;
			break;
		case 'DepartureDateInn':
			strCheckIn = 'ArrivalDateInn' ;
			strCheckOut = 'DepartureDateInn' ;
			break;

		case 'ArrivalDateSound':
			strCheckIn = 'ArrivalDateSound' ;
			strCheckOut = 'DepartureDateSound' ;
			break;
		case 'DepartureDateSound':
			strCheckIn = 'ArrivalDateSound' ;
			strCheckOut = 'DepartureDateSound' ;
			break;

		default:
			strCheckIn = 'CheckIn' ;
			strCheckOut = 'CheckOut' ;
			break;
	}

	var objCheckIn = document.getElementById(strCheckIn);
	var valCheckIn = objCheckIn.value;
	if (valCheckIn != ''){
		if ( _checkDate(valCheckIn)){
			valCheckIn = _returnDate(valCheckIn);
			objCheckIn.value = valCheckIn;
		}else{
			objCheckIn.value = '';
		}
	}	
	
	var objCheckOut = document.getElementById(strCheckOut);
	var valCheckOut = objCheckOut.value;
	if (valCheckOut != ''){
		if ( _checkDate(valCheckOut)){
			valCheckOut = _returnDate(valCheckOut);
			objCheckOut.value = valCheckOut;
		}else{
			objCheckOut.value = '';
		}
	}else{
		if( valCheckIn !='' && ( curObjectId =='CheckIn' || curObjectId =='ArrivalDateInn' || curObjectId =='ArrivalDateSound') ){
			myCheckIn = new Date(valCheckIn);
			myCheckIn.setDate(myCheckIn.getDate()+1);
			valCheckOut = _returnDate( myCheckIn.getMonth() + 1 + '.' +  myCheckIn.getDate()  + '.' + myCheckIn.getFullYear() ) ;
			objCheckOut.value = _returnDate( myCheckIn.getMonth() + 1 + '.' +  myCheckIn.getDate()  + '.' + myCheckIn.getFullYear() ) ;
		}
	}

	if( valCheckIn !='' && valCheckOut !=''){
		var dtCheckIn = new Date(valCheckIn);
		var dtCheckOut = new Date(valCheckOut);
		if (  dtCheckIn >= dtCheckOut ){
			window.alert ( 'check Arrival Date & Departure Date' );			
		}

	}
}

function quickResValidateInn(sAction) {
	
	var strCheckIn = '';
	var strCheckOut = '';
	
	var checkinyyyy = '';
	var checkinmm = '';
	var checkindd = '';
	var nightstay = '';
	var adults = '';
	var children = '';

	var blValidateInn = true;

	strCheckIn = 'ArrivalDateInn' ;
	strCheckOut = 'DepartureDateInn' ;

	var objCheckIn = document.getElementById(strCheckIn);
	var valCheckIn = objCheckIn.value;
	if (valCheckIn != ''){
		if ( _checkDate(valCheckIn)){
			myCheckIn = new Date(valCheckIn);
			checkinyyyy = myCheckIn.getFullYear();
			checkinmm = myCheckIn.getMonth() + 1;
			checkindd = myCheckIn.getDate();
		}else{
			window.alert ( "Need Arrival Date" );
			blValidateInn = false;
		}
	}else{
		window.alert ( "Need Arrival Date" );
		blValidateInn = false;
	}

	if (!blValidateInn){
		return false;
	}

	var objCheckOut = document.getElementById(strCheckOut);
	var valCheckOut = objCheckOut.value;
	if (valCheckOut != ''){
		if ( _checkDate(valCheckOut)){

			myCheckOut = new Date(valCheckOut);
			nightstay = myCheckOut - myCheckIn;
			nightstay = nightstay / 24;
			nightstay = nightstay / 60;
			nightstay = nightstay / 60;
			nightstay = nightstay / 1000;
			nightstay = parseInt(nightstay.toString());

		}else{
			window.alert ( "Need Departure Date" );
			blValidateInn = false;
		}
	}else{
		window.alert ( "Need Departure Date" );
		blValidateInn = false;
	}

	adults = document.getElementById('SelAdultsInn').options[document.getElementById('SelAdultsInn').selectedIndex].value;
	children = document.getElementById('SelChildrenInn').options[document.getElementById('SelChildrenInn').selectedIndex].value;

	if (nightstay<1){
		blValidateInn = false;
		return false;
	}
	
	if (!blValidateInn){
		return false;
	}
	
	sAction = sAction + "&checkinyyyymm=" + checkinyyyy + checkinmm + "&checkindd=" + checkindd + "&nightstay=" + nightstay + "&adults=" + adults + "&children=" + children;
	window.open(sAction, '_blank');
}

function quickResValidateHomes(sAction) {

	var strCheckIn = '';
	var strCheckOut = '';	
	var adults = '';

	var blValidateHomes = true;

	strCheckIn = 'ArrivalDateHomes' ;
	strCheckOut = 'DepartureDateHomes' ;

	var objCheckIn = document.getElementById(strCheckIn);
	var valCheckIn = objCheckIn.value;
	if (valCheckIn != ''){
		if ( !_checkDate(valCheckIn)){
			window.alert ( "Need Arrival Date" );
			blValidateHomes = false;
		}
	}else{
		window.alert ( "Need Arrival Date" );
		blValidateHomes = false;
	}

	if (!blValidateHomes){
		return false;
	}

	var objCheckOut = document.getElementById(strCheckOut);
	var valCheckOut = objCheckOut.value;
	if (valCheckOut != ''){
		if ( !_checkDate(valCheckOut)){
			window.alert ( "Need Departure Date" );
			blValidateHomes = false;
		}
	}else{
		window.alert ( "Need Departure Date" );
		blValidateHomes = false;
	}

	if (!blValidateHomes){
		return false;
	}

	adults = document.getElementById('SelAdultsHomes').options[document.getElementById('SelAdultsHomes').selectedIndex].value;
	
	if (!blValidateHomes){
		return false;
	}
	
	sAction = "http://www.watercolorvacationhomes.com/vacation-rentals/search-results.asp?"
	sAction = sAction + "CheckIn=" + valCheckIn + "&CheckOut=" + valCheckOut + "&SelAdults=" + adults ;
	window.open(sAction, '_blank');
}

function quickResValidateSound(sAction) {

	var strCheckIn = '';
	var strCheckOut = '';
	
	var blValidateSound = true;

	strCheckIn = 'ArrivalDateSound' ;
	strCheckOut = 'DepartureDateSound' ;

	var objCheckIn = document.getElementById(strCheckIn);
	var valCheckIn = objCheckIn.value;
	if (valCheckIn != ''){
		if ( !_checkDate(valCheckIn)){
			window.alert ( "Need Arrival Date" );
			blValidateSound = false;
		}
	}else{
		window.alert ( "Need Arrival Date" );
		blValidateSound = false;
	}

	if (!blValidateSound){
		return false;
	}

	var objCheckOut = document.getElementById(strCheckOut);
	var valCheckOut = objCheckOut.value;
	if (valCheckOut != ''){
		if ( !_checkDate(valCheckOut)){
			window.alert ( "Need Departure Date" );
			blValidateSound = false;
		}
	}else{
		window.alert ( "Need Departure Date" );
		blValidateSound = false;
	}

	adults = document.getElementById('SelAdultsSound').options[document.getElementById('SelAdultsSound').selectedIndex].value;

	if (!blValidateSound){
		return false;
	}
	
	sAction = "http://www.watersoundvacationrentals.com/vacation-rentals/search-results.asp?"
	sAction = sAction + "CheckIn=" + valCheckIn + "&CheckOut=" + valCheckOut + "&SelAdults=" + adults ;
	window.open(sAction, '_blank');
}

function quickResValidateSound_old(sAction) {

	var strCheckIn = '';
	var strCheckOut = '';
	
	var checkinyyyy = '';
	var checkinmm = '';
	var checkindd = '';
	var nightstay = '';
	var adults = '';
	var children = '';

	var blValidateSound = true;

	strCheckIn = 'ArrivalDateSound' ;
	strCheckOut = 'DepartureDateSound' ;

	var objCheckIn = document.getElementById(strCheckIn);
	var valCheckIn = objCheckIn.value;
	if (valCheckIn != ''){
		if ( _checkDate(valCheckIn)){
			myCheckIn = new Date(valCheckIn);
			checkinyyyy = myCheckIn.getFullYear();
			checkinmm = myCheckIn.getMonth() + 1;
			checkindd = myCheckIn.getDate();
		}else{
			window.alert ( "Need Arrival Date" );
			blValidateSound = false;
		}
	}else{
		window.alert ( "Need Arrival Date" );
		blValidateSound = false;
	}

	if (!blValidateSound){
		return false;
	}

	var objCheckOut = document.getElementById(strCheckOut);
	var valCheckOut = objCheckOut.value;
	if (valCheckOut != ''){
		if ( _checkDate(valCheckOut)){

			myCheckOut = new Date(valCheckOut);
			nightstay = myCheckOut - myCheckIn;
			nightstay = nightstay / 24;
			nightstay = nightstay / 60;
			nightstay = nightstay / 60;
			nightstay = nightstay / 1000;
			nightstay = parseInt(nightstay.toString());

		}else{
			window.alert ( "Need Departure Date" );
			blValidateSound = false;
		}
	}else{
		window.alert ( "Need Departure Date" );
		blValidateSound = false;
	}

	adults = document.getElementById('SelAdultsSound').options[document.getElementById('SelAdultsSound').selectedIndex].value;
	children = document.getElementById('SelChildrenSound').options[document.getElementById('SelChildrenSound').selectedIndex].value;

	if (nightstay<1){
		blValidateSound = false;
		return false;
	}
	
	if (!blValidateSound){
		return false;
	}
	
	sAction = sAction + "&checkinyyyymm=" + checkinyyyy + checkinmm + "&checkindd=" + checkindd + "&nightstay=" + nightstay + "&adults=" + adults + "&children=" + children;
	window.open(sAction, '_blank');
}
