function PropertyClass(strName)

{

	var jsdate = new Date();

	this.className = strName + Math.round(jsdate.getTime() / 1000);

	

	this._d = function()

	{

		var elements = new Array();

		for (var i = 0; i < arguments.length; i++)

		{

			var element = arguments[i];

			if (element && typeof element == 'string') element = document.getElementById(element);

			if (arguments.length == 1) return element;

			elements.push(element);

		}

		return elements;

	}

	

	this.get_property_searchtype = function()

	{

		var property_searchtype = ['resale','long-term-rental','short-term-rental'];

		return property_searchtype;

	}



	this.get_property_type = function()

	{

		var property_type = ['Studio','Apartment','Townhouse','Villa','Plot','Commercial'];

		return property_type;

	}




	this.get_property_subtype = function()

	{

		var property_subtype = [];		

		property_subtype['Studio'] = ['Ground-Floor','Middle-Floor','Penthouse'];

		property_subtype['Apartment'] = ['Ground-Floor','Middle-Floor','Penthouse'];

		property_subtype['Townhouse'] = ['Detached','Semi-Detached','Terraced'];

		property_subtype['Villa'] = ['Detached','Semi-Detached','Terraced','Finca'];

		property_subtype['Plot'] = ['Residential','Commercial','Land'];

		property_subtype['Commercial'] = ['Bar','Restaurant','Hotel','Night-Club','Hostel','Guest-House','Bed-&-Breakfast','Shop','Office','Garage','Mobile-Home','Mooring','Business','Farm','Stables','Cafe','Other','Storage-Room','Parking-Space'];

		return property_subtype;

	}



	this.get_property_area = function()

	{

		var property_area = ['Costa-de-la-Luz','Costa-del-Sol','Costa-del-Sol-East','Costa-Tropical','Costa-Almeria','Costa-Calida','Costa-Blanca-South','Costa-Blanca-North','Costa-Azahar','Costa-Brava','Costa-Dorada','Albacete','Asturias','Cordoba','Granada','Ibiza','Jaen','Madrid','Mallorca','Seville','Toledo','Valencia'];

		return property_area;

	}


	this.get_category_name = function()

	{

		var category_name = ['Setting','Orientation','Condition','Pool','Climate-Control','Views','Features','Kitchen','Garden','Security','Parking','Category'];

		return category_name;

	}

	this.get_feature_name = function()

	{

		var feature_name = [];		

		feature_name['Setting'] = ['Beachfront', 'Frontline-Golf', 'Town', 'Suburban', 'Country', 'Commercial-Area', 'Beachside', 'Port', 'Village', 'Mountain-Pueblo', 'Close-To-Golf', 'Close-To-Port', 'Close-To-Shops', 'Close-To-Sea', 'Close-To-Town', 'Close-To-Schools', 'Close-To-Skiing', 'Close-To-Forest', 'Marina', 'Close-To-Marina', 'Urbanisation'];

		feature_name['Orientation'] = ['North','North-East','East','South-East','South','South-West','West','North-West'];

		feature_name['Condition'] = ['Excellent','Good','Fair','Renovation-Required','Recently-Renovated','Recently-Refurbished'];

		feature_name['Pool'] = ['Communal','Private','Indoor','Heated','Room-For-Pool','Children`s-Pool'];

		feature_name['Climate-Control'] = ['Air-Conditioning','Pre-Installed-A/C','Hot-A/C','Cold-A/C','Central-Heating','Fireplace','U/F-Heating','U/F/H-Bathrooms'];

		feature_name['Views'] = ['Sea','Mountain','Golf','Beach','Port','Country','Panoramic','Garden','Pool','Courtyard','Lake','Urban','Ski','Forest','Street'];

		feature_name['Features'] = ['Covered-Terrace','Lift','Fitted-Wardrobes','Near-Transport','Private-Terrace','Solarium','Satellite-TV','ADSL','Gym','Sauna','Games-Room','Paddle-Tennis','Tennis-Court','Guest-Apartment','Guest-House','Storage-Room','Utility-Room','Ensuite-Bathroom','Wood-Flooring','Disabled-Access','Marble-Flooring','Jacuzzi','Bar','Barbeque','Double-Glazing','Domotics','24-Hour-Reception','Restaurant-On-Site','Car-Hire-Facility','Courtesy-Bus','Day-Care','Near-Mosque','Servants-Quarters','Stables'];

		feature_name['Kitchen'] = ['Fully-Fitted','Partially-Fitted','Not-Fitted','Kitchen-Lounge'];

		feature_name['Garden'] = ['Communal','Private','Landscaped','Easy-Maintenance'];

		feature_name['Security'] = ['Gated-Complex','Electric-Blinds','Entry-Phone','Alarm-System','24-Hour-Security','Safe'];

		feature_name['Parking'] = ['Underground','Garage','Covered','Open','Street','More-Than-One','Communal','Private'];

		feature_name['Category'] = ['Bargain','Beachfront','Cheap','Distressed','Golf','Holiday-Homes','Investment','Luxury','Off-Plan','Reduced','Repossession','Resale'];

		return feature_name;

	}

	this.get_property_location = function()

	{

		var property_location = [];

		property_location['Costa-de-la-Luz'] = ['Arcos-de-la-Frontera','C&aacute;diz','Ca&ntilde;os-de-Meca','Cartaya','Chiclana','Conil','Huelva','Isla-Canela','Jerez-de-la-Frontera','Novo-Sancti-Petri','Olvera','Playa-la-Barrosa','San-Pablo-de-Buceite','Sanlucar-de-Barrameda','Sevilla','Tarifa'];

		property_location['Costa-del-Sol'] = ['Alameda','Algeciras','Alhaur&iacute;n-de-la-Torre','Alhaur&iacute;n-el-Grande','Almog&iacute;a','Aloha','Alora','Alozaina','Altos-de-los-Monteros','Antequera','Archidona','Ardales','Arroyo-de-la-Miel','Artola','Atalaya','Bahia-de-Marbella','Bel-Air','Benahav&iacute;s','Benalmadena','Benalmadena-Costa','Benalmadena-Pueblo','Benamara','Benavista','Cabopino','Calahonda','Calypso','Campillos','Campo-Mijas','Ca&ntilde;ete-la-Real','Carib-Playa','Carratraca','C&aacute;rtama','Carvajal','Casabermeja','Casarabonela','Casares','Casares-Playa','Casares-Pueblo','Cerro-del-Aguila','Churriana','Co&iacute;n','Cortes-de-la-Frontera','Costabella','Costalita','Cuevas-de-San-Marcos','Diana-Park','Do&ntilde;a-Julia','El-Burgo','El-Chaparral','El-Faro','El-Madro&ntilde;al','El-Paraiso','El-Presidente','El-Rosario','Elviria','Estacion-de-Cartama','Estepona','Fuengirola','Fuente-de-Piedra','Gauc&iacute;n','Guadalmina-Alta','Guadalmina-Baja','Guadiaro','Guaro','Hacienda-Las-Chapas','Ist&aacute;n','Jimena-de-la-Frontera','Jimera-de-L&iacute;bar','Jubrique','La-Alcaidesa','La-Cala','La-Cala-de-Mijas','La-Cala-Hills','La-Campana','La-Cancelada','La-Carihuela','La-Duquesa','La-Heredia','La-L&iacute;nea','La-Mairena','La-Quinta','La-Zagaleta','Las-Brisas','Las-Chapas','Lauro-Golf','Los-Almendros','Los-Arqueros','Los-Barrios','Los-Boliches','Los-Flamingos','Los-Monteros','Los-Pacos','M&aacute;laga','Manilva','Marbella','Marbesa','Mijas','Mijas-Costa','Mijas-Golf','Miraflores','Mollina','Monda','Monte-Halcones','Nag&uuml;eles','New-Golden-Mile','Nueva-Andaluc&iacute;a','Oj&eacute;n','Pizarra','Pueblo-Nuevo-de-Guadiaro','Puerto-Ban&uacute;s','Puerto-de-Cabopino','Punta-Chullera','Reserva-de-Marbella','Rio-Real','Riviera-del-Sol','Ronda','San-Diego','San-Enrique','San-Luis-de-Sabinillas','San-Mart&iacute;n-de-Tesorillo','San-Pedro-de-Alc&aacute;ntara','San-Roque','Santa-Clara','Selwo','Sierra-Blanca','Sierrezuela','Sotogrande','Sotogrande-Alto','Sotogrande-Costa','Sotogrande-Marina','Sotogrande-Playa','Sotogrande-Puerto','Teba','The-Golden-Mile','Tolox','Torre-Real','Torreblanca','Torreguadiaro','Torremolinos','Torremuelle','Torrenueva','Torrequebrada','Valle-Romano','Valtocado','Villanueva-del-Trabuco','Yunquera','Zahara'];

		property_location['Costa-del-Sol-East'] = ['Alcauc&iacute;n','Alfarnate','Alfarnatejo','Algarrobo','Almachar','Almayate','&Aacute;rchez','Arenas','Axarquia','Benajarafe','Benamargosa','Benamocarra','Caleta-de-V&eacute;lez','Canillas-de-Aceituno','Canillas-de-Albaida','Colmenar','Comares','C&oacute;mpeta','C&uacute;tar','El-Borge','El-Morche','Frigiliana','Iznate','Moclinejo','Montefr&iacute;o','Nerja','Periana','Rinc&oacute;n-de-la-Victoria','Riogordo','Salares','Sayalonga','Sedella','Torre-del-Mar','Torrox','Total&aacute;n','Triana','V&eacute;lez-M&aacute;laga','Vi&ntilde;uela','Zafarraya'];

		property_location['Costa-Tropical'] = ['Aguadulce','Albunuelas','Albu&ntilde;ol','Algarrobo-Costa','Almu&ntilde;ecar','Castell-de-Ferro','Castillo-de-Ba&ntilde;os','Chilches','Guajar-Alto','Itrabo','La-Herradura','Lobres','Los-Guajares','Marina-del-Este','Molvizar','Motril','Otivar','Salobre&ntilde;a','V&eacute;lez-de-Benaudalla'];

		property_location['Costa-Almeria'] = ['Adra','Aguilas','Albox','Alfoquia','Almendricos','Almeria','Almerimar','Antas','Arboleas','Bedar','Calabardina','Calapanizo','Cantoria','Carboneras','Cuevas-del-Almanzora','El-Calon','El-Margen','Garrucha','Grima','Huercal-Overa','La-Alfoquia','La-Romana','Lijar','Lorca','Los-Gallardos','Los-Lobos','Macael','Mojacar','Mojacar-Playa','Mojacar-Pueblo','Palomares','Partaloa','Pozo-de-la-Higuera','Roquetas-de-Mar','San-Agustin','San-Juan-de-los-Terreros','Turre','Velez-Rubio','Vera','Vera-Playa','Vera-Pueblo','Vicar','Villaricos','Zurgena'];

		property_location['Costa-Calida'] = ['Abanilla','Alhama-de-Murcia','Aljariz','Balsicas','Ba&ntilde;os-y-Mendigo','Cabo-de-Palos','Calasparra','Corvera','El-Mojon','Fortuna','Jimenado','La-Azohia','La-Manga','La-Puebla','La-Tercia','La-Union','Lo-Martinez','Lo-Pagan','Los-Alcazares','Los-Urrutias','Macisvenda','Mar-Menor','Molina-de-Segura','Murcia','Purias','Roda','Roldan','San-Cayetano','San-Javier','San-Pedro-del-Pinatar','Santiago-de-la-Ribera','Sucina','Torre-Pacheco'];

		property_location['Costa-Blanca-South'] = ['Albatera','Algorfa','Alicante','Almanzora','Almoradi','Aspe','Benejuzar','Benferri','Benijofar','Bigastro','Cabo-Roig','Callosa-de-Segura','Cartagena','Catral','Ciudad-Quesda','Cox','Crevillenta','Daya-Nueva','Daya-Vieja','Dehesa-de-Campoamor','El-Altet','Elche','Elda','Formentera','Formentera-del-Segura','Gran-Alacant','Guardamar-del-Segura','Heredades','Holdon-de-las-Frailes','Hond&oacute;n-de-las-Nieves','Hondon-de-los-Frailes','Hurchillo','Jacarilla','Jumilla','La-Aparecida','La-Campaneta','La-Marina','La-Mata','La-Murada','La-Romana','Los-Balcones','Los-Montesinos','Mazarron','Mula','Novelda','Nuevo-Torre-Guil','Orihuela','Orihuela-Costa','Pilar-de-la-Horadada','Pinar-de-Campoverde','Pinoso','Pliego','Rafal','Rojales','San-Fulgencio','San-Miguel-de-Salinas','Santa-Pola','Santiago-De-Ribera','Sax','T&aacute;rbena','Torre-de-la-Horadada','Torremendo','Torrevieja','Villamartin','Villena'];

		property_location['Costa-Blanca-North'] = ['Agost','Aig&uuml;es','Albir','Alcalali','Alcoy','Alfas-Del-Pi','Altea','Altea-la-Vieja','Beniarbeig','Benidoleig','Benidorm','Benimarfull','Benissa','Benitachell','Biar','Busot','Callosa','Calpe','Campello','Campos-Del-Rio','Castalla','Ciudad-Quesada','Cocentaina','Crevillente','Delgadillo','Denia','El-Campello','El-Vergel','Els-Poblet','Els-Poblets','Finestrat','Gand&iacute;a','Gata-de-Gorgos','Guadalest','Guardamar','Ibi','Jalon','Jalon-Valley','Javea','L`Alfas-del-Pi','La-Nucia','La-Zenia','Lliber','Monforte-Del-Cid','Monovar','Moraira','Moroira','Muchamiel','Murla','Mutxamel','Oliva','Onil','Ontinyent','Orba','Orba-Valley','Orcheta','Orito','Parcent','Pedreguer','Pego','Petrer','Playa-Flamenca','Polop','Punta-Prima','Rafol-de-Almunia','Relleu','Sagra','Salinas','San-Juan','San-Miguel-de-Salinas','San-Vicente-Del-Raspeig','San-Vicente-Raspeig','Senija','Teulada','Tibi','Torremanzanas','Valle-del-Vinalopo','Villajoyosa','Xirles'];

		property_location['Costa-Azahar'] = ['Oropesa-del-Mar','Abdet','Alcossebre'];

		property_location['Costa-Brava'] = ['Almadraba','Barcelona','Blanes','Can-Isaac','Canyelles-Petites','Castell&oacute;-d`Emp&uacute;ries','El-Prat-de-Llobregat','Els-Olivars','Empuriabrava','Figueres','Garriguella','Girona','L`Escala','Les-Garrigues','Mas-Bohera','Mas-Busc&aacute;','Mas-Fumats','Mas-Mates','Mas-Oliva','Matar&oacute;','Palam&oacute;s','Palau-Saverdera','Pals','Pau','Peralada','Portbou','Puig-Rom','Roses','Sabadell','Sant-Pere-de-Ribes','Sant-Pere-Pescador','Santa-Margarita','Torroella-de-Montgri','Urbanitzaci&oacute;-Mas-Mestre','Vilajuiga','Vilamaniscle','Vilanova-i-la-Geltr&uacute;'];

		property_location['Costa-Dorada'] = ['Altafulla','Amposta','Calafell','Camarles','Cambrils','Castelldefels','El-Catllar','El-Vendrell','Garraf','l-Ametlla-de-Mar','l-Ampolla','Mont-Roig','Montblanc','Reus','Salou','Sant-Carles-de-la-Ràpita','Sitges','Tarragona','Torredembarra','Tortosa','Valls','Vandellòs'];

		property_location['Albacete'] = ['Almansa','Albacete'];

		property_location['Asturias'] = ['Asturias','Villaviciosa'];

		property_location['Cordoba'] = ['Almerimar','Cordoba','El-Poleo','Iznajar','Lucena','Priego-de-Cordoba','Puente-Genil','Rute'];

		property_location['Granada'] = ['Acequias','Albolote','Alfacar','Alhama-de-Granada','Alhendin','Beznar','Campot&eacute;jar','Chimeneas','Cozvijar','Cullar-Vega','Darro','Dehesas-Viejas','Deifontes','Domingo-P&eacute;rez','Durcal','Fornes','Fuensanta','Fuente-Vaqueros','Galera','Granada','Guadahortuna','Guadix','Gualchos','G&uuml;ev&eacute;jar','Illora','Iznalloz','La-Alpujarra','La-Mamola','La-Zubia','L&aacute;char','Lecrin-Valley','Loja','Los-Guajares','Lugros','Mecina-Bombar&oacute;n','Moclin','Montej&iacute;car','Montillana','Moraleda-de-Zafayona','Ogijares','Padul','Peligros','Puerto-Lope','Restabal','Riofr&iacute;o','Salar','Sierra-Nevada','Torre-Cardela','Ug&iacute;jar','V&eacute;lez-de-Benaudalla','Villanueva-Mesia'];

		property_location['Ibiza'] = ['Cala-Bassa','Cala-Conta','Cala-De-San-Vicente-Ibiza','Cala-Moli','Cala-Salada','Cala-Tarida','Can-Furnet','Cap-Martinet','Ciudad-Jardin','Es-Canar','Es-Cubells','Ibiza-Town','Jesus','La-Siesta','Les-Salines','Playa-D-en-Bossa','Playa-De-Cala-Llonga','Roca-Llisa','Sa-Carroca','San-Agustin-Des-Vedra','San-Antonio-De-Portmany','San-Carlos-De-Peralta','San-Jordi-De-Ses-Salines','San-Jose-De-La-Atalaya','San-Juan-De-Labritja','San-Lorenzo-De-Balafia','San-Miguel-De-Balasant','San-Rafel-De-La-Creu','Santa-Eulalia-Del-Rio','Santa-Gertrudis-De-Fruitera','Talamanca'];

		property_location['Jaen'] = ['Alcaudete','Castillo-de-Locub&iacute;n','Jaen','Las-Casillas','Linares','Martos','Pegalajar','Sabariego','Valdepe&ntilde;as-de-Ja&eacute;n'];

		property_location['Madrid'] = ['Madrid','Puerta-de-Arganda'];

		property_location['Mallorca'] = ['Alar&oacute;','Alc&uacute;dia','Algaida','Andratx','Ariany','Artà','Banyalbufar','Binissalem','B&uacute;ger','Bunyola','Calvià','Campanet','Campos','Capdepera','Consell','Costitx','Dey&aacute;','Escorca','Esporles','Estellencs','Felanitx','Fornalutx','Inca','Lloret-de-Vistalegre','Lloseta','Llub&iacute;','Llucmajor','Manacor','Mancor-de-la-Vall','Mar&iacute;a-de-la-Salut','Marratx&iacute;','Montuïri','Muro','Palma-de-Mallorca','Petra','Pollença','Porreres','Puigpunyent','Sa-Pobla','Sant-Joan','Sant-Llorenç-des-Cardassar','Santa-Eugènia','Santa-Margalida','Santa-Maria-del-Cam&iacute;','Santany&iacute;','Selva','Sencelles','Ses-Salines','Sineu','S&oacute;ller','Son-Servera','Valldemossa','Vilafranca-de-Bonany'];

		property_location['Seville'] = ['Casariche','&Eacute;cija','El-Viso-del-Alcor','Estepa','Isla-Redonda','La-Campana','Lora-de-Estepa','Marchena','Marinaleda','Sevilla'];

		property_location['Toledo'] = ['Toledo'];

		property_location['Valencia'] = ['Caudete-de-las-Fuentes','Valencia'];

		return property_location;

	}

	

	this.write_into = function (strId, strContent)

	{

		var self = this;

		if(self._d(strId))

		{

			var el = self._d(strId);

			if (el.type)

			{

				el.value = strContent;

			}

			else

			{

				el.innerHTML = strContent;

			}

		}

		return true;

	}

	

	this.get_html_translation_table = function (table, quote_style)

	{

		var entities = {}, hash_map = {}, decimal = 0, symbol = '';

		var constMappingTable = {}, constMappingQuoteStyle = {};

		var useTable = {}, useQuoteStyle = {};



		constMappingTable[0]	  = 'HTML_SPECIALCHARS';

		constMappingTable[1]	  = 'HTML_ENTITIES';

		constMappingQuoteStyle[0] = 'ENT_NOQUOTES';

		constMappingQuoteStyle[2] = 'ENT_COMPAT';

		constMappingQuoteStyle[3] = 'ENT_QUOTES';



		useTable = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';

		useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';



		if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES')

		{

			throw new Error("Table: "+useTable+' not supported');

		}



		entities['38'] = '&amp;';

		if (useTable === 'HTML_ENTITIES')

		{

			entities['160'] = '&nbsp;';

			entities['161'] = '&iexcl;';

			entities['162'] = '&cent;';

			entities['163'] = '&pound;';

			entities['164'] = '&curren;';

			entities['165'] = '&yen;';

			entities['166'] = '&brvbar;';

			entities['167'] = '&sect;';

			entities['168'] = '&uml;';

			entities['169'] = '&copy;';

			entities['170'] = '&ordf;';

			entities['171'] = '&laquo;';

			entities['172'] = '&not;';

			entities['173'] = '&shy;';

			entities['174'] = '&reg;';

			entities['175'] = '&macr;';

			entities['176'] = '&deg;';

			entities['177'] = '&plusmn;';

			entities['178'] = '&sup2;';

			entities['179'] = '&sup3;';

			entities['180'] = '&acute;';

			entities['181'] = '&micro;';

			entities['182'] = '&para;';

			entities['183'] = '&middot;';

			entities['184'] = '&cedil;';

			entities['185'] = '&sup1;';

			entities['186'] = '&ordm;';

			entities['187'] = '&raquo;';

			entities['188'] = '&frac14;';

			entities['189'] = '&frac12;';

			entities['190'] = '&frac34;';

			entities['191'] = '&iquest;';

			entities['192'] = '&Agrave;';

			entities['193'] = '&Aacute;';

			entities['194'] = '&Acirc;';

			entities['195'] = '&Atilde;';

			entities['196'] = '&Auml;';

			entities['197'] = '&Aring;';

			entities['198'] = '&AElig;';

			entities['199'] = '&Ccedil;';

			entities['200'] = '&Egrave;';

			entities['201'] = '&Eacute;';

			entities['202'] = '&Ecirc;';

			entities['203'] = '&Euml;';

			entities['204'] = '&Igrave;';

			entities['205'] = '&Iacute;';

			entities['206'] = '&Icirc;';

			entities['207'] = '&Iuml;';

			entities['208'] = '&ETH;';

			entities['209'] = '&Ntilde;';

			entities['210'] = '&Ograve;';

			entities['211'] = '&Oacute;';

			entities['212'] = '&Ocirc;';

			entities['213'] = '&Otilde;';

			entities['214'] = '&Ouml;';

			entities['215'] = '&times;';

			entities['216'] = '&Oslash;';

			entities['217'] = '&Ugrave;';

			entities['218'] = '&Uacute;';

			entities['219'] = '&Ucirc;';

			entities['220'] = '&Uuml;';

			entities['221'] = '&Yacute;';

			entities['222'] = '&THORN;';

			entities['223'] = '&szlig;';

			entities['224'] = '&agrave;';

			entities['225'] = '&aacute;';

			entities['226'] = '&acirc;';

			entities['227'] = '&atilde;';

			entities['228'] = '&auml;';

			entities['229'] = '&aring;';

			entities['230'] = '&aelig;';

			entities['231'] = '&ccedil;';

			entities['232'] = '&egrave;';

			entities['233'] = '&eacute;';

			entities['234'] = '&ecirc;';

			entities['235'] = '&euml;';

			entities['236'] = '&igrave;';

			entities['237'] = '&iacute;';

			entities['238'] = '&icirc;';

			entities['239'] = '&iuml;';

			entities['240'] = '&eth;';

			entities['241'] = '&ntilde;';

			entities['242'] = '&ograve;';

			entities['243'] = '&oacute;';

			entities['244'] = '&ocirc;';

			entities['245'] = '&otilde;';

			entities['246'] = '&ouml;';

			entities['247'] = '&divide;';

			entities['248'] = '&oslash;';

			entities['249'] = '&ugrave;';

			entities['250'] = '&uacute;';

			entities['251'] = '&ucirc;';

			entities['252'] = '&uuml;';

			entities['253'] = '&yacute;';

			entities['254'] = '&thorn;';

			entities['255'] = '&yuml;';

		}



		if (useQuoteStyle !== 'ENT_NOQUOTES')

		{

			entities['34'] = '&quot;';

		}

		if (useQuoteStyle === 'ENT_QUOTES')

		{

			entities['39'] = '&#39;';

		}

		entities['60'] = '&lt;';

		entities['62'] = '&gt;';



		for (decimal in entities)

		{

			symbol = String.fromCharCode(decimal);

			hash_map[symbol] = entities[decimal];

		}

		

		return hash_map;

	}

	

	this.htmlentities = function (string, quote_style)

	{

		var self = this;

		var hash_map = {}, symbol = '', tmp_str = '', entity = '';

		tmp_str = string.toString();

		

		if (false === (hash_map = self.get_html_translation_table('HTML_ENTITIES', quote_style)))

		{

			return false;

		}

		hash_map["'"] = '&#039;';

		for (symbol in hash_map)

		{

			entity = hash_map[symbol];

			tmp_str = tmp_str.split(symbol).join(entity);

		}

		

		return tmp_str;

	}



	this.urlencode = function (str)

	{

		str = (str+'').toString();

		return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');

	}

	

	this.urldecode = function (str)

	{

		return decodeURIComponent(str).replace(/\+/g, '%20');

	}



	this.convert_to_link = function (self, str)

	{

		return self.urlencode((str+'').toString().replace(/\s/g, '-'));

	}

	

	this.get_alpha = function (checkStr)

	{

		var OK = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');

		var result = '';

		var i;

		var j;

		var maxI = checkStr.split('').length;

		for (i=0; i<maxI; i++)

		{

			for (j=0; j<OK.length; j++)

			{

				if (checkStr.substring(i, i+1) == OK[j])

				{

					result += checkStr.substring(i, i+1);

				}

			}

		}

		return result;

	}

	

	this.compare_str = function(str1, str2)

	{

		var self = this;

		var i = 0;

		str1 = str1.toLowerCase();

		str2 = str2.toLowerCase();

		

		if(str1 == str2) i++;

		if(self.urldecode(str1) == str2) i++;

		if(str1 == self.htmlentities(str2)) i++;

		if(str1 == self.convert_to_link(self, str2)) i++;

		if(self.get_alpha(str1) == self.get_alpha(str2)) i++;

		

		return (i == 0) ? false : true;

	}

	

	this.ucwords = function (str)

	{

		return (str+'').replace(/^(.)|\s(.)/g, function ( $1 ) { return $1.toUpperCase( ); } );

	}

	

	this.get_searchtype_dd = function (strDestinationId, strSearchType)

	{

		var self = this;

		if(self._d(strDestinationId))

		{

			var i,len,isSelected;

			var property_searchtype = self.get_property_searchtype();

			len = property_searchtype.length;

			var s = '';

			s += '<select class="_sb" name="P_SearchType" id="P_SearchType" size="1" onchange="loadFeatures(); pc.create_url();">';

			for(i=0; i<len; i++)

			{

				isSelected = (!self.compare_str(strSearchType, property_searchtype[i])) ? '' : ' selected="selected"';

				s += '<option value="'+property_searchtype[i]+'"'+isSelected+'>'+self.ucwords(property_searchtype[i].replace(/-/g, ' '))+'<\/option>';

			}

			s += '<\/select>';

			self.write_into(strDestinationId, s);

		}

		return true;

	}



	this.get_type_dd = function (strDestinationId, strType)

	{

		var self = this;

		if(self._d(strDestinationId))

		{

			var i,len,isSelected;

			var property_type = self.get_property_type();

			len = property_type.length;

			var s = '';

			s += '<select class="_sb" name="P_Type" id="P_Type" size="1" onchange="loadFeatures(); pc.get_subtype_dd(\''+__PROPERTY_SUBTYPE_CONTAINER__+'\', this.value, \'\'); pc.create_url();">';

			s += '<option value="All-Types">---- Select Property ----<\/option>';

			for(i=0; i<len; i++)

			{

				isSelected = (!self.compare_str(strType, property_type[i])) ? '' : ' selected="selected"';

				s += '<option value="'+property_type[i]+'"'+isSelected+'>'+property_type[i].replace(/-/g, ' ')+'<\/option>';

			}

			s += '<\/select>';

			self.write_into(strDestinationId, s);

		}

		return true;

	}



	this.get_subtype_dd = function (strDestinationId, strType, strSubType)

	{

		var self = this;

		if(self._d(strDestinationId))

		{

			var i,len,isSelected;

			var property_subtype = self.get_property_subtype();

			var s = '';

			s += '<select class="_sb" name="P_SubType" id="P_SubType" size="1" onchange="loadFeatures(); pc.create_url();">';

			s += '<option value="All-SubTypes">----- Property Type -----<\/option>';

			if(property_subtype[strType])

			{

				var subtype = property_subtype[strType];

				len = subtype.length;

				for(i=0; i<len; i++)

				{

					isSelected = (!self.compare_str(strSubType, subtype[i])) ? '' : ' selected="selected"';

					s += '<option value="'+subtype[i]+'"'+isSelected+'>'+subtype[i].replace(/-/g, ' ')+'<\/option>';

				}

			}

			s += '<\/select>';

			self.write_into(strDestinationId, s);

		}

		return true;

	}



	this.get_area_dd = function (strDestinationId, strArea)

	{

		var self = this;

		if(self._d(strDestinationId))

		{

			var i,len,isSelected;

			var property_area = self.get_property_area();

			len = property_area.length;

			var s = '';

			s += '<select class="_sb" name="P_Area" id="P_Area" size="1" onchange="loadFeatures(); pc.get_location_dd(\''+__PROPERTY_LOCATION_CONTAINER__+'\', this.value, \'\'); pc.create_url();">';

			s += '<option value="All-Area">--------- All Area ---------<\/option>';

			for(i=0; i<len; i++)

			{

				isSelected = (!self.compare_str(strArea, property_area[i])) ? '' : ' selected="selected"';

				s += '<option value="'+property_area[i]+'"'+isSelected+'>'+property_area[i].replace(/-/g, ' ')+'<\/option>';

			}

			s += '<\/select>';

			self.write_into(strDestinationId, s);

		}

		return true;

	}

	

	this.convert_to_latin = function (str)

	{

		return str.replace(/&Aacute;/g, 'A').replace(/&aacute;/g, 'a').replace(/&Agrave;/g, 'A').replace(/&agrave;/g, 'a').replace(/&Ccedil;/g, 'C').replace(/&ccedil;/g, 'c').replace(/&Eacute;/g, 'E').replace(/&eacute;/g, 'e').replace(/&Egrave;/g, 'E').replace(/&egrave;/g, 'e').replace(/&Iacute;/g, 'I').replace(/&iacute;/g, 'i').replace(/&Iuml;/g, 'I').replace(/&iuml;/g, 'i').replace(/&Ntilde;/g, 'N').replace(/&ntilde;/g, 'n').replace(/&Oacute;/g, 'O').replace(/&oacute;/g, 'o').replace(/&Ograve;/g, 'O').replace(/&ograve;/g, 'o').replace(/&Uacute;/g, 'U').replace(/&uacute;/g, 'u').replace(/&Uuml;/g, 'U').replace(/&uuml;/g, 'u').replace(/&iexcl;/g, 'i').replace(/&iquest;/g, '').replace(/Á/g, 'A').replace(/á/g, 'a').replace(/À/g, 'A').replace(/à/g, 'a').replace(/Ç/g, 'C').replace(/ç/g, 'c').replace(/É/g, 'E').replace(/é/g, 'e').replace(/È/g, 'E').replace(/è/g, 'e').replace(/Í/g, 'I').replace(/í/g, 'i').replace(/Ï/g, 'I').replace(/ï/g, 'i').replace(/Ñ/g, 'N').replace(/ñ/g, 'n').replace(/Ó/g, 'O').replace(/ó/g, 'o').replace(/Ò/g, 'O').replace(/ò/g, 'o').replace(/Ú/g, 'U').replace(/ú/g, 'u').replace(/Ü/g, 'U').replace(/ü/g, 'u').replace(/¡/g, 'i').replace(/¿/g, '');

	}



	this.get_location_dd = function (strDestinationId, strArea, strLocation)

	{

		var self = this;

		if(self._d(strDestinationId))

		{

			var i,len,isSelected;

			var property_location = self.get_property_location();

			var s = '';

			s += '<select class="_sb" name="P_Location" id="P_Location" size="1" onchange="loadFeatures(); pc.create_url();">';

			s += '<option value="All-Locations">----- All Locations -----<\/option>';

			if(property_location[strArea])

			{

				var loc = property_location[strArea];

				len = loc.length;

				for(i=0; i<len; i++)

				{

					isSelected = (!self.compare_str(strLocation, self.convert_to_latin(loc[i]))) ? '' : ' selected="selected"';

					s += '<option value="'+self.convert_to_latin(loc[i])+'"'+isSelected+'>'+loc[i].replace(/-/g, ' ')+'<\/option>';

				}

			}

			s += '<\/select>';

			self.write_into(strDestinationId, s);

		}

		return true;

	}



	this.create_url = function ()

	{

		var self = this;

		var s = '';

		s += __BASE_URL__;

		if(self._d('P_SearchType') && self._d('P_Type') && self._d('P_SubType') && self._d('P_Area') && self._d('P_Location'))

		{
			featurValue = '';
			sep = '';
			if(document.forms['searchForm'].elements['feature[]'])
			{
				totalF = document.forms['searchForm'].elements['feature[]'].length;
				for(i = 0; i < totalF; i++)
				{
					if(document.forms['searchForm'].elements['feature[]'][i].checked == true)
					{
						featurValue += sep+document.forms['searchForm'].elements['feature[]'][i].value;
						sep = "-";
					}
				}
			}
			if(featurValue == '')
			{
				featurValue = 'all-features';
			}

			s += self._d('P_SearchType').value+'/';
			
			s += featurValue+'/';

			s += self._d('P_Type').value+'/';

			s += self._d('P_SubType').value+'/';

			s += self._d('P_Area').value+'/';

			s += self._d('P_Location').value;

			s += '.htm';

		}

		

		self.write_into(__SEARCH_URL_CONTAINER__, s);

		return true;

	}

}



