$.fn.log=function(a){if(typeof(console)!="undefined"&&console){console.log("%s: %o",a,this);}return this;};$.extend({log:function(a){if(typeof(console)!="undefined"&&console){console.log("%s",a);}}});$.fn.clearForm=function(){return this.each(function(){var b=this.type,a=this.tagName.toLowerCase();if(a=="form"){return $(":input",this).clearForm();
}if(b=="text"||b=="password"||a=="textarea"){this.value="";}else{if(b=="checkbox"||b=="radio"){this.checked=false;}else{if(a=="select"){this.selectedIndex=-1;}}}});};$.extend({deserialize:function(f,b,a){f=f.replace(/#|\?/g,"&");var c=typeof(b)!="undefined";var d=typeof(a)=="undefined"||a;var e={};jQuery.each(f.split("&"),function(i,j){if(j.length==0){return;
}var g=j.indexOf("=");var h=(g!=-1)?j.substr(0,g):j;if(!c||(d&&jQuery.inArray(h,b)!=-1)||(!d&&jQuery.inArray(h,b)==-1)){e[h]=(g!=-1)?unescape(j.substr(g+1)).replace(/\+/g," "):"true";}});return e;}});$.extend({deepCopy:function(b){var a={};jQuery.each(b,function(d,c){if(typeof(c)=="object"&&c.length){a[d]=$.deepCopy(c);
}else{a[d]=c;}});return a;}});(function(a){a.fn.extend({mousewheel:function(b){if(!b.guid){b.guid=a.event.guid++;}if(!a.event._mwCache){a.event._mwCache=[];}return this.each(function(){if(this._mwHandlers){return this._mwHandlers.push(b);}else{this._mwHandlers=[];}this._mwHandlers.push(b);var c=this;
this._mwHandler=function(g){g=a.event.fix(g||window.event);var h=0,f=true;if(g.wheelDelta){h=g.wheelDelta/120;}if(g.detail){h=-g.detail/3;}if(window.opera){h=-g.wheelDelta;}for(var d=0;d<c._mwHandlers.length;d++){if(c._mwHandlers[d]){if(c._mwHandlers[d].call(c,g,h)===false){f=false;g.preventDefault();
g.stopPropagation();}}}return f;};if(this.addEventListener){if(a.browser.mozilla){this.addEventListener("DOMMouseScroll",this._mwHandler,false);}else{this.addEventListener("mousewheel",this._mwHandler,false);}}else{this.onmousewheel=this._mwHandler;}a.event._mwCache.push(a(this));});},unmousewheel:function(b){return this.each(function(){if(b&&this._mwHandlers){for(var c=0;
c<this._mwHandlers.length;c++){if(this._mwHandlers[c]&&this._mwHandlers[c].guid==b.guid){delete this._mwHandlers[c];}}}else{if(this.addEventListener){if(a.browser.mozilla){this.removeEventListener("DOMMouseScroll",this._mwHandler,false);}else{this.removeEventListener("mousewheel",this._mwHandler,false);
}}else{this.onmousewheel=null;}this._mwHandlers=this._mwHandler=null;}});}});a(window).one("unload",function(){var c=a.event._mwCache||[];for(var b=0;b<c.length;b++){c[b].unmousewheel();}});})(jQuery);$.fn.staySelected=function(){return this.each(function(){var b=this.type,a=this.tagName.toLowerCase();
if(b=="text"||b=="password"||a=="textarea"){$(this).select();$(this).bind("click",function(c){this.select();});}});};var fieldTips;function initFieldTip(a){fieldTips=a;jQuery.each(a,function(c,b){currentField=$("#"+c);currentField.focus(function(d){if($(this).val()==fieldTips[this.id]){$(this).css({color:"#000"});
$(this).val("");}});currentField.blur(function(d){if($(this).val()==""){$(this).css({color:"#aaa"});$(this).val(fieldTips[this.id]);}});currentField.blur();});}var fieldClassTips;function initFieldClassTip(a){fieldClassTips=a;jQuery.each(a,function(c,b){currentField=$("."+c);currentField.focus(function(d){if($(this).val()==fieldClassTips[$(this).attr("class")]){$(this).css({color:"#000"}).val("");
}});currentField.blur(function(d){if($(this).val()==""){$(this).css({color:"#aaa"}).val(fieldClassTips[$(this).attr("class")]);}});currentField.blur();});}var offset=[15,15];var currentToolTip="";var newToolTip="";function clearCaption(){$("#tooltip").hide();currentToolTip="";}function setCaption(a){$("#tooltip").html(a);
currentToolTip=a;$("#tooltip").show();}function tt(a){newToolTip=a;}function initToolTip(){$("body").append('<div id="tooltip"></div>');$().mousemove(function(c){if(currentToolTip!=newToolTip){if(newToolTip==""){clearCaption();return;}else{setCaption(newToolTip);}}var b=offset[0];var a=offset[1];b+=c.pageX;
a+=c.pageY;$("#tooltip").css({left:b+"px",top:a+"px"});});}if(typeof hotpads=="undefined"){var hotpads={};}hotpads.tooltip={requiredCss:{position:"absolute",display:"none",zIndex:"5000"},defaultStyle:{fontSize:"11px",fontWeight:"bold",backgroundColor:"#3887B1",color:"#FFF",border:"1px solid #79B2D1",padding:"2px 4px 2px 4px"},init:function(b,a){if(typeof b=="undefined"){b="body";
}if(!$("#toolTip").length){$("body").append('<div id="toolTip"></div>');}$("#toolTip").css(hotpads.tooltip.requiredCss);if(typeof a=="undefined"){$("#toolTip").css(hotpads.tooltip.defaultStyle);}else{$("#toolTip").css(a);}$(b).mousemove(function(c){$("#toolTip").css({left:(c.pageX)+"px",top:(c.pageY+25)+"px"});
});$(b+" *[title]").each(function(){var c=$(this);c.attr("tooltip",c.attr("title"));c.removeAttr("title");c.hover(function(){$("#toolTip").text(c.attr("tooltip"));$("#toolTip").show();},function(){$("#toolTip").hide();});});}};function initMiniLogin(){$("#loginLink").click(function(){return showLogin();
});$("#logoutLink").click(function(){if(hotpads.fb&&hotpads.fb.fbUID!=null){hotpads.fb.logout();}else{ajaxLogout();}return false;});}function showLogin(){if($("#loginPopup").length){$("#loginFrame").attr("src","/mini-login.jsp");$("#loginPopup").show();$("body").click(function(){hideLoginBox();});$("#loginFrame").click(function(){return false;
});return false;}else{return true;}}function hideLoginBox(){$("#loginPopup").hide();}function updateLoginInfo(){if(!$("#mySearchesBox").length){window.location.reload();}if($("#headerLogin").length){$.ajax({async:false,url:"/main.htm?action=loginInfo&loginPopup=true&seed="+Math.random(),success:function(a){$("#headerLogin").fadeOut("fast",function(){$("#headerLogin").html(a);
$("#headerLogin").fadeIn("fast");initMiniLogin();});}});}if($("#mySearchesBox").length){$.ajax({async:false,url:"/main.htm?action=searchBox&seed="+Math.random(),success:function(a){$("#mySearchesBox").slideUp("fast",function(){$("#mySearchesBox").html(a);$("#mySearchesBox").slideDown("fast");});}});}}function loginError(){window.location.replace("/login.jsp?error=1");
}function ajaxLogout(){$.ajax({async:false,url:"/logout.jsp?ajax=true&seed="+Math.random(),success:function(a){updateLoginInfo();}});return false;}jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1;}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;
if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000));}else{f=m.expires;}e="; expires="+f.toUTCString();}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("");
}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break;}}}return d;}};jQuery.fn.extend({getUrlParam:function(f){f=escape(unescape(f));
var e=new Array();var b=null;if($(this).attr("nodeName")=="#document"){if(window.location.search.search(f)>-1){b=window.location.search.substr(1,window.location.search.length).split("&");}}else{if($(this).attr("src")!="undefined"){var d=$(this).attr("src");if(d.indexOf("?")>-1){var a=d.substr(d.indexOf("?")+1);
b=a.split("&");}}else{if($(this).attr("href")!="undefined"){var d=$(this).attr("href");if(d.indexOf("?")>-1){var a=d.substr(d.indexOf("?")+1);b=a.split("&");}}else{return null;}}}if(b==null){return null;}for(var c=0;c<b.length;c++){if(escape(unescape(b[c].split("=")[0]))==f){e.push(b[c].split("=")[1]);
}}if(e.length==0){return null;}else{if(e.length==1){return e[0];}else{return e;}}}});(function(a){a.fn.charCounter=function(c,b){c=c||100;b=a.extend({container:"<span></span>",classname:"charcounter",format:"(%1 characters remaining)",pulse:true,delay:0},b);var g,f;function e(i,h){i=a(i);if(i.val().length>c){i.val(i.val().substring(0,c));
if(b.pulse&&!g){d(h,true);}}if(b.delay>0){if(f){window.clearTimeout(f);}f=window.setTimeout(function(){h.html(b.format.replace(/%1/,(c-i.val().length)));},b.delay);}else{h.html(b.format.replace(/%1/,(c-i.val().length)));}}function d(h,i){if(g){window.clearTimeout(g);g=null;}h.animate({opacity:0.1},100,function(){a(this).animate({opacity:1},100);
});if(i){g=window.setTimeout(function(){d(h);},200);}}return this.each(function(){var h=(!b.container.match(/^<.+>$/))?a(b.container):a(b.container).insertAfter(this).addClass(b.classname);a(this).bind("keydown",function(){e(this,h);}).bind("keypress",function(){e(this,h);}).bind("keyup",function(){e(this,h);
}).bind("focus",function(){e(this,h);}).bind("mouseover",function(){e(this,h);}).bind("mouseout",function(){e(this,h);}).bind("paste",function(){var i=this;setTimeout(function(){e(i,h);},10);});if(this.addEventListener){this.addEventListener("input",function(){e(this,h);},false);}e(this,h);});};})(jQuery);
