SpamController=Class.create({
	initialize:function(spam){this.spammed=spam;if(this.spammed!=0)this.alertSpam();},
	alertSpam:function(){var spam_msg="Dear Visitor,";
		spam_msg+="\n\nSome fields in the submitted form contain URLs, HTTP and/or FTP links or characters used by spam robots.\n";
		spam_msg+="We can't insert the provided data into our database.\nPlease do not use \"line feed\" or ";
		spam_msg+="\"carriage return\" in single line fields or text containing \"http://\", \"ftp://\" or HTML markup tags.";
		spam_msg+="\n\nThank You.";alert(spam_msg);}
});
VertPopupSubMenus=Class.create({
	initialize:function(){this.vp=$("villa_popup");this.gp=$("golfer_popup");this.wp=$("wheelchair_popup");
		this.vb=$("vm_villa");this.gb=$("vm_golf");this.wb=$("vm_wheelchair");this.tv=0;this.tg=0;this.tw=0;
		this.hoverStyle=$H({background:"url(/images/roc_vm_hover.png) no-repeat",color:"#069",fontWeight:"bold"});
		this.outStyle=$H({background:"none",color:"#036",fontWeight:"normal"});
		this.vb.observe("mouseover",this.vh.bind(this,true));this.vb.observe("mouseout",this.vh.bind(this,false));
		this.vp.observe("mouseover",this.vh.bind(this,true));this.vp.observe("mouseout",this.vh.bind(this,false));
		this.gb.observe("mouseover",this.gh.bind(this,true));this.gb.observe("mouseout",this.gh.bind(this,false));
		this.gp.observe("mouseover",this.gh.bind(this,true));this.gp.observe("mouseout",this.gh.bind(this,false));
		this.wb.observe("mouseover",this.wh.bind(this,true));this.wb.observe("mouseout",this.wh.bind(this,false));
		this.wp.observe("mouseover",this.wh.bind(this,true));this.wp.observe("mouseout",this.wh.bind(this,false));},
	vh:function(s){if(s){this.vp.setStyle({display:"block",visibility:"visible",zIndex:7777});
		if(this.tv>0)window.clearTimeout(this.tv);this.hgp();this.hwp();this.vb.setStyle(this.hoverStyle.toObject());
		}else{this.tv=this.hvp.bind(this).delay(0.7);this.vb.setStyle(this.outStyle.toObject());}},
	gh:function(s){if(s){this.gp.setStyle({display:"block",visibility:"visible",zIndex:7777});
		if(this.tg>0)window.clearTimeout(this.tg);this.hvp();this.hwp();this.gb.setStyle(this.hoverStyle.toObject());
		}else{this.tg=this.hgp.bind(this).delay(0.7);this.gb.setStyle(this.outStyle.toObject());}},
	wh:function(s){if(s){this.wp.setStyle({display:"block",visibility:"visible",zIndex:7777});
		if(this.tw>0)window.clearTimeout(this.tw);this.hvp();this.hgp();this.wb.setStyle(this.hoverStyle.toObject());
		}else{this.tw=this.hwp.bind(this).delay(0.7);this.wb.setStyle(this.outStyle.toObject());}},
	hvp:function(){this.vp.setStyle({display:"none",visibility:"hidden",zIndex:0});},
	hgp:function(){this.gp.setStyle({display:"none",visibility:"hidden",zIndex:0});},
	hwp:function(){this.wp.setStyle({display:"none",visibility:"hidden",zIndex:0});}
});
DHTMLMenu=Class.create({
	initialize:function(){this.setObserver("roc_properties_buttons_area","roc_properties_label");
		this.setObserver("rental_selections_buttons_area","roc_rental_selections_label");
		this.setObserver("company_services_buttons_area","roc_company_services_label");
		this.setObserver("the_company_buttons_area","roc_the_company_label");},
	enterButtons:function(){var params=$A(arguments),reason=params[1],_target=params[2],_source=params[3];
		if(reason=="enter"){_target.setStyle({color:"#069",fontWeight:"bolder"});_source.setStyle({border:"1px solid #EEE"});}
		else if(reason=="leave"){_target.setStyle({color:"#036",fontWeight:"bold"});_source.setStyle({border:"none"});}},
	setObserver:function(source,target){var s=$(source),t=$(target);
		with(s){observe("mouseenter",this.enterButtons.bindAsEventListener(this,"enter",t,s));
			observe("mouseleave",this.enterButtons.bindAsEventListener(this,"leave",t,s));}}
});
FormManager=Class.create({
	initialize:function(form){this.form=$(form);this.formSubmitHandler=this.submitForm.bindAsEventListener(this);
		this.form.observe("submit",this.formSubmitHandler);this.setCalendarElements();
		this.setMandatoryFields();this.setLabels();this.setHandlers();this.startObservers();},
	setCalendarElements:function(){this.arrivalCal=$("arr_img");this.departureCal=$("dep_img");
		this.arrivalInput=$("arrivaldate");this.departureInput=$("departuredate");},
	setMandatoryFields:function(){
		this.firstNameInput=$("firstname");this.lastNameInput=$("lastname");this.emailInput=$("email");
		this.phoneInput=$("phone");this.guestsInput=$("numberofguests");this.conventionInput=$("convention");},
	setLabels:function(){
		this.fnLabel=$("first_name_label");this.lnLabel=$("last_name_label");this.emLabel=$("email_address_label");
		this.phLabel=$("telephone_number_label");this.ngLabel=$("sleeps_number_label");this.convLabel=$("convention_label");
		this.arrLabel=$("arrival_date_label");this.depLabel=$("departure_date_label");this.formTitle=$("contact_form_title");},
	setHandlers:function(){
		this.arrivalCalHoverHandler=this.hoverArrival.bind(this);this.arrivalCalOutHandler=this.outArrival.bind(this);
		this.arrivalCalClickHandler=this.clickArrival.bind(this);this.departureCalHoverHandler=this.hoverDeparture.bind(this);
		this.departureCalOutHandler=this.outDeparture.bind(this);this.departureCalClickHandler=this.clickDeparture.bind(this);
		this.arrivalInputClickHandler=this.clickArrival.bind(this);this.departureInputClickHandler=this.clickDeparture.bind(this);},
	startObservers:function(){
		this.arrivalCal.observe("mouseover",this.arrivalCalHoverHandler);this.arrivalCal.observe("mouseout",this.arrivalCalOutHandler);
		this.arrivalCal.observe("click",this.arrivalCalClickHandler);
		this.departureCal.observe("mouseover",this.departureCalHoverHandler);
		this.departureCal.observe("mouseout",this.departureCalOutHandler);
		this.departureCal.observe("click",this.departureCalClickHandler);
		this.arrivalInput.observe("click",this.arrivalCalClickHandler);
		this.departureInput.observe("click",this.departureCalClickHandler);},
	hoverArrival:function(){this.arrivalCal.setStyle({border:"1px solid #006699"});},
	outArrival:function(){this.arrivalCal.setStyle({border:"0px"});},
	clickArrival:function(){new XDCalendar("arrivaldate",{arrival:true});},
	hoverDeparture:function(){this.departureCal.setStyle({border:"1px solid #006699"});},
	outDeparture:function(){this.departureCal.setStyle({border:"0px"});},
	clickDeparture:function(){new XDCalendar("departuredate",{});},
	_oldIE:function(){
		return(Prototype.Browser.IE&&parseFloat(navigator.appVersion.split(';')[1].strip().split(' ')[1])<=6)?true:false;},
	isEmailValid:function(){var filter=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
		return(filter.test(this.emailInput.getValue()))?true:false;},
	controlDates:function(arr,dep){if(arr==""||dep=="")return 0;var dateFlag=1;this.dateStr="";
		var date1=new Date(arr);var date2=new Date(dep);
		if((date1.getTime())>(date2.getTime())){this.dateStr="Departure Date should not be anterior to arrival!";dateFlag=2;
		}else if((date1.getTime())==(date2.getTime())){thisdateStr="Departure and Arrival Dates are the same!";dateFlag=2;}
		if(dateFlag==2)alert(this.dateStr);return dateFlag;},
	checkForm:function(){
		var checkedOk=true,emailEmpty=false,fields="",field_names_array=new Array(),missing_fields_array=new Array();
		var fnv=this.firstNameInput.getValue();
		if(fnv==""){missing_fields_array.push(this.fnLabel);field_names_array.push("First Name");}else this.resetLabel(this.fnLabel);
		var lnv=this.lastNameInput.getValue();
		if(lnv==""){missing_fields_array.push(this.lnLabel);field_names_array.push("Last Name");}else this.resetLabel(this.lnLabel);
		var emv=this.emailInput.getValue();
		if(emv==""){missing_fields_array.push(this.emLabel);field_names_array.push("Email Address");emailEmpty=true;}else this.resetLabel(this.emLabel);
		var phv=this.phoneInput.getValue();
		if(phv==""){missing_fields_array.push(this.phLabel);field_names_array.push("Phone Number");}else this.resetLabel(this.phLabel);
		var ngv=this.guestsInput.getValue();
		if(ngv==""){missing_fields_array.push(this.ngLabel);field_names_array.push("Number of Guests");}else this.resetLabel(this.ngLabel);
		var cv=this.conventionInput.getValue();
		if(cv==""){missing_fields_array.push(this.convLabel);field_names_array.push("Convention or Vacation");}else this.resetLabel(this.convLabel);
		var arv=this.arrivalInput.getValue();
		if(arv==""){missing_fields_array.push(this.arrLabel);field_names_array.push("Arrival Date");}else this.resetLabel(this.arrLabel);
		var dev=this.departureInput.getValue();
		if(dev==""){missing_fields_array.push(this.depLabel);field_names_array.push("Departure Date");}else this.resetLabel(this.depLabel);
		for(var i=0,l=missing_fields_array.length;i<l;i++){this.hiliteLabel(missing_fields_array[i]);}
		for(var i=0,l=field_names_array.length;i<l;i++){fields+=" - "+field_names_array[i]+"\n";}
		if(missing_fields_array.length>0){checkedOk=false;
			this.formTitle.update("<u><b><i>Thank You</i></b> for completing the <span style=\"color:red;\">missing fields.</span></u>");
			var alert_str="Please, we would invite you to complete any missing fields (highlighted in red):\n";
			alert_str+=fields+"to facilitate the handling of your enquiry.\n\nThank You.";alert(alert_str);}
		if(!emailEmpty){if(!this.isEmailValid()){checkedOk=false;this.hiliteLabel(this.emLabel);
			var alert_str="Your Email Address is not valid!\nPlease provide us with a valid email address so that ";
			alert_str+="we can get back to you.\nThank You.";alert(alert_str);}else this.resetLabel(this.emLabel);}
		var dateFlag=this.controlDates(arv,dev);
		if(dateFlag==2){checkedOk=false;this.hiliteLabel(this.arrLabel);this.hiliteLabel(this.depLabel);
		}else if(dateFlag==1){this.resetLabel(this.arrLabel);this.resetLabel(this.depLabel);}return checkedOk;},
	submitForm:function(e){if(!this.checkForm())e.stop();},hiliteLabel:function(c){c.setStyle({color:"#FF0000"});},
	resetLabel:function(l){l.setStyle({color:"#002244"});}
});
var btllink="";
BackToListing=Class.create({
	initialize:function(){},
	initDivs:function(){this.imageDiv=$("btl");this.titleDiv=$("prop_title_id_div");
		this.btlNotify=$("btl_notify").setOpacity(0.0).update("Back to Listing");
		this.span=$("btlspan");this.setObservers();},
	setObservers:function(){this.imageDiv.observe("mouseover",this.eventHandler.bindAsEventListener(this,"mouseover"));
		this.imageDiv.observe("mouseout",this.eventHandler.bindAsEventListener(this,"mouseout"));
		this.imageDiv.observe("click",this.eventHandler.bindAsEventListener(this,"click"));},
	getLink:function(hl){this.hlink=hl;},
	eventHandler:function(e,r){var params=$A(arguments),el=params[0].element(),reason=params[1];
		if(reason=="mouseover"){if(el==this.imageDiv){el.setStyle({border:"2px solid #069"});
				this.titleDiv.setStyle({fontWeight:"bold",color:"#069"});this.span.setStyle({color:"#069"});
				new Effect.Opacity(this.btlNotify,{duration:0.25,from:0.0,to:1.0});}
		}else if(reason=="mouseout"){if(el==this.imageDiv){el.setStyle({border:"1px solid #036"});
				this.titleDiv.setStyle({fontWeight:"normal",color:"#036"});this.span.setStyle({color:"#036"});
				new Effect.Opacity(this.btlNotify,{duration:0.25,from:1.0,to:0.0});}
		}else if(reason=="click"){if(el==this.imageDiv)window.location.href=this.hlink;}}
});
ConventionPopupHandler=Class.create({
initialize:function(){this.elementArray=$("midem_upper_link","mipim_upper_link","miptv_upper_link","festival_upper_link","lions_upper_link","mipcom_upper_link","boat_show_upper_link","tfwa_upper_link","mapic_upper_link");for(var i=0,l=this.elementArray.length;i<l;++i)this.elementArray[i].observe("click",this.convHandler.bindAsEventListener(this));},
	convHandler:function(e){switch(e.element().identify()){
		case"midem_upper_link":e.stop();new XDEV.WIN.PropertyTypeDlg("MIDEM").show();break;
		case"mipim_upper_link":e.stop();new XDEV.WIN.PropertyTypeDlg("MIPIM").show();break;
		case"miptv_upper_link":e.stop();new XDEV.WIN.PropertyTypeDlg("MIPTV").show();break;
		case"festival_upper_link":e.stop();new XDEV.WIN.PropertyTypeDlg("Film Festival").show();break;
		case"lions_upper_link":e.stop();new XDEV.WIN.PropertyTypeDlg("LIONS").show();break;
		case"mipcom_upper_link":e.stop();new XDEV.WIN.PropertyTypeDlg("MIPCOM").show();break;
		case"boat_show_upper_link":e.stop();new XDEV.WIN.PropertyTypeDlg("Boat &amp; Yacht Show").show();break;
		case"tfwa_upper_link":e.stop();new XDEV.WIN.PropertyTypeDlg("TFWA Tax Free").show();break;
		case"mapic_upper_link":e.stop();new XDEV.WIN.PropertyTypeDlg("MAPIC").show();break;}}
});
var btl=new BackToListing();
Event.observe(document,"dom:loaded",function(){new FormManager("contact");if($("prop_thumb"))btl.initDivs();
	new DHTMLMenu();new ConventionPopupHandler();new VertPopupSubMenus();});