var pc = new PropertyClass('pc');



function set_dd_value()

{

	var curloc = (location.href+'').toString().replace(__BASE_URL__, '').replace('.htm', '').split('/');

	if(curloc.length > 4)

	{
//resale,all-features,Apartment,All-SubTypes,Costa-del-Sol,All-Locations
		pc._d('P_SearchType').value = (curloc[0]+'').toString();

		pc._d('P_Type').value = (curloc[2]+'').toString();

		pc._d('P_Area').value = (curloc[4]+'').toString();

		pc._d('P_SubType').value = (curloc[3]+'').toString();

		pc._d('P_Location').value = (curloc[5]+'').toString();		

	}

	else

	{

		pc._d('P_SearchType').value = __INITIAL_PROPERTY_SEARCHTYPE__;

		pc._d('P_Type').value = __INITIAL_PROPERTY_TYPE__;

		pc._d('P_Area').value = __INITIAL_PROPERTY_AREA__;

	}

	pc.create_url();

	return true;

}

function set_child_dd()

{

	pc.get_subtype_dd(__PROPERTY_SUBTYPE_CONTAINER__, pc._d('P_Type').value, '');

	pc.get_location_dd(__PROPERTY_LOCATION_CONTAINER__, pc._d('P_Area').value, '');

	setTimeout('set_dd_value()', 10);

	

	return true;

}



