var clickmessage="All graphics Copyright © 2009 Property Service SARL / www.cannes-filmfestival-accommodation.com";
function disableclick(e){
if(document.all){if(event.button==2||event.button==3){if(event.srcElement.tagName=="IMG"){alert(clickmessage);
return false;}}}else if(document.layers){if(e.which==3){alert(clickmessage);return false;}}
else if(document.getElementById)if(e.which==3&&e.target.tagName=="IMG")setTimeout("alert(clickmessage)",0);}
function associateimages(){for(i=0;i<document.images.length;i++)document.images[i].onmousedown=disableclick;}
if(document.all){document.onmousedown=disableclick;for(var i_tem=0;i_tem<document.images.length;i_tem++)
document.images[i_tem].galleryimg='no';}else if(document.getElementById)document.onmouseup=disableclick;
else if (document.layers)associateimages();
if((typeof Prototype=='undefined')||(typeof Element=='undefined')||(typeof Element.Methods=='undefined'))
	throw("Prototype JS framework >= 1.6.0.3 is required");
Element.addMethods({pngHack:function(el){var el=$(el);
		var ie7plus=(Prototype.Browser.IE&&parseFloat(navigator.appVersion.split(';')[1].strip().split(' ')[1])>=7)?true:false;
    	if(!Prototype.Browser.IE||ie7plus)return el;var gif="images/s.gif";
    	if((el.match('img'))&&(el.src.include("png"))){var alphaImgSrc=el.src;var sizingMethod="scale";el.src=gif;
    	}else if(el.getStyle("backgroundImage").include("png")){
      		var bgc=el.getStyle("backgroundColor")||"",alphaImgSrc=el.getStyle("backgroundImage").gsub(/url\(|\)|'|"/,"");
      		var sizingMethod="crop";el.setStyle({background:[bgc,"url(", gif, ") no-repeat"].join("")});
    	}else{return el;}
    el.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='#{al}',sizingMethod='#{sz}')".interpolate({al: alphaImgSrc,sz:sizingMethod});return el;}
});
BannerAnimation=Class.create({
	initialize:function(){$("golden_palm").setStyle({opacity:0.0});$("sixty_second").setStyle({opacity:0.0});
		setTimeout(function(){new Effect.Opacity($("golden_palm"),{duration:7.0,from:0.0,to:1.0});},3000);
		setTimeout(function(){new Effect.Opacity($("sixty_second"),{duration:7.0,from:0.0,to:1.0});},10000);}
});
TextColorFx=Class.create({
	initialize:function(div,clr1,clr2,clr3,clr4,duration,delay){this.textDiv=$(div);this.color1=clr1;this.color2=clr2;
	this.color3=clr3;this.color4=clr4;this.originalColor=this.textDiv.getStyle("color");
	this.duration=duration;this.delay=delay;this.toClr1();},
	toClr1:function(){new Effect.Morph(this.textDiv,{style:"color:"+this.color1,delay:this.delay,duration:this.duration,afterFinish:this.toClr2.bind(this)});},
	toClr2:function(){new Effect.Morph(this.textDiv,{style:"color:"+this.color2,duration:this.duration,afterFinish:this.toClr3.bind(this)});},
	toClr3:function(){new Effect.Morph(this.textDiv,{style:"color:"+this.color3,duration:this.duration,afterFinish:this.toClr4.bind(this)});},
	toClr4:function(){new Effect.Morph(this.textDiv,{style:"color:"+this.color4,duration:this.duration,afterFinish:this.toOrigin.bind(this)});},toOrigin:function(){new Effect.Morph(this.textDiv,{style:"color:"+this.originalColor.toString(),duration:this.duration,afterFinish:this.toClr1.bind(this)});}
});
VillaPopupSubMenu=Class.create({
	initialize:function(){this.tc=0;this.vb=$("villa_hlink");this.vp=$("villa_popup");this.vpLinks=$$("a.vp_links");
		for(var i=0,l=this.vpLinks.length;i<l;++i){this.vpLinks[i].observe("click",this.hvp.bind(this));}
		this.vb.observe("mouseover",this.ch.bind(this,true));this.vb.observe("mouseout",this.ch.bind(this,false));
		this.vp.observe("mouseover",this.ch.bind(this,true));this.vp.observe("mouseout",this.ch.bind(this,false));},
	ch:function(s){if(s){
			this.vp.setStyle({display:"block",visibility:"visible",zIndex:7777});if(this.tc>0)window.clearTimeout(this.tc);
		}else this.tc=this.hvp.bind(this).delay(0.7);},
	hvp:function(){this.vp.setStyle({display:"none",visibility:"hidden",zIndex:0});}
});
SimpleGMap=Class.create({
	initialize:function(){this.latitude=43.5531496;this.longitude=7.0193708;
		this.mapDiv;this.map;this.icon;this.officeMarker;this.originalZoomFactor;this.zoominButton;this.zoomoutButton;
	},
	initializeMap:function(){
		this.mapDiv=$("office_map");
		if (GBrowserIsCompatible()) {
			this.map=new GMap2(this.mapDiv);
			this.map.setCenter(new GLatLng(this.latitude,this.longitude),16,G_NORMAL_MAP);
			this.map.addControl(new GMapTypeControl());
			this.icon=new GIcon();this.icon.iconSize=new GSize(32,32);this.icon.image="/images/gmap_icon_blue.png";this.icon.iconAnchor=new GPoint(16,32);
			this.officeMarker=new GMarker(new GLatLng(this.latitude,this.longitude),this.icon);
			this.officeMarkerHoverHandler=this.officeMarkerHover.bind(this);
			this.officeMarkerOutHandler=this.officeMarkerOut.bind(this);
			GEvent.addListener(this.officeMarker,"mouseover",this.officeMarkerHoverHandler);
			GEvent.addListener(this.officeMarker,"mouseout",this.officeMarkerOutHandler);
			this.map.addOverlay(this.officeMarker);this.originalZoomFactor=this.map.getZoom();
		}
		this.createDivs();this.setHandlers();this.startObservers();
	},
	createDivs:function(){
		this.lowerDiv=new Element("div").setStyle({position:"absolute",left:"0px",bottom:"0px",width:"548px",height:"40px",
			borderTop:"1px solid #CCC",backgroundImage:"url(/images/gmap_console_bkg.png)",backgroundRepeat:"repeat-x",lineHeight:"11px",zIndex:7});
		this.mapDiv.insert(this.lowerDiv);
		this.labelDiv=new Element("div").setStyle({position:"absolute",left:"0px",top:"3px",width:"270px",height:"35px"});
		this.companyHtml="<strong>Cannes Film Festival Accommodation</strong>";
		this.companyHtml+="<br /><span style=\"font-size:11px;color:#666666;line-height:12px;\">\"Le Mercure\" 11, rue du Vingt Quatre Août</span>";
		this.companyHtml+="<br />06400 - Cannes <strong>FRANCE</strong>";
		this.labelDiv.update(this.companyHtml);
		this.lowerDiv.insert(this.labelDiv);
		this.phoneDiv=new Element("div").setStyle({position:"absolute",left:"320px",top:"8px",width:"auto",height:"35px",textAlign:"left"});
		this.phoneHtml="<strong>Phone: +33 (0) 493 681 556<br />Fax: +33 (0) 493 388 664</strong>";
		this.phoneDiv.update(this.phoneHtml);
		this.lowerDiv.insert(this.phoneDiv);
		this.zoominButton=new Element("div").setStyle({position:"absolute",right:"5px",top:"2px",width:"14px",height:"14px",
			border:"1px solid #002244",textAlign:"center",fontSize:"16px",lineHeight:"13px",cursor:"pointer"});
		this.zoominButton.update("+");
		this.lowerDiv.insert(this.zoominButton);
		this.zoomoutButton=new Element("div").setStyle({position:"absolute",right:"5px",bottom:"2px",width:"14px",height:"14px",
			border:"1px solid #002244",textAlign:"center",fontSize:"16px",lineHeight:"13px",cursor:"pointer"});
		this.zoomoutButton.update("-");
		this.lowerDiv.insert(this.zoomoutButton);
	},
	setHandlers:function(){
		this.buttonClickHandler=this.buttonClick.bindAsEventListener(this);
		this.buttonHoverHandler=this.buttonHover.bindAsEventListener(this);
		this.buttonOutHandler=this.buttonOut.bindAsEventListener(this);
		this.keyboardHandler=this.keyboardAction.bindAsEventListener(this);
	},
	startObservers:function(){
		this.zoominButton.observe("click",this.buttonClickHandler);
		this.zoominButton.observe("mouseover",this.buttonHoverHandler);
		this.zoominButton.observe("mouseout",this.buttonOutHandler);
		this.zoomoutButton.observe("click",this.buttonClickHandler);
		this.zoomoutButton.observe("mouseover",this.buttonHoverHandler);
		this.zoomoutButton.observe("mouseout",this.buttonOutHandler);
		document.observe("keydown",this.keyboardHandler); 
	},
	buttonClick:function(e){
		switch(Event.element(e)){
			case this.zoominButton:var zf=this.map.getZoom();this.map.setZoom(zf+1);break
			case this.zoomoutButton:var zf=this.map.getZoom();this.map.setZoom(zf-1);break
		}
	},
	showInfoDiv:function(){
		this.infoDiv=new Element("div").setStyle({position:"absolute",left:"10px",top:"10px",width:"240px",height:"auto",
			backgroundImage:"url(/images/gmap_office_bkg.png)",backgroundRepeat:"repeat-x",border:"1px solid #555",padding:"2px",textAlign:"center",zIndex:8, opacity:.85});
		var html="<span style=\"color:#004477;font-size:14px;font-weight:bold;\">Property Service Office</span><br />";
		html+="<span style=\"font-size:11px;font-weight:normal;color:#333;\">\"Le Mercure\" 11, rue du Vingt Quatre Août</span>";
		html+="<br /><span style=\"font-size:12px;font-weight:bold;color:#024;\">2nd Floor - Open: 10:00 to 19:00</span>";
		this.infoDiv.update(html);this.mapDiv.insert(this.infoDiv);
	},
	removeInfoDiv:function(){this.infoDiv.remove();},
	officeMarkerHover:function(){this.showInfoDiv();},
	officeMarkerOut:function(){this.removeInfoDiv();},
	buttonHover:function(e){Event.element(e).setStyle({color:"#0000FF",fontWeight:"bold",backgroundColor:"#FFFFFF"});},
	buttonOut:function(e){Event.element(e).setStyle({color:"#002244",fontWeight:"normal",backgroundColor:""});},
	keyboardAction:function(event){
        var keycode=event.keyCode,key=String.fromCharCode(keycode).toLowerCase(),zf=this.map.getZoom();
		if((key=='+')||(keycode==107))this.map.setZoom(zf+1);else if((key=='-')||(keycode==109))this.map.setZoom(zf-1);				
		else if((key=='u')||(keycode==85))this.map.panDirection(0,+1);else if((key=='d')||(keycode==68))this.map.panDirection(0,-1);			
		else if((key=='l')||(keycode==76))this.map.panDirection(+1,0);else if((key=='r')||(keycode==82))this.map.panDirection(-1,0); 			
    }
});
var sm=new SimpleGMap();
Event.observe(document,"dom:loaded",function(){									 
	sm.initializeMap();
	new BannerAnimation();
	new TextColorFx("about_title_text","#00F","#006000","#000","#7C010E",4,4);
	new TextColorFx("office_title","#00F","#006000","#000","#7C010E",4,4);
	new VillaPopupSubMenu();
});
Event.observe(window,"unload",function(){GUnload();});