// JavaScript Document
function includeFlash(areaid,fileName,fWidth,fHeight,bgcolour) {
	var flashArea = { movie:fileName, width:fWidth, height:fHeight, majorversion:"7", build:"0", xi:"true", bgcolor:bgcolour };
	UFO.create(flashArea,areaid);
}

//NAVIGATION
var home_0 = new Image(200,16);
home_0.src = 'images/main-nav-home0.png';
var home_1 = new Image(200,16);
home_1.src = 'images/main-nav-home1.png';

var accommodation_0 = new Image(200,16);
accommodation_0.src = 'images/main-nav-accommodation0.png';
var accommodation_1 = new Image(200,16);
accommodation_1.src = 'images/main-nav-accommodation1.png';

var facilities_and_features_0 = new Image(200,16);
facilities_and_features_0.src = 'images/main-nav-facilities-and-features0.png';
var facilities_and_features_1 = new Image(200,16);
facilities_and_features_1.src = 'images/main-nav-facilities-and-features1.png';

var meetings_0 = new Image(200,16);
meetings_0.src = 'images/main-nav-meetings0.png';
var meetings_1 = new Image(200,16);
meetings_1.src = 'images/main-nav-meetings1.png';

var local_attractions_0 = new Image(200,16);
local_attractions_0.src = 'images/main-nav-local-attractions0.png';
var local_attractions_1 = new Image(200,16);
local_attractions_1.src = 'images/main-nav-local-attractions1.png';

var location_0 = new Image(200,16);
location_0.src = 'images/main-nav-location0.png';
var location_1 = new Image(200,16);
location_1.src = 'images/main-nav-location1.png';

var special_offers_0 = new Image(200,16);
special_offers_0.src = 'images/main-nav-specials0.png';
var special_offers_1 = new Image(200,16);
special_offers_1.src = 'images/main-nav-specials1.png';

var contact_us_0 = new Image(200,16);
contact_us_0.src = 'images/main-nav-contact-us0.png';
var contact_us_1 = new Image(200,16);
contact_us_1.src = 'images/main-nav-contact-us1.png';



var make_a_booking_0 = new Image(200,16);
make_a_booking_0.src = 'images/main-nav-make-a-booking0.png';
var make_a_booking_1 = new Image(200,16);
make_a_booking_1.src = 'images/main-nav-make-a-booking1.png';

//DOWNLOAD BTN
var download_map_0 = new Image(130,25);
download_map_0.src = 'images/download-map0.gif';
var download_map_1 = new Image(130,25);
download_map_1.src = 'images/download-map1.gif';

var download_brochure_0 = new Image(178,25);
download_brochure_0.src = 'images/download-brochure0.gif';
var download_brochure_1 = new Image(178,25);
download_brochure_1.src = 'images/download-brochure1.gif';

var download_rate_card_0 = new Image(175,25);
download_rate_card_0.src = 'images/download-rate-card0.gif';
var download_rate_card_1 = new Image(175,25);
download_rate_card_1.src = 'images/download-rate-card1.gif';


var book_now_home_0 = new Image(103,103);
book_now_home_0.src = 'images/book-now0.gif';
var book_now_home_1 = new Image(103,103);
book_now_home_1.src = 'images/book-now1.gif';


function SwapImage(objectname,objectnewstate) {
	var imageobj = document.getElementById(objectname);
	imageobj.src = this[objectnewstate].src;
}

function contactFrm() {
	var theForm = document.getElementById("contactUsFrm");
	var requiredMessage = "";
	var validateMessage = "";
	var fullMessage = "";
	
	if(theForm.name.value == "") {
		requiredMessage += "\t* name.\n";
	}
	if (theForm.email.value == "") {
		requiredMessage += "\t* email.\n";
	} else if (!isValidEmail(theForm.email.value)) {
		validateMessage += "\t* email.\n";
	}
	if(theForm.comments.value == "") {
		requiredMessage += "\t* comments.\n";
	}
	
	
	if (requiredMessage != "") {
		fullMessage += "These fields are required:\n"+requiredMessage;
	}
	if (validateMessage != "") {
		fullMessage += "This field have invalid values:\n"+validateMessage;
	}
	
	if (fullMessage != "") {
		alert(fullMessage);
	} else {
		theForm.submit();
	}
}


function accommodationBookFrm() {
	var theForm = document.getElementById("accomodationBookingFrm");
	var requiredMessage = "";
	var validateMessage = "";
	var fullMessage = "";
	
	if(theForm.date_from.value == "") {
		requiredMessage += "\t* date from.\n";
	}
	if(theForm.date_to.value == "") {
		requiredMessage += "\t* date to.\n";
	}
	if(theForm.name.value == "") {
		requiredMessage += "\t* name.\n";
	}
	if (theForm.email.value == "") {
		requiredMessage += "\t* email.\n";
	} else if (!isValidEmail(theForm.email.value)) {
		validateMessage += "\t* email.\n";
	}
	
	
	if (requiredMessage != "") {
		fullMessage += "These fields are required:\n"+requiredMessage;
	}
	if (validateMessage != "") {
		fullMessage += "This field have invalid values:\n"+validateMessage;
	}
	
	if (fullMessage != "") {
		alert(fullMessage);
	} else {
		theForm.submit();
	}
}


function meetingBookFrm() {
	var theForm = document.getElementById("meetingsBookingFrm");
	var requiredMessage = "";
	var validateMessage = "";
	var fullMessage = "";
	
	if(theForm.number_of_guests.value == "") {
		requiredMessage += "\t* number of guests.\n";
	}
	if(theForm.name.value == "") {
		requiredMessage += "\t* name.\n";
	}
	if (theForm.email.value == "") {
		requiredMessage += "\t* email.\n";
	} else if (!isValidEmail(theForm.email.value)) {
		validateMessage += "\t* email.\n";
	}
	if(theForm.date_from_m.value == "") {
		requiredMessage += "\t* date from.\n";
	}
	if(theForm.date_to_m.value == "") {
		requiredMessage += "\t* date to.\n";
	}
	
	if (requiredMessage != "") {
		fullMessage += "These fields are required:\n"+requiredMessage;
	}
	if (validateMessage != "") {
		fullMessage += "This field have invalid values:\n"+validateMessage;
	}
	
	if (fullMessage != "") {
		alert(fullMessage);
	} else {
		theForm.submit();
	}
}


function isValidEmail(strEmail){
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	// search email text for regular exp matches
	if (strEmail.search(validRegExp) == -1) {
		return false;
	} 
	return true; 
}

/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   //alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   //alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		//alert("Invalid E-mail ID")
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		//alert("Invalid E-mail ID")
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		//alert("Invalid E-mail ID")
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		//alert("Invalid E-mail ID")
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		//alert("Invalid E-mail ID")
		return false
	 }

	 return true					
}
//SPAMBOTS EMAIL PROTECTION
function emailantispam(email1, email3, email4){
   emailE = email1 + '@' + email3 + email4;
   document.write('<a href="mailto:' + emailE + '" class="bodyCopyLink">' + emailE + '</a>');
}
//FOOTER MAIL
function emailantispam_footer(email1, email3, email4){
   emailE = email1 + '@' + email3 + email4;
   document.write('<a href="mailto:' + emailE + '" class="footerAddressLinks">' + emailE + '</a>');
}