function changeOpacity(opacity, id)

{

	var o = pc._d(id).style;

	o.opacity = (opacity / 100);

	o.MozOpacity = (opacity / 100);

	o.KhtmlOpacity = (opacity / 100);

	o.filter = "alpha(opacity=" + opacity + ")";

}



function setOpacity(id, millisec)

{

	var timer = 0;

	var speed = Math.round(millisec / 100);

	var i;

	if(timer > 100)

	{

		timer = 0;

		for(i = 0; i >= 100; i--)

		{

			setTimeout("changeOpacity(" + i + ",'" + id + "')", (timer * speed));

			timer++;

		}

	}

	else if(timer < 100)

	{

		timer = 0;

		for(i = 0; i <= 100; i++)

		{

			setTimeout("changeOpacity(" + i + ",'" + id + "')", (timer * speed));

			timer++;

		}

	}

}



function rotate_pictures(intJ)

{

	var picCount = parseInt(pc._d('pdc').value);

	var j;

	for(j = 0; j < picCount; j++)

	{

		if(pc._d('pd-'+j))

		{

			changeOpacity(0, 'pd-'+j);

			pc._d('pd-'+j).style.display = 'none';

		}

	}

	

	intJ = (intJ == picCount) ? 0 : intJ;

	if(pc._d('pd-'+intJ))

	{

		pc._d('pd-'+intJ).style.display = 'inline';

		setOpacity('pd-'+intJ, 1000);

		intJ++;

	}

	setTimeout('rotate_pictures('+intJ+')', 4500);

}



