<?php

/**  **/
function get_condo_meta_desc($condo) {
	$db = new DB();
	$html = '';
	if($condo->dist_mrt_near1 > 0){
		$condo_dist_mrt_near1 = ($condo->dist_mrt_near1).'mins <img src="'.mobile_url.'img/walk.png" style="height: 12px"> to ';
	}else{
		$condo_dist_mrt_near1 = 'Near ';
	}
	$html .= $condo_dist_mrt_near1;
	
	switch (substr($condo->tenure_desc,0,3)){
		Case "Fre": $condo_tenure_desc_short = 'Freehold'; break;
		Case "99 ": $condo_tenure_desc_short = '99 Yr Leasehold'; break;
		Case "999": $condo_tenure_desc_short = '999 Yr Leasehold'; break;
		Case "103": $condo_tenure_desc_short = '103 Yr Leasehold'; break;
	}
	$condo_tenure_desc_long = str_replace("lease commencing ", "", $condo->tenure_desc);
	
	$html = $condo->project.' is a '.$condo->tenure_short_desc.' development located at '.$condo->street_name.'.';
	
	if($condo_dist_mrt_near1>0){
		$html = $html.' The condo is '.$condo_dist_mrt_near1.''.$condo->name_mrt_near1.' MRT Station and '.$condo->train_stops_to_raffles.' stops to Raffles Place.';
	}
	//Handling Amenities
	$query_amenities = "SELECT * FROM amenities WHERE condo_id = $condo->id";
	$result = $db->query($query_amenities);
	
	foreach($result->result as $row) {
		if($row['mall1_time']<10){
			$mall_1 = $row['mall1_name'].'<br>'.$row['mall1_time'].' min(s) <img src="'.mobile_url.'img/walk.png" style="height: 12px">';
			$html = $html.' Malls nearby include '.$row['mall1_name'].', which is '.$row['mall1_time'].'min(s) walk away';
		}else{
			$mall_1 = $row['mall1_name'].'<br>'.$row['mall1_time_drive'].' min(s) <img src="'.mobile_url.'img/drive.png" style="height: 12px">';				
			$html = $html.' Malls nearby include '.$row['mall1_name'].', which is '.$row['mall1_time_drive'].'min(s) drive away.';
		}
		
		if($row['mall2_time']<10){
			$mall_2 = '<b>'.$row['mall2_name'].'</b> '.$row['mall2_time'].' min(s) <img src="'.mobile_url.'img/walk.png" style="height: 12px">';
		}else{
			$mall_2 = '<b>'.$row['mall2_name'].'</b> '.$row['mall2_time_drive'].' min(s) <img src="'.mobile_url.'img/drive.png" style="height: 12px">';				
		}		
		
		$pri_1 = '<b>'.$row['ps1_name'].'</b> '.round($row['ps1_dist'],2).' KM radius, '.$row['ps1_time'].' min(s) <img src="https://www.drea.com.sg/mobile/img/drive.png" style="height: 12px">';
		$pri_2 = '<b>'.$row['ps2_name'].'</b> '.round($row['ps2_dist'],2).' KM radius, '.$row['ps2_time'].' min(s) <img src="https://www.drea.com.sg/mobile/img/drive.png" style="height: 12px">';
		$sec_1 = '<b>'.$row['ss1_name'].'</b> '.$row['ss1_time'].' min(s) <img src="https://www.drea.com.sg/mobile/img/drive.png" style="height: 12px">';
		$sec_2 = '<b>'.$row['ss2_name'].'</b> '.$row['ss2_time'].' min(s) <img src="https://www.drea.com.sg/mobile/img/drive.png" style="height: 12px">';
		$jc = '<b>'.$row['jc_name'].'</b> '.$row['jc_time'].' mins <img src="https://www.drea.com.sg/mobile/img/drive.png" style="height: 12px">';

		$html = $html.' '.$row['ps1_name'].' is '.round($row['ps1_dist'],2).' KM from '.$condo->project.' and is '.$row['ps1_time'].'min(s) drive away.';

		$food_1 = '<b>'.$row['food1_name'].'</b> '.$row['food1_walktime'].' min(s) <img src="https://www.drea.com.sg/mobile/img/walk.png" style="height: 12px">';				
		$food_2 = '<b>'.$row['food2_name'].'</b> '.$row['food2_walktime'].' min(s) <img src="https://www.drea.com.sg/mobile/img/walk.png" style="height: 12px">';				

		$supermarket = '<b>'.$row['supermarket_name'].'</b> '.$row['supermarket_walktime'].' min(s) <img src="https://www.drea.com.sg/mobile/img/walk.png" style="height: 12px">';				

		$preschool_1 = '<b>'.$row['preschool1_name'].'</b> '.$row['preschool1_drivetime'].' min(s) <img src="https://www.drea.com.sg/mobile/img/drive.png" style="height: 12px">';				
		$preschool_2 = '<b>'.$row['preschool2_name'].'</b> '.$row['preschool2_drivetime'].' min(s) <img src="https://www.drea.com.sg/mobile/img/drive.png" style="height: 12px">';			
	}
	//Handling Amenities
	return $html;
}

