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 #002244",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>Property Service - Cannes Property Rentals</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",backgroundColor:"#FFFFCC",border:"1px solid #002244",padding:"2px",textAlign:"center",zIndex:8});
		var html="<span style=\"color:#006699;font-size:14px;font-weight:bold;\">Property Service Office</span><br />";
		html+="<span style=\"font-size:11px;font-weight:normal;color:#666666;\">\"Le Mercure\" 11, rue du Vingt Quatre Août</span>";
		html+="<br /><span style=\"font-size:12px;font-weight:bold;color:#003366;\">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();
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});}
});
Event.observe(document,"dom:loaded",function(){									 
	//ip=new imagePreloader("/images/cpr_prim_button_hover_bkg.png","/images/cpr_sec_button_hover_bkg.png","/images/cpr_ter_button_hover_bkg.png","/images/cpr_logo_hover.png");
	sm.initializeMap();
	new XDEV.textColorFx(document.getElementsByTagName("H2")[0],"#00F","#069","#060","#024",4,4);
	new VillaPopupSubMenu();
});
Event.observe(window,"unload",function(){GUnload();});