var Apartment = new Class({
	
	id		: undefined,
	image	: undefined,
	wrapper	: undefined,
	content	: undefined,
	data 	: undefined,
	
	favorite: 			false,
	viewingMoreInfo:	false,
	loadingMoreInfo: 	false,
	onStreetView: 		false,
	
	dataProperties: {
		imageProperty		: "mainImage",
		thumbnailProperty	: "thumbnail",
		idProperty			: "apartmentId",
		contentProperty		: "conditions",
		titleProperty		: "title",
		imagesProperty		: "imgs",
		descriptionProperty : "description",
		street1Property 	: "street1",
		street2Property 	: "street2",
		servicesProperty	: "services",
		crsLabelProperty	: "CRSLabel",
		cityProperty		: "city",
		postalCodeProperty	: "postalCode",
		latitudeProperty	: "latitude",
		longitudeProperty	: "longitude",
		
		pricePerDayProperty			: "priceperday",
		pricePerPerPersonProperty	: "priceperpersonday",
		totalProperty				: "totalprice",
		priceFromProperty			: "fromPrice",
		
		conditions : {"capacity" : {label:"Capacidad", tail:" plazas"}, 
					  "sofabeds" : {label:"Sofás-cama", tail:""}, 
					  "bedrooms" : {label:"Habitaciones", tail:""}, 
					  "area" 	 : {label:"Superficie", tail:"m&sup2;"}, 
					  "toilets"  : {label:"Baños", tail:""}, 
					  "deposit"  : {label:"Depósito", tail:"&euro;"}
					  }
	},
	
	ajaxProperties: {
		AJAX_KEY_CRS_ID : "CRS_ID",
		AJAX_KEY_APARTMENT_ID : "APARTMENT_ID"
	},
	
	initialize: function(data, withComments)
	{
		this.data = data;
		this.setUp();
		
		if(($defined(withComments)) && (withComments == true))
		{
			this.setUpComments();
		}
		
		this.loaded();
		
	},
	
	loaded: function()
	{
		this.bus.trigger("apartmentLoaded", this.data);
	},
	
	moreInfoShowed: function(apartment)
	{
		if(apartment.getId() != this.getId())
		{
			this.hideMoreInfo();
		}
	},
	
	setUp: function()
	{
		this.bus = new SearchBus();
		//console.log("wtf");/* NEW FEATURE AGILITY CODING PRO SISTEM ENCOURAGEMENT DEPLOY MORE SUPPLYS */
		this.bus.registerCallback(this.moreInfoShowed.bind(this), "showMoreInfo");
		
		
		this.id 			= this.data[this.dataProperties.idProperty];
		this.wrapper		= new Element("div", {"class":"apartment","id": this.getId()});
		
		this.infoContainer	= new Element("div", {"class":"apartmentInfo"}).inject(this.wrapper);
		this.infoContainer.addEvent("mouseenter", this.mouseenter.bind(this));
		this.infoContainer.addEvent("mouseleave", this.mouseleave.bind(this));
		this.infoContainer.addEvent("click", this.click.bind(this));
		this.infoContainer.set("tween", {transition:"Quint:out", duration:400});
		
		this.title = new Element("h1", {text:this.data[this.dataProperties.titleProperty]}).inject(this.infoContainer);
		this.title.addEvent("click", function(event){event.stop()});
		this.title.addEvent("click", this.moreInfo.bind(this));
		this.content	= new Element("div", {"class":"text"}).inject(this.infoContainer);
		
		this.image 		= new Element("img", {"src":this.data[this.dataProperties.imageProperty], "class":"mainImage"}).inject(this.wrapper);
		this.image.set("tween", {transition:"Quint:out", duration:400});
		this.image.addEvent("click", this.moreInfo.bind(this));
		this.printListInfo();
		
		this.content.set("morph", {transition:"Quint:out", duration:400});
		
		this.createPriceInfo();
		
		//this.buttons	= new Element("div", {"class":"apartmentButtons"}).inject(this.wrapper);
		this.addToFavorite = new Element("a", {href:"#", title:"Añadir a Favoritos", "class": "addToPrefered", "html": "<span></span>compara y comparte"})/*.inject(this.infoContainer);*/
		this.addToFavorite.addEvent("click", function(event){event.stop()});
		this.addToFavorite.addEvent("click", this.addToFavorites.bind(this));
		
		this.chooseButtonContainer = new Element("div", {"class": "bookNow"}).inject(this.wrapper);
		this.chooseButton = new Element("a", {href:"#", text:"Reserva este apartamento"}).inject(this.chooseButtonContainer);
		this.chooseButton.addEvent("click", function(event){event.stop()});
		this.chooseButton.addEvent("click", this.choose.bind(this));
		
		var target 	= this.wrapper;
		var where 	= undefined;
		
		if($defined(this.commentsContainer))
		{
			var target 	= this.commentsContainer;
			var where 	= "before";
		}
		
		this.moreInfoBottomContainer 	= new Element("div", {"class":"moreInfo bottom"}).inject(target, where);
		this.moreInfoBottomContainer.set("tween", {duration:400, transition:"Quint:out"});
		this.moreInfoTopContainer 	= new Element("div", {"class":"moreInfo top"}).inject(this.infoContainer, "after");
		/*this.moreInfoButton = new Element("a", {href:"#", text:"+ info", "class": "moreInfo"}).inject(this.wrapper);
		this.moreInfoButton.addEvent("click", function(event){event.stop()});
		this.moreInfoButton.addEvent("click", this.moreInfo.bind(this));*/
		
		this.crsLabel = new Element("div", {"class":"providerInfo", html:"<span>vía</span> "+this.data[this.dataProperties.crsLabelProperty]}).inject(this.infoContainer);
		
	},
	
	requestFinalPrice: function()
	{
		var data = this.getIdObject();
		var requestURL = "public/multicrsapartmentselectioncontroller/getfinalprice";
		if($defined(document.baseURL))
		{
			requestURL = document.baseURL + requestURL;
		}
		new Request.JSON({url:requestURL, data:{"QUERY":JSON.encode(data)}, 
		onComplete:function(response){
			
			if(response.ANSWER.result == false) 
			{
				return false;
			}
			
			this.updatePrices(response.ANSWER.result);			
			
		}.bind(this)}).send();
	},
	
	createPriceInfo: function()
	{
		this.prices			= new Element("div", {"class":"prices"}).inject(this.infoContainer);
		this.pricePerPersonContainer 	= new Element("div", {"class":"price first", html:"<strong>Precio por persona/día</strong>"}).inject(this.prices);
		this.pricePerDayContainer 		= new Element("div", {"class":"price", html:"<strong>Precio por día</strong>"}).inject(this.prices);
		this.totalContainer 			= new Element("div", {"class":"price", html:"<strong>Total estancia</strong>"}).inject(this.prices);
		
		var priceToShow = this.data[this.dataProperties.totalProperty];
		var priceInfo = "";
		
		if(priceToShow == "" || priceToShow == null)
		{
			priceToShow = this.data[this.dataProperties.priceFromProperty];
			priceInfo = "* precio desde";
			this.requestFinalPrice();
		}
		
		var perPerson = this.data[this.dataProperties.pricePerPerPersonProperty];
		var perPersonDay = this.data[this.dataProperties.pricePerDayProperty];
		
		
		this.pricePerPerson 	= new Element("span").inject(this.pricePerPersonContainer);
		this.pricePerDay		= new Element("span").inject(this.pricePerDayContainer);
		this.total				= new Element("span").inject(this.totalContainer);
		this.priceInfo			= new Element("span", {"class":"priceInfo", text:priceInfo}).inject(this.totalContainer);
		
		
		this.setPrices(priceToShow, perPerson, perPersonDay);
	},
	
	setPrices: function(price, perPerson, perPersonDay)
	{
		this.pricePerPerson.set("html", perPerson+"&nbsp;&euro;");
		this.pricePerDay.set("html", perPersonDay+"&nbsp;&euro;");
		this.total.set("html", price+"&nbsp;&euro;");
	},
	
	updatePrices: function(newPrices)
	{
		this.data = $merge(this.data, newPrices);
		
		var totalPrice = newPrices[this.dataProperties.totalProperty];
		var perPerson = newPrices[this.dataProperties.pricePerPerPersonProperty];
		var perPersonDay = newPrices[this.dataProperties.pricePerDayProperty];
		this.priceInfo.set("html", "");
		
		this.setPrices(totalPrice, perPerson, perPersonDay);
	},
	
	printListInfo: function()
	{
		this.conditions = new Element("ul", {"class":"features"}).inject(this.content);
		$H(this.dataProperties.conditions).each(function(value, key){
			new Element("li", {html:"<span>"+value.label+"</span> <strong>"+this.data[key]+value.tail+"</strong>"}).inject(this.conditions);
		}.bind(this));
	},
	
	choose: function()
	{
		this.bus.trigger("apartmentReservation", this);
		try{
			pageTracker._trackPageview("/apartmentReservation-"+this.getId());
			pageTracker._trackPageview("/apartmentReservation");
		}
		catch(exception){}
	},
	
	moreInfo: function()
	{
		if(this.loadingMoreInfo)
		{
			return false;
		}
		
		if(this.viewingMoreInfo)
		{
			this.hideMoreInfo();
			return;
		}
		
		if($defined(this.data.moreInfo))
		{
			this.showMoreInfo();
		}
		else
		{
			this.getMoreInfo();
		}
	},
	
	getMoreInfo: function()
	{
		this.moreInfoBottomContainer.addClass("loading");
		this.moreInfoBottomContainer.setStyles({
			"height": "30px"
		});
		this.moreInfoBottomContainer.set("text", "Cargando...");
		this.loadingMoreInfo = true;
		var data = this.getIdObject();
		var requestURL = "public/multicrsapartmentselectioncontroller/getapartmentdetails";
		if($defined(document.baseURL))
		{
			requestURL = document.baseURL + requestURL;
		}
		new Request.JSON({url:requestURL, data:{"QUERY":JSON.encode(data)}, onComplete:this.getMoreInfoComplete.bind(this)}).send();
	},
	
	showMoreInfo: function()
	{
		if(!$defined(this.panorama))
		{
			this.createMoreInfo(this.data.moreInfo);
		}
		
		this.bus.trigger("showMoreInfo", this);
		this.moreInfoBottomContainer.tween("height", this.moreInfoBottomContainer.getScrollSize().y);
		this.moreInfoTopContainer.tween("height", this.moreInfoTopContainer.getScrollSize().y);
		
		this.moreInfoBottomContainer.setStyle("margin-bottom", 10);
		this.moreInfoTopContainer.setStyle("margin-bottom", 10);
		
		this.viewingMoreInfo 	= true;
		try{
			pageTracker._trackPageview("/apartmentShowMoreInfo-"+this.getId());
		}
		catch(exception){}
	},
	
	hideMoreInfo: function(instant)
	{
		
		if(!$defined(this.moreInfoBottomContainer))
		{
			return false;
		}
		
		if($defined(instant) && instant == true)
		{
			this.moreInfoBottomContainer.setStyle("height", 0);
			this.moreInfoTopContainer.setStyle("height", 0);
		}
		else
		{
			try {
				this.moreInfoBottomContainer.tween("height", "0px");
				this.moreInfoTopContainer.tween("height", "0px");
				
				this.moreInfoBottomContainer.setStyle("margin-bottom", 0);
				this.moreInfoTopContainer.setStyle("margin-bottom", 0);
			}
			catch(exception)
			{
				
			}
			
			/*this.moreInfoBottomContainer.morph(".minimizedInfo");
			this.moreInfoTopContainer.morph(".minimizedInfo");*/
		}
		this.image.setStyle("display","block");
		
		
		this.viewingMoreInfo = false;
		
	},
	
	getMoreInfoComplete: function(response)
	{
		this.moreInfoBottomContainer.set("text", "");
		this.loadingMoreInfo = false;
		if(response.ANSWER.result == false)
		{
			return false;
		}

		this.createMoreInfo(response.ANSWER.result);
		this.data.moreInfo 	= response.ANSWER.result
		this.showMoreInfo();
		this.moreInfoBottomContainer.removeClass("loading");
	},
	
	createMoreInfo: function(moreInfo)
	{
		this.panorama				= new Element("div", {"class":"panorama"}).inject(this.moreInfoTopContainer);
		this.mapSwitcher 			= new Element("a", {href:"#", "text":"Ver localización en Google Street View", "class":"mapSwitcher"}).inject(this.moreInfoTopContainer); 
		this.map 					= new Element("div", {"class":"map"}).inject(this.moreInfoTopContainer);
		this.moreInfoTopContainer.set("tween", {duration:400, transition:"Quint:out", onComplete:function(){
			if(!$defined(this.gmaps))
			{
				var options = {};
				options.mapOptions = {};
				options.mapOptions.zoom = 15;
				
				this.gmaps = new MooMap(this.map, undefined, options);
				this.gmaps.addEvent("onMarkerAdd", function(marker){
                   	this.gmaps.center(marker.getLatLng());
				   	this.gmaps.streetView(this.panorama, marker.getLatLng());
               	}.bind(this));
				
				this.gmaps.addEvent("streetViewError", function(errorCode, panorama){
					
					/*if(errorCode == 600)
					{
						panorama.set("html", "<div class='error'> No existe street view para esta direccion </div>");
					}
					
					if(errorCode == 603)
					{
						panorama.set("html", "<div class='error'> Tu navegador no soporta flash </div>");
					}*/
					
					this.mapSwitcher.removeEvents();
					this.mapSwitcher.addEvent("click", function(e){if(e)e.stop()});
					this.mapSwitcher.destroy();
					
				}.bind(this))
				
				var mapsData = this.getMapsData(); 
				this.gmaps.addMarker(mapsData);
			}
		}.bind(this)});
		
		this.mapSwitcher.addEvent("click", function(e){if(e)e.stop()});
		this.mapSwitcher.addEvent("click", this.switchMap.bind(this));
		
		
		
		this.leftColumn = new Element("div", {"class":"column left", html:"<h2>Descripción</h2>"}).inject(this.moreInfoBottomContainer);
		this.descriptionScrollerContainer = new Element("div", {"class":"descriptionScrollContainer"}).inject(this.leftColumn);
		
		var description = moreInfo[this.dataProperties.descriptionProperty];
		if(description == "")
		{
			description = "Descripción no disponible";
		}
		
		this.descriptionContainer = new Element("div", {"class":"text", "html":description}).inject(this.descriptionScrollerContainer);
		this.scroller = new DaneMooScroll(this.descriptionScrollerContainer);
		this.rightColumn = new Element("div", {"class":"column right", html:"<h2>Localización</h2>"}).inject(this.moreInfoBottomContainer);
		
		var localizationHTML = this.generateLocalizationHTML(moreInfo);
		
		this.textLocalization = new Element("div", {"class":"text hcard", html:localizationHTML}).inject(this.rightColumn);
		
		var titleServices = new Element("h2", {text:"Servicios"}).inject(this.rightColumn);
		this.textServices = new Element("div", {"class":"text"}).inject(this.rightColumn);
		this.printServices(moreInfo[this.dataProperties.servicesProperty], this.textServices);
		
		this.printImages(moreInfo[this.dataProperties.imagesProperty]);
		
		this.moreInfoBottomContainer.setStyles({"height": 0, "overflow":"hidden"});
		this.moreInfoTopContainer.setStyles({"height": 0, "overflow":"hidden"});
	},
	
	generateLocalizationHTML: function(moreInfo)
	{
		var result = "";
		result += "<span>referencia: <strong>"+this.getId()+"</strong></span><br/>";
		result += "<div class='adr'><span>ciudad: </span><strong><span class='locality'>"+moreInfo[this.dataProperties.cityProperty]+"</span></strong><br>";
		
		var addressText = "";
		
		if(moreInfo[this.dataProperties.street1Property] != "" && moreInfo[this.dataProperties.street1Property] != null)
		{
			addressText = "dirección: <strong><span class='street-adress'>"+moreInfo[this.dataProperties.street1Property]+"</span></strong><br />";
		}
		
		if(moreInfo[this.dataProperties.street1Property] != "" && moreInfo[this.dataProperties.street1Property] != null && moreInfo[this.dataProperties.street2Property] != "" && moreInfo[this.dataProperties.street2Property] != null)
		{
			addressText = "dirección: <strong><span class='street-adress'>"+moreInfo[this.dataProperties.street1Property]+"</span>, <span class='extended-address'>"+moreInfo[this.dataProperties.street2Property]+"</span></strong><br />";
		}
		
		result += addressText;
		
		if (moreInfo[this.dataProperties.postalCodeProperty] != "" &&moreInfo[this.dataProperties.postalCodeProperty] != null) 
		{
			result += "<span>código postal: </span> <strong><span class='postal-code'>"+moreInfo[this.dataProperties.postalCodeProperty]+"</span></strong><br />";
		}
		result += "</div>";
		
		if (moreInfo[this.dataProperties.latitudeProperty] != null && moreInfo[this.dataProperties.longitudeProperty] != null)
		{
			result += "<div class='geo'><span>coordenadas GPS: </span> <strong><span class='latitude'>"+moreInfo[this.dataProperties.latitudeProperty]+"</span><span class='longitude'>"+moreInfo[this.dataProperties.longitudeProperty]+"</span></strong></div>";
		} 
		
		return result;
	},
	
	getMapsData: function()
	{
		var result = {};
		var moreInfo = this.data.moreInfo;
		result.id = this.getId();
		if(moreInfo.longitude != null && moreInfo.latitude != null)
		{
			result.gps = {};
			result.gps.lat = (moreInfo.latitude);
			result.gps.lng = (moreInfo.longitude);
		}
		result.address = moreInfo.street1+" "+moreInfo.street2+", "+moreInfo.postalCode+" "+moreInfo.city;
		return result;
	},
	
	switchMap: function() 
	{
		if(this.onStreetView)
		{
			this.toMap();
		}
		else
		{
			this.toStreetView();
		}
	},
	
	toStreetView: function()
	{
		this.map.setStyle("display", "none");
		this.panorama.setStyle("display", "block");
		this.mapSwitcher.set("text", "Ver localización en Google Maps");
		this.onStreetView = true;
	},
	
	toMap : function()
	{
		this.map.setStyle("display", "block");
		this.panorama.setStyle("display", "none");
		this.mapSwitcher.set("text", "Ver localización en Google Street View");
		this.onStreetView = false;
	},
	
	printServices: function(services, container)
	{
		this.services = new Element("ul", {"class":"services"}).inject(container);
		services.each(function(service){
			new Element("li", {html:service}).inject(this.services);
		}.bind(this))
		
		/*$H(services).each(function(service){
			var text = service.label;
			if(service.price > 0)
			{
				text = text+" ("+service.price+" "+service.unit+")";
			}
			new Element("li", {html:text}).inject(this.services);
		}.bind(this));*/
	},
	
	printDescription: function(description)
	{
		//this.description = new Element("div", {"class":"description", "html":"<pre>"+description+"</pre>"}).inject(this.moreInfoBottomContainer);
	},
	
	printImages: function(images)
	{
		
		if(images.length == 0)
		{
			return false;
		}
		
		this.imagesContainer = new Element("div", {"class":"imagesContainer"}).inject(this.moreInfoTopContainer);
		this.controls = new Element("div", {"class":"viewerControls"}).inject(this.imagesContainer);
		this.controls.setStyle("opacity", ".6");
		this.controls.set("tween", {duration:400, transition:"Quint:out"});
		this.images = new Element("ul", {"class":"imageViewer"}).inject(this.imagesContainer);
		
		this.prevImageButton = new Element("a", {href:"#", "class":"prevImage"}).inject(this.controls);
		this.switchPlayButton = new Element("a", {href:"#", "class":"pause"}).inject(this.controls);
		this.nextImageButton = new Element("a", {href:"#", "class":"nextImage"}).inject(this.controls);
		this.prevImageButton.addEvent("click", function(e){if(e){e.stop()}});
		this.nextImageButton.addEvent("click", function(e){if(e){e.stop()}});
		this.switchPlayButton.addEvent("click", function(e){if(e){e.stop()}});
		
		var originalControlsTop = this.controls.getStyle("top");
		this.imagesContainer.addEvent("mouseenter", function(){
			this.controls.tween("top","0");			
		}.bind(this))
		
		this.imagesContainer.addEvent("mouseleave", function(){
			this.controls.tween("top", originalControlsTop);			
		}.bind(this))
		
		images.each(function(image){
			var li 		= new Element("li").inject(this.images);
			var img 	= new Element("img", {"src":image}).inject(li);
		}.bind(this));
		
		this.viewer = new viewer(this.images.getElements("li"),{
			mode: 'alpha',
			interval: 5000
		});
		
		this.prevImageButton.addEvent('click',function(){
			this.viewer.previous();
			this.viewer.stop();
			this.switchPlayButton.set("class", "pause");
		}.bind(this));
		
		this.nextImageButton.addEvent('click',function(){
			this.viewer.next();
			this.viewer.stop();
			this.switchPlayButton.set("class", "pause");
		}.bind(this));
		
		this.switchPlayButton.ongoing = true;
		this.switchPlayButton.addEvent("click", function(){
			if(this.switchPlayButton.ongoing)
			{
				this.viewer.stop();
				this.switchPlayButton.set("class", "play");
				this.switchPlayButton.ongoing = false;	
			}
			else
			{
				this.viewer.play(true);
				this.switchPlayButton.set("class", "pause");
				this.switchPlayButton.ongoing = true;
			}
		}.bind(this))
		
		this.viewer.play(true);
		
	},
	
	addToFavorites: function()
	{
		if(this.favorite)
		{
			
			this.bus.trigger("favoriteRemoved", this);
			this.removedFromFavorites();
		}
		else
		{
			this.bus.trigger("addFavoriteApartment", this);
			this.markFavorite();
		}
	},
	
	markFavorite: function(data)
	{
		this.addToFavorite.set("title", "Eliminar de Favoritos");
		this.wrapper.addClass("favorite");
		this.favorite = true;
	},
	
	removedFromFavorites: function()
	{
		this.addToFavorite.set("title", "Añadir a Favoritos");
		this.wrapper.removeClass("favorite");
		this.favorite = false;
	},
	
	setUpComments: function()
	{
		this.commentsContainer 	= new Element("div", {"class":"commentsContainer"}).inject(this.wrapper);
		
		this.commentsButton 	= new Element("a", {href:"#", "class":"commentsButton", "text":"+ comentario"}).inject(this.commentsContainer, "after");
		this.commentsButton.addEvent("click", function(event){event.stop()});
		this.commentsButton.addEvent("click", this.showCommentsForm.bind(this));
		
		this.form 				= new FormComments();
		this.form.addEvent("onSend", this.formSended.bind(this));
		
		if($defined(this.data.comments))
		{
			this.data.comments.each(this.createComment.bind(this));
		}
		else
		{
			this.data.comments = [];
		}
	},
	
	showCommentsForm: function()
	{
		this.form.inject(this.commentsButton, "after");
	},
	
	formSended: function(params)
	{
		this.form.dispose();
		this.form.resetValues();
		this.data.comments.push(params);
		this.createCommentFromForm(params);
		this.bus.trigger("ApartmentCommentSend", [params, this.getId()]);
	},
	
	createCommentFromForm: function(comment)
	{
		var commentContainer= new Element("div", {"class":"comment"}).inject(this.commentsContainer);
		var author 			= new Element("strong", {text:comment[this.form.ajaxProperties.author]}).inject(commentContainer);
		var author 			= new Element("div", {"class":"text", text:comment[this.form.ajaxProperties.message]}).inject(commentContainer);
	},
	
	createComment: function(comment)
	{
		var commentContainer= new Element("div", {"class":"comment"}).inject(this.commentsContainer);
		var author 			= new Element("strong", {text:comment.author}).inject(commentContainer);
		var author 			= new Element("div", {"class":"text", text:comment.message}).inject(commentContainer);
	},
	
	getData: function()
	{
		return this.data;
	},
	
	getId: function()
	{
		return this.id.CRS+this.id.remoteId;
	},
	
	getIdObject: function()
	{
		var result = {};
		result[this.ajaxProperties.AJAX_KEY_CRS_ID] = this.data.apartmentId.CRS;
		result[this.ajaxProperties.AJAX_KEY_APARTMENT_ID] = this.data.apartmentId.remoteId;
		return result;
	},
	
	inject: function(container, where)
	{
		this.wrapper.inject(container, where);
		
		if($defined(this.data.moreInfo) && !$defined(this.moreInfoBottomContainer))
		{
			this.createMoreInfo(this.data.moreInfo);
		}
	},
	
	click: function()
	{
		this.moreInfo();
	},
	
	mouseenter: function()
	{
		this.wrapper.addClass("hover");
	},
	
	mouseleave: function()
	{
		this.wrapper.removeClass("hover");
	},
	
	destroy: function()
	{
		this.wrapper.dispose();
	},
	
	highlight: function(id)
	{
		this.wrapper.addClass("highlight");
	},
	
	unHighlight: function(id)
	{
		this.wrapper.removeClass("highlight");
	}
	
});