function get_subzone($subzone){
	$db = new DB();
	$query_subzone = sprintf("SELECT * FROM subzone_desc WHERE subzone_name = '%s'",$subzone);
	$result = $db->query($query_subzone,true);
	
    $subzone_desc = rtrim(rtrim($result->result['subzone_desc']),'.');
    $subzone_specialnote = rtrim(rtrim($result->result['subzone_specialnote']),'.');
	if($subzone_desc!=""){$subzone_desc.='.';}
	if($subzone_specialnote!=""){$subzone_specialnote.='.';}
	
	return array(
				'subzone_desc'=>$subzone_desc, 
				'subzone_specialnote'=>$subzone_specialnote
				);
}

function get_drive_time($id, $destination) {
	$db = new DB();
	$raffles_car_time = 0;
	
	$query = sprintf("SELECT travel_time FROM traveltime WHERE condo_id = '%s' AND dest_id = '%s'", $id, $destination);
	$result = $db->query($query,true);
	if($result->num_rows > 0){
		$raffles_car_time = $result->result['travel_time'];
		if($raffles_car_time > 0){
			$raffles_car_time = round($raffles_car_time,0);
		}
	}
	
	return $raffles_car_time;
}

function get_map($lat,$lon,$project) {
	$lat = $lat/10000000;
	$lon = $lon/10000000;
	$html = '<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD3dx6BHKB1T1Yy7mOH6umx462s3q41sLE&v=3.exp"></script>';
	
	$html .=  sprintf('
	<script type="text/javascript">

	function showmap() {

	var rendererOptions = {
	  draggable: true
	};

	var condo_map;
	var directionsDisplay1 = new google.maps.DirectionsRenderer(rendererOptions);;
	var directionsService1 = new google.maps.DirectionsService();

	var singapore = new google.maps.LatLng(%s,%s);

	document.getElementById("map-canvas").style.height="300px";
			
			  var mapOptions = {
				zoom: 17,
				mapTypeId: google.maps.MapTypeId.ROADMAP,
				center: singapore
			  };

			  condo_map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

			  var marker = new google.maps.Marker({
					position: singapore,
					map: condo_map,
					title: \'%s\'
			  });

	}

	google.maps.event.addDomListener(window, "load", showmap);
	</script>
	',$lat,$lon,$project);
	
	$html .= '<div id="map-canvas" style="display: block; width:100%; height:300px;"></div>';
	
	return $html;
}

function get_amenities($condo) {
	$row = $condo->get_amenities();
	
	$pri_1 = "<b>".$row['ps1_name']."</b> ".round($row['ps1_dist'],2)." KM radius, ".$row['ps1_time']." min(s) <img src='https://www.drea.com.sg/mobile/img/drive.png' style='height: 12px'>";
	$pri_2 = "<b>".$row['ps2_name']."</b> ".round($row['ps2_dist'],2)." KM radius, ".$row['ps2_time']." min(s) <img src='https://www.drea.com.sg/mobile/img/drive.png' style='height: 12px'>";
	$sec_1 = "<b>".$row['ss1_name']."</b> ".$row['ss1_time']." min(s) <img src='https://www.drea.com.sg/mobile/img/drive.png' style='height: 12px'>";
	$sec_2 = "<b>".$row['ss2_name']."</b> ".$row['ss2_time']." min(s) <img src='https://www.drea.com.sg/mobile/img/drive.png' style='height: 12px'>";
	$jc = "<b>".$row['jc_name']."</b> ".$row['jc_time']." mins <img src='https://www.drea.com.sg/mobile/img/drive.png' style='height: 12px'>";
	$preschool_1 = "<b>".$row['preschool1_name']."</b> ".$row['preschool1_drivetime']." min(s) <img src='https://www.drea.com.sg/mobile/img/drive.png' style='height: 12px'>";				
	$preschool_2 = "<b>".$row['preschool2_name']."</b> ".$row['preschool2_drivetime']." min(s) <img src='https://www.drea.com.sg/mobile/img/drive.png' style='height: 12px'>";			
	$food_1 = "<b>".$row['food1_name']."</b> ".$row['food1_walktime']." min(s) <img src='https://www.drea.com.sg/mobile/img/walk.png' style='height: 12px'>";				
	$food_2 = "<b>".$row['food2_name']."</b> ".$row['food2_walktime']." min(s) <img src='https://www.drea.com.sg/mobile/img/walk.png' style='height: 12px'>";	
	$supermarket = "<b>".$row['supermarket_name']."</b> ".$row['supermarket_walktime']." min(s) <img src='https://www.drea.com.sg/mobile/img/walk.png' style='height: 12px'>";
	if($row['mall1_time']<10){
		$mall_1 = $row['mall1_name']."<br>".$row['mall1_time']." min(s) <img src='".mobile_url."img/walk.png' style='height: 12px'>";
	}else{
		$mall_1 = $row['mall1_name']."<br>".$row['mall1_time_drive']." min(s) <img src='".mobile_url."img/drive.png' style='height: 12px'>";
	}
	if($row['mall2_time']<10){
			$mall_2 = "<b>".$row['mall2_name']."</b> ".$row['mall2_time']." min(s) <img src='".mobile_url."img/walk.png' style='height: 12px'>";
	}else{
			$mall_2 = "<b>".$row['mall2_name']."</b> ".$row['mall2_time_drive']." min(s) <img src='".mobile_url."img/drive.png' style='height: 12px'>";				
	}		

	
	$html = '
	<table class = "selector">
		<tr>
			<td id="selector-school-'.$condo->id.'" class="selector active" data-option="school">
				<img src="'.web_url.'sg-property/icon/condos/school.png" style="width: 60px;">
			</td>				
			<td id="selector-preschool-'.$condo->id.'" class="selector"
			<td id="selector-school-'.$condo->id.'" class="selector" data-option="preschool">
				<img src="'.web_url.'sg-property/icon/condos/preschools.png" style="width: 60px;">
			</td>
			<td id="selector-food-'.$condo->id.'" class="selector"
			<td id="selector-school-'.$condo->id.'" class="selector" data-option="food">
				<img src="'.web_url.'sg-property/icon/condos/food.png" style="width: 60px;">
			</td>
			<td id="selector-supermarket-'.$condo->id.'" class="selector"
			<td id="selector-school-'.$condo->id.'" class="selector" data-option="supermarket">
				<img src="'.web_url.'sg-property/icon/condos/supermarkets.png" style="width: 60px;">
			</td>
			<td id="selector-mall-'.$condo->id.'" class="selector"
			<td id="selector-school-'.$condo->id.'" class="selector" data-option="mall">
				<img src="'.web_url.'sg-property/icon/condos/shopping-mall.png" style="width: 60px;">
			</td>
		</tr>
		<tr>		
			<td colspan=5>
			
			<div id="amenities-school-'.$condo->id.'" class="amenities active">    
				<table width=100% style="border: hidden;">
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/prischool.png" style="width: 25px; height: 25px;"></td>
						<td>'.$pri_1.'</td>
					</tr>
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/prischool.png" style="width: 25px; height: 25px;"></td>
						<td>'.$pri_2.'</td>
					</tr>
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/secschool.png" style="width: 25px; height: 25px;"></td>
						<td>'.$sec_1.'</td>
					</tr>
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/secschool.png" style="width: 25px; height: 25px;"></td>
						<td>'.$sec_2.'</td>
					</tr>
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/jc.png" style="width: 25px; height: 25px;"></td>
						<td>'.$jc.'</td>
					</tr>
				</table>
			</div>
			
			<div id="amenities-preschool-'.$condo->id.'" class="amenities">    
				<table width=100% style="border: hidden;">
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/preschool.png" style="width: 25px; height: 25px;"></td>
						<td>'.$preschool_1.'</td>
					</tr>
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/preschool.png" style="width: 25px; height: 25px;"></td>
						<td>'.$preschool_2.'</td>
					</tr>
				</table>
			</div>
			
			<div id="amenities-food-'.$condo->id.'" class="amenities">    
				<table width=100% style="border: hidden;">
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/food.png" style="width: 25px; height: 25px;"></td>
						<td>'.$food_1.'</td>
					</tr>
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/food.png" style="width: 25px; height: 25px;"></td>
						<td>'.$food_2.'</td>
					</tr>
				</table>
			</div>
			
			<div id="amenities-supermarket-'.$condo->id.'" class="amenities">    
				<table width=100% style="border: hidden;">
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/supermarket.png" style="width: 25px; height: 25px;"></td>
						<td>'.$supermarket.'</td>
					</tr>
				</table>
			</div>
			
			<div id="amenities-mall-'.$condo->id.'" class="amenities">    
				<table width=100% style="border: hidden;">
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/mall.png" style="width: 25px; height: 25px;"></td>
						<td>'.$mall_1.'</td>
					</tr>
					<tr>
						<td style="width: 20%;"><img src="https://www.drea.com.sg/mobile/img/mall.png" style="width: 25px; height: 25px;"></td>
						<td>'.$mall_2.'</td>
					</tr>
				</table>
			</div>
			
			</td>
		</tr>
	</table>';
	
	$html .= '
	<script type="text/javascript">
	$(\'td.selector\').on(\'click\', function(e){
		var $curr = $(this);
		var option = $curr.data(\'option\');
		
		$(\'td.selector\').each(function(e){
			$(this).removeClass(\'active\');
		});
		$(\'.amenities\').each(function(e){
			$(this).removeClass(\'active\');
		});
		$(\'#amenities-\'+option+\'-'.$condo->id.'\').addClass(\'active\');
		console.log($(\'#amenities-\'+option+\'-'.$condo->id.'\'));
		$curr.addClass(\'active\');
	});
	</script>';
	
	return $html;
}

function get_price_slides($condo) {
	$unit_prices = $condo->get_prices();
	$html = '<ul class="slides">';
	foreach($unit_prices as $prices) {
		$html .= '<li>
					<h4>Unit Prices</h4>
					<div class="condoDetails">			
						<table width=100% cellspacing=0px style="font-size: 12px; border: hidden;">
							<tr>
									<td width=25%><b>Unit Size  (SQFT)</b></td>
									<td width=25% bgcolor="#e3e3e3"><b>Asking Range</b></td>
									<td width=25%><b>Transacted Range</b></td>
									<td width=25% bgcolor="#e3e3e3"><b>No. of Txn</b></td>
							</tr>
							<tr>
								<td width=25%> &le;500 </td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['asking']['500'].'</td>
								<td width=25%>'.$prices['transaction']['500']['range'].'</td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['transaction']['500']['count'].'</td>
							</tr>
							<tr>
								<td width=25%> 501-1000 </td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['asking']['1000'].'</td>
								<td width=25%>'.$prices['transaction']['1000']['range'].'</td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['transaction']['1000']['count'].'</td>
							</tr>
							<tr>
								<td width=25%> 1001-1500 </td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['asking']['1500'].'</td>
								<td width=25%>'.$prices['transaction']['1500']['range'].'</td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['transaction']['1500']['count'].'</td>
							</tr>
							<tr>
								<td width=25%> 1501-2000 </td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['asking']['2000'].'</td>
								<td width=25%>'.$prices['transaction']['2000']['range'].'</td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['transaction']['2000']['count'].'</td>
							</tr>
							<tr>
								<td width=25%> >2000 </td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['asking']['abv2000'].'</td>
								<td width=25%>'.$prices['transaction']['abv2000']['range'].'</td>
								<td width=25% bgcolor=#e3e3e3>'.$prices['transaction']['abv2000']['count'].'</td>
							</tr>
						</table>						
					</div>
				</li>';
	}
	$html .= '</ul>';
		
	return $html;
}


function add_card($id='', $title='', $callback=false, $ajaxload=false){
	if($callback != false && $id != '') {
		if($ajaxload) {
			$widget_output = sprintf('
			<div class="loading %s"><center><img src=https://www.drea.com.sg/assets/shareicons/drea_icon.png style="height: 40px;">
			<span class="loading-text">Loading</span>
			<br><img src="https://www.drea.com.sg/assets/graphics/loader.gif"></center>
			</div>', $id);
		} else {
			$widget_output = get_widget($id,$title, $callback);
		}
		global $params;
		if($ajaxload) {
			$widget_output .= '
				<script type="text/javascript">
				$(window).load(function() {
					postdata = {\'action\' : \'load_widget\', \'widget-name\' : \''.$callback.'\', \'params\' : \''.serialize($params).'\'};	
					$.post(
						"http://localhost/DREA/ajax",
						postdata,
						function(data){ 
							//console.log(data);
							$(\'#'.$id.'\').html(data);
						}
					);
				});
				</script>';
		}
		
		$content_template = $title != ''? '<h4>%s</h4>%s' : '%s%s';
		$card_template = '<section id="%s" class="content-panel">'.$content_template.'</section>';
		$html = sprintf($card_template, $id, $title, $widget_output);
		echo $html;
	}
}

function ajax_load_widget() {
	$callback = $_REQUEST['widget-name'];
	if(function_exists($callback)) {
		$return = call_user_func($callback);
		if($return) echo $return;
	}
}

function condos_autocomplete($freetext) {
	$condos = search_condos($freetext);
	
	$html = '';
	foreach($condos as $condo) {
		
		$html .= '
		<div class="result-row">
			<a class="result-link" target="_self" href="'.$condo->get_condo_link().'">
				<img src="http://www.drea.com.sg/assets/images/condos/sg/'.$condo->id.'/icon.jpg">
				<div class="result-details">
					<span class="result-name">'.$condo->project.'</span><span class="result-desc"> - '.$condo->street_name.' [D'.$condo->district.']</span>
				</div>
			</a>
		</div>';
	}
	
	return $html;
}

function search_condos($freetext = '', $limit = 3) {
	
	$condos = array();
	$db = new DB();
	
	//Remove digits and special characters
	$freetext_array = explode(" ", str_replace(array("'",';',",",'.',"<",">","%")," ",$freetext));
	
	global $words_remove;
	$freetext_array = array_udiff($freetext_array,$words_remove,'strcasecmp');
	
	
	$original = ltrim($freetext," ");

	//query original string
	$so = $db->real_escape_string(str_replace(" ","",$original));
      
	global $wordlist;
	$string = array_udiff($freetext_array,$wordlist,'strcasecmp');
	
	$s_search = '';
	$s_para = '';
	
	foreach ($string as &$value) {
		$s_search .= $value;
		$s_para .= "(REPLACE(CONCAT(project,streetname,name_mrt_near1),' ','') LIKE '%$value%') OR ";
	}
	$s_para = rtrim($s_para," OR ");
	
	$query_original = "SELECT * FROM condos WHERE
		REPLACE(CONCAT(project,streetname,name_mrt_near1),' ','') LIKE '%$so%'
			AND project != ' ' AND id > 0
		ORDER BY CASE
			WHEN project LIKE '%$so%' THEN 1
			WHEN project LIKE '%$so%' THEN 2
			WHEN streetname LIKE '%$so%' THEN 3
		ELSE 4
		END
		LIMIT 0, ".$limit;
	//echo $query_original.'<br>';
    $query = "SELECT * FROM condos WHERE
		'$s_para'
		AND project != ' ' AND id > 0
        LIMIT 0, ".$limit;
	//echo $query.'<br>';
    $query_best = "SELECT * FROM condos WHERE
		'.$s_para.'
		AND project != ' ' AND id > 0
		LIMIT 0, 1";
	//echo $query_best.'<br>';
	$i = 0;
	$res_original = $db->query($query_original);
	$res = $db->query($query);
	$res_best = $db->query($query_best);
	
	$condos = array();
	if($res_best){
		if($res_best->num_rows > 0) {
			if(count($condos) < $limit) {
				foreach($res_best->result as $condo) {
					if(count($condos) == $limit) {
						break;
					}
					if(!array_key_exists($condo['id'],$condos)){
						$condos[$condo['id']] = new Condo($condo);
					}
				}
			}
		}
	}
	
	if($res_original){
		if($res_original->num_rows > 0) {
			if(count($condos) < $limit) {
				foreach($res_original->result as $condo) {
					if(count($condos) == $limit) {
						break;
					}
					if(!array_key_exists($condo['id'],$condos)){
						$condos[$condo['id']] = new Condo($condo);
					}
				}
			}
		}
	}
	
	if($res) {
		if($res->num_rows > 0) {
			if(count($condos) < $limit) {
				foreach($res->result as $condo) {
					if(count($condos) == $limit) {
						break;
					}
					if(!array_key_exists($condo['id'],$condos)){
						$condos[$condo['id']] = new Condo($condo);
					}
				}
			}
		}
	}
	
	return $condos;
}

$wordlist = array(
"units",
"listings",
"unit",
"listing",
"for sale",
"for rent",
"month",
"mth",
"per month",
"per mth",
"for lease",
"for let",
"condo",
"condos",
"projects",
"project",
"apartment",
"apartments",
"flat",
"flats",	
"rates in",
"asking",
"last",
"transacted",
"price",
"prices",
"prices in",
"price in",
"condo prices",
"condo rental prices",
"apartment prices",
"apartment rental rates",
"apartment rental prices",
"rates around",
"prices in",
"price in",
"prices around",
"price around",
"prices near",
"condo prices",
"condo rental prices",
"apartment prices",
"apartment rental rates",
"apartment rental prices",
"transacted price",
"transaction trend",
"sale price",
"historical price",
"past price",
"trend",
"precedent price",
"last transacted", 
"price", 
"rent","rental",
"lease price",
"rental rate",
"historical rental", 
"historical rental rate", 
"past rental",
"past rent", 
"last rent",
"last rental price", 
"previous rental", 
"previous rent",
"unsold",
"available units", 
"new units", 
"new supply",
"supply",
"completed", 
"upcoming supply",
"upcoming units", 
"upcoming apartments", 
"under construction",
"units coming online", 
"condos TOP",
"pending TOP",
"new apartments",
"completing",
"constructed",
"construction",
"constructing",
"finished units",
"units finishing",
"finished building", 	
"interest in area", 
"views", 
"unique view",
"interested buyer", 
"demand", 
"unique visit",
"viewed",
"seen", 
"favourites",
"bookmarked", 
"agents",
"real estate agents",
"call agent",
"find agent",
"agent",
"broker",
"expert",
"call",
"book",
"appointment", 
"housing agent",	
"news", 
"real estate update", 
"updates", 
"update",
"latest development", 
"whats new", 
"market update",
"whats happening", 
"recent change",
"recent development", 
"ura announce ",
"regulatory change", 
"new policy",
"government announce", 
"news archive", 
"past news", 
"old news",
"in",												
"Freehold",	"Leasehold",	"FH",	"LH",	"999",	"99",	"103",									
"Developer ",	"[Name]",	"Dvlp",	"Constructed ",	"Developed",	"Develop",	"Built",	"Build",								
"TOP",															
"near",	"near to" ,"at",	"around",	"nearby",	"proximity",	"surrounding",	"m from",	"metres from",	"metre from",	"km from",	"kilometres from",	"m to",	"metres to",	"metre to",	"km to",	"kilometres to",
"[Mall name]",															
"[MRT name]",	"Station",	"MRT",	"Train",	"line",	"LRT",										
"[Food Court name]",	"food court ",	"food",	"f&b",	"eateries",	"restaurant",	"kopitiam",	"café",	"coffeeshop",	"coffee shop",						
"[Market name]",	"market",	"grocery",	"groceries",	"grocer",	"cold storage",	"mrkt",	"market place ",								
"[School name]",	"Poly",	"JC",	"Uni",	"University",	"school",	"child care",	"childcare",	"polytechnic",	"junior college",	"high school",	"secondary",	"primary",	"kindergarten",	"day care",	"day-care",
"[Airport]",	"changi ",	"[Building name]",	"[Sentosa]",												
"mins",	"min",	"hour",	"hours",	"half an hour",	"1/2 hr",	"hr",	"minutes",	"hrs",							
"Airport",	"[building name]",	"[area name]",													
"[School name]",	"Poly",	"JC",	"Uni",	"University",	"school",	"child care",	"childcare",	"polytechnic",	"junior college",	"high school",	"secondary",	"primary",	"kindergarten",	"day care",	"day-care",
"[Mall name]",															
"[Market name]",	"market",	"grocery",	"groceries",	"grocer",	"cold storage",	"mrkt",	"market place ",								
"walk to",	"walk from",	"stroll to",	"stroll from",												
"[MRT name]",	"Station",	"MRT",	"Train",	"line",	"LRT",										
"[Mall name]",															
"[Food Court name]",	"food court ",	"food",	"f&b",	"eateries",	"restaurant",	"kopitiam",	"café",	"coffeeshop",	"coffee shop",						
"mrt stops from",	"mrt stops to",	"train stops from",	"train stops to",	"stations from",	"stations to",										
"near [name] station",	"near [name] interchange",														
"red line",	"north south line",	"north-south line",	"ns line",	"green line",	"east west line",	"east-west line",	"ew line",	"purple line",	"north east line",	"north-east line",	"NE line",	"NEL",	"yellow line",	"circle line",	"cc line",
"psf",	"per sqft",	"per square feet",	"per square foot",	"psft",											
"psm",	"per sqm",	"per square metre",													
"yield",	"rental return",	"return",	"returns",	"rental rate",											
"sqft",	"sqm",	"sq feet",	"sq foot",	"sq metre",	"sq meter",	"sq ft",	"sq m",	"m square",							
"shoebox",	"studio",	"room",	"loft",	"penthouse",	"ph",	"1 bed room",	"1 bedroom",	"1 br",	"1bed room",	"1bedroom",	"1br",	"1bedder",	"1 bedder",	"one bed room",	"one bedroom",
"high floor",	"low floor",	"highfloor",	"lowfloor",	"topfloor",	"higherfloor",	"higher floor ",	"lower floor",	"lowerfloor",							
"bay window",	"baywindow",	"balcony",	"layout",	"lay out",	"open concept",	"openconcept",									
"swimming pool",	"pool",	"jacuzzi",	"sauna",	"steam room",	"club house",	"clubhouse",	"tennis",	"basketball",	"gym",	"gymnasium",	"playground",	"facilities ",	"facility",		
"[Name]",															
"[Name]",															
"[Name]",															
"[Postal code]",															
"year",	"198[x]","199[x]","200[x]","201[x]","202[x]","yr",									
"1 year",	"2 year",	"1yr",	"2yr",	"3 year",	"3yr",										
"Female",	"Male",	"woman",	"man",	"women",	"men",										
"singaporean",	"local",	"foreigner",	"malaysian",	"philippino",	"filipino",	"indonesian",	"expat",	"thailand",	"vietnamese",						
"20-30",	"20-25",	"mid-20",	"25-30",	"30+",	">30",	"<20",									
"Professional",	"Expat",														
"No Pets",	"No Pet",	"Pets Ok",	"pets allowed ",	"pets not allowed ",	"pets yes",										
"Immediately available",	"Not available",	"Pending TOP",	"January",	"February ",	"March",	"April",	"May",	"June",	"July",	"August",	"September",	"October",	"November",	"December",	"Currently available",
"No tenant",	"tenanted",	"with tenant",	"vacant",												
"Furnished",	"fully furnished",	"partially furnished",	"not furnished",	"can be furnished",	"unfurnished",	"basic furnishing",
"aboard ",
"about ",
"above ",
"according to ",
"across from ",
"across ",
"after ",
"against ",
"ahead of ",
"along ",
"alongside ",
"along with ",
"amid ",
"among ",
"apart from ",
"around ",
"aside from ",
"as of ",
"at ",
"atop ",
"barring ",
"because of ",
"before ",
"behind ",
"below ",
"beneath ",
"beside ",
"besides ",
"between ",
"bedroom",
"br",
"by ",
"beyond ",
"but ",
"by means of ",
"concerning ",
"considering ",
"despite ",
"down ",
"during ",
"except ",
"for ",
"from ",
"in ",
"in addition to ",
"in back of ",
"in front of ",
"in lieu of ",
"in place of ",
"in regard to ",
"inside ",
"in spite of ",
"instead of ",
"into ",
"in view of ",
"like ",
"near ",
"nearby ",
"next to ",
"of",
"off",
"on",
"on account of ",
"onto ",
"on top of ",
"opposite ",
"out ",
"out of ",
"outside ",
"owing to ",
"over ",
"past ",
"per ",
"prior to ",
"regarding ",
"round ",
"since ",
"through ",
"throughout ",
"till ",
"to ",
"together with ",
"towards ",
"under ",
"underneath ",
"until ",
"unto ",
"up ",
"upon ",
"with ",
"within ",
"without ",
"toward ",
"condos around",
"condos near",
"condos beside",
"condo around",
"condo near",
"condo beside",
"apartments around",
"apartments near",
"apartments beside",
"projects around",
"projects near",
"projects beside",
"developmentss around",
"developmentss near",
"developmentss beside",
"condos like",
"similar ",
"similar to ",
"comparable condos",
"benchmark",
"compare",
"similar",
"comparable",
"comps for",
"I","Me","Mine","You","Your","Yours","He","Him","His","She","Her","Hers","it","we","they","we all","theirs","us","ours",
"who","what","when","why","how","which",
"is","isn't","was","wasn't","are","aren't","were","weren't",
"this","that","the",
"find","show",
"would","could","should",
"know","want",
"current","now","today","historical",
"amenities",
"facilities",
"tenure of",
"TOP",
"reviews",
"photo","photos",
"floorplan","floorplans",
"map",
"streetview",
"view",
"facade"
);

$words_remove = array(

    "find",

    "I",

    "min",

    "me",

    "you",

    "yours",

    "him",

    "her",

    "who",

    "what",

    "when",

    "why",

    "how",

    "this",

    "that",

    "these",

    "those",

    "realis",

    "to",

    "DREA",

    "drea",

    "Hi",

    "Hello",

    "all",

    "for",

    "of",

    "is",

    "the",

    "price",

    "prices",

    "of",

    "for",

    "studio",

    "and",

    "or",

    "a",

    "walk",

    "drive",

    "train",

    "mrt",

    "minute",

    "mins",

    "m",

    "million",

    "mil",

    "with",

    "without",

    "k",

    "per",

    "sqft",

    "psf",

    "under",

    "above",

    "between",

    "d",

    "district",

    "least",

    "most",

    "min",

    "max",

    "show",

    "showflats",

    "new",

    "launch",

    "EC",

    "deverloper",

    "development",

    "enbloc",

    "caveats",

    "transactions",

    "more",

    "or",

    "less",

    "than",

    "homes",

    "house",

    "landed",

    "strata",

    "title",

    "pct",

    "percent",

    "room",

    "bedroom",

    "bedrooms",

    "br"

);