/**
* JSONscriptRequest good for making json requests
*
*/
function JSONscriptRequest(fullUrl, callback) {
// REST request path
this.fullUrl = fullUrl;
// Keep IE from caching requests
this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
// Get the DOM location to put the script tag
this.headLoc = document.getElementsByTagName("head").item(0);
// Generate a unique script tag id
this.scriptId = 'JscriptId' + JSONscriptRequest.scriptCounter++;
}
JSONscriptRequest.scriptCounter = 1;
JSONscriptRequest.prototype.buildScriptTag = function () {
// Create the script tag
this.scriptObj = document.createElement("script");
// Add script object attributes
this.scriptObj.setAttribute("type", "text/javascript");
this.scriptObj.setAttribute("charset", "utf-8");
this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE);
this.scriptObj.setAttribute("id", this.scriptId);
};
JSONscriptRequest.prototype.removeScriptTag = function () {
// Destroy the script tag
this.headLoc.removeChild(this.scriptObj);
};
JSONscriptRequest.prototype.addScriptTag = function () {
// Create the script tag
this.headLoc.appendChild(this.scriptObj);
};
/**
* ScriptImporter
*
* @author Rodrigo Oliveira
*/
function ScriptImporter(fullUrl) {
this.fullUrl = fullUrl.indexOf('?') < 0? fullUrl + '?':fullUrl;
this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
this.headElement = document.getElementsByTagName("head").item(0);
this.scriptId = 'JscriptId' + ScriptImporter.scriptCounter++;
return this;
};
ScriptImporter.scriptCounter = 1;
ScriptImporter.prototype.buildScriptTag = function () {
this.scriptObj = document.createElement("script");
this.scriptObj.setAttribute("type", "text/javascript");
this.scriptObj.setAttribute("charset", "utf-8");
this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE);
this.scriptObj.setAttribute("id", this.scriptId);
};
ScriptImporter.prototype.removeScriptTag = function () {
this.headElement.removeChild(this.scriptObj);
};
ScriptImporter.prototype.addScriptTag = function () {
this.headElement.appendChild(this.scriptObj);
};
ScriptImporter.prototype.importScript = function() {
this.buildScriptTag();
this.addScriptTag();
return this;
};
/**
* CSSImporter
*
* @author Rodrigo Oliveira
*/
function CSSImporter(fullUrl) {
this.fullUrl = fullUrl.indexOf('?') < 0? fullUrl + '?':fullUrl;
this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
this.headElement = document.getElementsByTagName("head").item(0);
this.linkId = 'cssId' + CSSImporter.scriptCounter++;
return this;
}
CSSImporter.scriptCounter = 1;
CSSImporter.prototype.buildScriptTag = function () {
this.linkElement = document.createElement("link");
this.linkElement.setAttribute("type", "text/css");
this.linkElement.setAttribute("rel", "stylesheet");
this.linkElement.setAttribute("charset", "utf-8");
this.linkElement.setAttribute("media", "screen");
this.linkElement.setAttribute("href", this.fullUrl + this.noCacheIE);
this.linkElement.setAttribute("id", this.linkId);
};
CSSImporter.prototype.removeScriptTag = function () {
this.headElement.removeChild(this.linkElement);
};
CSSImporter.prototype.addScriptTag = function () {
this.headElement.appendChild(this.linkElement);
};
CSSImporter.prototype.importCSS = function() {
this.buildScriptTag();
this.addScriptTag();
return this;
};
/**
* Utility function for making a JSON Request and specifying a callback
*
* @author Rodrigo Oliveira
*/
function jsonRequest(requestUrl, callback) {
// alert(requestUrl+ '&callback='+callback);
var jsonScript = new JSONscriptRequest(requestUrl+ '&callback='+callback);
jsonScript.buildScriptTag();
jsonScript.addScriptTag();
}
function getParam(parameterName) {
return getParameter(document.location.search.substring(1), parameterName);
}
/**
* This function triggers the downloading and parsing of a selected text file
* marker, sidebar and infowindow data is extracted from the file
*/
function getParameter ( queryString, parameterName ) {
// Add "=" to the parameter name (i.e. parameterName=value)
var values = [];
parameterName += "=";
while ( queryString.length > 0 ) {
// Find the beginning of the string
var begin = queryString.indexOf ( parameterName );
var end = queryString.length;
// If the parameter name is not found, skip it, otherwise return the value
if ( begin != -1 ) {
// Add the length (integer) to the beginning
begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
end = queryString.indexOf ( "&" , begin );
if ( end == -1 ) {
end = queryString.length;
}
// Return the string
var value = unescape ( queryString.substring ( begin, end ) );
values.push(value!=null?value.replace(/\+/g, " "):null);
}
queryString = queryString.substring(end, queryString.length);
}
if (values.length === 1) {
return values[0];
} else if (values.length > 1) {
return values;
}
return null;
}
jQuery(document).ready(function() {
if(jQuery("#pw_owner_portal_login_form").length > 0){
jQuery('body').append('');
} else if(jQuery("#pw_tenant_portal_login_form").length > 0){
jQuery('body').append('');
}
if (jQuery(".widget_version_2").size() == 0) {
jQuery("#pw_owner_portal_login_form").html(jQuery("#pw_owner_portal_login_form").html() + '');
jQuery("#pw_tenant_portal_login_form").html(jQuery("#pw_tenant_portal_login_form").html() + '');
}
});
var featuredListingSlideDirection = 1; //
var featuredForSaleListingSlideDirection = 1; //
function outputFeaturedListingV2(jsonObj) {
if (typeof jsonObj != "undefined") {
if (jsonObj.unit != null) {
//jQuery('#pw_featured_rental_listing_v2_content_div').hide("slide", {direction: featuredListingSlideDirection==1?"down":"down"}, 250);
var photo = '';
if (jsonObj.unit.image != null) {
photo = IMAGE_SERVICE_BASE_URL+jsonObj.unit.image;
} else {
// if( jsonObj.unit.forSale == 'true'){
if (jsonObj.forSaleWidget ) {
photo = PW_SERVER_URL+'/pw/website/widgets/images/pw_featured_for_sale_listing_no_photo.png';
} else {
photo = PW_SERVER_URL+'/pw/website/widgets/images/pw_featured_rental_listing_no_photo.png';
}
}
//*********** FOR SALE LISTING **********//
// if (jsonObj.unit.forSale == 'true') {
if (jsonObj.forSaleWidget ) {
var url = jsonObj.forsalePage+"?uid="+jsonObj.unit.id+ '&isEnterpriseWidget=' + jsonObj.unit.isEnterpriseWidget;
// We need to give the user the ability to pass in 1 to many siteIDs to the enterprise listing widget.
// If a site ID is passed in then the listing widget should show available listings associated to that site.
// If no site IDs are passed in it should work off of the "Publish Partner Listings" option.
if (typeof enterpriseWidgetSiteDs != "undefined") {
url += "&enterpriseWidgetSiteDs=" + enterpriseWidgetSiteDs;
}
var imageTag ='';
jQuery("#pw_featured_for_sale_listing_v2_img_td").html(imageTag + ' ');
jQuery("#pw_featured_for_sale_listing_v2_type_and_price_td").html(jsonObj.unit.salePrice + ' | ' + jsonObj.unit.type );
jQuery("#pw_featured_for_sale_listing_v2_desc_td h2").html(jsonObj.unit.postingTitle);
jQuery("#pw_featured_for_sale_listing_v2_address_td").html(jsonObj.unit.address + ', ' + jsonObj.unit.city + ', ' + jsonObj.unit.state);
jQuery("#pw_featured_for_sale_listing_v2_desc_td p").html( jsonObj.unit.comments );
// ONLY FOR TEST PURPOSE
//jQuery("#pw_featured_for_sale_listing_v2_desc_td p").html( "list: " + jsonObj.featuredUnitIDs + " id: " + jsonObj.unit.id ); if (jsonObj.featuredUnitIDs != null) { var numberOfUnits = jsonObj.featuredUnitIDs.length; for (i = 0; i < numberOfUnits; i++) { if (jsonObj.unit.id == jsonObj.featuredUnitIDs[i]) { if ((i + 1 < numberOfUnits)) { jQuery('#pw_featured_for_sale_listing_v2_next_td').html(' '); } else { jQuery('#pw_featured_for_sale_listing_v2_next_td').html(''); } if (i > 0) { jQuery('#pw_featured_for_sale_listing_v2_previous_td').html(' '); } else { jQuery('#pw_featured_for_sale_listing_v2_previous_td').html(''); } previousFeaturedForSaleID = (i - 1 >= 0)?jsonObj.featuredUnitIDs[i-1]:null; } } } jQuery('#pw_featured_for_sale_listing_v2_content_div').show("slide", {direction: featuredForSaleListingSlideDirection==1?"right":"left"}, 250); //jQuery('#pw_featured_for_sale_listing_v2_img_link').animate({backgroundPosition:"(center center)"}, {duration:500}); } else { //*********** FOR RENT LISTING **********// var url = jsonObj.unitPage + jsonObj.unit.id + '&isEnterpriseWidget=' + jsonObj.unit.isEnterpriseWidget ; // We need to give the user the ability to pass in 1 to many siteIDs to the enterprise listing widget. // If a site ID is passed in then the listing widget should show available listings associated to that site. // If no site IDs are passed in it should work off of the "Publish Partner Listings" option. if (typeof enterpriseWidgetSiteDs != "undefined") { url += "&enterpriseWidgetSiteDs=" + enterpriseWidgetSiteDs; } var imageTag =''; jQuery("#pw_featured_rental_listing_v2_img_td").html(imageTag + ' '); jQuery("#pw_featured_rental_listing_v2_type_and_price_td").html(jsonObj.unit.targetRentDescription + ' | ' + jsonObj.unit.type ); jQuery("#pw_featured_rental_listing_v2_desc_td h2").html(jsonObj.unit.postingTitle); jQuery("#pw_featured_rental_listing_v2_address_td").html(jsonObj.unit.address + ', ' + jsonObj.unit.city + ', ' + jsonObj.unit.state); jQuery("#pw_featured_rental_listing_v2_desc_td p").html(jsonObj.unit.comments); // ONLY FOR TEST PURPOSE //jQuery("#pw_featured_rental_listing_v2_desc_td p").html( "list: " + jsonObj.featuredUnitIDs + " id: " + jsonObj.unit.id ); if (jsonObj.featuredUnitIDs != null) { var numberOfUnits = jsonObj.featuredUnitIDs.length; for (i = 0; i < numberOfUnits; i++) { if (jsonObj.unit.id == jsonObj.featuredUnitIDs[i]) { if ((i + 1 < numberOfUnits)) { jQuery('#pw_featured_rental_listing_v2_next_td').html(' '); } else { jQuery('#pw_featured_rental_listing_v2_next_td').html(''); } if (i > 0) { jQuery('#pw_featured_rental_listing_v2_previous_td').html(' '); } else { jQuery('#pw_featured_rental_listing_v2_previous_td').html(''); } previousFeaturedRentalID = (i - 1 >= 0)?jsonObj.featuredUnitIDs[i-1]:null; } } } jQuery('#pw_featured_rental_listing_v2_content_div').show("slide", {direction: featuredListingSlideDirection==1?"right":"left"}, 250); //jQuery('#pw_featured_rental_listing_v2_img_link').animate({backgroundPosition:"(center center)"}, {duration:500}); } } } else { jQuery('#pw_featured_rental_listing_animated').hide(); jQuery('#pw_featured_enterprise_rental_listing_animated').hide(); jQuery('#pw_featured_for_sale_listing_animated').hide(); jQuery('#pw_featured_enterprise_for_sale_listing_animated').hide(); } } function loadFeaturedUnit(uid, direction, isEnterpriseWidget) { if (uid != null) { featuredListingSlideDirection = direction; var url = PW_SCRIPT_SERVER_URL+"/pw/marketing/website.do?action=f&callback=outputFeaturedListingV2&sid="+SID+"&uid="+uid+"&isEnterpriseWidget="+isEnterpriseWidget; // We need to give the user the ability to pass in 1 to many siteIDs to the enterprise listing widget. // If a site ID is passed in then the listing widget should show available listings associated to that site. // If no site IDs are passed in it should work off of the "Publish Partner Listings" option. if (typeof enterpriseWidgetSiteDs != "undefined") { url += "&enterpriseWidgetSiteDs=" + enterpriseWidgetSiteDs; } new ScriptImporter( url ).importScript(); } } function loadForSaleFeaturedUnit(uid, direction, isEnterpriseWidget) { if (uid != null) { featuredForSaleListingSlideDirection = direction; var url = PW_SCRIPT_SERVER_URL+"/pw/marketing/website.do?action=f&forSale=true&callback=outputFeaturedListingV2&sid="+SID+"&uid="+uid+"&isEnterpriseWidget="+isEnterpriseWidget; // We need to give the user the ability to pass in 1 to many siteIDs to the enterprise listing widget. // If a site ID is passed in then the listing widget should show available listings associated to that site. // If no site IDs are passed in it should work off of the "Publish Partner Listings" option. if (typeof enterpriseWidgetSiteDs != "undefined") { url += "&enterpriseWidgetSiteDs=" + enterpriseWidgetSiteDs; } new ScriptImporter( url ).importScript(); } } /** * todo rodrigo: widget needs to be refactored, mark up can be moved into the actual widget * * @param result */ function outputFeaturedListing(result) { if (result.unit != null) { var imageTag; var pageName = "rentals"; var url = pageName+'.html?uid='+result.unit.id+ '&isEnterpriseWidget=' + result.unit.isEnterpriseWidget; // We need to give the user the ability to pass in 1 to many siteIDs to the enterprise listing widget. // If a site ID is passed in then the listing widget should show available listings associated to that site. // If no site IDs are passed in it should work off of the "Publish Partner Listings" option. if (typeof enterpriseWidgetSiteDs != "undefined") { url += "&enterpriseWidgetSiteDs=" + enterpriseWidgetSiteDs; } if(result.unit.featuredForSale == 'true' && result.unit.featuredForRent == 'false')//only featured for sale, show for sale detail page pageName = "forsale"; if (result.unit.image != null) { imageTag = ''; } else { imageTag = ''; } jQuery("#pw_featured_rental_listing").html(' ' + result.unit.type + '' + '' + imageTag+ ' ' + '' + ' ' + result.unit.marketingName + '' + result.unit.type + '' + result.unit.city + ', ' + result.unit.state + '' + result.unit.neighborhood + ' '+result.unit.commentsAbbreviated+' More Info'); } } function getNaturalHeight(img) { if( img.naturalHeight ) { return img.naturalHeight; } else { lgi = new Image(); lgi.src = img.src; return lgi.height; } } function getNaturalWidth(img) { if( img.naturalWidth ) { return img.naturalWidth; } else { lgi = new Image(); lgi.src = img.src; return lgi.width; } } /** * Remote Login Widets */ var jsonScript = null; function handleRemoteLogin(jsonData) { if ('success' == jsonData.status) { document.location.href = jsonData.forwardURL; } else { alert('Login Failed'); } jsonScript.removeScriptTag(); } function remoteLogin( username, password, loginType) { var browserTimeZone = 'America/Los_Angeles'; if ( typeof jstz != 'undefined') { browserTimeZone = jstz.determine().name(); } var req = REMOTE_LOGIN_ACTION_URL + '?callback=handleRemoteLogin&username=' + encodeURIComponent(username) +'&password=' + encodeURIComponent(password) + '&type=' + loginType+ '&browserTimeZone=' +browserTimeZone ; jsonScript = new JSONscriptRequest(req); jsonScript.buildScriptTag(); jsonScript.addScriptTag(); } function portalLogin() { remoteLogin(document.forms['portalLoginForm'].username.value, document.forms['portalLoginForm'].password.value, document.forms['portalLoginForm'].loginType.value ); } function portalForgotPassword( param ) { document.location.href = BASE_PORTAL_URL + '/forgotPassword.action?from=' + param; } function portalOwnerForgotPassword( param ) { document.location.href = BASE_PORTAL_URL + '/ownerPortalForgotPassword.action?from=' + param; } function portalSignUp( param ) { document.location.href = BASE_PORTAL_URL + '/signup.action?from=' + param; } function portalOwnerSignUp( param ) { document.location.href = BASE_PORTAL_URL + '/ownerPortalSignup.action?from=' + param; } function outputErrors() { var myJSONtext = getURLParam("err"); if (myJSONtext != null && myJSONtext != '') { var result = eval('(' + myJSONtext + ')'); if (result != null & result != '' && result.errors != null) { var oErrorsDiv = document.getElementById('errors'); var oH2 = document.createElement("h2"); oH2.appendChild(document.createTextNode("You must correct the following: ")); oErrorsDiv.appendChild(oH2); var oUl = document.createElement("ul"); for(i = 0; i < result.errors.length; i++) { oUl.innerHTML = oUl.innerHTML + result.errors[i]; } oErrorsDiv.appendChild(oUl); } } } function getURLParam( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return unescape(results[1].replace(/\+/g, " ")); } function updateSearch(){ document.forms['searchListings'].startItem.value = 1; document.forms['searchListings'].endItem.value = 20; document.searchListings.submit(); } function formatPhone(field){ //alert(field.value) field.value = field.value.replace(' ',''); var ov = field.value; var v = ""; var x = -1; // is this phone number 'escaped' by a leading plus? if (0 < ov.length && '+' != ov.charAt(0)) { // format it // count number of digits var n = 0; if ('1' == ov.charAt(0)) { // skip it ov = ov.substring(1, ov.length); } for (i = 0; i < ov.length; i++) { var ch = ov.charAt(i); // build up formatted number if (ch >= '0' && ch <= '9') { if (n == 0) v += "("; else if (n == 3) v += ") "; else if (n == 6) v += "-"; v += ch; n++; } // check for extension type section; // are spaces, dots, dashes and parentheses the only valid non-digits in a phone number? if (! (ch >= '0' && ch <= '9') && ch != ' ' && ch != '-' && ch != '.' && ch != '(' && ch != ')') { x = i; break; } } // add the extension if (x >= 0) v += " " + ov.substring(x, ov.length); // if we recognize the number, then format it if (n == 10 && v.length <= 40) { //alert(v); field.value = v }; } return true; } function windowCentered() { var hide = arguments[3]; if (hide == null){ hide = true; } var htmlID = arguments[0]; var xOffset = 0; var yOffset = 0; if (arguments.length > 1) { xOffset = arguments[1]; } if (arguments.length > 2) { yOffset = arguments[2]; } var theTop = 0; if (document.documentElement && document.documentElement.scrollTop) theTop = document.documentElement.scrollTop; else if (document.body) theTop = document.body.scrollTop; var obj = jQuery("#"+htmlID); if (obj != null) { obj.css({left:((jQuery(document.body).width() - obj.width()) / 2) + xOffset}); var zTop = theTop + (jQuery(window).height() - obj.height()) / 2; if (zTop < 0) { zTop = 0; } if (zTop + yOffset < 0) { obj.css({top:0}); } else { obj.css({top:zTop + yOffset}); } } if (hide){ hideWait(); } } function hideWait() { jQuery('#globalWaiting').hide(); } function formatCurrency(item) { var num = item.value; num = num.toString().replace(/\$|\,|\./g,''); if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); item.value = (((sign)?'':'-') + '$' + num + '.' + cents); } function showHidePetQuestions(item) { var hasPets = item.value; if (hasPets === "true") { $('#questionNumberOfPets').show(); $('#questionPetType').show(); $('#questionPetWeight').show(); } else { $('#questionNumberOfPets').hide(); $('#questionPetType').hide(); $('#questionPetWeight').hide(); } } FILTER BY CITY: All Rentals
FILTER BY COUNTY: All County
PER PAGE:
|