/* (c) LoopNet BasePage Version 1.0 */
LNJS.__basepage=true;LNJS.BasePage=Class.create();LNJS.BasePage.prototype=(new LNJS.Base()).extend({initialize:function(options){this.__className="LNJS.BasePage";this.options={}.extend(options||{});this.EL=new Object();this.EL.length=0;if(LNJS.isNull(LNJS.Analytics))throw this.Err("LNJS.BasePage requires LNJS.Analytics!");this.Log=new LNJS.Analytics();this.Msgs=({add:function(msg,args){if(!LNJS.isNull(args.type)&&!LNJS.isNull(args.source)){if(LNJS.isNull(this[args.type]))this[args.type]={};msg.type=args.type;msg.source=args.source;this[args.type][args.source]=msg;}else if(!LNJS.isNull(args.name)){msg.name=args.name;this[args.name]=msg;}}});this.Msgs.add({title:"Sorry!",text:"We weren't able to process your request.<br/><br/>Please refresh the page and try again.<br/><br/>If you keep getting this message, call our Client Services team at (888) 567-7442.",width:"283px"},{type:LNJS.ErrType.SystemError,source:LNJS.ErrSource.ClientSideJavaScriptError});this.Msgs.add({title:"Sorry!",text:"We weren't able to process your request.<br/><br/>Please disable your POP-UP BLOCKER and try again.<br/><br/>If you keep getting this message, call our Client Services team at (888) 567-7442.",width:"283px"},{name:"PopUpBlocker"});},openWindow:function(args){var options={name:"NewWindow"}.extend(args);LNJS.NewWindow=window.open(options.url,options.name,options.features);setTimeout((function(){try{if(LNJS.isNull(LNJS.NewWindow)){LNJS.Page.showMsg(LNJS.Page.Msgs.PopUpBlocker);if(!LNJS.isNull(options.onFailure))options.onFailure();}else{if(LNJS.NewWindow.opener==null)LNJS.NewWindow.opener=window;if(!LNJS.isNull(options.onSuccess))options.onSuccess(LNJS.NewWindow);LNJS.NewWindow=null;}}catch(e){alert("Please disable your POP-UP BLOCKER and try again.");}}).bind(this),400);},showMsg:function(msg){if(LNJS.isNull(msg)){this.hideMsg();return;}if(LNJS.isNull(this.EL.msgcont)){LNJS.Trace.error("Error! type:"+msg.type+" source:"+msg.source+" message:"+msg.input);return;}this.currentMsg=msg;if(this.EL.msgdontshow){if(Element.visible(this.EL.msgdontshow)){this.EL.dontshowagain.checked=false;var name=(msg.name)?msg.name:(msg.type+""+msg.source);if(getCookie(name)!=null)return;}}var title=LNJS.isNull(msg.title)?"Unknown Error":msg.title;var top=LNJS.isNull(msg.x)?'40%':msg.x;var left=LNJS.isNull(msg.y)?'50%':msg.y;var className=LNJS.isNull(msg.className)?"dropdown dd-alert":msg.className;if(typeof top=='object'){top=top.offsetTop+msg.offsetX;}else if(!LNJS.isNull(msg.targetX)){var target=$(msg.targetX);if(target){top=Position.cumulativeOffset(target)[1]+msg.offsetX;}else{top=Position.cumulativeOffset(document.forms[0][msg.targetX])[1]+msg.offsetX;}}Element.removeClassNames(this.EL.msgpntr,'alert-um','alert-mr','alert-bm','alert-ml');this.EL.msgcont.style.top=top;this.EL.msgcont.style.left=left;if(!LNJS.isNull(msg.width)){this.EL.msgcont.orgWidth=this.EL.msgcont.style.width;this.EL.msgcont.style.width=msg.width;}else if(this.EL.msgcont.orgWidth){this.EL.msgcont.style.width=this.EL.msgcont.orgWidth;}if(!LNJS.isNull(msg.pointer))Element.addClassName(this.EL.msgpntr,'alert-'+msg.pointer);if(this.EL.msgdontshow){Element[(msg.dontshow===true)?'show':'hide'](this.EL.msgdontshow);}Element[(!(msg.showclose===false))?'show':'hide'](this.EL.msgclose);Element.innerHTML(this.EL.msgtext,"<strong>"+msg.title+"</strong><p>"+msg.text+"</p>");this.EL.msgclass.className=className;if(!LNJS.isNull(msg.onShow))msg.onShow();Element.show(this.EL.msgcont);if(!LNJS.isNull(msg.type)&&!LNJS.isNull(msg.source)){this.Log.__LogError({errortype:msg.type,errorsource:msg.source,errordetails:msg.text,inputdata:msg.input});}},handleError:function(e){var oMsg=null;var input='';try{oMsg=this.Msgs[e.ErrType][e.ErrSource];}catch(err){}if(!oMsg){oMsg=this.Msgs[LNJS.ErrType.SystemError][LNJS.ErrSource.ClientSideJavaScriptError];input+='; Error in '+e.__className;}if(typeof LNJS.__LastErr=='object'){if(LNJS.__LastErr.ErrSource!=LNJS.ErrSource.ClientSideJavaScriptError){text=(oMsg.useErrText)?e.message:oMsg.text;input=(LNJS.isNull(e.ErrInput))?e.message+input:e.ErrInput;if(input==text)input=null;if(oMsg)this.showMsg(oMsg.extend({text:text,input:input}));return;}}text=(oMsg.useErrText)?e.message:oMsg.text;if(oMsg)this.showMsg(oMsg.extend({text:text,input:'Error in '+e.__className+" "+e.message}));},handleAllError:function(sMsg,url,lno){if(sMsg.indexOf("non-chrome context")>=0)return true;if(!LNJS.isNull(LNJS.__LastErr)){if(LNJS.__LastErr.message==sMsg){if(LNJS.__LastErr.ErrSource!=LNJS.ErrSource.ClientSideJavaScriptError){LNJS.Page.handleError(LNJS.__LastErr);return true;}}}LNJS.Trace.error("Error: msg:"+sMsg+"; line:"+lno+"; url:"+url);var oMsg=LNJS.Page.Msgs[LNJS.ErrType.SystemError][LNJS.ErrSource.ClientSideJavaScriptError];var text=(oMsg.useErrText)?sMsg:oMsg.text;LNJS.Page.showMsg(oMsg.extend({input:"msg:"+text+"; line:"+lno}));return true;},hideMsg:function(){if(LNJS.isNull(this.EL.msgcont))this.EL.msgcont=$("msgcont");if(LNJS.isNull(this.EL.msgcont))return;Element.hide(this.EL.msgcont);if(this.EL.msgdontshow&&LNJS.Page.currentMsg){if(Element.visible(this.EL.msgdontshow)&&this.EL.dontshowagain.checked){var name=(LNJS.Page.currentMsg.name)?LNJS.Page.currentMsg.name:(LNJS.Page.currentMsg.type+""+LNJS.Page.currentMsg.source);var date=new Date();date.setTime(date.getTime()+(3650*24*60*60*1000));setCookie(name,this.EL.dontshowagain.checked.toString(),date,"/");}}LNJS.Page.currentMsg=null;LNJS.__LastErr=null;},cacheEL:function(element,name,ignoreErr){var el=$(element);if(LNJS.isNull(el)&&!ignoreErr)throw this.Err(this.__className+": Unable to cache element not found: "+element);if(LNJS.isNull(name)&&el)name=el.id||el.name;if(name){el._name=name;this.EL[name]=el;this.EL.length++;}},clearEL:function(element){if(LNJS.isNull(element)||typeof(element)!='object')return;Element.purge(element);this.EL[element._name]=null;this.EL.length--;},clearAllEL:function(){for(element in this.EL)this.clearEL(this.EL[element]);},destroy:function(){this.disposeAll(this);this.clearAllEL();this.EL=null;},disposeAll:function(object){for(property in object){if(!LNJS.isNull(object[property])&&typeof object[property]=='object'){if(typeof object[property]['dispose']!='undefined'){(object[property][('dispose'||LNJS.emptyFunction)])();}}}if(object.dispose)object.dispose();},_msgVisible:function(){if(LNJS.isNull(this.EL.msgcont))return false;return Element.visible(this.EL.msgcont);}});