// JavaScript Document
$(document).ready(function(){
      var clockoptions = {
        utc: true,
        utcOffset: +8,
		format: '%A %B %d, %Y %I:%M:%S %p'
      }
      $('#clock').jclock(clockoptions);
	  
	  $('#dates_arrive').datepick({dateFormat: 'dd - M - yy'});
	  $('#dates_depart').datepick({dateFormat: 'dd - M - yy'});
	  
	  $('#submit-contact').formValidator({
		scope		: '#frm-contact',
		errorDiv	: '#errors',
		onSuccess	: null
	   })
	  
	  $('#submit-booking').formValidator({
		scope		: '#frm-booking',
		errorDiv	: '#errors',
		onSuccess	: null
	   })
	  
	  $('#submit-links').formValidator({
		scope		: '#frm-links',
		errorDiv	: '#errors',
		onSuccess	: null
	   })
	  
	  $("#type").change(onSelectChange);
});


function onSelectChange(){
	        var val = $('#type').val();
	        if(val=='bali-villa-sale') {
	            $('#price').hide();
				$('#number_of_bedrooms').show();
			}else if(val=='bali-land-sale'){
				$('#price').hide();
				$('#number_of_bedrooms').hide();
			}else if(val=='bali-villa-sublease'){
				$('#price').hide();
				$('#number_of_bedrooms').show();
			}else if(val=='bali-land-lease'){
				$('#price').hide();
				$('#number_of_bedrooms').hide();
	        }else{
				$('#price').show();
				$('#number_of_bedrooms').show();
			}
}