function onLoadAll()

{

	var curloc = (location.href+'').toString().replace(__BASE_URL__, '').replace('.htm', '').split('/');



	pc.get_searchtype_dd(__PROPERTY_SEARCHTYPE_CONTAINER__, __INITIAL_PROPERTY_SEARCHTYPE__);

	pc.get_type_dd(__PROPERTY_TYPE_CONTAINER__, __INITIAL_PROPERTY_TYPE__);

	pc.get_area_dd(__PROPERTY_AREA_CONTAINER__, __INITIAL_PROPERTY_AREA__);

	if(curloc.length > 4)

	{
//resale,all-features,Apartment,All-SubTypes,Costa-del-Sol,All-Locations
		pc._d('P_SearchType').value = (curloc[0]+'').toString();

		pc._d('P_Type').value = (curloc[2]+'').toString();

		pc._d('P_Area').value = (curloc[4]+'').toString();
		
		//pc._d('P_SubType').value = (curloc[3]+'').toString();

	}

	setTimeout('set_child_dd()', 10);

	

	if(pc._d('pdc'))

	{

		rotate_pictures(0);

	}

	

	return true;

}



function loadParams()

{

	if (window.attachEvent)

	{

		window.attachEvent('onload', onLoadAll);

	}

	else if (window.addEventListener)

	{

		window.addEventListener('load', onLoadAll, true);

	}

	else

	{

		window.onload = function() { setTimeout('onLoadAll()', 10); }

	}

	return true;

}



var __SEARCH_URL_CONTAINER__ = 'url_div';

var __PROPERTY_SEARCHTYPE_CONTAINER__ = 'searchtype_div';

var __PROPERTY_TYPE_CONTAINER__ = 'type_div';

var __PROPERTY_SUBTYPE_CONTAINER__ = 'subtype_div';

var __PROPERTY_AREA_CONTAINER__ = 'area_div';

var __PROPERTY_LOCATION_CONTAINER__ = 'location_div';

var __INITIAL_PROPERTY_SEARCHTYPE__ = 'resale';

var __INITIAL_PROPERTY_TYPE__ = 'All-Types';

var __INITIAL_PROPERTY_AREA__ = 'Costa-del-Sol';


loadParams();




