// PINOYWEBDEV -- this has to be global
var g_tmObj = 0;
function mortgage() {
var oForm = document.getElementById('mortgage');
var rate = new String(oForm.rate.value);
intRate = (rate.replace(/[^0-9\.]/g, '')/100)/12;
years = new String(oForm.years.value);
months = years.replace(/[^0-9\.]/g, '') * 12;
principal = new String(oForm.principal.value);
principal = principal.replace(/[^0-9\.]/g, '')
oForm.payment.value = '$' + Math.floor((principal*intRate)/(1-Math.pow(1+intRate,(-1*months)))*100)/100;
}
function SubmitContactForm()
{
// check for empty fields
alert('continue');
// there are empty fields if corresponding error fields are visible
if ((document.getElementById('name_error').style.display == "block") ||
(document.getElementById('email_error').style.display == "block") ||
(document.getElementById('phone_error').style.display == "block"))
{
alert('Form is not complete.');
}
else
{
var xmlHttpObj = getNewHttp();
var url = "/bin/process.php";
var strName = document.getElementById('name').value;
var strEmail = document.getElementById('email').value;
var strPhone = document.getElementById('phone').value;
var strComment = document.getElementById('comment').value;
// only to make sure that the comment does not have '&' character when passed as url params
// _REPLACE_IT_BY_AMPERSAND_ will be converted back to '&' on the php side
while(strComment.indexOf('&') > -1)
{
strComment = strComment.replace('&','_REPLACE_IT_BY_AMPERSAND_');
}
var params = "name="+ strName + "&email=" + strEmail + "&phone=" + strPhone + "&comment=" + strComment;
xmlHttpObj.open("POST", url, true);
//Send the proper header information along with the request
xmlHttpObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttpObj.setRequestHeader("Content-length", params.length);
xmlHttpObj.setRequestHeader("Connection", "close");
xmlHttpObj.onreadystatechange = function()
{//Call a function when the state changes.
if(xmlHttpObj.readyState == 4 && xmlHttpObj.status == 200)
{
var contactDiv = document.getElementById('contact_form');
contactDiv.style.display = "none";
var msgDiv = document.getElementById('contact_form_submitted');
msgDiv.style.display = "block";
msgDiv.innerHTML = '
Contact Form Submitted!
I will be in touch soon.';
}
}
xmlHttpObj.send(params);
}
return false; // return false so we don't leave the page
}
function txtInputLostFocus(inputId,inputErrId)
{
if (inputErrId != "")
{
document.getElementById(inputErrId).style.display = "none";
}
document.getElementById(inputId).style.backgroundColor="#FFFFFF";
if (inputErrId != "")
{
if (trim_s(document.getElementById(inputId).value)=="")
{
document.getElementById(inputErrId).style.display = "block";
}
}
if (document.getElementById('popup_wrapper'))
{
ShowTourMeForm();
}
}
function txtInputGotFocus(inputId,inputErrId)
{
if (inputErrId != "")
{
document.getElementById(inputErrId).style.display = "none";
}
document.getElementById(inputId).style.backgroundColor="#FFDDAA";
if (document.getElementById('popup_wrapper'))
{
ShowTourMeForm();
}
}
function trim_s(s)
{
s = s.replace(/^\s+|\s+$/g, '') ;
return s;
}
function getNewHttp()
{
var xmlHttp;
try
{ // Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{ // Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
return xmlHttp;
}
// Contributors
// Ilkka Huotari at http://www.editsite.net
// Mathieu 'p01' HENRI at http://www.p01.org/
// http://seky.nahory.net/2005/04/rounded-corners/
// Steven Wittens at http://www.acko.net/anti-aliased-nifty-corners
// Original Nifty Corners by Alessandro Fulciniti at http://pro.html.it/esempio/nifty/
function NiftyCheck() {
if(!document.getElementById || !document.createElement) {
return false;
}
var b = navigator.userAgent.toLowerCase();
if (b.indexOf("msie 5") > 0 && b.indexOf("opera") == -1) {
return false;
}
return true;
}
function Rounded(className, sizex, sizey, sizex_b, sizey_b) {
var bk;
if (!NiftyCheck()) return;
if (typeof(sizex_b) == 'undefined')
sizex_b = sizex;
if (typeof(sizey_b) == 'undefined')
sizey_b = sizey;
var v = getElements(className);
var l = v.length;
for (var i = 0; i < l; i++)
{
color = get_current_style(v[i],"background-color","transparent");
bk = get_current_style(v[i].parentNode,"background-color","transparent");
AddRounded(v[i], bk, color, sizex, sizey, true);
AddRounded(v[i], bk, color, sizex_b, sizey_b, false);
}
}
Math.sqr = function (x) {
return x*x;
};
function Blend(a, b, alpha) {
var ca = Array(
parseInt('0x' + a.substring(1, 3)),
parseInt('0x' + a.substring(3, 5)),
parseInt('0x' + a.substring(5, 7))
);
var cb = Array(
parseInt('0x' + b.substring(1, 3)),
parseInt('0x' + b.substring(3, 5)),
parseInt('0x' + b.substring(5, 7))
);
return '#' + ('0'+Math.round(ca[0] + (cb[0] - ca[0])*alpha).toString(16)).slice(-2).toString(16)
+ ('0'+Math.round(ca[1] + (cb[1] - ca[1])*alpha).toString(16)).slice(-2).toString(16)
+ ('0'+Math.round(ca[2] + (cb[2] - ca[2])*alpha).toString(16)).slice(-2).toString(16);
return '#' + ('0'+Math.round(ca[0] + (cb[0] - ca[0])*alpha).toString(16)).slice(-2).toString(16)
+ ('0'+Math.round(ca[1] + (cb[1] - ca[1])*alpha).toString(16)).slice(-2).toString(16)
+ ('0'+Math.round(ca[2] + (cb[2] - ca[2])*alpha).toString(16)).slice(-2).toString(16);
}
function AddRounded(el, bk, color, sizex, sizey, top) {
if (!sizex && !sizey)
return;
var i, j;
var d = document.createElement("div");
d.style.backgroundColor = bk;
var lastarc = 0;
for (i = 1; i <= sizey; i++) {
var coverage, arc2, arc3;
// Find intersection of arc with bottom of pixel row
arc = Math.sqrt(1.0 - Math.sqr(1.0 - i / sizey)) * sizex;
// Calculate how many pixels are bg, fg and blended.
var n_bg = sizex - Math.ceil(arc);
var n_fg = Math.floor(lastarc);
var n_aa = sizex - n_bg - n_fg;
// Create pixel row wrapper
var x = document.createElement("div");
var y = d;
x.style.margin = "0px " + n_bg + "px";
x.style.height='1px';
x.style.overflow='hidden';
// Make a wrapper per anti-aliased pixel (at least one)
for (j = 1; j <= n_aa; j++) {
// Calculate coverage per pixel
// (approximates circle by a line within the pixel)
if (j == 1) {
if (j == n_aa) {
// Single pixel
coverage = ((arc + lastarc) * .5) - n_fg;
}
else {
// First in a run
arc2 = Math.sqrt(1.0 - Math.sqr((sizex - n_bg - j + 1) / sizex)) * sizey;
coverage = (arc2 - (sizey - i)) * (arc - n_fg - n_aa + 1) * .5;
// Coverage is incorrect. Why?
coverage = 0;
}
}
else if (j == n_aa) {
// Last in a run
arc2 = Math.sqrt(1.0 - Math.sqr((sizex - n_bg - j + 1) / sizex)) * sizey;
coverage = 1.0 - (1.0 - (arc2 - (sizey - i))) * (1.0 - (lastarc - n_fg)) * .5;
}
else {
// Middle of a run
arc3 = Math.sqrt(1.0 - Math.sqr((sizex - n_bg - j) / sizex)) * sizey;
arc2 = Math.sqrt(1.0 - Math.sqr((sizex - n_bg - j + 1) / sizex)) * sizey;
coverage = ((arc2 + arc3) * .5) - (sizey - i);
}
x.style.backgroundColor = Blend(bk, color, coverage);
if (top)
y.appendChild(x);
else
y.insertBefore(x, y.firstChild);
y = x;
var x = document.createElement("div");
x.style.height='1px';
x.style.overflow='hidden';
x.style.margin = "0px 1px";
}
x.style.backgroundColor = color;
if (top)
y.appendChild(x);
else
y.insertBefore(x, y.firstChild);
lastarc = arc;
}
if (top)
el.insertBefore(d, el.firstChild);
else
el.appendChild(d);
}
function getElements(className) {
var elements = [];
var el = document.getElementsByTagName('DIV');
var regexp=new RegExp("\\b"+className+"\\b");
for (var i = 0; i < el.length; i++)
{
if (regexp.test(el[i].className))
elements.push(el[i]);
}
return elements;
}
function get_current_style(element,property,not_accepted)
{
var ee,i,val,apr;
try
{
var cs=document.defaultView.getComputedStyle(element,'');
val=cs.getPropertyValue(property);
}
catch(ee)
{
if(element.currentStyle)
{
apr=property.split("-");
for(i=1;i -1 || val==not_accepted) && element.parentNode)
{
if(element.parentNode != document)
val=get_current_style(element.parentNode,property,not_accepted);
else
val = '#FFFFFF';
}
if (val.indexOf("rgb") > -1 && val.indexOf("rgba") == -1)
val = rgb2hex(val);
if (val.length == 4)
val = '#'+val.substring(1,1)+val.substring(1,1)+val.substring(2,1)+val.substring(2,1)+val.substring(3,1)+val.substring(3,1);
return val;
}
function rgb2hex(value)
{
var x = 255;
var hex = '';
var i;
var regexp=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;
var array=regexp.exec(value);
for(i=1;i<4;i++) hex += ('0'+parseInt(array[i]).toString(16)).slice(-2);
return '#'+hex;
}
function getWindowWidth() {
var myWidth = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
}
return myWidth;
}
function getWindowHeight() {
var myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myHeight = document.body.clientHeight;
}
return myHeight;
}
function ShowTourMeForm()
{
var winW = getWindowWidth();
var winH = getWindowHeight();
var tbox = document.getElementById('popup_wrapper');
var tbox2 = document.getElementById('popup_form_wrapper');
if (tbox)
{
tbox.style.position = "absolute";
tbox.style.display = "block";
}
if (tbox2)
{
tbox2.style.position = "absolute";
tbox2.style.display = "block";
}
// thumb only show if we are not on a non-property related form
if (document.getElementById('form_for').value != "SEND_EMAIL_ALERT2")
{
if (document.getElementById('propertyThumbImg') != null) {
var thumb_src = document.getElementById('propertyThumbImg').src;
if (thumb_src != "")
{
document.getElementById('popup_property_thumb').src = thumb_src;
}
}
}
document.getElementById('the_form').style.display = "block";
document.getElementById('form_result').style.display = "none";
// position the form on the middle of the page and compute for the correct height of transparent div
var nScrollPos = f_scrollTop();
var innerBoxH = tbox2.offsetHeight;
var innerBoxW = tbox2.offsetWidth;
if (innerBoxH == 0)
{
innerBoxH = tbox2.style.height;
innerBoxW = tbox2.style.width;
}
innerBoxH += 20;
innerBoxW += 20;
//alert("innerBoxH: " + innerBoxH + " ******* innerBoxW: " + innerBoxW);
tbox.style.top = (((winH/2)-(innerBoxH/2)) + nScrollPos ) + 'px';
tbox.style.left =((winW/2)-(innerBoxW/2)) + 'px';
tbox.style.height = innerBoxH + 'px';
tbox.style.width = innerBoxW + 'px';
innerBoxH -= 20;
innerBoxW -= 20;
tbox2.style.top = (((winH/2)-(innerBoxH/2))+ nScrollPos ) + 'px';
tbox2.style.left =((winW/2)-(innerBoxW/2)) + 'px';
}
function HideTourMeForm()
{
var tbox = document.getElementById('popup_wrapper');
if (tbox)
{
tbox.style.display="none";
tbox.style.height='';
tbox.style.width='';
}
var tbox2 = document.getElementById('popup_form_wrapper');
if (tbox2)
{
tbox2.style.display="none";
tbox2.style.height='';
tbox2.style.width='';
}
var sendingObj = document.getElementById('sending_progress_wrapper');
var formResObj = document.getElementById('form_result');
if (sendingObj)
{
sendingObj.style.height='';
}
if (formResObj)
{
formResObj.style.height='';
}
// hide error messages
document.getElementById('name_error').style.display = "none";
document.getElementById('phone_error').style.display = "none";
document.getElementById('email_error').style.display = "none";
document.getElementById('name').value = "";
document.getElementById('email').value = "";
document.getElementById('phone').value = "";
document.getElementById('comment').value = "";
// tour type reset
document.getElementById('tour_type_1').checked=true;
}
function GetTop(elm)
{
var y = 0;
//set y to elm’s offsetTop
y = elm.offsetTop;
//set elm to its offsetParent
elm = elm.offsetParent;
while(elm != null)
{
y = parseInt(y) + parseInt(elm.offsetTop);
elm = elm.offsetParent;
}
return y;
}
function GetLeft(elm)
{
var x = 0;
//set x to elm’s offsetLeft
x = elm.offsetLeft;
//set elm to its offsetParent
elm = elm.offsetParent;
while(elm != null)
{
x = parseInt(x) + parseInt(elm.offsetLeft);
elm = elm.offsetParent;
}
return x;
}
function f_scrollTop() {
return f_filterResults (
window.pageYOffset ? window.pageYOffset : 0,
document.documentElement ? document.documentElement.scrollTop : 0,
document.body ? document.body.scrollTop : 0
);
}
function f_filterResults(n_win, n_docel, n_body) {
var n_result = n_win ? n_win : 0;
if (n_docel && (!n_result || (n_result > n_docel)))
n_result = n_docel;
return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
function emailAlert_ShowTourMeForm()
{
document.getElementById('form_for').value = 'PRICE_ALERT';
document.getElementById('form_title').innerHTML = 'Automated email of new listings or price changes in this subdivision';
if (document.getElementById('thumb_table') != null) {
document.getElementById('thumb_table').style.display = "none";
}
document.getElementById('phone_label').style.display = "block";
document.getElementById('phone').style.display = "block";
document.getElementById('comment_label').style.display = "block";
document.getElementById('form_property_info').style.display="none";
//document.getElementById('popup_form_wrapper').style.backgroundColor="#00063F";
document.getElementById('popup_form_wrapper').style.width="530px";
document.getElementById('popup_wrapper').style.width="550px";
document.getElementById('comment').style.display = "block";
document.getElementById('alert_options').style.display = "none";
document.getElementById('tourme_options').style.display="none";
document.getElementById('sent_message_wrapper').style.display="none";
ShowTourMeForm();
}
function emailAlert_ShowSubmit()
{
document.getElementById('form_for').value = 'email_list';
document.getElementById('form_title').innerHTML = 'Success';
document.getElementById('thumb_table').style.display = "none";
document.getElementById('phone_label').style.display = "none";
document.getElementById('phone').style.display = "none";
document.getElementById('comment_label').style.display = "none";
document.getElementById('comment').style.display = "none";
// forSaleInfo = document.getElementById('forsale_info1').innerHTML;
//forSaleInfo += "
" + document.getElementById('forsale_info2').innerHTML
//document.getElementById('form_property_info').innerHTML = forSaleInfo;
document.getElementById('form_property_info').style.display="none";
document.getElementById('alert_options').style.display = "none";
document.getElementById('tourme_options').style.display="none";
document.getElementById('send_alert_form').style.display="none";
document.getElementById('sent_message_wrapper').style.display="block";
ShowTourMeForm();
}
function inline_email(){
var oForm = document.getElementById('inline_email_alert_form');
if (oForm.email.value == ""){
document.getElementById('sent_message').innerHTML ="Please enter valid contact information";
}else{
sendParams("email=" + oForm.email.value + "&request_type=email updates only");
document.getElementById('sent_message').innerHTML ="Thank you, your email has been sent.";
}
emailAlert_ShowSubmit();
return false;
}
function inline_similar(){
var oForm = document.getElementById('inline_similar_form');
if ((oForm.email.value == "") || (oForm.phone.value == "") || (oForm.name.value == "") ) {
document.getElementById('sent_message').innerHTML ="Please enter valid contact information";
}else{
var strComment = oForm.comment.value;
while(strComment.indexOf('&') > -1)
{
strComment = strComment.replace('&','_REPLACE_IT_BY_AMPERSAND_');
}
sendParams("name=" + oForm.name.value + "&email=" + oForm.email.value + "&phone=" + oForm.phone.value + "&propertyId=" + oForm.propertyId.value + "&comment=" + strComment + "&alert_type=2" + "&request_type=send similar");
document.getElementById('sent_message').innerHTML ="Thank you, I will get these listings to you shortly.";
}
emailAlert_ShowSubmit();
}
function sendParams(params){
var xmlHttpObj = getNewHttp();
xmlHttpObj.open("POST", "/bin/process.php", true);
xmlHttpObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttpObj.setRequestHeader("Content-length", params.length);
xmlHttpObj.setRequestHeader("Connection", "close");
xmlHttpObj.send(params);
return false;
}
function forSale_ShowTourMeForm()
{
document.getElementById('form_for').value = 'FOR_SALE_TOURME';
document.getElementById('form_title').innerHTML = 'Tour Request On For Sale Property';
document.getElementById('thumb_table').style.display = "block";
document.getElementById('phone_label').style.display = "block";
document.getElementById('phone').style.display = "block";
document.getElementById('comment_label').style.display = "block";
document.getElementById('comment').style.display = "block";
forSaleInfo = document.getElementById('forsale_info1').innerHTML;
forSaleInfo += "
" + document.getElementById('forsale_info2').innerHTML
document.getElementById('form_property_info').innerHTML = forSaleInfo;
document.getElementById('form_property_info').style.display="block";
document.getElementById('alert_options').style.display = "none";
document.getElementById('tourme_options').style.display="block";
document.getElementById('sent_message_wrapper').style.display="none";
ShowTourMeForm();
}
function SubmitTourMeForm()
{
var sPhone = "";
// make sure required fields are not empty
if (document.getElementById('phone').style.display=="block")
{
txtInputLostFocus('phone','phone_error');
sPhone = document.getElementById('phone').value;
}
txtInputLostFocus('name','name_error');
txtInputLostFocus('email','email_error');
if ((document.getElementById('name_error').style.display == "block") ||
(document.getElementById('email_error').style.display == "block") ||
(document.getElementById('phone_error').style.display == "block") )
{
alert('Correct form errors and try again');
}
else
{
var sName = document.getElementById('name').value;
var sEmail = document.getElementById('email').value;
var sComment = "";
var sEmailList = "3"; // no email alert
var sPropId = "";
var sTour = "";
var xTour = "";
if (document.getElementById('form_for').value == "SEND_EMAIL_ALERT")
{
sComment = "Email Alert Request";
if (document.getElementById('alert_type_1').checked)
{
sEmailList = document.getElementById('alert_type_1').value;
}
else
{
sEmailList = document.getElementById('alert_type_2').value;
}
}
else if (document.getElementById('form_for').value == "SEND_EMAIL_ALERT2")
{
sComment = "Email Alert Request";
sEmailList = "1"
}
else
{
if (document.getElementById('form_for').value == "FOR_SALE_TOURME")
{
sComment = "Tour Request on FOR SALE Property \n";
sComment += document.getElementById('forsale_info1').innerHTML + "\n";
sComment += document.getElementById('forsale_info2').innerHTML + "\n\n";
}
else if (document.getElementById('form_for').value == "FOR_RENT_TOURME")
{
sComment = "Tour Request on FOR RENT Property \n";
sComment += document.getElementById('forrent_info1').innerHTML + "\n";
sComment += document.getElementById('forrent_info2').innerHTML + "\n\n";
}
if (document.getElementById('tour_type_1').checked)
{
sTour = document.getElementById('tour_type_1').value;
xTour = "tour now";
}
else
{
sTour = document.getElementById('tour_type_2').value;
xTour = "send details";
}
}
if (document.getElementById('form_for').value != "SEND_EMAIL_ALERT2")
{
sPropId = document.getElementById('propertyId').value;
}
// users comment on form if any....
sComment += document.getElementById('comment').value;
while(sComment.indexOf('&') > -1)
{
sComment = sComment.replace('&','_REPLACE_IT_BY_AMPERSAND_');
}
var xmlHttpObj = getNewHttp();
var url = "/bin/process.php";
var params = "name="+ sName + "&email=" + sEmail + "&phone=" + sPhone + "&emailList=" + sEmailList + "&propertyId=" + sPropId + "&tour=" + sTour + "&request_type=" + xTour + "&comment=" + sComment;
xmlHttpObj.open("POST", url, true);
//Send the proper header information along with the request
xmlHttpObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttpObj.setRequestHeader("Content-length", params.length);
xmlHttpObj.setRequestHeader("Connection", "close");
// preserved form's height
var nFormHt = document.getElementById('popup_form_wrapper').offsetHeight;
var nInnerFormHt = document.getElementById('the_form').offsetHeight;
xmlHttpObj.onreadystatechange = function()
{//Call a function when the state changes.
if(xmlHttpObj.readyState == 4 && xmlHttpObj.status == 200)
{
document.getElementById('sending_progress_wrapper').style.display = "none";
document.getElementById('form_result').style.display = "block";
document.getElementById('form_result').style.height = nInnerFormHt + 'px';
document.getElementById('popup_form_wrapper').style.height = nFormHt + 'px';
clearTimeout(g_tmObj);
}
else if (xmlHttpObj.readyState == 4 && xmlHttpObj.status != 200)
{
document.getElementById('sending_progress_wrapper').style.display = "none";
document.getElementById('sending_failed').style.display = "block";
document.getElementById('sending_failed').style.height = nInnerFormHt + 'px';
document.getElementById('popup_form_wrapper').style.height = nFormHt + 'px';
clearTimeout(g_tmObj);
}
}
document.getElementById('the_form').style.display = "none";
document.getElementById('sending_progress_wrapper').style.display = "block";
document.getElementById('sending_progress_wrapper').style.height = nInnerFormHt + 'px';
// show progress
displaySendingProgress();
xmlHttpObj.send(params);
}
return false;
}
function displaySendingProgress()
{
var oProg = document.getElementById('sending_progress');
if (oProg)
{
var sProg = oProg.innerHTML;
sProg = trim(sProg);
sProg = sProg.toLowerCase();
if (sProg == 'sending
')
{
sProg = 'Sending .
';
}
else if (sProg == 'sending .
')
{
sProg = 'Sending . .
';
}
else if (sProg == 'sending . .
')
{
sProg = 'Sending . . .
';
}
else if (sProg == 'sending . . .
')
{
sProg = 'Sending
';
}
oProg.innerHTML = sProg;
g_tmObj = setTimeout("displaySendingProgress()",300);
}
}
function trim(s) {
return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}
function showLargerMap()
{
var bgDiv = document.getElementById('popup_wrapper');
var popupFrm = document.getElementById('popup_form_wrapper');
// make sure popup form for send email alert and tour me are closed
popupFrm.style.display = "none";
var nScrollPosTop = f_scrollTop();
winW = getWindowWidth();
winH = getWindowHeight();
bgDiv.style.top = nScrollPosTop + 'px';
bgDiv.style.left = 0 + 'px';
bgDiv.style.height = winH + 'px';
bgDiv.style.width = (winW-10) + 'px';
bgDiv.style.display = "block";
var mapDiv = document.getElementById('map_div_wrapper');
if (mapDiv)
{
mapDiv.style.top = nScrollPosTop + 20 + 'px';
mapDiv.style.left = 20 + 'px';
mapDiv.style.width = (winW - 50) + 'px';
mapDiv.style.height = (winH - 55) + 'px';
mapDiv.style.display = "block";
}
var mapCanvas = document.getElementById('map_canvas');
if (mapCanvas)
{
mapCanvas.style.top = (parseInt(mapDiv.style.top)+20) + 'px';
mapCanvas.style.left = (parseInt(mapDiv.style.left)+15) + 'px';
mapCanvas.style.width = (parseInt(mapDiv.style.width)-30) + 'px';
mapCanvas.style.height = (parseInt(mapDiv.style.height)-40) + 'px';
mapCanvas.style.display = "block";
}
var closeLink = document.getElementById('map_close_link');
if (closeLink)
{
closeLink.style.top = (parseInt(mapCanvas.style.top)+parseInt(mapCanvas.style.height))+ 'px';
closeLink.style.left = ((winW/2)-10) + 'px';
closeLink.style.display = "block";
}
}
function moveLargeMap()
{
var mapDiv = document.getElementById('map_div_wrapper');
if (mapDiv.style.display == 'block')
{
showLargerMap();
}
}
function doScrollFunctions()
{
moveLargeMap();
moveBigMapMessage();
}
function moveBigMapMessage()
{
var oMsgDiv = document.getElementById('big_streetview_map_message');
if ((oMsgDiv)&&(oMsgDiv.style.display=="block"))
{
var mapCanvas = document.getElementById("map_canvas");
oMsgDiv.style.top = (parseInt(mapCanvas.style.top)) + 'px';
oMsgDiv.style.left = (parseInt(mapCanvas.style.left)) + 'px';
}
}
function HideLargeMap()
{
var bgDiv = document.getElementById('popup_wrapper');
var mapDiv = document.getElementById('map_div_wrapper');
var mapCanvas = document.getElementById('map_canvas');
var closeLink = document.getElementById('map_close_link');
if (bgDiv)
{
bgDiv.style.width = 10 + 'px';
bgDiv.style.display = "none";
}
if (mapDiv)
{
mapDiv.style.display = "none";
}
if (mapCanvas)
{
mapCanvas.style.display = "none";
}
if (closeLink)
{
closeLink.style.display = "none";
}
}
function displayMap(mapType)
{
HidePopup('big_streetview_map_message');
if (GBrowserIsCompatible())
{
var map = new GMap2(document.getElementById('map_canvas'));
// PINOYWEBDEV comment
// This is the html that goes into a map marker
// a marker can have its own html shown into the popup info window
var html = 'Name of subdivision
'+
'Price Range $20k-$50k
'+
'20 homes for sale/30 homes for Rent
';
var centerIcon = new GIcon();
var iconbig = new GIcon();
var point;
var streetviewlatlong;
centerIcon.image = "/images/marker_34_orange.png";
centerIcon.shadow = "/images/marker_shadow.png";
centerIcon.iconSize = new GSize(20, 34);
centerIcon.shadowSize = new GSize(37, 34);
centerIcon.iconAnchor = new GPoint(6, 34);
centerIcon.infoWindowAnchor = new GPoint(10, 10);
iconbig.image = "/images/marker_34_green.png";
iconbig.shadow = "/images/marker_shadow.png";
iconbig.iconSize = new GSize(20, 34);
iconbig.shadowSize = new GSize(37, 34);
iconbig.iconAnchor = new GPoint(6, 34);
iconbig.infoWindowAnchor = new GPoint(10, 10);
point = new GLatLng(28.436136,-81.404427);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, centerIcon);
// create new point
point = new GLatLng(28.4337, -81.4017);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4411, -81.3998);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4421, -81.4049);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4381, -81.4077);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4337, -81.4116);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4370, -81.4180);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4426, -81.4183);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4456, -81.4090);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4273, -81.4092)
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4346, -81.3905);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
point = new GLatLng(28.4394, -81.3924);
streetviewlatlong = 'Street View';
setupMarkersAndInfoWindow(map, point, html, streetviewlatlong, iconbig);
mapTypes = map.getMapTypes();
// 0 - street map
// 1 - satelite map
// 2 - hybrid map
map.setCenter(new GLatLng(28.436136,-81.404427), 14, mapTypes[mapType] );
map.addControl(new GSmallMapControl());
}
}
function createMarker(point, html, icon)
{
var marker = new GMarker(point, icon);
GEvent.addListener(marker, "click", function()
{
marker.openInfoWindowHtml('' + html + '
');
});
return marker;
}
function MapStreetView(lat,lng)
{
HidePopup('big_streetview_map_message');
var pt = new GLatLng(lat,lng);
var client = new GStreetviewClient();
var callback = function (latlng)
{
var marker;
if (latlng != null)
{
var myPano = new GStreetviewPanorama(document.getElementById("map_canvas"));
var fenwayPark = new GLatLng(lat,lng);
myPOV = {yaw:370.64659986187695,pitch:-5};
myPano.setLocationAndPOV(fenwayPark, myPOV);
GEvent.addListener(myPano, "error", handleNoFlash);
}
else
{
// popup no streetview message here
var oMsgDiv = document.getElementById('big_streetview_map_message');
if (oMsgDiv)
{
oMsgDiv.innerHTML = 'Street View Map not available for the location: GLatLng(' + lat + ',' + lng + ')';
var mapCanvas = document.getElementById("map_canvas");
oMsgDiv.style.top = (parseInt(mapCanvas.style.top)) + 'px';
oMsgDiv.style.left = (parseInt(mapCanvas.style.left)) + 'px';
oMsgDiv.style.display="block";
setTimeout("HidePopup('big_streetview_map_message')",5000);
}
}
};
client.getNearestPanoramaLatLng(pt,callback);
}
function setupMarkersAndInfoWindow(map, pt, html, streetview_link, marker_icon) // pt is GLatLng(...)
{
var client = new GStreetviewClient();
var callback = function (latlng)
{
var marker;
if (latlng != null)
{
marker = createMarker( pt, html+streetview_link, marker_icon);
}
else
{
marker = createMarker( pt, html, marker_icon);
}
map.addOverlay(marker);
};
client.getNearestPanoramaLatLng(pt,callback);
}
var myPano;
// PINOYWEBDEV comment
// modified this script so that if there is no available street view
// a map is drawn instead of just nothing
function DrawMapToPanoDiv(MAP_TYPE,lat,lng)
{
// hide pano map notice
HidePopup('pano_map_message');
var pt = new GLatLng(lat,lng);
var client = new GStreetviewClient();
var callback = function (latlng)
{
var marker;
if (latlng != null)
{
// lat and lng for street view is present, draw street view
var myPano = new GStreetviewPanorama(document.getElementById("pano"));
fenwayPark = new GLatLng(lat,lng);
myPOV = {yaw:370.64659986187695,pitch:-5};
myPano.setLocationAndPOV(fenwayPark, myPOV);
GEvent.addListener(myPano, "error", handleNoFlash);
}
else
{
// no lat lng for street view, just draw the map
var map = new GMap2(document.getElementById('pano'));
map.setCenter(new GLatLng(lat,lng), 14 );
map.addControl(new GSmallMapControl());
var marker = new GMarker(new GLatLng(lat,lng));
map.addOverlay(marker);
// show message
var msgDiv = document.getElementById('pano_map_message');
msgDiv.innerHTML = 'Street View Map not available for the location: GLatLng(' + lat + ',' + lng + ')';
msgDiv.style.display = "block";
setTimeout("HidePopup('pano_map_message');",5000); // 5seconds before the street view map not available message is hidden
}
};
if (MAP_TYPE=='STREETVIEW')
{
client.getNearestPanoramaLatLng(pt,callback);
}
else
{
var map = new GMap2(document.getElementById('pano'));
map.setCenter(new GLatLng(lat,lng), 14 );
map.addControl(new GSmallMapControl());
var marker = new GMarker(new GLatLng(lat,lng));
map.addOverlay(marker);
mapTypes = map.getMapTypes();
// 0 - street map
// 1 - satelite map
// 2 - hybrid map
map.addControl(new GSmallMapControl());
if (MAP_TYPE=='STREETMAP')
{
map.setCenter(new GLatLng(lat,lng), 14, mapTypes[0] );
}
else if (MAP_TYPE=='SATELITEMAP')
{
map.setCenter(new GLatLng(lat,lng), 14, mapTypes[1] );
}
else if (MAP_TYPE=='HYBRIDMAP')
{
map.setCenter(new GLatLng(lat,lng), 14, mapTypes[2] );
}
}
}
function HidePopup(popupId)
{
var msgDiv = document.getElementById(popupId);
if (msgDiv)
{
msgDiv.style.display="none";
}
}
// PINOYWEBDEV comment
// replaced FLASH_UNAVAILABLE with 603
// FLASH_UNAVAILABLE is causing javascript errors
function handleNoFlash(errorCode) {
if (errorCode == 603) {
alert("Error: Flash doesn't appear to be supported by your browser");
return;
}
}
function ForSaleTourMeFormDetails()
{
document.getElementById('tour_type_2').checked=true;
forSale_ShowTourMeForm();
}
function ForRentTourMeFormDetails()
{
document.getElementById('tour_type_2').checked=true;
forRent_ShowTourMeForm();
}
window.onscroll = doScrollFunctions;