function open_window(url, width, height, is_scroll, is_resize, is_centered) {
var pHoriz;
var top;
var left;
if (is_centered == 1) {
if(window.screen) {
left = (screen.width - width) / 2;
top = (screen.height - height) / 2;
}
} else {
left = 100;
top = 100;
}
if(!pHoriz || pHoriz.closed) {
pHoriz = window.open(url,'','width='+ width +', height='+ height +', left='+ left +', top='+ top +', screenX='+ left +', screenY='+ top +', scrollbars='+ is_scroll +', resizable= '+ is_resize +', menubar=no, toolbar=no');
} else {
pHoriz.focus();
}
}
function add_bookmark (url, title){
if (window.sidebar) {
window.sidebar.addPanel(title, url, "");
} else if ( document.all ) {
window.external.AddFavorite(url, title);
} else if (window.opera && window.print) {
return true;
} else {
alert("Your browser does not support this. Please Bookmark this search manually.");
}
}
function hilite_row(element, classid) {
var parent = element.parentNode;
parent.className = classid;
}
function expand_homepage() {
Effect.BlindDown('HPB_2', { duration: 0.3 });
$('HPB_1').hide();
}
function contract_homepage() {
Effect.BlindUp('HPB_2', { duration: 0.3 });
$('HPB_1').show();
}
function display_image(id, image, w) {
var ic = $('BI');
var nwide = parseInt(ic.width) + 12;
$('IMP').show();
setTimeout(function() {
ic.style.height = img_array[id][2];
ic.style.width = img_array[id][1];
ic.src ='/images/properties/lg_'+ image;
$('IMP').style.width = parseInt(img_array[id][1]) + 12;
$('IMP').style.height = parseInt(img_array[id][2]) + 12;
$('IMP').style.left = ((450 - parseInt(img_array[id][1])) / 2) - 14;
Effect.Fade('IMP', { duration: 0.3 });
}, 1200);
}
function count_results() {
var load_button = $('LRB').innerHTML;
var form = $('QS');
var params = form.serialize();
$('LRB').innerHTML = "
";
new Ajax.Request('/search/get_count/', { method:'post', parameters: params,
onSuccess: function(transport) {
$('RR').innerHTML = transport.responseText;
Effect.BlindDown('RR', { duration: 0.3 });
Effect.ScrollTo('RES', { duration: 1.3 });
$('LRB').innerHTML = load_button;
}
});
}
function swap_pmenus(e) {
var node = e.value;
var min = $('price_min');
var max = $('price_max');
min.options.length = 0;
max.options.length = 0;
min.options[0] = new Option('Choose Minimum Price...', '');
min.options[1] = new Option('-----------------', '');
max.options[0] = new Option('Choose Maximum Price...', '');
max.options[1] = new Option('-----------------', '');
if (node == 'R') {
min.options[2] = new Option('Less than 20,000', '0');
min.options[3] = new Option('20,000', '20000');
min.options[4] = new Option('30,000', '30000');
min.options[5] = new Option('40,000', '40000');
min.options[6] = new Option('50,000', '50000');
min.options[7] = new Option('75,000', '75000');
min.options[8] = new Option('100,000', '100000');
min.options[9] = new Option('More than 100,000', '+');
max.options[2] = new Option('Less than 20,000', '0');
max.options[3] = new Option('20,000', '20000');
max.options[4] = new Option('30,000', '30000');
max.options[5] = new Option('40,000', '40000');
max.options[6] = new Option('50,000', '50000');
max.options[7] = new Option('75,000', '75000');
max.options[8] = new Option('100,000', '100000');
max.options[9] = new Option('More than 100,000', '+');
} else {
min.options[2] = new Option('Less than 500,000', '0');
min.options[3] = new Option('1 Million', '1000000');
min.options[4] = new Option('3 Million', '3000000');
min.options[5] = new Option('5 Million', '5000000');
min.options[6] = new Option('7 Million', '7000000');
min.options[7] = new Option('10 Million', '10000000');
min.options[8] = new Option('20 Million', '20000000');
min.options[9] = new Option('More than 20 Million', '+');
max.options[2] = new Option('Less than 500,000', '0');
max.options[3] = new Option('1 Million', '1000000');
max.options[4] = new Option('3 Million', '3000000');
max.options[5] = new Option('5 Million', '5000000');
max.options[6] = new Option('7 Million', '7000000');
max.options[7] = new Option('10 Million', '10000000');
max.options[8] = new Option('20 Million', '20000000');
max.options[9] = new Option('More than 20 Million', '+');
}
}
function fade_element(el) {
Effect.Fade(el, { duration: 0.3 });
}
function rss_init() {
$('tRSS').hide();
Effect.Appear('rRSS', { duration: 0.3 });
}
function rss_cancel() {
$('rRSS').hide();
Effect.Appear('tRSS', { duration: 0.3 });
}
function rss_subscribe() {
var feed = $('feed').value;
var url = '/rss/?s='+ feed;
open_window(url, 520, 440, 1, 0, 1);
}
function strand() {
var q = 'yprope';
var p = 'cit';
var e = 'om';
var t = 'info';
var w = 'rties';
var g = 'pattaya';
var y = 'law';
var r = '.c';
bedlum = t + '@' + g + p + q + w + r + e;
vacate(bedlum);
}
function vacate(i) {
document.location.href='mailto:'+ i;
}
function save_listing(id) {
Effect.BlindDown('SLI', { duration: 0.3 });
new Ajax.Request('/listings/save_listing/'+ id, { method:'get',
onSuccess: function(transport) {
$('SLI').innerHTML = transport.responseText;
$('MLI').show();
}
});
}
function curr_convert(baht) {
Effect.BlindDown('CURR', { duration: 0.3 });
new Ajax.Request('/listings/get_rates/'+ baht, { method:'get',
onSuccess: function(transport) {
$('CURR').innerHTML = transport.responseText;
}
});
}
function size_convert(size, unit) {
Effect.BlindDown('SIZE', { duration: 0.3 });
new Ajax.Request('/listings/convert_size/?size='+ size +'&unit='+ unit, { method:'get',
onSuccess: function(transport) {
$('SIZE').innerHTML = transport.responseText;
}
});
}
function locate(i) {
alert('The locator map interface is still under development.');
}
function view_mylist() {
var url = '/listings/mylist/';
Effect.BlindDown('LIST', { duration: 0.3 });
new Ajax.Request(url, { method:'get',
onSuccess: function(transport) {
$('LIST').innerHTML = transport.responseText;
}
});
}
function remove_listing_node(id) {
$('DI_'+id).blur();
$('DI_'+id).src = '/images/load_arrows.gif';
new Ajax.Request('/listings/mylist/index.c?remove='+ id, { method:'get',
onSuccess: function(transport) {
$('LIST').innerHTML = transport.responseText;
}
});
}
function inquire(id) {
Effect.BlindDown('INQ', { duration: 0.3 });
new Ajax.Request('/contact/quick_inquiry/index.c?pid='+ id, { method:'get',
onSuccess: function(transport) {
$('INQ').innerHTML = transport.responseText;
}
});
}
function send_inquiry() {
var f = $('QI');
var m = '';
var ep = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
if (f.name.value == '') {
m += '