// JavaScript Document


		// Change Image Background *******************
		
    function changeBodyImage1(){
        var imgPath = new String();
        imgPath = document.body.style.background = "url(http://clients.novasolution.com/mbc/site/graphics/background1.jpg)top center no-repeat";
    }
   
    function changeBodyImage2(){
        var imgPath = new String();
        imgPath = document.body.style.background = "url(http://clients.novasolution.com/mbc/site/graphics/background2.jpg) top center no-repeat";
    }
   
    function changeBodyImage3(){
        var imgPath = new String();
        imgPath = document.body.style.background = "url(http://clients.novasolution.com/mbc/site/graphics/background3.jpg) top center no-repeat";
    }
		
		// Random Background
		var totalCount = 4;
		function ChangeIt() {
			var num =  Math.ceil( Math.random() * totalCount );
			document.body.style.background = "url(http://clients.novasolution.com/mbc/site/graphics/"+num+".jpg) top center no-repeat";
		}

		// Change Image Background *******************
				
		//Calendar Date Picker Contact Us Page ***********
		
		$(function() {
			$( "#TxtNArrivalDate" ).datepicker();
		});
		
		$(function() {
			$( "#TxtNDepartureDate" ).datepicker();
		});
		//Calendar Date Picker Contact Us Page ***********
		
		
		// Rotanting Banners Slider *******************
    $(document).ready(function(){	
			$("#slider").easySlider({
			});
		});	
		// Rotanting Banners Slider *******************
		
		
		// Condos / Mahana Resort Photo Galleries jQuery/Lightbox
		$(function() {
        $('#divGallery a').lightBox();
    });
		
		// Condos / Mahana Resort Photo Galleries jQuery/Lightbox
		$(function() {
        $('#divGalleryMahana a').lightBox();
    });
		
		
		// Condos / Mahana Resort Photo Galleries jQuery/Lightbox
		$(function() {
        $('#divGalleryNews a').lightBox();
    });
		
		
		//ReCaptcha Customs http://code.google.com/apis/recaptcha/docs/customization.html
		var RecaptchaOptions = {
				theme : 'red'
		 };
		
	
	// Only Numbers Textbox
	function onlyNumbers(evt){
		var e = event || evt; // for trans-browser compatibility
		var charCode = e.which || e.keyCode;
		if (charCode > 31 && (charCode < 48 || charCode > 57)){
			alert("Only numbers required!");
			return false;
		}
		return true;
	}
	
	
	
	// Newsletter form validations
	function checkFormNewsletter(){
		mail = document.formNewsletter.Email.value;
		Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   
	 if(document.formNewsletter.Name.value == ""){
      document.getElementById('nameNewsletter').style.color='#FF0000';
			document.getElementById('nameNewsletter').innerHTML  = "Name is a mandatory field.";
			document.formNewsletter.Name.focus();
			return false;
			} else if(Filtro.test(mail)== false){
					document.getElementById('nameNewsletter').style.color='#666';
					document.getElementById('nameNewsletter').innerHTML  = "Name";
					document.getElementById('emailNewsletter').style.color='#FF0000';
					document.getElementById('emailNewsletter').innerHTML  = "Valid email address required.";
					document.formNewsletter.Email.focus();
					return false;
	}
}



// Contact Form Validation
	function checkFormContact(){
		mail = document.formContact.TxtNEmail.value;
		Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   
	 if(document.formContact.TxtSFirstName.value == ""){
      document.getElementById('firstname').style.color='#FF0000';
			document.getElementById('firstname').innerHTML  = "*First Name:";
			document.formContact.TxtSFirstName.focus();
			return false;
			 } else if(document.formContact.TxtSLastName.value == ""){
								 document.getElementById('firstname').style.color='#666';
								 document.getElementById('firstname').innerHTML  = "First Name:";
								 document.getElementById('lastname').style.color='#FF0000';
								 document.getElementById('lastname').innerHTML  = "*Last Name:";
								 document.formContact.TxtSLastName.focus();
								 return false;
						} else if(Filtro.test(mail)==false){
										document.getElementById('lastname').style.color='#666';
			 			 				document.getElementById('lastname').innerHTML  = "Last Name:";
										document.getElementById('lblemail').style.color='#FF0000';
										document.getElementById('lblemail').innerHTML  = "A valid email is required.";
										document.formContact.TxtNEmail.focus();
										return false;
							} else if(document.formContact.TxtNAdults.value == ""){	
													 document.getElementById('lblemail').style.color='#666';
			 			 						   document.getElementById('lblemail').innerHTML  = "Email Address:";
													 document.getElementById('lblAdults').style.color='#FF0000';
													 document.getElementById('lblAdults').innerHTML  = "*Adults:";
													 document.formContact.TxtNAdults.focus();
											     return false;
								} else if(document.formContact.TxtNArrivalDate.value == ""){	
														 document.getElementById('lblAdults').style.color='#666';
														 document.getElementById('lblAdults').innerHTML  = "Adults:";
														 document.getElementById('lblArrival').style.color='#FF0000';
														 document.getElementById('lblArrival').innerHTML  = "*Arrival Date:";
														 document.formContact.TxtNArrivalDate.focus();
														 return false;
									} else if(document.formContact.TxtNDepartureDate.value == ""){	
														 document.getElementById('lblArrival').style.color='#666';
														 document.getElementById('lblArrival').innerHTML  = "Arrival Date:";
														 document.getElementById('lblDeparture').style.color='#FF0000';
														 document.getElementById('lblDeparture').innerHTML  = "*Departure Date:";
														 document.formContact.TxtNDepartureDate.focus();
														 return false;
										} else if(document.formContact.TxtSCommnets_Questions.value == ""){	
													 document.getElementById('lblDeparture').style.color='#666';
			 			 						   document.getElementById('lblDeparture').innerHTML  = "Departure Date:";
													 document.getElementById('comments').style.color='#FF0000';
													 document.getElementById('comments').innerHTML  = "*Comments &amp; Questions:";
													 document.formContact.TxtSCommnets_Questions.focus();
											     return false;
					} 
}



//########### CHANGE PAGE FROM DROPDOWN LIST ###########
function view(targ,selObj,restore){ 
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}


