var OneAmApply={validate:function()
{var val=new Validator();var wrapper=$('applyform');val.add(wrapper.down('[name="loan_amount"]'),{required:true,isNumeric:true});val.add(wrapper.down('[name="first_name"]'),{required:true});val.add(wrapper.down('[name="last_name"]'),{required:true});val.add(wrapper.down('[name="home_phone1"]'),{required:true,isNumeric:true});val.add(wrapper.down('[name="home_phone2"]'),{required:true,isNumeric:true});val.add(wrapper.down('[name="home_phone3"]'),{required:true,isNumeric:true});val.add(wrapper.down('[name="ssn1"]'),{required:true,isNumeric:true});val.add(wrapper.down('[name="ssn2"]'),{required:true,isNumeric:true});val.add(wrapper.down('[name="ssn3"]'),{required:true,isNumeric:true});val.add(wrapper.down('[name="mapp_birth_date"]'),{required:true,minSelectedIndex:1});val.add(wrapper.down('[name="dapp_birth_date"]'),{required:true,minSelectedIndex:1});val.add(wrapper.down('[name="yapp_birth_date"]'),{required:true,minSelectedIndex:1});val.add(wrapper.down('[name="email"]'),{required:true,email:true});if(!val.validate())
{Dlg.Show('Validation failed',val.validationErrorsAsList());}}};function autoTab(field,len)
{var autotab_focus_value=document.forms['f1'].autotab_focus;var field_index;if(field.value.length<len)
autotab_focus_value.value=1;if(field.value.length==len&&autotab_focus_value.value==1)
{field_index=getIndex(field);if(field.value.length!=4)
field.form[field_index+1].focus();if(field.form[field_index+1].type=="text")
field.form[field_index+1].select();}}
function getIndex(field)
{var ix=-1,i=0,found=false;while(i<field.form.length&&ix==-1)
if(field.form[i]==field)
ix=i;else
i++;return ix;}
function unSetautotab_focus()
{document.forms['f1'].autotab_focus.value=0;}
function Setautotab_focus(field,len)
{if(field.value.length<len)
document.forms['f1'].autotab_focus.value=1;}
function formatCurrency(num)
{num=num.toString().replace(/\$|\,/g,'');if(num!='')
{if(isNaN(num))
num="0";var sign=(num==(num=Math.abs(num)));num=Math.floor(num*100+0.50000000001);var 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));return(((sign)?'':'-')+num+'.'+cents);}
else
return'';}
function FillCoAddress()
{frm=document.f1;if(frm.same_address.checked)
{frm.mailing_address.value=frm.address.value;frm.mailing_city.value=frm.city.value;frm.mailing_state.selectedIndex=frm.state.selectedIndex;frm.mailing_zip1.value=frm.zip1.value;frm.mailing_zip2.value=frm.zip2.value;return}
else
return}
function MyCheckEnteredValue(val){if(Utl.trim(val).length>0)
{valid=true;allowed="0123456789()-,.$";digits="0123456789";numCount=0;for(i=0;i<val.length;i++)
{if(allowed.indexOf(val.charAt(i))<0)
valid=false;if(digits.indexOf(val.charAt(i))>-1)
numCount++;}
if(valid&&numCount==0)
{alert("Only numeric values are allowed!");return false;}}
return true;}
function dosum1()
{var frm=document.f1;var tmp1,tmp2,tmp3,tmp4
tmp1=parseFloat(frm.app_emp.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp1))tmp1=0;tmp2=parseFloat(frm.coapp_emp.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp2))tmp2=0;tmp3=parseFloat(frm.app_other.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp3))tmp3=0;tmp4=parseFloat(frm.coapp_other.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp4))tmp4=0;frm.total.value=formatCurrency(tmp1+tmp2+tmp3+tmp4);}
function dosum2()
{var frm=document.f1;var tmp1,tmp2,tmp3,tmp4,tmp5,tmp6
tmp1=parseFloat(frm.first_mtg.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp1))tmp1=0;tmp2=parseFloat(frm.sec_mtg.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp2))tmp2=0;tmp3=parseFloat(frm.prop_taxes.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp3))tmp3=0;tmp4=parseFloat(frm.owner_insurance.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp4))tmp4=0;tmp5=parseFloat(frm.mtg_insurance.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp5))tmp5=0;tmp6=parseFloat(frm.rent_monthly_payment.value.toString().replace(/\$|\,/g,''));if(isNaN(tmp6))tmp6=0;frm.total1.value=formatCurrency(tmp1+tmp2+tmp3+tmp4+tmp5+tmp6);}
function FillCoAddress()
{var frm=document.f1;if(frm.same_address.checked)
{frm.mailing_address.value=frm.address.value;frm.mailing_city.value=frm.city.value;frm.mailing_state.selectedIndex=frm.state.selectedIndex;frm.mailing_zip1.value=frm.zip1.value;frm.mailing_zip2.value=frm.zip2.value;return}
else
return}
onBranchSelected=function(select)
{var frm=document.f1;frm.office_name.value=select.options[select.selectedIndex].text;setOptions(frm.loan_officer,select.options[select.selectedIndex].value,'Please select a loan officer');};setOptions=function(dest,val,defaultSelect){eval("arrayDest = "+dest.name)
dest.length=0;dest.options[0]=new Option(defaultSelect,'0');index=1;for(i=0;i<arrayDest.length;i++)
{if(arrayDest[i][2]==val){dest.options[index]=new Option(arrayDest[i][1],arrayDest[i][1]);index++;}}};setIndex=function(dest,index){selectedIndex=0;for(i=0;i<dest.options.length;i++)
if(dest.options[i].value==index)
selectedIndex=i;dest.selectedIndex=selectedIndex;};var loan_officer=[['11589','Mauro Ramirez','1318'],['11825','Rob Clark','1318'],['11613','Joe Baca','1913'],['11728','Rick Supple','1913'],['11729','Jenn Baca','1913'],['11730','Jeremy Phillips','1913'],['11760','1am Homeloans','1927'],['8327','Robert Gerrard','1927'],['11826','Sarah Hernandez','1927'],['11853','Karen Snyder','1940'],['11795','Karrie  Moorhouse','1871'],['11381','Marty Padilla','1871'],['11588','Audie Stanley','1871'],['11964','Sarah Voccio','1871'],['11172','Howard  Karloff','1856'],['11328','David Perley','1856'],['11500','Gregg Freiermuth','1856'],['10602','Wayne Knipe','1793'],['10689','Veronica Knipe','1793'],['10866','Eddie Stewart','1793'],['10414','Marc Croker','1772'],['11939','James Gilligan','1772'],['11725','Steve Evans','1772'],['10415','David White','1772'],['8737','Culley Phillips','1772'],['8298','Mike Hill','1772'],['8301','Paul Greer','1772'],['8302','Vernetta Willis','1772'],['8304','Will Thornburg','1772'],['10654','Joel Carrington','1772'],['10416','Hope Marshall','1772'],['10417','Kimberli Dunn','1772'],['10418','Jamie Davis','1772'],['10126','Shawn Geiser','1688'],['10194','Lisa Mathis','1688'],['9833','Chuck  Baudrau','1545'],['11641','Greg Torres','1545'],['9859','Lori Rocco','1542'],['10104','Philip Brown','1288'],['9839','Traci Brown','1288'],['11524','JoAnna Camposano','1288'],['11530','Ameen Charania','1288'],['9497','Susan Denton-Clay','1288'],['9807','Arnold Fisher','1288'],['11513','Scott Hevel','1288'],['11837','Jason Hutchinson','1288'],['8294','Kevin Johnson','1288'],['8295','Charles Mentesana','1288'],['8293','Pete Montesino','1288'],['8296','Jim Spalding','1288'],['7948','Minerva Simpson','1068'],['11759','Kimberly Moreland','1068'],['7949','Cindy Garza','1068'],['11535','Lucy Cadenas','1068'],['11283','Jacinto Oviedo','1068'],['10437','Edgar Lopez','1068'],['9680','Juan Mendez','1068'],['11484','Paty Cabrales','1068'],['8417','Velia Lopez','1068'],['9441','Ruben Gomez','1068'],['8931','Debra Martinez','1068'],['10343','Steven Garcia','1065'],['11741','Maria Teran','1065'],['11709','Rodger Lara','1065'],['11567','Arthur Andrade','1065'],['10156','Lupe Garcia','1065'],['10938','Linda Guerrero','1065'],['10430','Milton Kinnard','1065'],['11496','Mark Ingersoll','1065'],['11498','Art Nieto','1065']];window.DevCompose={update:function(newAttributes)
{var i=0;if(ViewMan.up&&newAttributes&&newAttributes.length>0)
{ViewMan.up.Attributes=newAttributes;}
UtilPop.setField($('ri_devname'),ViewMan.development.name);var wrapper=$('request');if(!wrapper)
{return;}
Formatter.formatUserProfile(ViewMan.up,wrapper,true,false);var fieldsToToggle=wrapper?wrapper.select('.dyn_newuser'):[];if(Identity.GetLoginID()!==null)
{for(i=0;i<fieldsToToggle.length;i++)
{fieldsToToggle[i].hide();}}
else
{for(i=0;i<fieldsToToggle.length;i++)
{fieldsToToggle[i].show();}
if($('requestform'))
{$('requestform').reset();}
if(window.SearchInput)
{var searchQuery=SearchInput.convertRawSearchQueryToJSON(SearchInput.readSearchQueryCookie());if(searchQuery)
{if(searchQuery.minP)
{wrapper.select('.register_min_price').each(function(item)
{for(i=2;i<item.options.length;i++)
{if(item.options[i].value==searchQuery.minP)
{item.options[i].selected=true;break;}}});}
if(searchQuery.maxP)
{wrapper.select('.register_max_price').each(function(item)
{for(i=2;i<item.options.length;i++)
{if(item.options[i].value==searchQuery.maxP)
{item.options[i].selected=true;break;}}});}}}}
wrapper.select('.property_wrapper').each(function(propWrapper)
{Utl.clearAllChildren(propWrapper);if(propWrapper.parentNode)
{if(ViewMan.development.properties.length>0)
{propWrapper.parentNode.show();}
else
{propWrapper.parentNode.hide();}}
ViewMan.development.properties.each(function(aProperty)
{if(aProperty.isenabled=='False'||(fwk.PROD_KEY=='BM'&&aProperty.isauction=='True'))
{return;}
var propInstance=Formatter.format_property(aProperty,'template_prop_checklist',false,false,false);propWrapper.appendChild(propInstance);});});},onClickedPropertyRequestInfo:function(propID)
{var reqWrapper=$('request');if(!reqWrapper)
{return;}
ViewMan.tabManager.gotoTab('tabRequestInfo');Effect.ScrollTo(ViewMan.tabManager.tabContainer);reqWrapper.select('.dyn_unit_num_chk').each(function(check)
{if(check.id==propID)
{check.checked=true;reqWrapper.down('.property_wrapper').scrollToElement(check,5);}});},sendNote:function()
{var i=0;var validator=new Validator();if(Identity.GetLoginID()===null)
{var form='request';validator.addItemClass(form,'register_first_name',{required:true,isAlphaNumeric:true});validator.addItemClass(form,'register_last_name',{required:true,isAlphaNumeric:true});validator.addItemClass(form,'register_email',{required:true,email:true});if(!validator.validate())
{Dlg.Show('Validation failed',validator.validationErrorsAsList());return;}}
var wrapper=$('request');Dlg.ShowProgress('Please wait while we send your Information Request...');var profileInfo=UserProfile.buildProfile(wrapper);var devId=ViewMan.development.developmentid;if(devId!==null&&devId>0)
{var dev=new Development();dev.setID(devId);profileInfo.setMyDevelopments(dev);}
var qiXML=document.createElement('questionaireInfo');var sendMeXML=document.createElement('sendmeinformation');qiXML.appendChild(sendMeXML);var sendmeOptions=wrapper.select('.dyn_sendme');for(i=0;i<sendmeOptions.length;i++)
{if(sendmeOptions[i].checked)
{var inforeqElement=document.createElement('inforequest');inforeqElement.setAttribute("sendme",sendmeOptions[i].name);sendMeXML.appendChild(inforeqElement);}}
var attributeFields=wrapper.select('.dyn_question');for(i=0;i<attributeFields.length;i++)
{if(attributeFields[i])
{var questionElement=document.createElement('question');questionElement.setAttribute("question",attributeFields[i].name);questionElement.setAttribute("answer",attributeFields[i].getVal());qiXML.appendChild(questionElement);}}
var callback;if(Identity.GetLoginID()===null)
{callback=DialogueHandler.SendMessageNewProfileHandler;}
else
{callback=DialogueHandler.SendMessageHandler;}
profileInfo.sendInfoRequest(qiXML,devId,escape($('compose_message_body').value),callback);},sendOffer:function()
{var form=$(Dlg.textMessage);var validator=new Validator();if(Identity.GetLoginID()===null)
{validator.addItemClass(form,'register_first_name',{required:true,isAlphaNumeric:true});validator.addItemClass(form,'register_last_name',{required:true,isAlphaNumeric:true});validator.addItemClass(form,'register_email',{required:true,email:true});}
validator.addItemClass(form,'offer_amount',{required:true,isNumeric:true});if(!validator.validate())
{Dlg.stopProcessing();Dlg.setResponse(validator.validationErrorsAsList());return;}
Dlg.setResponse('Please wait while we send your Information Request...');var profileInfo=UserProfile.buildProfile(form);var devId=ViewMan.development.developmentid;var qiXML=document.createElement('questionaireInfo');var attributeFields=form.select('.dyn_question');for(var i=0;i<attributeFields.length;i++)
{if(attributeFields[i])
{var questionElement=document.createElement('question');questionElement.setAttribute("question",attributeFields[i].name);questionElement.setAttribute("answer",attributeFields[i].getVal());qiXML.appendChild(questionElement);}}
var callback;if(Identity.GetLoginID()===null)
{callback=DialogueHandler.SendMessageNewProfileHandler;}
else
{callback=DialogueHandler.SendMessageHandler;}
profileInfo.sendInfoRequest(qiXML,devId,escape(form.down('.compose_message_body').value),callback);},sendInvestment:function()
{Dlg.ShowProgress('Sending information');var validator=new Validator();validator.addItem($('investment_input'),{required:true});validator.addItem($('investment_phone'),{required:true});if(!validator.validate())
{Dlg.stopProcessing();Dlg.Show(validator.validationErrorsAsList());return;}
Dlg.setResponse('Please wait while we send your Information Request...');var profileInfo=UserProfile.buildProfile($('request'));var devId=ViewMan.development.developmentid;var qiXML=document.createElement('questionaireInfo');var questionElement=document.createElement('question');questionElement.setAttribute("question","Investment Amount");questionElement.setAttribute("answer",$('investment_input').value);qiXML.appendChild(questionElement);questionElement=document.createElement('question');questionElement.setAttribute("question","Phone Number");questionElement.setAttribute("answer",$('investment_phone').value);qiXML.appendChild(questionElement);profileInfo.sendInfoRequest(qiXML,devId,'',DialogueHandler.SendMessageHandler);}};var DevLocation={mapper:null,isLoaded:false,onLocationFocus:function(force)
{if(window.CmaeonGmaps)
{DevLocation.mapper=new CmaeonGmaps('',{clustered:true,disableMapControl:false,disableMapTypeControl:false,disableScrollZoom:false,enableOverviewMapControl:true,enableWaypointControl:false,iconColor:'#EE0000',iconTextColor:'#EE0000'});if(fwk.PROD_KEY=='RS'||fwk.PROD_KEY=='BM')
{DevLocation.mapper.map.addOverlay(new EInsert(new GLatLng(48.47755,-123.52264),"http://map.bearmountain.ca/mapimages/map-zoom12.png",new GSize(105,123.125),12,0,12,12));DevLocation.mapper.map.addOverlay(new EInsert(new GLatLng(48.47755,-123.52264),"http://map.bearmountain.ca/mapimages/map-zoom13.png",new GSize(210,246.25),13,0,13,13));DevLocation.mapper.map.addOverlay(new EInsert(new GLatLng(48.47755,-123.52264),"http://map.bearmountain.ca/mapimages/map-zoom14.png",new GSize(420,492.5),14,0,14,14));DevLocation.mapper.map.addOverlay(new EInsert(new GLatLng(48.47755,-123.52264),"http://map.bearmountain.ca/mapimages/map-zoom15.png",new GSize(840,985),15,0,15,15));DevLocation.mapper.map.addOverlay(new EInsert(new GLatLng(48.47755,-123.52264),"http://map.bearmountain.ca/mapimages/map-zoom16.png",new GSize(1680,1970),16,0,16,16));}
DevLocation.updateMarker();}
DevLocation.isLoaded=true;},updateMarker:function()
{if(DevLocation.mapper&&DevLocation.mapper.map.isLoaded())
{DevLocation.mapper.clearMarkers();DevLocation.mapper.addMarker(ViewMan.development.location[0],{zoomLevel:13,infoHtml:ViewMan.development.location[0].address});}}};var ViewMan={development:null,tabManager:null,slideShow:null,searchResults:null,tabsSetup:false,tabDisplay:{overview:function(){return'Overview';},gallery:function(){return'Photos';},files:function(){if(fwk.PROD_KEY=='LHA'){return'Documents';}return'Files';},location:function(){return'Location';},requestinfo:function(){return'Request Information';},forum:function(){return'Community';},invest:function(){return'Invest';}},asyncGetNewDevelopmentFromHash:function(hash)
{var matches=hash.match(/devid=(\d+)/);if(matches&&matches.length>1)
{ViewMan.asyncGetNewDevelopment(matches[1],true);}
else if(hash.length===0)
{ViewMan.asyncGetNewDevelopment(ViewMan.origDevID,true);}},asyncGetNewDevelopment:function(devID,noHash)
{if(window.Dlg&&Dlg.modalDialogue)
{Dlg.ShowProgress('Loading Data');}
Development.LoadDevelopment(devID,ViewMan.asyncLoadNewDevelopment,true);if(!noHash)
{ApeMan.setHash('#devid='+devID,true);}},asyncLoadNewAuction:function(auction)
{AucMan.currentAuction=auction;AucMan.auctions=[auction];},asyncLoadNewDevelopment:function(aDevelopment)
{if(aDevelopment)
{document.title=aDevelopment.name+' - '+
(aDevelopment.location?aDevelopment.location[0].city[0].cityname+' '+
aDevelopment.location[0].city[0].stateprov[0].abbreviation+', '+
aDevelopment.location[0].city[0].stateprov[0].country[0].abbreviation+' - ':'')+
fwk.PROD_NAME;ViewMan.development=aDevelopment;ViewMan.load_DevelopmentInfo();if(ViewMan.tabManager)
{if(ViewMan.development.location&&(ViewMan.development.location[0].latitude!==0||ViewMan.development.location[0].longitude!==0))
{ViewMan.tabManager.showTab('tabLocation');}
else
{ViewMan.tabManager.hideTab('tabLocation');}
if($('units_wrapper'))
{if(aDevelopment.issinglelisting=="False")
{$('units_wrapper').show();}
else
{$('units_wrapper').hide();}}
if(ViewMan.development.commentthreadid&&fwk.PROD_KEY=='RS')
{BlogMan.LoadThreadComments(ViewMan.development.commentthreadid);ViewMan.tabManager.showTab('tabForum');}
else
{ViewMan.tabManager.hideTab('tabForum');}}
if(window.DevCompose)
{DevCompose.update();}
ViewImages.loadViewImages();DevLocation.updateMarker();DevOverview.loadOverviewHTML();if(ViewMan.slideShow)
{ViewMan.slideShow.addVariable("xmlfile","/SSPConfig-"+ViewMan.development.developmentid+".xml");ViewMan.slideShow.addVariable("xmlfiletype","Default");ViewMan.slideShow.write('flashcontent');}}
Dlg.hide();},loadPage:function()
{if(!ViewMan.development||!ViewMan.development.developmentid)
{location.href='/';}
ApeMan.addHashChangeCallBack(ViewMan.asyncGetNewDevelopmentFromHash);ViewMan.load_DevelopmentInfo();if(AucMan.auctions.length>0&&Auction.getAuctionStatus(AucMan.auctions[0],fwk.SERVER_TIME_DIFF)==Auction.AuctionStatus.Current)
{$('content').select('.dyn_link_bid').each(function(ele)
{if(ViewMan.development.owneraccount[0].associatedportal&&ViewMan.development.owneraccount[0].associatedportal.length>0&&ViewMan.development.owneraccount[0].associatedportal[0].portalkey=='LHA')
{ele.observe('click',function(evnt)
{TemplatedDialogue.Show_Make_Offer(ViewMan.development);});}
else if(AucMan.auctions[0]&&AucMan.auctions[0].AuctionItems[0])
{ele.href='/auction/'+AucMan.auctions[0].id+'/'+AucMan.auctions[0].AuctionItems[0].id;}
ele.show();});}
ViewMan.tabManager=new TabbedPanelManager('tabs_tab_headers','tabs_tab_panels',false);ViewMan.tabManager.addPanel(fwk.SKIN_ROOT+'/templates/view_development/overview.htm',null,ViewMan.tabDisplay.overview(),'tabOverview');ViewMan.tabManager.addPanel(fwk.SKIN_ROOT+'/templates/view_development/images.htm',null,ViewMan.tabDisplay.gallery(),'tabGallery');if((fwk.PROD_KEY=='LHA'||fwk.PROD_KEY=='LA')&&Identity.GetLoginID()<=0)
{ViewMan.tabManager.addPanel(fwk.SKIN_ROOT+'/templates/view_development/login-required.htm',null,ViewMan.tabDisplay.files(),'tabFiles');}
else
{ViewMan.tabManager.addPanel(fwk.SKIN_ROOT+'/templates/view_development/files.htm',null,ViewMan.tabDisplay.files(),'tabFiles');}
ViewMan.tabManager.addPanel(fwk.SKIN_ROOT+'/templates/view_development/location.htm',null,ViewMan.tabDisplay.location(),'tabLocation');if(ViewMan.development.issinglelisting=="False")
{$('units_wrapper').show();}
if(fwk.PROD_KEY!='1AM'&&fwk.PROD_KEY!='LK'&&fwk.PROD_KEY!='OM')
{ViewMan.tabManager.addPanel(fwk.SKIN_ROOT+'/templates/view_development/requestinfo.htm',null,ViewMan.tabDisplay.requestinfo(),'tabRequestInfo');}
ViewMan.tabManager.addPanel(fwk.SKIN_ROOT+'/templates/view_development/comments.htm',null,ViewMan.tabDisplay.forum(),'tabForum');if(fwk.PROD_KEY=='LA')
{if(Identity.GetLoginID()<=0)
{ViewMan.tabManager.addPanel(fwk.SKIN_ROOT+'/templates/view_development/login-required.htm',null,ViewMan.tabDisplay.invest(),'tabInvest');}
else
{ViewMan.tabManager.addPanel(fwk.SKIN_ROOT+'/templates/view_development/invest.htm',null,ViewMan.tabDisplay.invest(),'tabInvest');}}
if(ViewMan.development.location[0].latitude===0&&ViewMan.development.location[0].longitude===0)
{ViewMan.tabManager.hideTab('tabLocation');}
if(ViewMan.development.commentthreadid)
{BlogMan.LoadThreadComments(ViewMan.development.commentthreadid);ViewMan.tabManager.showTab('tabForum');}
else
{ViewMan.tabManager.hideTab('tabForum');}
if(location.href.indexOf('requestinfo')>0)
{ViewMan.tabManager.gotoTab('tabRequestInfo');$('tabs_tab_headers').scrollTo();}
$(ViewMan.loadSlideShow).delay(1);},updateResultList:function(response)
{if(response&&response.developments&&response.developments.length>0)
{ViewMan.searchResults.ids=response.developments;ViewMan.setupPaginator();}},setupPaginator:function()
{var searchResults;if(ViewMan.searchResults===null)
{var curSearchQuery=SearchInput.readSearchQueryCookie();query=new SearchQuery();query.setRawQuery(curSearchQuery);query.setID(SearchInput.currentQueryID);searchResults=SearchInput.readCurrentSearchResult();ViewMan.searchResults=searchResults;if(searchResults&&searchResults.pagenumber>0&&searchResults.ids.length>=searchResults.pagesize)
{SearchQuery.GetFullResultsAsIDList(query,searchResults.sort,ViewMan.updateResultList);}}
else
{searchResults=ViewMan.searchResults;}
if(searchResults&&searchResults.pagenumber>0)
{var nextLink=$('search_result_next');var prevLink=$('search_result_prev');$('search_result_nav').hide();var auctionLink=$('back_to_auction');if(searchResults.searchreturn&&auctionLink&&searchResults.searchreturn.indexOf('auction'))
{var resultsLink=$('back_to_results');var mapLink=$('back_to_map');if(resultsLink)
{resultsLink.hide();}
if(mapLink)
{mapLink.hide();}
auctionLink.show();auctionLink.href=searchResults.searchreturn;}
var nextId=-1;var prevId='ViewMan.asyncGetNewDevelopment(';var results=searchResults.ids;$('search_result_cur_page').innerHTML=searchResults.pagenumber;$('search_result_total_pages').innerHTML=Math.ceil((parseInt(searchResults.totalresults,10)/parseInt(searchResults.pagesize,10)));var curIdx=results.indexOf(parseInt(ViewMan.development.developmentid,10));if(curIdx==-1||results.length==1)
{return;}
else if(curIdx===0)
{prevId=results[results.length-1];nextId=results[1];}
else if(curIdx>=(results.length-1))
{prevId=results[results.length-2];nextId=results[0];}
else
{prevId=results[(curIdx-1)%(results.length)];nextId=results[(curIdx+1)%(results.length)];}
nextLink.stopObserving('click');prevLink.stopObserving('click');nextLink.observe('click',function(){ViewMan.asyncGetNewDevelopment(nextId);});prevLink.observe('click',function(){ViewMan.asyncGetNewDevelopment(prevId);});$('search_result_nav').show();}},loadSlideShow:function()
{if(window.SWFObject)
{ViewMan.slideShow=fwk.PROD_KEY=='LHA'?new SWFObject("/includes/3rdparty/ssp/ssp-large.swf","flash","565","365","7","white"):new SWFObject("/includes/3rdparty/ssp/ssp.swf","flash","190","225","7","white");ViewMan.slideShow.addVariable("xmlfile","/SSPConfig-"+ViewMan.development.developmentid+".xml");ViewMan.slideShow.addVariable("xmlfiletype","Default");ViewMan.slideShow.addParam("wmode","transparent");ViewMan.slideShow.write("flashcontent");}
else if($('no_flash'))
{$('no_flash').show();}},load_DevelopmentInfo:function()
{var ourInstance=Formatter.format_development(ViewMan.development,'developmentDetailsWrapper',true,false,true);if(ViewMan.development.issinglelisting=='False'||ViewMan.development.issinglelisting===false)
{Formatter.format_properties(ourInstance,ViewMan.development.properties,'template_property',true,false);}
else if($('units_wrapper'))
{$('units_wrapper').hide();}
var virtualTourLink=$('virtual_tour');if(virtualTourLink)
{virtualTourLink.hide();}
for(var i=0;i<ViewMan.development.tags.length;i++)
{if(ViewMan.development.tags[i].value.toLowerCase()=='virtual tour')
{virtualTourLink.show();break;}}
ViewMan.populate_QuickFactsDevelopmentInfo(ViewMan.development);ViewMan.setupPaginator();ourInstance.show();$('loadingDevMsg').hide();$('secondary-content').show();if(fwk.DRAG_DROP)
{var draggable=ourInstance.getElementsByClassName('dyn_draggable')[0];new Draggable(draggable,{revert:true,ghosting:true,handle:'dyn_draggable_handle',onStart:DDHandler.onDevDragStart,onEnd:DDHandler.onDevDragEnd});}},loadVirtualTour:function()
{window.open("/viewmovie.aspx?moviefile=multimedia/Virtual_tour/"+ViewMan.development.developmentid+"/virtual_tour.wmv","Movie","width=552,height=475,status=0,menubar=0,directories=0,location=0,toolbar=0");},authChangeHandler:function()
{if(ViewMan.up)
{ViewMan.up.Attributes=[];}
if(fwk.PROD_KEY=='LHA'||fwk.PROD_KEY=='LA')
{if(Identity.GetLoginID()<=0)
{ViewMan.tabManager.updatePanel(fwk.SKIN_ROOT+'/templates/view_development/login-required.htm',null,ViewMan.tabDisplay.files(),'tabFiles');}
else
{ViewMan.tabManager.updatePanel(fwk.SKIN_ROOT+'/templates/view_development/files.htm',null,ViewMan.tabDisplay.files(),'tabFiles');}}
if(fwk.PROD_KEY=='LA')
{if(Identity.GetLoginID()<=0)
{ViewMan.tabManager.updatePanel(fwk.SKIN_ROOT+'/templates/view_development/login-required.htm',null,ViewMan.tabDisplay.invest(),'tabInvest');}
else
{ViewMan.tabManager.updatePanel(fwk.SKIN_ROOT+'/templates/view_development/invest.htm',null,ViewMan.tabDisplay.invest(),'tabInvest');}}
if(Identity.GetLoginID()!==null)
{UserProfile.GetProfileAttributes(DevCompose.update);DevLocation.onLocationFocus.defer(true);}
else
{DevCompose.update();}
if(window.BlogMan&&ViewMan.development&&ViewMan.development.commentthreadid&&fwk.PROD_KEY=='RS')
{BlogMan.LoadThreadComments(ViewMan.development.commentthreadid);}},populate_QuickFactsDevelopmentInfo:function(aDevelopment)
{var ourInstance=$('quick_facts');var propertyLocation=ourInstance.down('.location_info');if(aDevelopment.location)
{propertyLocation.innerHTML='<ul><li>'+
aDevelopment.location[0].city[0].cityname+', '+
aDevelopment.location[0].city[0].stateprov[0].name+', '+
aDevelopment.location[0].city[0].stateprov[0].country[0].name+'</li></ul>';}
var propertyPrice=ourInstance.down('.price_info');propertyPrice.innerHTML='<ul><li>'+Formatter.formatDevelopmentPrice(aDevelopment)+'</li></ul>';var propertyTypeTags=ourInstance.down('.type_info');propertyTypeTags.innerHTML=ViewMan.toUList(Utl.filterEnumList(aDevelopment.tags,'typeid',RealestateTagType.values.PropertyType),'value');var propertyTags=ourInstance.down('.tag_info');propertyTags.innerHTML=ViewMan.toUList(aDevelopment.tags,'value',true);},toUList:function(aObj,attr,bindQuickSearchLink)
{if(!attr)
{attr='tag';}
if(aObj)
{aObj.sort(function(a,b)
{var x=a.value.toLowerCase();var y=b.value.toLowerCase();return((x<y)?-1:((x>y)?1:0));});}
var primaryListLen=25;var lastValue='';var unorderedList='<ul>';for(i=0;i<aObj.length&&i<primaryListLen;i++)
{if(aObj[i][attr]==lastValue)
{continue;}
lastValue=aObj[i][attr];unorderedList+=ViewMan.createListItem(lastValue,bindQuickSearchLink);}
if(!aObj||aObj.length===0)
{unorderedList+='N/A';}
unorderedList+='</ul>';if(aObj.length>primaryListLen)
{unorderedList+='<ul class="tags_overflow" style="display:none">';for(i=primaryListLen;i<aObj.length;i++)
{if(aObj[i][attr]==lastValue)
{continue;}
lastValue=aObj[i][attr];unorderedList+=ViewMan.createListItem(lastValue,bindQuickSearchLink);}
unorderedList+='</ul><a class="fakelink" onclick="ViewMan.toggleTagsOverflow(this)">Show</a>';}
return unorderedList;},createListItem:function(lastValue,bindQuickSearchLink)
{var unorderedList='<li>';if(bindQuickSearchLink)
{unorderedList+='<a href="/newsearch/tag/'+lastValue.replace("'","\\'")+'">'+lastValue+'</a>';}
else
{unorderedList+=lastValue;}
unorderedList+='</li>\n';return unorderedList;},toggleTagsOverflow:function(elem)
{var attrsWrap=elem.up('.tag_info').down('.tags_overflow');if(attrsWrap.visible())
{attrsWrap.blindUp();elem.innerHTML='Show';}
else
{attrsWrap.blindDown();elem.innerHTML='Hide';}}};var ViewImages={currentImageID:0,loadViewImages:function(developmentID,imgWrapper,fileWrapper)
{developmentID=developmentID||ViewMan.development.developmentid;imgWrapper=imgWrapper||$('viewdev_imageList');fileWrapper=fileWrapper||$('fileList');FileManager.LoadFilesInFolderAsList_('dev/'+developmentID,function(result){ViewImages.populateFileList(result,'dev\\'+developmentID,imgWrapper,fileWrapper);});},loadPropertyFiles:function(propertyID,wrapper)
{FileManager.LoadFilesInFolderAsList_('prop/'+propertyID,function(result){ViewImages.populateFileList(result,'prop\\'+propertyID,wrapper.down('.dyn_prop_images'),wrapper.down('.dyn_prop_files'));});},loadAuctionFiles:function(auctionID,wrapper)
{FileManager.LoadFilesInFolderAsList_('auc/'+auctionID,function(result){ViewImages.populateFileList(result,'auc\\'+propertyID,wrapper.down('.dyn_auc_images'),wrapper.down('.dyn_auc_files'));});},populateFileList:function(fileList,folder,imgDisplayList,fileDisplayList)
{var imgRowCount=0;var fileRowCount=0;if(imgDisplayList){Utl.clearAllChildren(imgDisplayList);}
if(fileDisplayList){Utl.clearAllChildren(fileDisplayList);}
FileManager.SortFileListByTag(fileList);for(var fileIdx=0;fileIdx<fileList.length;fileIdx++)
{var curFile=fileList[fileIdx];curFile.folderpath=curFile.folderpath.replace(/\\/g,'/');if(curFile.folderpath.indexOf('images')>0&&imgDisplayList)
{imgDisplayList.appendChild(ViewImages.format_viewImage(curFile,folder));}
else if(fileDisplayList)
{fileDisplayList.appendChild(ViewImages.format_viewFile(curFile,fileRowCount++));}}
if(fileRowCount===0&&fileDisplayList)
{var noFiles=$(document.createElement('span'));UtilPop.setField(noFiles,'There are no extra information files.');fileDisplayList.appendChild(noFiles);}},format_viewImage:function(anImageFile,grouping)
{grouping=grouping?'lightbox['+grouping.replace(/\\/g,'-')+']':'lightbox';var ourInstance=Utl.getInstanceOfTemplate("template_view_dev_image",true,false);var anImageReference={imagepath:anImageFile.folderpath+anImageFile.filename,tooltip:ViewMan.development.name,imagereferenceid:ViewImages.currentImageID++};ourInstance.rel=grouping;ourInstance.href=FileServer_ImagePath+anImageReference.imagepath;ourInstance.title=anImageReference.tooltip;var img=ourInstance.select('.dyn_image')[0];img.src=FileServer_ImagePath+'thumbs/'+anImageReference.imagepath;img.title=anImageReference.tooltip;img.alt=anImageReference.tooltip;return ourInstance;},format_viewFile:function(aFile,rowIdx)
{var ourInstance=Utl.getInstanceOfTemplate("template_dev_filelist",true,false);if(!ourInstance)
{return;}
if(Utl.isEven(rowIdx))
{ourInstance.addClassName('alt-row');}
UtilPop.setField(ourInstance.select('.dyn_fileName')[0],aFile.filename);var filePath=aFile.folderpath+aFile.filename;var preview=ourInstance.select('.dyn_filepreview')[0];preview.title='Click here to download the file';preview.href=FileServer_FilePath+filePath;preview.target='_blank';var fileType=ourInstance.select('.dyn_fileType')[0];fileType.src=imgUtl.getFileIconImage(aFile);return ourInstance;}};