var gIsLive=true,SearchEngineEnum={Scour:0,Google:1,Yahoo:2,MSN:3,YouTube:4,OneRiot:5},SortByEnum={Scour:0,Google:1,Yahoo:2,MSN:3,OneRiot:4},SearchType={Web:1,Image:2,Video:3,Comments:4,Votes:5,Community:6,Local:7,Business:8},userSettings={disabledSearchTypes:true,disableSafeSearch:false,googleWeight:100,numYahooResults:10,numGoogleResults:8,yahooWeight:100,msnWeight:100,oneriotWeight:80,showSortingButtons:true,openLinksInVotingFrame:false,sortResultsBy:SortByEnum.Scour,username:"",userid:"",showflydown:true,showpostfirstsearchpopup:true,numMSNResults:10,isSurveyVisited:false,showHomePageBox:true,introSearches:0,showSearchInvitePsst:true,showWebAwardBox:true,showPageNumberHint:true,lastSearchTerm:"",lastSearchPage:0,lastSearchType:SearchType.Web,showSerpsGiveawayBanner:true,showSerpsRealtimeNoticePsst:true,showSurveyHeaderRewards:true,lastLocation:"",checkBCT:true,isLoggedIn:function(){return this.username!==""},restoreDefaults:function(){this.disabledSearchTypes=true;this.disableSafeSearch=false;this.googleWeight=100;this.numYahooResults=10;this.yahooWeight=100;this.msnWeight=100;this.oneriotWeight=80;this.showSortingButtons=true;this.openLinksInVotingFrame=false;this.numMSNResults=10;this.numGoogleResults=10;window.cookies.saveSettings()}};window.userSettings=userSettings;function CookieManager(){}CookieManager.prototype={getCookie:function(f,e){for(var c=f+"=",d=document.cookie.split(";"),b=0;b<d.length;b++){var a=d[b];while(a.charAt(0)===" ")a=a.substring(1,a.length);if(a.indexOf(c)===0)return a.substring(c.length,a.length)}return e},setCookie:function(f,e,d){var b;if(d){var c=new Date;c.setTime(c.getTime()+d*24*60*60*1e3);b="; expires="+c.toGMTString()+";"}else b="";var a=f+"="+e+b+"; path=/";if(gIsLive)a+=";domain=.scour.com";else a+=";domain=scour.webdev.thinkingbig.net";document.cookie=a},clearCookie:function(a){this.setCookie(a,"")}};function AppCookies(){}AppCookies.prototype={load:function(){this.loadSettings()},loadSettings:function(){var a=new CookieManager,b=userSettings;b.disabledSearchTypes=a.getCookie("disabledSearchTypes","true")=="true";b.disableSafeSearch=a.getCookie("disableSafeSearch","true")=="true";b.googleWeight=Number(a.getCookie("googleWeight",100));b.numYahooResults=Number(a.getCookie("numYahooResults",10));b.yahooWeight=Number(a.getCookie("yahooWeight",100));b.msnWeight=Number(a.getCookie("msnWeight",100));b.oneriotWeight=Number(a.getCookie("oneriotWeight",80));b.showSortingButtons=a.getCookie("showSortingButtons","true")=="true";b.showSU=a.getCookie("showSU","false")=="true";b.sortResultsBy=a.getCookie("sortResultsBy",SortByEnum.Scour);b.username=a.getCookie("username","");b.userid=a.getCookie("userid","");b.openLinksInVotingFrame=a.getCookie("openLinksInVotingFrame","false")=="true";b.showflydown=a.getCookie("showflydown","true")=="true";b.showpostfirstsearchpopup=a.getCookie("showpostfirstsearchpopup","true")=="true";b.numMSNResults=Number(a.getCookie("numMSNResults",10));b.isSurveyVisited=a.getCookie("isSurveyVisited","false")=="true";b.showHomePageBox=a.getCookie("showHomePageBox","true")=="true";b.introSearches=Number(a.getCookie("introSearches",0));b.showSearchInvitePsst=a.getCookie("showSearchInvitePsst","true")=="true";b.showWebAwardBox=a.getCookie("showWebAwardBox","true")=="true";b.numGoogleResults=a.getCookie("numGoogleResults",8);b.showPageNumberHint=a.getCookie("showPageNumberHint","true")=="true";b.lastSearchTerm=a.getCookie("lastSearchTerm","");b.lastSearchPage=Number(a.getCookie("lastSearchPage",0));b.lastSearchType=Number(a.getCookie("lastSearchType",""),SearchType.Web);b.showSerpsGiveawayBanner=a.getCookie("showSerpsGiveawayBanner","true")=="true";b.showSerpsRealtimeNoticePsst=a.getCookie("showSerpsRealtimeNoticePsst","true")=="true";b.showSurveyHeaderRewards=a.getCookie("showSurveyHeaderRewards","true")=="true";b.lastLocation=a.getCookie("lastLocation","");b.checkBCT=a.getCookie("checkBCT","true")=="true"},saveSettings:function(){var a=new CookieManager,c=userSettings,b=365*10;a.setCookie("disabledSearchTypes",c.disabledSearchTypes,b);a.setCookie("disableSafeSearch",c.disableSafeSearch,b);a.setCookie("googleWeight",c.googleWeight,b);a.setCookie("numYahooResults",c.numYahooResults,b);a.setCookie("yahooWeight",c.yahooWeight,b);a.setCookie("msnWeight",c.msnWeight,b);a.setCookie("oneriotWeight",c.oneriotWeight,b);a.setCookie("showSortingButtons",c.showSortingButtons,b);a.setCookie("sortResultsBy",SortByEnum.Scour,b);a.setCookie("showflydown",c.showflydown,b);a.setCookie("openLinksInVotingFrame",c.openLinksInVotingFrame,b);a.setCookie("showpostfirstsearchpopup",c.showpostfirstsearchpopup,b);a.setCookie("numMSNResults",c.numMSNResults,b);a.setCookie("isSurveyVisited",c.isSurveyVisited,b);a.setCookie("showHomePageBox",c.showHomePageBox,b);a.setCookie("introSearches",c.introSearches,b);a.setCookie("showSearchInvitePsst",c.showSearchInvitePsst,b);a.setCookie("showWebAwardBox",c.showWebAwardBox,b);a.setCookie("numGoogleResults",c.numGoogleResults,b);a.setCookie("showPageNumberHint",c.showPageNumberHint,b);a.setCookie("lastSearchTerm",c.lastSearchTerm,b);a.setCookie("lastSearchPage",c.lastSearchPage,b);a.setCookie("lastSearchType",c.lastSearchType,b);a.setCookie("showSerpsGiveawayBanner",c.showSerpsGiveawayBanner,b);a.setCookie("showSerpsRealtimeNoticePsst",c.showSerpsRealtimeNoticePsst,b);a.setCookie("showSurveyHeaderRewards",c.showSurveyHeaderRewards,b);a.setCookie("lastLocation",c.lastLocation,b);a.setCookie("checkBCT",c.checkBCT,20)},setSearch:function(d,c,b){var a=window.userSettings;a.lastSearchTerm=d;a.lastSearchPage=c;a.lastSearchType=b;this.saveSettings()},setSurveyVisisted:function(){userSettings.isSurveyVisited=true;this.saveSettings()},setShowedSearchPsst:function(){userSettings.isSurveyVisited=true;this.saveSettings()},setShowSurveyHeaderRewards:function(){userSettings.showSurveyHeaderRewards=false;this.saveSettings()}};window.cookies=new AppCookies;window.cookies.load();(function(a){var b=a.scrollTo=function(b,c,d){a(window).scrollTo(b,c,d)};b.defaults={axis:"y",duration:1};b.window=function(){return a(window).scrollable()};a.fn.scrollable=function(){return this.map(function(){var c=this.parentWindow||this.defaultView,b=this.nodeName=="#document"?c.frameElement||c:this,d=b.contentDocument||(b.contentWindow||b).document,e=b.setInterval;return b.nodeName=="IFRAME"||e&&a.browser.safari?d.body:e?d.documentElement:this})};a.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function")d={onAfter:d};d=a.extend({},b.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue)e/=2;d.offset=c(d.offset);d.over=c(d.over);return this.scrollable().each(function(){var h=this,j=a(h),b=f,i,g={},k=j.is("html,body");switch(typeof b){case"number":case"string":if(/^([+-]=)?\d+(px)?$/.test(b)){b=c(b);break}b=a(b,this);case"object":if(b.is||b.style)i=(b=a(b)).offset()}a.each(d.axis.split(""),function(p,f){var e=f=="x"?"Left":"Top",c=e.toLowerCase(),a="scroll"+e,n=h[a],o=f=="x"?"Width":"Height",q=o.toLowerCase();if(i){g[a]=i[c]+(k?0:n-j.offset()[c]);if(d.margin){g[a]-=parseInt(b.css("margin"+e))||0;g[a]-=parseInt(b.css("border"+e+"Width"))||0}g[a]+=d.offset[c]||0;if(d.over[c])g[a]+=b[q]()*d.over[c]}else g[a]=b[c];if(/^\d+$/.test(g[a]))g[a]=g[a]<=0?0:Math.min(g[a],m(o));if(!p&&d.queue){n!=g[a]&&l(d.onAfterFirst);delete g[a]}});l(d.onAfter);function l(a){j.animate(g,e,d.easing,a&&function(){a.call(this,f,d)})}function m(c){var a="scroll"+c,b=h.ownerDocument;return k?Math.max(b.documentElement[a],b.body[a]):h[a]}}).end()};function c(a){return typeof a=="object"?a:{top:a,left:a}}})(jQuery);jQuery.extend({historyCurrentHash:undefined,historyCallback:undefined,historyIframeSrc:undefined,historyInit:function(d,c){jQuery.historyCallback=d;if(c)jQuery.historyIframeSrc=c;var a=location.hash.replace(/\?.*$/,"");jQuery.historyCurrentHash=a;if(jQuery.browser.msie){if(jQuery.historyCurrentHash=="")jQuery.historyCurrentHash="#";jQuery("body").prepend('<iframe id="jQuery_history" style="display: none;"'+(jQuery.historyIframeSrc?' src="'+jQuery.historyIframeSrc+'"':"")+"></iframe>");var e=jQuery("#jQuery_history")[0],b=e.contentWindow.document;b.open();b.close();b.location.hash=a}else if(jQuery.browser.safari){jQuery.historyBackStack=[];jQuery.historyBackStack.length=history.length;jQuery.historyForwardStack=[];jQuery.lastHistoryLength=history.length;jQuery.isFirst=true}a&&jQuery.historyCallback(a.replace(/^#/,""));setInterval(jQuery.historyCheck,100)},historyAddHistory:function(a){jQuery.historyBackStack.push(a);jQuery.historyForwardStack.length=0;this.isFirst=true},historyCheck:function(){if(jQuery.browser.msie){var e=jQuery("#jQuery_history")[0],f=e.contentDocument||e.contentWindow.document,a=f.location.hash.replace(/\?.*$/,"");if(a!=jQuery.historyCurrentHash){location.hash=a;jQuery.historyCurrentHash=a;jQuery.historyCallback(a.replace(/^#/,""))}}else if(jQuery.browser.safari){jQuery.lastHistoryLength==history.length&&jQuery.historyBackStack.length>jQuery.lastHistoryLength&&jQuery.historyBackStack.shift();if(!jQuery.dontCheck){var b=history.length-jQuery.historyBackStack.length;jQuery.lastHistoryLength=history.length;if(b){jQuery.isFirst=false;if(b<0)for(var c=0;c<Math.abs(b);c++)jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop());else for(var c=0;c<b;c++)jQuery.historyBackStack.push(jQuery.historyForwardStack.shift());var d=jQuery.historyBackStack[jQuery.historyBackStack.length-1];if(d!=undefined){jQuery.historyCurrentHash=location.hash.replace(/\?.*$/,"");jQuery.historyCallback(d)}}else if(jQuery.historyBackStack[jQuery.historyBackStack.length-1]==undefined&&!jQuery.isFirst){if(location.hash){var a=location.hash;jQuery.historyCallback(location.hash.replace(/^#/,""))}else{var a="";jQuery.historyCallback("")}jQuery.isFirst=true}}}else{var a=location.hash.replace(/\?.*$/,"");if(a!=jQuery.historyCurrentHash){jQuery.historyCurrentHash=a;jQuery.historyCallback(a.replace(/^#/,""))}}},historyLoad:function(a){var b;a=decodeURIComponent(a.replace(/\?.*$/,""));if(jQuery.browser.safari)b=a;else{b="#"+a;location.hash=b}jQuery.historyCurrentHash=b;if(jQuery.browser.msie){var d=jQuery("#jQuery_history")[0],c=d.contentWindow.document;c.open();c.close();c.location.hash=b;jQuery.lastHistoryLength=history.length;jQuery.historyCallback(a)}else if(jQuery.browser.safari){jQuery.dontCheck=true;this.historyAddHistory(a);var e=function(){jQuery.dontCheck=false};window.setTimeout(e,200);jQuery.historyCallback(a);location.hash=b}else jQuery.historyCallback(a)}});(function(a){a.modal=function(c,b){return a.modal.impl.init(c,b)};a.modal.close=function(){a.modal.impl.close(true)};a.fn.modal=function(b){return a.modal.impl.init(this,b)};a.modal.defaults={overlay:50,overlayId:"modalOverlay",overlayCss:{},containerId:"modalContainer",containerCss:{},close:true,closeTitle:"Close",closeClass:"modalClose",persist:false,onOpen:null,onShow:null,onClose:null};a.modal.impl={opts:null,dialog:{},init:function(b,c){if(this.dialog.data)return false;this.opts=a.extend({},a.modal.defaults,c);if(typeof b=="object"){b=b instanceof jQuery?b:a(b);if(b.parent().parent().size()>0){this.dialog.parentNode=b.parent();if(!this.opts.persist)this.dialog.original=b.clone(true)}}else if(typeof b=="string"||typeof b=="number")b=a("<div>").html(b);else{console&&console.log("SimpleModal Error: Unsupported data type: "+typeof b);return false}this.dialog.data=b.addClass("modalData");b=null;this.create();this.open();a.isFunction(this.opts.onShow)&&this.opts.onShow.apply(this,[this.dialog]);return this},create:function(){this.dialog.overlay=a("<div>").attr("id",this.opts.overlayId).addClass("modalOverlay").css(a.extend(this.opts.overlayCss,{opacity:this.opts.overlay/100,height:"100%",width:"100%",position:"fixed",left:0,top:0,zIndex:3e3})).hide().appendTo("body");this.dialog.container=a("<div>").attr("id",this.opts.containerId).addClass("modalContainer").css(a.extend(this.opts.containerCss,{position:"fixed",zIndex:3100})).append(this.opts.close?'<a class="modalCloseImg '+this.opts.closeClass+'" title="'+this.opts.closeTitle+'"></a>':"").hide().appendTo("body");a.browser.msie&&a.browser.version<7&&this.fixIE();this.dialog.container.append(this.dialog.data.hide())},bindEvents:function(){var b=this;a("."+this.opts.closeClass).click(function(a){a.preventDefault();b.close()})},unbindEvents:function(){a("."+this.opts.closeClass).unbind("click")},fixIE:function(){var b=a(document.body).height()+"px",c=a(document.body).width()+"px";this.dialog.overlay.css({position:"absolute",height:b,width:c});this.dialog.container.css({position:"absolute"});this.dialog.iframe=a('<iframe src="javascript:false;">').css(a.extend(this.opts.iframeCss,{opacity:0,position:"absolute",height:b,width:c,zIndex:1e3,width:"100%",top:0,left:0})).hide().appendTo("body")},open:function(){this.dialog.iframe&&this.dialog.iframe.show();if(a.isFunction(this.opts.onOpen))this.opts.onOpen.apply(this,[this.dialog]);else{this.dialog.overlay.show();this.dialog.container.show();this.dialog.data.show()}this.bindEvents()},close:function(b){if(!this.dialog.data)return false;if(a.isFunction(this.opts.onClose)&&!b)this.opts.onClose.apply(this,[this.dialog]);else{if(this.dialog.parentNode)if(this.opts.persist)this.dialog.data.hide().appendTo(this.dialog.parentNode);else{this.dialog.data.remove();this.dialog.original.appendTo(this.dialog.parentNode)}else this.dialog.data.remove();this.dialog.container.remove();this.dialog.overlay.remove();this.dialog.iframe&&this.dialog.iframe.remove();this.dialog={}}this.unbindEvents()}}})(jQuery);function dummy(){}(function(a){a.scour=a.scour||{};a.scour.consts={domain:"scour.com"};a.scour.util={addSearchProvider:function(){if(window.external&&"AddSearchProvider"in window.external)window.external.AddSearchProvider("http://"+a.scour.consts.domain+"/searchplugins/scour.xml");else if(window.sidebar&&"addSearchEngine"in window.sidebar)window.sidebar.addSearchEngine("http://"+a.scour.consts.domain+"/searchplugins/scour.src","http://"+a.scour.consts.domain+"/searchplugins/scour.gif","scour","The Social Search Engine");else alert("No search engine plugin support detected (FireFox or IE 7 required)");return false}};a.scour.homepage={escapeSearch:function(a){a=a.replace(/\//g," ");var b=encodeURIComponent(a);b=b.replace(/'/gi,"%27");return b},getActiveTab:function(b){if(b===undefined)b="";return a("#nSearch-container"+b).hasClass("nSearch-w")?"web":a("#nSearch-container"+b).hasClass("nSearch-i")?"images":a("#nSearch-container"+b).hasClass("nSearch-v")?"video":a("#nSearch-container"+b).hasClass("nSearch-l")?"local":a("#nSearch-container"+b).hasClass("nSearch-b")?"business":a("#tabComments"+b).hasClass("activetab")?"comment":a("#tabVotes"+b).hasClass("activetab")?"vote":a("#tabCommunity"+b).hasClass("activetab")?"community":void 0},getSearchType:function(b){var a=this.getActiveTab(b);switch(a){case"web":return SearchType.Web;case"images":return SearchType.Image;case"video":return SearchType.Video;case"comment":return SearchType.Comments;case"vote":return SearchType.Votes;case"community":return SearchType.Community;case"local":return SearchType.Local;case"business":return SearchType.Business;default:return SearchType.Web}},getSearchTypeText:function(a){switch(a){case SearchType.Web:return"web";case SearchType.Image:return"images";case SearchType.Video:return"video";case SearchType.Comments:return"comment";case SearchType.Votes:return"vote";case SearchType.Community:return"community";case SearchType.Local:return"local";case SearchType.Business:return"business"}},search:function(d){if(d===undefined)d="";var c=a("#txtSearch"+d).get(0).value,f=a("#localSearchArea").get(0).value;window.cookies.setSearch(this.escapeSearch(c),0,this.getSearchType(d));var e,b=this.getActiveTab(d);if(b=="local"){window.userSettings.lastLocation=a("#localSearchArea").val();window.cookies.saveSettings()}if(b=="vote")e="/votes/search/all/"+this.escapeSearch(c)+"/";else if(b=="comment")e="/comments/search/all/"+this.escapeSearch(c)+"/";else if(b=="local")e="/search/"+b+"/"+this.escapeSearch(c)+"/locale/"+f+"/";else e="/search/"+b+"/"+this.escapeSearch(c);if(c!="")window.location.href=e;return false},setActiveTab:function(c,b){if(b===undefined)b="";a("#nSearch-container"+b).removeClass("nSearch-w").removeClass("nSearch-i").removeClass("nSearch-v").removeClass("nSearch-b");c=="tabWeb"+b&&a("#nSearch-container"+b).addClass("nSearch-w");c=="tabImages"+b&&a("#nSearch-container"+b).addClass("nSearch-i");c=="tabVideo"+b&&a("#nSearch-container"+b).addClass("nSearch-v");c=="tabBusiness"+b&&a("#nSearch-container"+b).addClass("nSearch-b");c=="tabComments"+b&&a("#tabComments"+b).addClass("activetab");c=="tabVotes"+b&&a("#tabVotes"+b).addClass("activetab");c=="tabCommunity"+b&&a("#tabCommunity"+b).addClass("activetab");c=="tabLocal"+b&&a("#nSearch-container"+b).addClass("nSearch-l");return false}}})(jQuery);function showHide(a){$("#"+a).slideToggle("slow")}function doVoteFrame(d,b,a){a=unescape(a);pageTracker&&pageTracker._trackPageview("/outgoing/resultclick/"+searcher.searchType+"/"+searcher.search_query+"/"+gSource);$.ajax({url:"/services/resultClick/",data:{query:searcher.search_query,click_url:b,search_type:searcher.searchType},type:"post",cache:false,dataType:"json",success:function(){if(userSettings.openLinksInVotingFrame){var c=Base64.encode(b);a=Base64.encode(encode(stripBolding(a.replace("/",""))));var d=encodeURIComponent(searcher.search_query).replace("/","");window.location.href="/view/result/"+d+"/"+a+"/"+c+"/?URL="+b}else window.location.href=b}});return true}function searchOnDomain(c){var a=searcher.search_query,b=a.indexOf("site:");if(b>=0)a=a.substr(0,a.indexOf("site:"));window.userSettings.lastSearchPage=0;window.cookies.saveSettings();window.location.href="/search/web/"+a+" site:"+c+"/related"}function resultClickThru(a){pageTracker&&pageTracker._trackPageview("/outgoing/resultclick/"+searcher.searchType+"/"+searcher.search_query+"/"+gSource);$.ajax({url:"/services/resultClick/",data:{query:searcher.search_query,click_url:a,search_type:searcher.searchType},type:"post",cache:false,dataType:"json",success:function(){}});return true}function clearComment(a){if(a&&a.defaultValue==a.value)a.value=""}function vote(a,b){if(!userSettings.isLoggedIn()){if(window.confirm("You must be logged in to vote.  Would you like to login now?"))window.location.href="/login/";return false}b.blur();b.onclick=dummy;$.ajax({url:"/services/addPosVote/",data:{query:searcher.search_query,url:searcher.aggSearchResults.list[a].getFirstUrl()},type:"post",cache:false,dataType:"json",success:function(){}});$("#voteup_link"+a).addClass("resultVoteUpComplete");$("#voteup_link"+a).attr({title:"Voted Up. Thanks!"});$("#votedown_link"+a).fadeOut("slow");$("#votedown_link_frame"+a).fadeOut("slow");return false}function votedown(a,b){if(!userSettings.isLoggedIn()){if(window.confirm("You must be logged in to vote.  Would you like to login now?"))window.location.href="/login/";return false}b.blur();b.onclick=dummy;$("#votedown_link"+a).addClass("resultVoteDownComplete");$("#votedown_link"+a).attr({title:"Voted Down. Thanks!"});$("#voteup_link"+a).fadeOut("slow");$("#voteup_link_frame"+a).fadeOut("slow");$.ajax({url:"/services/addNegVote/",data:{query:searcher.search_query,url:searcher.aggSearchResults.list[a].getFirstUrl()},type:"post",cache:false,dataType:"json",success:function(){}});return false}function commentvoteup(a,b){if(!userSettings.isLoggedIn()){if(window.confirm("You must be logged in to vote.  Would you like to login now?"))window.location.href="/login/";return false}b.blur();b.onclick=dummy;$.ajax({url:"/services/addPosVote/",data:{query:searcher.search_query,url:searcher.aggSearchResults.list[a].getFirstUrl()},type:"post",cache:false,dataType:"json",success:function(){}});$("#voteup_link"+a).addClass("resultVoteUpComplete");$("#voteup_link"+a).attr({title:"Voted Up. Thanks!"});$("#votedown_link"+a).fadeOut("slow");$("#votedown_link_frame"+a).fadeOut("slow");return false}function commentvotedown(a,b){if(!userSettings.isLoggedIn()){if(window.confirm("You must be logged in to vote.  Would you like to login now?"))window.location.href="/login/";return false}b.blur();b.onclick=dummy;$("#votedown_link"+a).addClass("resultVoteDownComplete");$("#votedown_link"+a).attr({title:"Voted Down. Thanks!"});$("#voteup_link"+a).fadeOut("slow");$("#voteup_link_frame"+a).fadeOut("slow");$.ajax({url:"/services/addNegVote/",data:{query:searcher.search_query,url:searcher.aggSearchResults.list[a].getFirstUrl()},type:"post",cache:false,dataType:"json",success:function(){}});return false}function showFeedbackForm(){document.getElementById("feedback-name").value=userSettings.username;document.getElementById("feedback-section").value=window.location.href;$("#feedbackform").modal({close:false,overlayId:"feedback-overlay",containerId:"feedback-container",onOpen:feedback.open,onShow:feedback.show,onClose:feedback.close});return false}function toogleVotingFrame(){userSettings.openLinksInVotingFrame=!userSettings.openLinksInVotingFrame;cookies.saveSettings();var a="on";if(!userSettings.openLinksInVotingFrame)a="off";$("#toogleVotingFrameStatus").text(a)}function hideHomePageBox(){userSettings.showHomePageBox=false;cookies.saveSettings();$("#homepage_explination").fadeOut("slow");$("#learnmore").fadeOut("slow");$("#homepageMoreInfo").fadeIn("slow")}function showHomepageBox(){userSettings.showHomePageBox=true;cookies.saveSettings();$("#homepage_explination").fadeIn("slow");$("#learnmore").fadeIn("slow");$("#homepageMoreInfo").fadeOut("slow")}function closeComment(a){$("#l_comments"+a).slideToggle()}function addComment(b,f,d,c,e){if(userSettings.isLoggedIn()){var a=c.parent().parent();$.ajax({url:"/services/addComment/",data:{query:searcher.search_query,comment:b,url:f,positive:d},type:"post",cache:false,dataType:"json",success:function(f){if(f.success){var g=f.avatar;c.attr("disabled","disabled");a.find(".addCommentPosted").text("Comment Posted, thanks!");a.find(".addCommentPosted").show();a.find(".addCommentErrors").hide();a.find(".addCommentPostNeg").hide();a.find(".addCommentPostPos").hide();var h=a.parent().find(".resultCommentsBox"),d="";d+='<div class="comMyComment" >';d+='  <div class="comAvatarBar">';d+='    <a href="/profile/user/'+userSettings.username+'" class="comAvatar">';if(g!="")d+='      <img src="'+g+'" alt="" />';d+="    </a>";d+='    <div class="comBoxTip"></div>';d+="  </div>";d+='  <div class="comMain" id="justaddedcomment" style="display:none">';d+='    <div class="comInfo">';d+='      <a href="/profile/user/'+userSettings.username+'/" class="comUsername">'+userSettings.username.toString()+"</a>";d+='      <span class="comTime">Just added</span>';d+='      <div class="comReport" title="Report comment abuse"></div>';d+='      <div class="comVoting">';d+='        <div class="comPoints"> 0</div>';d+='        <div class="comID" style="display:none">'+f.commentid+"</div>";d+="      </div>";d+="    </div>";d+='    <div class="comBody">'+b+"</div>";d+="  </div>";d+="</div>";h.append(d);$("#justaddedcomment").fadeIn("slow")}else{a.find(".addCommentErrors").text(f.error);a.find(".addCommentPosted").hide();a.find(".addCommentErrors").show();e.show()}}})}else window.confirm("You must be logged in to comment.  Would you like to login now?")&&showLoginModal()}function goodieView(a,b){if(b=="s")document.getElementById(a).style.display="block";else document.getElementById(a).style.display="none"}function recommendComment(c,a,b){$.ajax({url:"/services/recommendComment/",data:{comment:c,positive:a},type:"post",cache:false,dataType:"json",success:function(a){$(b).parent().find(".comPoints").text(a.num)}})}function adClickThru(b,a){pageTracker&&pageTracker._trackPageview("/outgoing/adclick/"+searcher.searchType+"/"+searcher.search_query+"/"+gSource);$.ajax({url:"/services/addClickThru/",data:{query:searcher.search_query,url:b,search_type:searcher.searchType,bid:a,subid:gSubID},type:"post",cache:false,dataType:"json",complete:function(){}})}function addslashes(a){a=a.replace(/\\/g,"\\\\");a=a.replace(/\'/g,"\\'");a=a.replace(/\"/g,'\\"');a=a.replace(/\0/g,"\\0");a=a.replace(/&#39;/g,"\\'");return a}function scourPointsClick(){if(!userSettings.isLoggedIn())window.location.href="/login/";else window.location.href="/profile/points/"}function checkPaste(b){if($(this).val().length>searcher.addCommentTextboxValue.length+2){b.stopPropagation();$(this).val(searcher.addCommentTextboxValue);var a=$(this).parent();a.find(".addCommentErrors").text("Sorry, no pasting, we want the details from you! :-)");a.find(".addCommentErrors").show();a.find(".addCommentPosted").hide()}else searcher.addCommentTextboxValue=$(this).val()}function boldTextSplit(e,d){for(var b=e,c=d.split(/\s/),a=0;a<c.length;a++)if(c[a]!=""){var f=RegExp("("+c[a].replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")+")","gi");b=b.replace(f,"<b>$1</b>")}return b}function escapeRegExp(a){return a===undefined?"":a}function stripBolding(a){if(a===undefined)return"";a=a.replace(/<strong>/gim,"");a=a.replace(/<\/strong>/gim,"");a=a.replace(/<b>/gim,"");a=a.replace(/<\/b>/gim,"");return a}var searcher={rawSearchResults:new Collection,aggSearchResults:new SResult,sidebarHandler:null,votes:new VoteCollection,_searchResultContainer:null,_pagerResultContainer:null,_searchingContainer:null,_timeResultContainer:null,_spellCheckContainer:null,finishedSearches:[],startTime:null,endTime:null,_finshedOPSIScores:[],search_query:"",searchType:"web",numPages:0,currentPage:0,_totalResultsAvailable:0,_requestedPage:0,_spellCheckValue:"",_videoResults:new Collection,haveGoogle:false,haveMSN:false,haveYahoo:false,haveOneRiot:false,haveScour:false,haveRendered:false,haveFeaturedContent:false,commentCounts:[],ads:[],addCommentTextboxValue:"",featuredContent:new Collection,featuredContentTestIndex:1,featuredContentImpressionKey:"",addResult:function(a){this.rawSearchResults.add(a)},addVoteResult:function(a){this.votes.add(a)},calculateResults:function(){this.aggSearchResults.clear();for(var a,d=0;d<this.rawSearchResults.count();d++){var b=this.rawSearchResults.list[d];a=this.aggSearchResults.getByUrl(b.link);var c=this.votes.getByUrl(b.link);if(a!=null){a.add(b);c!=null&&a.addVote(c)}else{var e=new AggSResult(b);c!=null&&e.addVote(c);this.aggSearchResults.add(e)}}this.aggSearchResults.rankScores()},callbackSpellCheck:function(a){this._spellCheckValue=a;var b=$("#spellcheck");if(a!=""){$("#results-related").show();var c=$("#spellcheckterm");c.html('<a href="/search/'+this.searchType+"/"+a+'/related/" class="spellCheckLink">'+a+"</a>&nbsp;&nbsp;</span>");b.fadeIn("fast")}else b.hide()},callbackRelatedTerms:function(f){var g=$("#spellcheckrelated"),a=f.length,b,c;if(a>5)a=5;for(var d=0;d<a;d++){b=f[d];c="/search/"+this.searchType+"/"+encodeURIComponent(b)+"/related/";if(window.gSubID&&window.gSubID==1)c+="abc/";g.append("<a href='"+c+"'>"+boldTextSplit(b,this.search_query)+"</a>")}var e=$("#relatedterms");if(a>0){$("#results-related").show();e.fadeIn("fast")}else e.hide()},callbackImageSearch:function(){},callbackEngineWebSearchComplete:function(a){this._finishedSearches.push(a);if(!this.haveScour&&!this.haveMSN&&!this.haveYahoo&&!this.haveGoogle)this.endTime=(new Date).getTime();if(a==SearchEngineEnum.Google)this.haveGoogle=true;if(a==SearchEngineEnum.Yahoo)this.haveYahoo=true;if(a==SearchEngineEnum.MSN)this.haveMSN=true;if(a==SearchEngineEnum.Scour)this.haveScour=true;if(!this.haveRendered&&a!=SearchEngineEnum.Scour&&this.rawSearchResults>0||this._finishedSearches.length>=5){this.haveRendered=true;this.calculateResults();this.renderResults();this.setSearchTime();this.hideSearching();this.showSortByButtons();this.showBottomSearch()}},clearSearch:function(){this.aggSearchResults.clear();this._finishedSearches=[];this._finshedOPSIScores=[];this._searchResultContainer&&this._searchResultContainer.html("");this._pagerResultContainer.html("");this.rawSearchResults.clear();this.votes.clear();this.numPages=0;this.clearSpellCheck();this._spellCheckValue="";this._videoResults.clear()},clearSpellCheck:function(){$("#spellcheckterm").html("");$("#spellcheckrelated").html("")},createDelegate:function(a,b){return function(){return b.apply(a,arguments)}},displayCommentCounts:function(){this.haveRendered&&this.renderResults()},displayFeaturedContent:function(){if(searcher.haveFeaturedContent){var a=this.featuredContent.count();if(this.featuredContentTestIndex==1){var d=$("#featured-sidebar"),c=[];a>0&&c.push("<h3>Featured Content</h3>");for(var b=0;b<a;b++){var e=this.featuredContent.list[b],g=e.snippet;if(g.length>60)g=g.substring((0,60))+"...";c.push("<a onmouseup=\"searcher.trackFeaturedContentClick('"+e.redirectUrl+'\'); return true;" href="',e.redirectUrl,'" target="_blank">');c.push(' <div class="clear">');c.push("  <h6>",e.title,"</h6>");c.push('  <div class="featured-content-snippet">');e.thumbnail&&c.push('<img src="',e.thumbnail.url,'" width="90" height="90" align="right" />');c.push(e.snippet,"</div>");c.push('  <div class="featured-content-source">Source: ',e.source,"</div>");c.push(" </div>");c.push("</a>");searcher.trackOneRiotImpression(b)}d.html(c.join(""));searcher.trackScourOneRiotImpressions(a)}else if(this.featuredContentTestIndex==2){if(a>0){$("#result0").after(searcher.getFeaturedContentDisplayCode(this.featuredContent.list[0]));this.trackOneRiotImpression(0)}if(a>1){$("#result3").after(searcher.getFeaturedContentDisplayCode(this.featuredContent.list[1]));searcher.trackOneRiotImpression(1)}if(a>2){$("#result5").after(searcher.getFeaturedContentDisplayCode(this.featuredContent.list[2]));searcher.trackOneRiotImpression(2)}if(a>3){$("#result7").after(searcher.getFeaturedContentDisplayCode(this.featuredContent.list[3]));searcher.trackOneRiotImpression(3)}if(a>4){$("#result9").after(searcher.getFeaturedContentDisplayCode(this.featuredContent.list[4]));searcher.trackOneRiotImpression(4)}searcher.trackScourOneRiotImpressions(a)}else if(this.featuredContentTestIndex=4){var d,c=[];d=$("#featuredContentTop");a>0&&d.append("<h3>Real-time Content</h3>");for(var b=0;b<a;b++){var e=this.featuredContent.list[b];c.push(searcher.getFeaturedContentDisplayCode(e));searcher.trackOneRiotImpression(b);f=b}d.append(c.join(""));a>0&&d.show("fast");searcher.trackScourOneRiotImpressions(a)}else{var d,c=[],f=0;if(this.featuredContentTestIndex==0){a>0&&$("#featuredAds").empty();d=$("#featuredContentTop");for(var b=0;b<3;b++){var e=this.featuredContent.list[b];c.push(searcher.getFeaturedContentDisplayCode(e));this.trackOneRiotImpression(b);f=b}d.html(c.join(""));a>0&&d.show("fast");searcher.trackScourOneRiotImpressions(a);return}d=$("#featuredcontentbottom");for(var b=f;b<a;b++){var e=this.featuredContent.list[b];c.push(searcher.getFeaturedContentDisplayCode(e));searcher.trackOneRiotImpression(b)}d.html(c.join(""));a>0&&d.show("fast")}}},trackOneRiotImpression:function(b){if(this.featuredContent&&this.featuredContent.list[b]){var a=searcher.featuredContent.list[b];if(a.hasCalledHome==undefined||a.hasCalledHome==false){a.hasCalledHome=true;var c=document.createElement("img");c.src=a.trackingUrl;document.getElementsByTagName("body")[0].appendChild(c)}}},trackScourOneRiotImpressions:function(b){if(searcher.featureContentCalledHome!==undefined)return;if(b==0)return;for(var c=[],a=0;a<b;a++)c.push(this.featuredContent.list[a].redirectUrl);$.ajax({url:"/services/trackRiotWiseDisplay/",data:{query:searcher.search_query,segment:searcher.featuredContentTestIndex,urls:c.join(","),impression_key:searcher.featuredContentImpressionKey},type:"post",cache:false,dataType:"json",success:function(){}});this.featureContentCalledHome=true},trackFeaturedContentClick:function(a){$.ajax({url:"/services/trackRiotWiseClick/",data:{query:this.search_query,segment:this.featuredContentTestIndex,url:a},type:"post",cache:false,dataType:"json",complete:function(){}})},doImageSearch:function(a){$("#searchingflickr").show("fast");$("#rightsidecell").hide("fast");this._imageWrapper=new ImageSearchWrapper(this,searcher.createDelegate(this.callbackImageSearch));this._imageWrapper.setSearchPage(this._requestedPage);this._imageWrapper.search(a,this._callback);spellCheckerWrapper.search(a,this.createDelegate(this,this.callbackSpellCheck));relatedSearchWrapper.search(a,this.createDelegate(this,this.callbackRelatedTerms));this.sidebarHandler.displayImageItems()},doWebSearch:function(a){this.showSearching();var b=a;if(userSettings.disabledSearchTypes)b+=" -filetype:pdf -filetype:doc -filetype:ppt";if(gEngineMode==0){gIsAmerican&&scourlocal.search(a);this.featuredContentImpressionKey=(new Date).getTime();this.featuredContentTestIndex=this.featuredContentImpressionKey%3;oneriotWrapper.search(a,this.featuredContentTestIndex,this,this.createDelegate(this,this.callbackEngineWebSearchComplete));if(userSettings.numGoogleResults>0)googleWrapper.search(b,this,this.createDelegate(this,this.callbackEngineWebSearchComplete));else this.callbackEngineWebSearchComplete(SearchEngineEnum.Google);if(userSettings.numYahooResults>0)yahooWrapper.websearch(b,this,this.createDelegate(this,this.callbackEngineWebSearchComplete));else this.callbackEngineWebSearchComplete(SearchEngineEnum.Yahoo);if(userSettings.numMSNResults>0)bingWrapper.websearch(b,this,this.createDelegate(this,this.callbackEngineWebSearchComplete));else this.callbackEngineWebSearchComplete(SearchEngineEnum.MSN);this.doVoteCheck(a,this,this.createDelegate(this,this.callbackEngineWebSearchComplete));adUpdater.updateAds(a);adUpdater.addTrending(a);spellCheckerWrapper.search(a,this.createDelegate(this,this.callbackSpellCheck));relatedSearchWrapper.search(a,this.createDelegate(this,this.callbackRelatedTerms))}else{$("#results-related").hide();adUpdater.updateAds(a);spellCheckerWrapper.search(a,this.createDelegate(this,this.callbackSpellCheck));relatedSearchWrapper.search(a,this.createDelegate(this,this.callbackRelatedTerms))}},doVideoSearch:function(a){youtubeVideoSearch(a);spellCheckerWrapper.search(a,this.createDelegate(this,this.callbackSpellCheck));relatedSearchWrapper.search(a,this.createDelegate(this,this.callbackRelatedTerms));this.sidebarHandler.displayVideoItems()},doVoteCheck:function(c,a,b){$.ajax({url:"/services/getsearchdata/",data:{query:c},type:"post",cache:false,dataType:"json",complete:function(){b(SearchEngineEnum.Scour)},success:function(d){for(var c=d.votes,e=c.length,b=0;b<e;b++)a.addVoteResult(new VoteResult(c[b].Url,c[b].NumVotes));a.commentCounts=d.comments;a.displayCommentCounts()}});setTimeout("handleVoteCheckTimeout()",6e3)},getFeaturedAdDisplayCode:function(b,f){var g=boldTextSplit(b.title,this.search_query),h=boldTextSplit(b.description,this.search_query).wordWrap(120,"<br />",0),c=b.url;if(c.indexOf("http://")==0)c=c.substr(7);var a="",d=" ";if(f)d+="gFeaturedAd";a+='<a href="'+b.redirect+'" class="v2result'+d+'" onmouseover="window.status=\'\';" onmouseup="adClickThru(\''+b.redirect+"', "+b.bid+'); return true;" style="cursor:pointer" target="_blank"><div class="resultTitle">'+g+"</div>";if(f){var e="Sponsored Link";if(searcher.searchType=="business")e="Sponsored Business Listings";a+='<div class="resultSponsored">'+e+"</div>"}a+='<div class="resultNewWindow" title="Open result in new window"></div>';a+='<div class="resultMain">';a+='<div class="resultMainBorder">';a+=' <div class="resultContent">';a+='    <div class="resultSummary">'+h+'<div class="resultDomain">';a+='        <div class="resultDomainLink">'+c+"</div>";a+="      </div>";a+="    </div>";a+="  </div>";a+="</div>";a+="</div>";a+="</a>";return a},getFeaturedContentDisplayCode:function(b){if(b===undefined)return;var c=stripBolding(b.title);if(c.length>50)c=c.substring(0,50)+"...";c=boldTextSplit(c,this.search_query);var a='<div class="v2result featuredContentContainer"><a href="'+b.redirectUrl+'" onmouseup="searcher.trackFeaturedContentClick(\''+b.redirectUrl+'\'); return true;" class="resultTitle" target="_blank">'+c+"</a>";a+='<div class="resultNewWindow" title="Open result in new window"></div>';a+='<div class="resultSponsored">Featured Content</div>';a+='<div class="resultMain">';a+='<div class="resultMainBorder">';a+=' <div class="resultContent">';a+='    <div class="resultSummary">'+b.snippet+'<div class="resultDomain">';a+='        <a href="'+b.redirectUrl+'" class="resultDomainLink" target="_blank">'+b.source+"</a>";a+="      </div>";a+="    </div>";a+="  </div>";a+="</div>";a+="</div>";a+="</div>";return a},getNoResultsDisplay:function(){var a="<p style='font-size:120%' class='clear'>No results found containing your search.</p>";a+="<p style='font-size:110%'>Suggestions:<br />";a+="  <ul style='margin-left:10px'>";a+="    <li style='margin-left:20px;font-size:130%'>Make sure your spelling is correct.</li>";a+="    <li style='margin-left:20px;font-size:130%'>Try more general keywords.</li>";a+="    <li style='margin-left:20px;font-size:130%'>Try different keywords.</li>";a+="  </ul>";return a},getSearchTime:function(){return(this.endTime-this.startTime)/1e3},hideSearching:function(){$("#results").show();$("#pager").show();userSettings.showPageNumberHint&&$("#pagerinfo").show();$("#searching").hide()},isSiteSearch:function(){return!this.search_query?false:this.search_query.indexOf("site:")!=-1},loadElements:function(){this._searchResultContainer=$("#results");this._pagerResultContainer=$("#pager");this._searchingContainer=$("#searching");this._timeResultContainer=$("#time");this._spellCheckContainer=$("#spellcheck")},renderResults:function(){var a=$("#results");a.empty();$("#pager").empty();if(this.aggSearchResults.count()==0)a.html(this.getNoResultsDisplay());else this.showPage(this.currentPage);this.setupWebPager();this.displayFeaturedContent()},search:function(a){this.clearSearch();this.search_query=a;this.startTime=(new Date).getTime();this.sidebarHandler=new SidebarWrapper("image-sidebar");var b=window.userSettings,c=$.scour.homepage.getSearchTypeText(b.lastSearchType);if($.scour.homepage.escapeSearch(a)==b.lastSearchTerm&&this.searchType==c){this.currentPage=b.lastSearchPage;this._requestedPage=b.lastSearchPage}else b.lastSearchPage=0;if(this.searchType=="web")this.doWebSearch(a);else if(this.searchType=="images")this.doImageSearch(a);else if(this.searchType=="video")this.doVideoSearch(a);else this.doWebSearch(a)},setFontWeight:function(c,b){var a=$(c).get(0);if(a)a.style.fontWeight=b},setSearchTime:function(){var a,d;if(this.searchType=="web"){a=Math.max(this.currentPage*12,0)+1;d=Math.min(a+11,this.aggSearchResults.count())}else{a=this._requestedPage*50+1;d=a+49}for(var c=this.search_query.replace('"',"").split(" "),e="",b=0;b<c.length;b++)e+='<a href="/search/web/'+encodeURIComponent(c[b])+'">'+c[b]+"</a>";$("#time").html('<div id="statsTime"><span></span><b>'+this.getSearchTime()+'</b> Seconds</div><div id="statsResults">Results '+a+"-"+d+" for "+e+'</div><div id="statsPageNumber"><span></span>'+Number(this.currentPage+1)+"</div>")},setSearchType:function(a){if(a!="images"&&a!="video"&&a!="business"){this.searchType="web";$.scour.homepage.setActiveTab("tabWeb")}else{this.searchType=a;if(a=="images")$.scour.homepage.setActiveTab("tabImages");else if(a=="business"){$.scour.homepage.setActiveTab("tabBusiness");$.scour.homepage.setActiveTab("tabBusinessB","B")}else $.scour.homepage.setActiveTab("tabVideo")}},setTotalResultsAvailable:function(){alert("setTotalResultsAvailable needs to be written")},setupWebPager:function(){if(this.aggSearchResults.count()>12){this.numPages=Math.ceil(this.aggSearchResults.count()/12);var c=this.currentPage,b="";if(c>0)b+='<a href="#'+c.toString()+'" id="pagerPrev" title="Previous Page" class="havehistory">Prev</a>';else b+='<span id="pagerPrev" class="nextprev">Prev</span>';for(var a=1;a<=this.numPages;a++)if(a-1==c)b+='<span id="pagerPrev" class="nextprev">'+a+"</span>";else b+='<a href="#'+a.toString()+'" title="View Page '+a.toString()+'" class="havehistory">'+a.toString()+"</a>";if(c+1<this.numPages)b+='<a href="#'+(c+2).toString()+'" id="pagerNext" title="Next Page" class="havehistory">Next</a>';else b+='<span id="pageNext" class="nextprev">Next</span>';$("#pager").html(b)}},showBottomSearch:function(){$("#bottomseearch").show()},showPage:function(a){if(a<0)a=0;$("#results").empty();var h="";this.currentPage=a;window.userSettings.lastSearchPage=this.currentPage;window.cookies.saveSettings();this._searchResultContainer=$("#results").get(0);var e=$("#results");e.empty();for(var c=Math.max(a*12,0),f=Math.min(c+12,this.aggSearchResults.count()),b=c;b<f;b++){var d=document.createElement("div"),g=this.aggSearchResults.list[b].getDisplayHTML(b);try{d.innerHTML=g}catch(i){}this._searchResultContainer.appendChild(d)}this.wireResults();this.setupWebPager();this.setSearchTime();this.updateAdditionalInfo()},showNextPage:function(){this.showPage(this.currentPage+1)},showPrevPage:function(){this.showPage(this.currentPage-1)},showSearching:function(){this._searchingContainer.show();this._searchResultContainer.hide();this._pagerResultContainer.hide()},showSortByButtons:function(){var b=$("#submenuTitle");if(userSettings.showSortingButtons){b.show();var a=userSettings.sortResultsBy;if(a==SortByEnum.Scour)$("#sortByScour").addClass("sortByScour_selected");else $("#sortByScour").removeClass("sortByScour_selected");if(a==SortByEnum.Google)$("#sortByGoogle").addClass("sortByGoogle_selected");else $("#sortByGoogle").removeClass("sortByGoogle_selected");if(a==SortByEnum.Yahoo)$("#sortByYahoo").addClass("sortByYahoo_selected");else $("#sortByYahoo").removeClass("sortByYahoo_selected");if(a==SortByEnum.MSN)$("#sortByLive").addClass("sortByLive_selected");else $("#sortByLive").removeClass("sortByLive_selected")}else b.hide()},sortBy:function(a,b){if(a!=userSettings.sortResultsBy||b){this.currentPage=0;window.userSettings.lastSearchPage=this.currentPage;window.cookies.saveSettings();this.aggSearchResults._sortyBy=a;userSettings.sortResultsBy=a;cookies.saveSettings();this.aggSearchResults.rankScores();this.renderResults();this.updateAdditionalInfo();this.showSortByButtons()}},updateAdditionalInfo:function(){},wireResults:function(){$("#weighting-default").click(function(a){a.preventDefault();userSettings.googleWeight=100;userSettings.yahooWeight=100;userSettings.msnWeight=100;userSettings.oneriotWeight=60;cookies.saveSettings();window.location.reload()});$("#weighting-realtime").click(function(a){a.preventDefault();userSettings.googleWeight=30;userSettings.yahooWeight=30;userSettings.msnWeight=30;userSettings.oneriotWeight=100;cookies.saveSettings();window.location.reload()});$(".resultTitleRow").hover(function(){$(this).find(".resultNewWindow").show()},function(){$(this).find(".resultNewWindow").hide()});$(".addCommentComment").focus(function(){var a=$(this);a.val()=="Be the first to Comment!"&&a.val("")});$(".addCommentComment").each(function(){watchTextarea($(this))});$(".addCommentComment").blur(function(){var b=new Number($(this).parent().parent().find(".commentCount").text()),a=$(this);a.val()==""&&b==0&&a.val("Be the first to Comment!")});$(".resultComments").click(function(){var f=$(this).parent(),e=f.parent();f.find(".resultCommentsArrow").toggleClass("arrowUp");e.children(".resultCommentsContainer").slideToggle();var g=e.find(".addCommentPanel");g.each(function(){$(this).find(".addCommentComment").width($(this).width()-250+"px")});var h=g.find(".addCommentComment");searcher.addCommentTextboxValue=h.val();$(h).keyup(checkPaste).keydown(checkPaste).click(checkPaste).blur(checkPaste).focus(checkPaste);var i=f.find(".resultCommentsArrow").hasClass("arrowUp");if(i){var b=e.parent(),c=new Number(b.find(".commentCount").text());b.find(".comCurPage").text(0);var d=0;if(c>0){var j=b.find(".resultUrl").text(),a=b.find(".resultCommentsBox");a.empty();$.ajax({url:"/services/getComments/",data:{query:searcher.search_query,url:j,page:d,sort:b.find(".comCurPage").val()},type:"post",cache:false,dataType:"json",success:function(j){b.find(".comCurPage").text(++d);for(var l=j.length,e="",i=0;i<l;i++){var f=j[i];e+='<div class="';if(f.id==userSettings.userid)e+="comMyComment";else if(f.positive==1)e+="comCommentSinglePos";else if(f.positive==0)e+="comCommentSingleNeg";else e+="comCommentSingle";e+='">';e+='  <div class="comAvatarBar">';e+='    <a href="/profile/user/'+f.username.toString()+'" class="comAvatar">';if(f.avatar!="")e+='      <img src="'+f.avatar+'" alt="" />';e+="    </a>";e+='    <div class="comBoxTip"></div>';e+="  </div>";e+='  <div class="comMain" style="display:none">';e+='    <div class="comInfo">';e+='      <a href="/profile/user/'+f.username.toString()+'/" class="comUsername">'+f.username.toString()+"</a>";e+='      <span class="comTime">'+f.time.toString()+"</span>";e+='      <div class="comReport" title="Report comment abuse"></div>';e+='      <div class="comVoting">';e+='        <div class="comVoteDown" title="Vote comment down"></div>';e+='        <div class="comVoteUp" title="Vote comment up"></div>';e+='        <div class="comPoints"> '+f.rec.toString()+"</div>";e+='        <div class="comID" style="display:none">'+f.id.toString()+"</div>";e+="      </div>";e+="    </div>";e+='    <div class="comBody">'+f.comment.toString()+"</div>";e+="  </div>";e+="</div>"}a.append(e);a.find(".comMain").fadeIn("slow");var g=a.parent().find(".commentLoadMore");if(c>d*10){var k=d*10+1,h=d*10+10;if(h>c)h=c;g.text("Load Comments "+k+"-"+h+" of "+c);g.show();g.css("visibility","visible")}else g.css("visibility","hidden");a.find(".comVoteUp").bind("click.custom",function(){var a=$(this).parent().find(".comID").text();recommendComment(a,1,this);$(this).unbind("click.custom");$(this).addClass("comVotedUp");$(this).parent().find(".comVoteDown").animate({opacity:"0",width:"0px"})});a.find(".comVoteDown").bind("click.custom",function(){var a=$(this).parent().find(".comID").text();recommendComment(a,0,this);$(this).unbind("click.custom");$(this).addClass("comVotedDown");$(this).parent().find(".comVoteUp").animate({opacity:"0",width:"0px"})});a.find(".comReport").click(function(){var c=$(this).parent().find(".comID").text(),a=$(this).parent().parent().find(".comUsername").text(),b=$(this).parent().parent().find(".comBody").text();$("#reportform-commentid").text(c);$("#report-form-author").val(a);$("#abusetype1").attr("checked","checked");$("#report-form-comment").val(b);$("#reportmodal").modal({close:false,overlayId:"report-overlay",containerId:"report-container"});$("#report-form-info").get(0).focus()});a.find(".comReply").click(function(){alert("We will wire this up when we have main comment functions down.\n  It will be a clone of that short of an indent for display.")})}})}}});$(".commentLowerClose").click(function(){var b=$(this).parent(),a=b.parent();b.find(".resultCommentsArrow").toggleClass("arrowUp");a.children(".resultCommentsContainer").slideToggle("slow",function(){$.scrollTo(a.parent().parent(),450,{offset:-10})})});$(".addCommentButton").click(function(){if(userSettings.isLoggedIn()){var a=$(this).parent().find(".addCommentPanel");a.show();var c=a.find(".addCommentComment");c.width(a.width()-250+"px")}else{var b=$(this).parent().find(".guestCommentPanel");b.show();$.scrollTo(b,450,{offset:-100})}});$(".guestCommentLink").click(function(){showLoginModal()});$(".commentLoadMore").click(function(){var f=$(this).parent(),e=f.parent(),b=e.parent(),c=new Number(b.find(".commentCount").text()),d=new Number(b.find(".comCurPage").text());if(c>0){var g=b.find(".resultUrl").text(),a=b.find(".resultCommentsBox");$.ajax({url:"/services/getComments/",data:{query:searcher.search_query,url:g,page:d,sort:b.find(".comSortSelect").val()},type:"post",cache:false,dataType:"json",success:function(j){b.find(".comCurPage").text(++d);for(var l=j.length,i=0;i<l;i++){var f=j[i],e='<div class="';if(f.id==userSettings.userid)e+="comMyComment";else if(f.positive==1)e+="comCommentSinglePos";else if(f.positive==0)e+="comCommentSingleNeg";else e+="comCommentSingle";e+='">';e+='  <div class="comAvatarBar">';e+='    <a href="/profile/user/'+f.username.toString()+'" class="comAvatar">';if(f.avatar!="")e+='      <img src="'+f.avatar+'" alt="" />';e+="    </a>";e+='    <div class="comBoxTip"></div>';e+="  </div>";e+='  <div class="comMain" style="display:none">';e+='    <div class="comInfo">';e+='      <a href="/user/'+f.username+'/" class="comUsername">'+f.username+"</a>";e+='      <span class="comTime">'+f.time+"</span>";e+='      <div class="comReport"></div>';e+='      <div class="comVoting">';e+='        <div class="comVoteDown"></div>';e+='        <div class="comVoteUp"></div>';e+='        <div class="comPoints"> '+f.rec+"</div>";e+='        <div class="comID" style="display:none">'+f.id+"</div>";e+="      </div>";e+="    </div>";e+='    <div class="comBody">'+f.comment+"</div>";e+="  </div>";e+="</div>";a.append(e)}a.find(".comMain").fadeIn("slow");var g=a.parent().find(".commentLoadMore");if(c>d*10){var k=d*10+1,h=d*10+10;if(h>c)h=c;g.text("Load Comments "+k+"-"+h+" of "+c);g.show();g.css("visibility","visible")}else g.css("visibility","hidden");a.find(".comVoteUp").bind("click.custom",function(){var a=$(this).parent().find(".comID").text();recommendComment(a,1,this);$(this).unbind("click.custom");$(this).addClass("comVotedUp");$(this).parent().find(".comVoteDown").animate({opacity:"0",width:"0px"})});a.find(".comVoteDown").bind("click.custom",function(){var a=$(this).parent().find(".comID").text();recommendComment(a,0,this);$(this).unbind("click.custom");$(this).addClass("comVotedUp");$(this).parent().find(".comVoteDown").animate({opacity:"0",width:"0px"})});a.find(".comReport").click(function(){var c=$(this).parent().find(".comID").text(),a=$(this).parent().parent().find(".comUsername").text(),b=$(this).parent().parent().find(".comBody").text();$("#reportform-commentid").text(c);$("#report-form-author").val(a);$("#abusetype1").attr("checked","checked");$("#report-form-comment").val(b);$("#reportmodal").modal({close:false,overlayId:"report-overlay",containerId:"report-container"});$("#report-form-info").get(0).focus()});a.find(".comReply").click(function(){alert("We will wire this up when we have main comment functions down.\n  It will be a clone of that short of an indent for display.")})}})}});$(".comSortSelect").change(function(){var f=$(this).parent(),e=f.parent();f.find(".resultCommentsArrow").toggleClass("arrowUp");e.children(".resultCommentsContainer").slideToggle();var c=e.parent(),b=new Number(c.find(".commentCount").text());c.find(".comCurPage").text(0);var d=0;if(b>0){var g=c.find(".resultUrl").text(),a=c.find(".resultCommentsBox");a.find(".comMain").fadeOut("slow");$.ajax({url:"/services/getComments/",data:{query:searcher.search_query,url:g,page:0,sort:$(this).val()},type:"post",cache:false,dataType:"json",success:function(j){a.empty();c.find(".comCurPage").text(++d);for(var l=j.length,i=0;i<l;i++){var f=j[i],e='<div class="';if(f.id==userSettings.userid)e+="comMyComment";else if(f.positive==1)e+="comCommentSinglePos";else if(f.positive==0)e+="comCommentSingleNeg";else e+="comCommentSingle";e+='">';e+='  <div class="comAvatarBar">';e+='    <a href="/profile/user/'+f.username.toString()+'" class="comAvatar">';if(f.avatar!="")e+='      <img src="'+f.avatar+'" alt="" />';e+="    </a>";e+='    <div class="comBoxTip"></div>';e+="  </div>";e+='  <div class="comMain" style="display:none">';e+='    <div class="comInfo">';e+='      <a href="/user/'+f.username+'/" class="comUsername">'+f.username+"</a>";e+='      <span class="comTime">'+f.time+"</span>";e+='      <div class="comReport"></div>';e+='      <div class="comVoting">';e+='        <div class="comVoteDown"></div>';e+='        <div class="comVoteUp"></div>';e+='        <div class="comPoints"> '+f.rec+"</div>";e+='        <div class="comID" style="display:none">'+f.id+"</div>";e+="      </div>";e+="    </div>";e+='    <div class="comBody">'+f.comment+"</div>";e+="  </div>";e+="</div>";a.append(e)}$(".comMain").fadeIn("slow");var g=a.parent().find(".commentLoadMore");if(b>d*10){var k=d*10+1,h=d*10+10;if(h>b)h=b;g.text("Load Comments "+k+"-"+h+" of "+b);g.show();g.css("visibility","visible")}else g.css("visibility","hidden");a.find(".comVoteUp").bind("click.custom",function(){var a=$(this).parent().find(".comID").text();recommendComment(a,1,this);$(this).unbind("click.custom");$(this).addClass("comVotedUp");$(this).parent().find(".comVoteDown").animate({opacity:"0",width:"0px"})});a.find(".comVoteDown").bind("click.custom",function(){var a=$(this).parent().find(".comID").text();recommendComment(a,0,this);$(this).unbind("click.custom");$(this).addClass("comVotedUp");$(this).parent().find(".comVoteDown").animate({opacity:"0",width:"0px"})});a.find(".comReport").click(function(){var c=$(this).parent().find(".comID").text(),a=$(this).parent().parent().find(".comUsername").text(),b=$(this).parent().parent().find(".comBody").text();$("#reportform-commentid").text(c);$("#report-form-author").val(a);$("#abusetype1").attr("checked","checked");$("#report-form-comment").val(b);$("#reportmodal").modal({close:false,overlayId:"report-overlay",containerId:"report-container"});$("#report-form-info").get(0).focus()});a.find(".comReply").click(function(){alert("We will wire this up when we have main comment functions down.\n  It will be a clone of that short of an indent for display.")})}})}})}},adUpdater={error:function(){if(gEngineMode==1){gEngineMode=0;searcher.doWebSearch(searcher.search_query)}},addTrending:function(){$.ajax({url:"/services/realtimetrending/",data:{},type:"post",cache:false,dataType:"json",success:function(c){return;if(c&&c.results&&c.results.length>0){for(var a=[],f=c.results.length,b,d=0;d<f;d++){b=c.results[d];a.push("<a onmouseup=\"searcher.trackFeaturedContentClick('"+b.redirect_url+'\'); return true;" href="',b.redirect_url,'" target="_blank">');a.push(' <div class="clear">');a.push("  <h6>",b.title,"</h6>");a.push('  <div class="featured-content-snippet">');b.img&&a.push('<img src="',b.img,'" width="20" height="20" align="right" />');a.push(b.snippet,"</div>");a.push('  <div class="featured-content-source">Source: ',b.source,"</div>");a.push(" </div>");a.push("</a>");var e=document.createElement("img");e.src=b.tracking_url;document.getElementsByTagName("body")[0].appendChild(e)}$("#trending-items").html(a.join("")).show()}}})},updateAds:function(a){if(window.gSubID==11)return;$.ajax({url:"/services/getabcf/",data:{subid:gSubID,term:a,engine_mode:gEngineMode},type:"post",cache:false,dataType:"json",success:function(c){var e=$("#featuredAds");e.empty();e.show();var g=c.length;if(g>0){var b=3;if(gEngineMode==1){b=7;$("#results-cell").prepend('<h2 style="margin-left: 20px;color: #737072"><em>Results for <span style="color:#a9e95d;text-decoration: underline">'+a+"</span></em></h2>");e.append('<div class="resultSponsored">Featured</div>')}else{var k="Sponsored Link";if(searcher.searchType=="business")k="Sponsored Business Listings";e.append('<div class="resultSponsored">'+k+"</div>")}var h;if(g<b)b=g;for(var f=0,f=0;f<b;f++)if(gEngineMode==1&&f==0){h=searcher.getFeaturedAdDisplayCode(c[f],true);e.before(h)}else{h=searcher.getFeaturedAdDisplayCode(c[f]);e.append(h)}if(g>b){var l=f;b+=8;if(g<b)b=g;$("#adsbar").append('<h2 class="sl f" style="font-size:90%">Sponsored Links</h2><div class="clear"></div>');for(var d=l;d<b;d++){var m=boldTextSplit(c[d].title,searcher.search_query),i=boldTextSplit(c[d].description,searcher.search_query);if(i.length>200)i=i.substring(0,200)+"...";var j=c[d].url;if(j.length>30)j=j.substring(0,30)+"...";$("#adsbar").append('<div class="adbarad" onmouseup="adClickThru(\''+c[d].redirect+"', "+c[d].bid+'); $(this).find(\'.adDisplayUrl\').click();return false;" style="cursor:pointer;display:none"><div class="clear"><a href="'+c[d].redirect+'" onmouseover="return true" class="adDisplayUrl" target="_blank">'+m+'</a></div><div class="clear">'+i+'</div><span class="a">'+j+"</span><br></div><br />")}$(".adbarad").fadeIn("slow")}e.fadeIn("slow")}else if(gEngineMode==1){gEngineMode=0;searcher.doWebSearch(searcher.search_query)}},error:adUpdater.error})}},msnWrapper={search:function(c,b,a){$.getJSON("/search/getmsn/"+encodeURIComponent(c)+"/"+userSettings.numMSNResults+"/"+(new Date).getTime()+"/",function(f){for(var g=userSettings.msnWeight/100,h=f.length,d=f,e,c=0;c<h;c++){e=new SearchResult(d[c].Url,d[c].Title,d[c].Description,SearchEngineEnum.MSN,c+1,d[c].DisplayUrl,d[c].CacheUrl,-1,"");e.score=Math.pow(1.3,10-c)*g;b.addResult(e)}a(SearchEngineEnum.MSN)})}};function SearchResult(j,h,i,g,k,b,e,c,f,d,a){this.link=j;this.title=h;this.desc=i;this.engine=g;this.rank=k;this.displayUrl=b;this.cacheUrl=e;this.cacheSize=c;this.mimeType=f;this.isDefault=d;this.score=null;this.realtimeAdditionaInfo=a;this.bold=function(b,a){return b?b.replace(new RegExp(escapeRegExp(a),"gi"),"<strong>"+a+"</strong>"):""};this.displayHtml=function(){return'<p><a href="'+this.link+'">'+this.title+"</a><br /><div>"+this.desc+"</div><br />"+this.displayUrl+"</p>"};this.getDomain=function(){var a=this.normalizeURL(),b=a.indexOf("/");return b==-1?a:a.substring(0,b)};this.normalizeLink=function(){var a=this.link;return a.startsWith("http://www.")?a.substring(11):a.startsWith("https://www.")?a.substring(12):a.startsWith("http://")?a.substring(7):a.startsWith("https://")?a.substring(8):a.startsWith("www")?a.substring(3):a};this.normalizeURL=function(){var a=this.displayUrl;if(a==undefined)a=this.link;if(a==undefined)return"";var b=a.match(/^https?:\/\/(www\.)?(.*?)(\/?|\/(index|default)(\.\w*))$/i);return(b&&b[2]?b[2]:a).toLowerCase()};this.toString=function(){return this.normalizeLink()}}VoteResult=function(b,a){this.url=b;this.numVotes=a};var spellCheckerWrapper={buildSearchUri:function(c){var b=this.getYahooApplicationID(),a="";if(userSettings.disableSafeSearch)a="1";return"http://api.search.yahoo.com/WebSearchService/V1/spellingSuggestion?appid="+b+"&output=json&query="+encodeURIComponent(c)+"&callback=?&adult_ok="+a},getYahooApplicationID:function(){return"rf4H64XV34F4l8UUfGVbsRCjyRzxcMxiJwNc4fnW01kBr3HxbkHE7UuYGIrq9V.otUPFZSM-"},search:function(b,a){this.searchstarttime=(new Date).getTime();$.getJSON(this.buildSearchUri(b),function(b){this._searchEndTime=(new Date).getTime();b&&b.ResultSet&&b.ResultSet.Result&&a(b.ResultSet.Result)})}},relatedSearchWrapper={buildSearchUri:function(c){var b=this.getYahooApplicationID(),a="";if(userSettings.disableSafeSearch)a="1";return"http://search.yahooapis.com/WebSearchService/V1/relatedSuggestion?appid="+b+"&output=json&query="+encodeURIComponent(c)+"&callback=?&adult_ok="+a},getYahooApplicationID:function(){return"rf4H64XV34F4l8UUfGVbsRCjyRzxcMxiJwNc4fnW01kBr3HxbkHE7UuYGIrq9V.otUPFZSM-"},search:function(b,a){this.searchstarttime=(new Date).getTime();$.getJSON(this.buildSearchUri(b),function(b){b&&b.ResultSet&&b.ResultSet.Result&&a(b.ResultSet.Result)})}},gLocalSearchMap,scourlocal={search:function(a){if(userSettings.lastLocation==""){$.ajax({url:"/services/getLocation/",data:{},type:"post",cache:false,dataType:"json",success:function(b){userSettings.lastLocation=b.location;cookies.saveSettings();$("#localSearchArea").val(b.location);scourlocal.processLocalSearch(a)}});return}scourlocal.processLocalSearch(a)},processLocalSearch:function(b){var a=0;$.ajax({url:"/services/getlocal/",data:{query:encodeURIComponent(searcher.search_query),subid:gSubID,locationOverride:userSettings.lastLocation},type:"post",cache:false,dataType:"json",success:function(c){if(userSettings.lastLocation==""){userSettings.lastLocation=c.location;$("#localSearchArea").val(c.location);cookies.saveSettings()}c=c.results;if(c!=undefined&&c.length>0){$("#local-results").show();var h=GBrowserIsCompatible(),f=0;if(h){gLocalSearchMap=new GMap2(document.getElementById("local-results-map"));gLocalSearchMap.setCenter(new GLatLng(0,0),0);gLocalSearchMap.addControl(new GSmallMapControl);var i=new GLatLngBounds}var l=new GIcon(G_DEFAULT_ICON),g={};g.icon=l;g.title="";$("#local-results-title").append("<div>Your local search results for <b>"+b+"</b> near <b>"+userSettings.lastLocation+"</b></div>");for(var d=0;d<c.length;d++){var e=c[d].tagline;if(e=="")e=c[d].description;if(e.length>40)e=e.substring(0,40)+"...";var k='<div><a href="/search/local/'+searcher.search_query+"/bizprofile/"+c[d].listing_id+'/"><span class="local-result-name">'+c[d].name+'</span></a> - <span class="local-result-tagline">'+e+'</span><span class="local-search-rating_star-small-'+c[d].overall_rating+'"></span></a></div>';$("#local-results-list").append(k);if(h){function j(b,c){var d=new GLatLng(parseFloat(b.latitude),parseFloat(b.longitude));i.extend(d);var a=new GMarker(d);GEvent.bind(a,"click",a,function(){window.location.href="/search/local/"+searcher.search_query+"/bizprofile/"+b.id});GEvent.bind(a,"mouseover",a,function(){$("#local-results-list div").get(c).className="selected"});GEvent.bind(a,"mouseout",a,function(){$("#local-results-list div").get(c).className=""});g.title=b.name;gLocalSearchMap.addOverlay(a)}if(parseFloat(c.latitude)!=0&&parseFloat(c.longitude)!=0){j(c[d],d);f++}}}a=c.length;if(c.length>8){$("#local-results-list >div:last").append('<span class=""><a href="/search/local/'+b+"/locale/"+userSettings.lastLocation+'" target="_blank" class="local-result-more">See More</a></span>');$("#local-results").append('<div class="clear"></div>')}else{var m="http://api.citysearch.com/search/locations?what="+searcher.search_query+"&where="+userSettings.lastLocation+"&publisher=advertise_rbl&format=json&callback=?";$.ajax({url:m,data:{},type:"get",cache:false,dataType:"jsonp",success:function(e){if(e==undefined||e.jsonResponse==undefined||e.jsonResponse.results.length==0)return;for(var d=e.jsonResponse.results,c=0;c<d.length;c++){var j=d[c].location.tagline;if(j&&j.length>40)j=j.substring(0,40)+"...";var l='<div><a href="/search/local/'+searcher.search_query+"/bizprofile/"+d[c].location.id+'/"><span class="local-result-name">'+d[c].location.name+'</span></a> - <span class="local-result-tagline">'+d[c].location.neighborhood+'</span><span class="local-search-rating_star-small-'+d[c].location.rating+'"></span></a></div>';$("#local-results-list").append(l);if(h){function k(b,c){var d=new GLatLng(parseFloat(b.latitude),parseFloat(b.longitude));i.extend(d);var a=new GMarker(d);GEvent.bind(a,"click",a,function(){window.location.href="/search/local/"+searcher.search_query+"/bizprofile/"+b.id});GEvent.bind(a,"mouseover",a,function(){$("#local-results-list div").get(c).className="selected"});GEvent.bind(a,"mouseout",a,function(){$("#local-results-list div").get(c).className=""});g.title=b.name;gLocalSearchMap.addOverlay(a)}if(parseFloat(e.latitude)!=0&&parseFloat(e.longitude)!=0){k(d[c].location,c);f++}a++;if(a>=9){$("#local-results-list >div:last").append('<span class=""><a href="/search/local/'+b+"/locale/"+userSettings.lastLocation+'" target="_blank" class="local-result-more">See More</a></span>');break}}}f>0&&$("#local-results-map").show()}})}if(h)if(f>0)setTimeout(function(){gLocalSearchMap.setZoom(gLocalSearchMap.getBoundsZoomLevel(i)-1);gLocalSearchMap.setCenter(i.getCenter(),9)},800);else $("#local-results-map").hide()}}})}};function com_oneriot_search_results(b){if(!b)return;if(false&&gAllowFeaturedContent&&b.featuredResultList){for(var d=b.featuredResultList.length,a=0;a<d;a++)searcher.featuredContent.add(b.featuredResultList[a]);if(d>0)searcher.haveFeaturedContent=true}if(b.resultList)for(var d=parseInt(b.resultList.length),e=userSettings.oneriotWeight/100,a=0;a<d;a++){var c=b.resultList[a];new_result=new SearchResult(c.redirectUrl,c.title,c.snippet,SearchEngineEnum.OneRiot,a+1,c.displayUrl,"",-1,"",false,c.firstFound);new_result.score=Math.pow(1.3,10-a)*e;searcher.addResult(new_result)}}var oneriotWrapper={callback:null,endTime:null,engine:null,searchStartTime:null,webSearch:null,search:function(d,b,c,a){this.callback=a;this.engine=c;$.ajax({url:"/services/realtime/",data:{query:encodeURIComponent(d),num:10,test_index:b},type:"post",cache:false,dataType:"jsonp",complete:function(){this._searchEndTime=(new Date).getTime();a(SearchEngineEnum.OneRiot);searcher.haveOneRiot=true},success:function(){},error:function(){}});setTimeout("handleOneRiotTimeout()",6e3)}};function logIt(a){if(window.console&&window.console.log)console.log(a);else alert(a)}var googleWrapper={callback:null,endTime:null,engine:null,searchStartTime:null,webSearch:null,parseResult:function(f){try{var e=1;e=userSettings.googleWeight/100;var b=f.responseData.results,d=b.length;if(d>userSettings.numGoogleResults)d=userSettings.numGoogleResults;for(var c,a=0;a<d;a++){c=new SearchResult(b[a].unescapedUrl,b[a].titleNoFormatting,b[a].content,SearchEngineEnum.Google,a+1,b[a].visibleUrl,b[a].cacheUrl,-1,"");c.score=Math.pow(1.3,10-a)*e;this.engine.addResult(c)}this.endTime=(new Date).getTime()}catch(g){alert("Failed to get google result with error: "+g.message)}searcher.havegoogle=true;this.callback&&this.callback(SearchEngineEnum.Google)},search:function(c,b,a){this.callback=a;this.engine=b;$.getJSON("http://ajax.googleapis.com/ajax/services/search/web?q="+encodeURIComponent(searcher.search_query)+"&v=1.0&start=1&rsz=large&lr=en&callback=?&",function(b){googleWrapper.parseResult(b);this._searchEndTime=(new Date).getTime();a(SearchEngineEnum.Google);searcher.haveGoogle=true});setTimeout("handleGoogleTimeout()",6e3)}},yahooWrapper={searchstarttime:null,buildSearchUri:function(c){var b=userSettings.numYahooResults,a="";if(userSettings.disableSafeSearch)a="-porn -hate";return"http://boss.yahooapis.com/ysearch/web/v1/"+c+"?appid=58fa746f5973b117b63051c3b3d197be&filter="+a+"&count="+b+"&format=json&callback=?"},parseResult:function(d){if(d&&d.ysearchresponse&&d.ysearchresponse.resultset_web){var e=1;e=userSettings.yahooWeight/100;for(var b=d.ysearchresponse.resultset_web,f=b.length,a=0;a<f;a++){var c=new SearchResult(b[a].url,b[a].title,b[a].abstract,SearchEngineEnum.Yahoo,a+1,b[a].dispurl);if(b[a].Cache){c._cacheUrl=b[a].Cache.Url;c._cacheSize=b[a].Cache.Size}c.score=Math.pow(1.3,10-a)*e;this.engine.addResult(c)}}},websearch:function(c,b,a){this.engine=b;this.searchstarttime=(new Date).getTime();$.getJSON(this.buildSearchUri(c),function(b){yahooWrapper.parseResult(b);this._searchEndTime=(new Date).getTime();a(SearchEngineEnum.Yahoo);searcher.haveYahoo=true});setTimeout("handleYahooTimeout()",6e3)}},bingWrapper={searchstarttime:null,buildSearchUri:function(c){var b=userSettings.numMSNResults,a="Off";if(userSettings.disableSafeSearch)a="Strict";return"http://api.bing.net/json.aspx?appid=57B91027FB24A039463D7959B74A46DFA0BAC6D6&Query="+c+"&Sources=Web&Version=2.0&Market=en-us&Adult="+a+"&Options=&Web.Count="+b+"&Web.Offset=0&JsonType=callback&JsonCallback=?"},parseResult:function(d){var e=d.SearchResponse.Errors;if(e!=null)return;var b=d.SearchResponse.Web.Results;if(b==null)return;for(var g=null,f=userSettings.yahooWeight/100,a=0;a<b.length;a++){var c=new SearchResult(b[a].Url,b[a].Title,b[a].Description,SearchEngineEnum.MSN,a+1,b[a].DisplayUrl);if(b[a].CacheUrl)c._cacheUrl=b[a].CacheUrl;c.score=Math.pow(1.3,10-a)*f;this.engine.addResult(c)}},websearch:function(c,b,a){this.engine=b;this.searchstarttime=(new Date).getTime();$.getJSON(this.buildSearchUri(c),function(b){bingWrapper.parseResult(b);this._searchEndTime=(new Date).getTime();a(SearchEngineEnum.MSN);searcher.haveMSN=true});setTimeout("handleMSNTimeout()",6e3)}};function SResult(){this.list=[];this.add=function(a){this.list[this.list.length]=a};this.aggSearchResults=function(){};this.clear=function(){this.list=[]};this.count=function(){return this.list.length};this.sort=function(a){var c=a;if(a==undefined)a=searcher.createDelegate(this,this.sortByNumber);for(var b=0;b<this.list.length;b++)this.list[b].updateScore();this.list.sort(a)};this.sortByNumber=function(a,b){return a-b};this.getByDomain=function(b){for(var a=0;a<this.count();a++)if(this.list[a].domain==b)return this.list[a];return null};this.getByUrl=function(b){for(var a=0;a<this.count();a++)if(this.list[a].getFirstUrl()==b)return this.list[a];return null};this.get_Score=function(a){return this.list[a].score},this.rankScores=function(){var a=userSettings.sortResultsBy;if(a==SortByEnum.Scour)this.sort(this._sortCallbackScour);else if(a==SortByEnum.Google)this.sort(this._sortCallbackGoogle);else if(a==SortByEnum.Yahoo)this.sort(this._sortCallbackYahoo);else if(a==SortByEnum.MSN)this.sort(this._sortCallbackMSN);else if(a==SortByEnum.OneRiot)this.sort(this._sortCallbackOneRiot);else this.sort(this._sortCallbackScour)};this._sortCallbackScour=function(a,b){return b._score-a._score};this._sortCallbackGoogle=function(a,b){return a.getGoogleRank()-b.getGoogleRank()};this._sortCallbackYahoo=function(a,b){return a.getYahooRank()-b.getYahooRank()};this._sortCallbackMSN=function(a,b){return a.getMSNRank()-b.getMSNRank()};this._sortCallbackOneRiot=function(a,b){return a.getOneRiotRank()-b.getOneRiotRank()}}function Collection(){this.list=[];this.add=function(a){this.list[this.list.length]=a};this.clear=function(){this.list=[]};this.count=function(){return this.list.length}}function VoteCollection(){this.list=[];this.add=function(a){this.list[this.list.length]=a};this.clear=function(){this.list=[]};this.count=function(){return this.list.length};this.getByUrl=function(b){for(var a=0;a<this.count();a++)if(this.list[a].url==b)return this.list[a];return null}}function AggSResult(a){this.list=[];this.votes=new VoteCollection;this.index=-1;this.domain=stripBolding(a.getDomain());this._score=-1;this._comments=null;this.add=function(a){this.list[this.list.length]=a};this.add(a);this.addVote=function(a){this.votes.add(a)};this.count=function(){return this.list.length};this.getResultByType=function(b){for(var c=this.count(),a=0;a<c;a++)if(this.list[a].engine==b)return this.list[a];return this.getDefaultResult()};this.getYahooResult=function(){return this.getResultByType(SearchEngineEnum.Yahoo)};this.getGoogleResult=function(){return this.getResultByType(SearchEngineEnum.Google)};this.getMSNResult=function(){return this.getResultByType(SearchEngineEnum.MSN)};this.getOneRiotResult=function(){return this.getResultByType(SearchEngineEnum.OneRiot)};this.getDefaultResult=function(b){var a=new SearchResult("#","","",b,"-","#","","-","",true);a.score=0;return a};this.getDisplayLink=function(b,c,d,a){return b.displayUrl!="#"&&b.displayUrl?b.displayUrl:c.displayUrl!="#"&&c.displayUrl?c.displayUrl:d.displayUrl!="#"&&d.displayUrl?d.displayUrl:a.displayUrl!="#"&&a.displayUrl?a.displayUrl:""};this.getTitle=function(b,c,d,a){return b.title.trim()!=""?b.title:c.title!=""?c.title:d.title!=""?d.title:a.title!=""?a.title:""};this.getUrl=function(b,c,d,a){return b.link!="#"&&b.link?b.link:c.link!="#"&&c.link?c.link:d.link!="#"&&d.link?d.link:a.link!="#"&&a.link?a.link:""};this.getGoogleRank=function(){var a=this.getGoogleResult().rank;if(isNaN(a))a=1e3;return a};this.getYahooRank=function(){var a=this.getYahooResult().rank;if(isNaN(a))a=1e3;return a};this.getMSNRank=function(){var a=this.getMSNResult().rank;if(isNaN(a))a=1e3;return a};this.getOneRiotRank=function(){var a=this.getOneRiotResult().rank;if(isNaN(a))a=1e3;return a};this.getSummary=function(b,c,d,a){return b.desc!=""?b.desc:c.desc!=""?c.desc:d.desc!=""?d.desc:a.desc!=""?a.desc:""};this.getFirstUrl=function(){var a=this.getGoogleResult(),b=this.getYahooResult(),c=this.getMSNResult(),d=this.getOneRiotResult();return this.getUrl(a,b,c,d)};this.getDisplayHTML=function(c){this.index=c;var j=this.getGoogleResult(),v=j.toString()!="#"&&j.toString()!="",d=this.getYahooResult(),o=d.toString()!="#"&&d.toString()!="",l=this.getMSNResult(),w=l.toString()!="#"&&l.toString()!="",i=this.getOneRiotResult(),r=i.toString()!="#"&&i.toString()!="",f=this.getTitle(j,d,l,i),x=f,h=this.getUrl(j,d,l,i),k=this.getSummary(j,d,l,i),m=this.getDisplayLink(j,d,l,i),q=this.domain;f=stripBolding(f);k=stripBolding(k);k.replace(/<br>/gi,"").replace(/<br \/>/gi,"");k=k.wordWrap(100,"<br />",0);if(f.length>80)f=f.substring(0,60)+"...";if(m.length>60)m=m.substring(0,60)+"...";f=boldTextSplit(f,searcher.search_query);k=boldTextSplit(k,searcher.search_query);m=boldTextSplit(m,searcher.search_query);var g="";if(searcher.commentCounts[h]!=undefined)g=searcher.commentCounts[h];var p=h;if(userSettings.openLinksInVotingFrame){var u=Base64.encode(h),t=Base64.encode(stripBolding(f.replace(/\?/gi,"").replace(/\//gi,""))),s=encodeURIComponent(searcher.search_query.replace(/\?/gi,"").replace(/\//gi,""));p="/view/result/"+s+"/"+t+"/"+u+"/?URL="+h}var b=searcher.search_query;b=addslashes(b);var a=[];a.push('<div class="v2result clear" id="result',c,'">');a.push('  <div class="resultTitleRow">');a.push('    <a href="',p,'" class="resultTitle" onclick="return doVoteFrame(',c,",'",h,"', '",escape(f.replace("?","")),"','",addslashes(q),"');\">");if(r){var n=i.realtimeAdditionaInfo;if(n!=undefined)if(n.userService=="TWITTER")a.push('<span href="http://twitter.com/',n.userId,'" title="Realtime Twitter result via OneRiot from tweet: ',n.comment,'"><img src="http://assets.scour.com/images/resultsV3/twitter-icon.png" alt="Realtime Twitter result via OneRiot" />&nbsp;</span>');else a.push('<span href="http://digg.com/users/',n.userId,'" title="Realtime Digg result via OneRiot"><img src="http://assets.scour.com/images/resultsV3/digg-icon.png" alt="Realtime Twitter result via OneRiot" />&nbsp;</span>');else a.push('<img src="/images/resultsV3/realtime.png" alt="Realtime result" /> ')}a.push(f);a.push("</a>");a.push('    <a href="',p,'" class="resultNewWindow" title="Open result in new window" target="_blank" onmouseup="resultClickThru(\'',h,"')\"></a>");a.push("  </div>");a.push('  <div class="resultMain">');a.push('    <div class="resultRank" title="">');var e=encodeURIComponent(searcher.search_query);if(v)a.push('      <a href="http://www.google.com/search?q=',e,'" title="This represents the search listing rank on Google #',j.rank," - Click to search Google for ",b,'" target="_blank" class="resultGoogleRank"><span></span>',j.rank,"</a>");else a.push('      <a href="http://www.google.ca/search?q=',e,'" title="This represents the search listing rank on Google(Not In Top Results) - Click to search Google for ',b,'" target="_blank" class="resultGoogleRankNone"><span></span>-</a>');if(window.gIsAussie)if(o)a.push('      <a href="http://au.search.yahoo.com/search?p=',e,'" title="This represents the search listing rank on Yahoo #',d.rank," - Click to search Yahoo for ",b,'" target="_blank" class="resultYahooauRank"><span></span> ',d.rank,"</a>");else a.push('      <a href="http://au.search.yahoo.com/search?p=',e,'" title="This represents the search listing rank on Yahoo(Not In Top Results) - Click to search Yahoo for ',b,'" target="_blank" class="resultYahooauRankNone"><span></span>-</a>');else if(window.gIsUK)if(o)a.push('      <a href="http://uk.search.yahoo.com/search?p=',e,'" title="This represents the search listing rank on Yahoo #',d.rank," - Click to search Yahoo for ",b,'" target="_blank" class="resultYahooauRank"><span></span> ',d.rank,"</a>");else a.push('      <a href="http://uk.search.yahoo.com/search?p=',e,'" title="This represents the search listing rank on Yahoo(Not In Top Results) - Click to search Yahoo for ',b,'" target="_blank" class="resultYahooauRankNone"><span></span>-</a>');else if(o)a.push('      <a href="http://search.yahoo.com/search?p=',e,'" title="This represents the search listing rank on Yahoo #',d.rank," - Click to search Yahoo for ",b,'" target="_blank" class="resultYahooRank"><span></span>',d.rank,"</a>");else a.push('      <a href="http://search.yahoo.com/search?p=',e,'" title="This represents the search listing rank on Yahoo(Not In Top Results) - Click to search Yahoo for ',b,'" target="_blank" class="resultYahooRankNone"><span></span>-</a>');if(w)a.push('      <a href="http://search.msn.com/results.aspx?q=',e,'" title="This represents the search listing rank on Bing #',d.rank," - Click to search Bing for ",b,'" target="_blank" class="resultLiveRank"><span></span>',l.rank,"</a>");else a.push('      <a href="http://search.msn.com/results.aspx?q=',e,'" title="This represents the search listing rank on Bing(Not In Top Results) - Click to search Bing for ',b,'" target="_blank" class="resultLiveRankNone"><span></span>-</a>');if(r)a.push('      <a href="http://www.oneriot.com/search?q=',e,'&st=web&ot=" title="This represents the search listing rank on OneRiot #',i.rank," - Click to search OneRiot for ",b,'" target="_blank" class="resultOneRiotRank"><span></span>',i.rank,"</a>");else a.push('      <a href="http://www.oneriot.com/search?q=',e,'&st=web&ot=" title="This represents the search listing rank on OneRiot(Not In Top Results) - Click to search OneRiot for ',b,'" target="_blank" class="resultOneRiotRankNone"><span></span>-</a>');a.push("    </div>");a.push('    <div class="resultMainBorder">');a.push('      <div class="resultContent">');a.push('        <div class="resultSummary">',k,"</div>");a.push('        <div class="resultDomain">');a.push('          <a href="',h,'" class="resultDomainLink" onclick="return doVoteFrame(',c,",'",h,"', '",escape(f.replace("?","")),"','",q,"');\">",m,"</a>");a.push('          <a href="#" class="resultDomainSearch" onclick="return searchOnDomain(\'',q,"');\">Search this Site</a>");a.push("        </div>");a.push('        <a href="#" class="resultVoteUp" onclick="vote(',c,', this); return false;" id="voteup_link',c,'"></a>');a.push('        <a href="#" class="resultVoteDown" onclick="votedown(',c,', this); return false;" id="votedown_link',c,'"></a>');a.push('        <div class="resultComments">');a.push("          <span></span> ",g.toString()," comments");a.push('          <div class="resultCommentsArrow"></div>');a.push("        </div>");a.push("      </div>");a.push('      <div class="resultCommentsContainer" style="display:none;">');g!=""&&a.push('        <div class="addCommentButton" onclick="$(\'#addComment',c,",#commentClose",c,"').fadeIn('slow');\">Add Comment</div>");a.push('          <div class="commentLowerCloseTop" id="commentClose',c,'" style="display:none" onclick="$(\'#addComment',c,",#commentClose",c,"').fadeOut('slow');\">Discard</div>");a.push('        <div class="comSort">');a.push('          <select class="comSortSelect">');a.push('            <option value="newest">Newest</option>');a.push('            <option value="oldest">Oldest</option>');a.push('            <option value="positive">Positive</option>');a.push('            <option value="negative">Negative</option>');a.push('            <option value="recommended">Recommended</option>');a.push("          </select>");a.push("        </div>");a.push('        <h2 class="resultCommentsTitle">');if(g!="")a.push(g," Comments");else a.push("&nbsp;");a.push("</h2>");a.push('        <div class="addCommentPanel" style="display:none" id="addComment',c,'">');a.push('          <textarea id="addCommentComment" class="addCommentComment" rows="4" cols="50" oncontextmenu="return false;">');userSettings.isLoggedIn()&&(g==""||g==0)&&a.push("Be the first to Comment!");a.push("</textarea>");a.push('          <a href="#" class="addCommentPostNeg"></a>');a.push('          <a href="#" class="addCommentPostPos"></a>');a.push('          <div class="addCommentErrors" style="display:none">');a.push('            <div class="addCommentErrorsIcon"></div>');a.push('            <span class="addCommentErrorsText"></span>');a.push("          </div>");a.push('          <div class="addCommentPosted" style="display:none">');a.push('            <span class="addCommentPostedText">Comment Posted, thanks!</span>');a.push("          </div>");a.push('          <div class="addCommentCharacters">');a.push('            <span class="currentCharacters">0</span>/500 characters');a.push("          </div>");a.push("        </div>");a.push('<div class="resultCommentsBox">');if(!userSettings.isLoggedIn()){a.push('        <div class="noCommentsHeader">Be the first to Comment!');a.push('&nbsp;&nbsp;<a href="#" class="guestCommentLink">Login</a> or <a href="/signup/" target="_blank">Join Now</a>!');a.push("        </div>")}a.push("</div>");a.push('<div class="commentLowerClose">Close</div>');a.push('        <div class="commentLoadMore" style="visibility: hidden"></div>');a.push('        <div class="addCommentPanel"');!userSettings.isLoggedIn()&&a.push(' style="display:none"');a.push("         >");a.push('          <textarea id="addCommentComment" class="addCommentComment" rows="4" cols="50" oncontextmenu="return false;">');userSettings.isLoggedIn()&&(g==""||g==0)&&a.push("Be the first to Comment!");a.push("</textarea>");a.push('          <a href="#" class="addCommentPostNeg"></a>');a.push('          <a href="#" class="addCommentPostPos"></a>');a.push('          <div class="addCommentErrors" style="display:none">');a.push('            <div class="addCommentErrorsIcon"></div>');a.push('            <span class="addCommentErrorsText"></span>');a.push("          </div>");a.push('          <div class="addCommentPosted" style="display:none">');a.push('            <span class="addCommentPostedText">Comment Posted, thanks!</span>');a.push("          </div>");a.push('          <div class="addCommentCharacters">');a.push('            <span class="currentCharacters">0</span>/500 characters');a.push("          </div>");a.push("        </div>");if(!userSettings.isLoggedIn()){a.push('        <div class="guestCommentPanel" style="display:none">');a.push('           Please <a href="#" class="guestCommentLink">Login</a> to Comment.<br>');a.push('           If you don\'t have an account, <a href="/signup/" target="_blank">sign up now</a>!');a.push("        </div>")}a.push('        <span class="commentCount" style="display:none">',g.toString(),"</span>");a.push('        <span class="comCurPage" style="display:none">0</span>');a.push('        <span class="resultUrl" style="display:none">',h,"</span>");a.push('        <span class="currentlyDisplayedCommentCount" style="display:none">0</div>');a.push("      </div>");a.push("    </div>");a.push("  </div>");a.push("</div>");return a.join("")};this.updateScore=function(){for(var b=0,a=0;a<this.list.length;a++)b+=this.list[a].score;for(a=0;a<this.votes.list.length;a++)b+=this.votes.list[a].numVotes/50;this._score=b}}Array.prototype.contains=function(b){for(var a=0;a<this.length;a++)if(this[a]==b)return true;return false};String.prototype.startsWith=function(a){return this.indexOf(a)==0};String.prototype.trim=function(){var a=this;while(a.substring(0,1)==" ")a=a.substring(1,a.length);while(a.substring(a.length-1,a.length)==" ")a=a.substring(0,a.length-1);return a};String.prototype.wordWrap=function(d,h,f){var c,a,g,b,e;if(d<1)return this;for(c=-1,g=(e=this.split("\n")).length;++c<g;e[c]+=b)for(b=e[c],e[c]="";b.length>d;e[c]+=b.slice(0,a)+((b=b.slice(a)).length?h:""))a=f==2||(a=b.slice(0,d+1).match(/\S*(\s)?$/))[1]?d:a.input.length-a[0].length||f==1&&d||a.input.length+(a=b.slice(d).match(/^\S*/)).input.length;return e.join("\n")};SidebarWrapper=function(a){this.targetID=a};SidebarWrapper.prototype={displayImageItems:function(){this.displayNews();this.displayVideos();this.displayYAnswers();this.displayWeb()},displayVideoItems:function(){$("#widget-sidebar").empty();this.displayNews();this.displayYAnswers();this.displayWeb()},displayNews:function(){$.getJSON("http://ajax.googleapis.com/ajax/services/search/news?q="+searcher.search_query+"&v=1.0&start=1&rsz=small&lr=en&callback=?&",function(f){var g=$("#widget-sidebar"),d=f.responseData.results.length;if(d>3)d=3;var c='<div class="clear"><h3><span>News</span></h3>';if(d>0)for(var e=0;e<d;e++){var b=f.responseData.results[e],a=new Date(b.publishedDate);a=a.getFullYear().toString()+"/"+a.getMonth().toString()+"/"+a.getDay().toString();c+='<div class="serps-sidebaritem"><a href="'+b.unescapedUrl+'" target="_blank">'+b.titleNoFormatting+'</a><div class="serps-sidebar-source">Source: '+b.publisher+'</div><div class="serps-sidebar-date">'+a+"</div></div>"}else c+='<div class="serps-sidebar-duration padded" style="padding-top:0;margin-top:0;">No news found.</div>';c+="</div>";g.append(c)})},displayVideos:function(){$.getJSON("http://ajax.googleapis.com/ajax/services/search/video?q="+searcher.search_query+"&v=1.0&start=1&rsz=large&lr=en&callback=?&",function(d){var f=$("#widget-sidebar");if(d.responseData==null)return;var c=d.responseData.results.length;if(c>5)c=5;var b='<div class="clear"><h3><span>Videos</span></h3>';if(c>0)for(var e=0;e<c;e++){var a=d.responseData.results[e];b+='<div class="serps-sidebaritem clear"><a href="'+a.url+'" target="_blank"><img src="'+a.tbUrl+'" alt="" width="80" align="left" style="padding-right: 4px;" /></a><a href="'+a.url+'" target="_blank">'+a.titleNoFormatting+'</a><div class="serps-sidebar-duration">'+a.duration+" seconds</div></div>"}else b+='<div class="serps-sidebar-duration padded" style="padding-top:0;margin-top:0;">No videos found.</div>';b+="</div>";f.append(b)})},displayYAnswers:function(){$.getJSON("http://answers.yahooapis.com/AnswersService/V1/questionSearch?query="+searcher.search_query+"&appid=58fa746f5973b117b63051c3b3d197be&results=5&sort=date_desc&output=json&callback=?&",function(e){var f=$("#widget-sidebar"),a=e.all.count;if(a>5)a=5;if(a==0)return;var b='<div class="clear"><h3><span>Answers</span></h3>';if(a>0)for(var d=0;d<a;d++){var c=e.all.questions[d];b+='<div class="serps-sidebaritem clear"><a href="'+c.Link+'" target="_blank">'+c.Subject+'</a><div class="serps-sidebar-duration">'+c.NumAnswers+" answers</div></div>"}else b+='<div class="serps-sidebar-duration padded" style="padding-top:0;margin-top:0;">No answers found.</div>';b+="</div>";f.append(b)})},displayWeb:function(){$.getJSON("http://ajax.googleapis.com/ajax/services/search/web?q="+searcher.search_query+"&v=1.0&start=1&rsz=large&lr=en&callback=?&",function(d){var f=$("#image-news-sidebar");if(d.responseData==null)return;var b=d.responseData.results.length;if(b>5)b=5;var a='<div class="clear"><h3><span>Web</span></h3>';if(b>0)for(var e=0;e<b;e++){var c=d.responseData.results[e];a+='<div class="serps-sidebaritem clear"><a href="'+c.unescapedUrl+'" target="_blank">'+c.titleNoFormatting+'</a><div class="serps-sidebar-duration">'+c.content+"</div></div>"}else a+='<div class="serps-sidebar-duration padded" style="padding-top:0;margin-top:0;">No results found.</div>';a+="</div>";f.append(a)})}};ImageSearchWrapper=function(){this._searchPage=1;this.numResults=0};ImageSearchWrapper.prototype={returned_count:0,have_results:false,completedCallback:function(a){this.parseFlickrResult(a)},buildSearchUri:function(b){var a="1";if(!userSettings.disableSafeSearch)a="3";return"http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key="+this.getApiKey()+"&format=json&text="+encodeURIComponent(b)+"&privacy_filter=interestingness-desc&safe_search="+a+"&per_page=10&page="+this._searchPage+"&jsoncallback=?&extras=o_dims,owner_name&sort=relevance"},clearSearch:function(){$("#results").empty();$("#pager").empty()},getApiKey:function(){return"58fa746f5973b117b63051c3b3d197be"},handleNoResults:function(a){if(a==0)if(searcher._imageWrapper.returned_count==2&&!searcher._imageWrapper.have_results)$("#results").html(searcher.getNoResultsDisplay());else searcher._imageWrapper.returned_count++;else this.have_results=true},search:function(a){this.numResults=0;this.startTime=(new Date).getTime();$.getJSON("http://ajax.googleapis.com/ajax/services/search/images?q="+a+"&v=1.0&start="+this._searchPage*8+"&rsz=large&lr=en&callback=?&",function(d){var e=$("#results"),b=d.responseData.results.length;$("#searchingflickr").hide("fast");this.numResults+=b;for(var c=0;c<b;c++){var a=d.responseData.results[c];e.append('<div class="imagedisplay"><a href="'+a.unescapedUrl+'" class="launchimage" target="_blank" title="View picture"></a><a class="thumbpreview" href="'+a.originalContextUrl+'" target="_blank" imgurl="'+a.url+'"><img src="'+a.tbUrl+'" border="0" align="top" width="'+parseInt(a.tbWidth)*1.3+'" height="'+parseInt(a.tbHeight)*1.3+'" /><br /><span style="position:absolute;bottom:7px;width: 240px;left:2px;"><span style="color:#555">'+a.contentNoFormatting+"</span><br />"+a.visibleUrl+" ("+a.width+"x"+a.height+")</span></a></div>")}searcher._imageWrapper.handleNoResults(b)});$.getJSON("http://boss.yahooapis.com/ysearch/images/v1/"+encodeURIComponent(a)+"?appid=uZhhBfbV34FgwNft89oh5hwYBpO9fJVbxJZHYVR1UACfDUSle0EB070CB18D2CxiDz0DWrQ-&start="+this._searchPage*8+"&count=42&callback=?",function(e){var g=$("#results"),d=0;if(e.ysearchresponse.resultset_images){d=e.ysearchresponse.resultset_images.length;this.numResults+=d;$("#searchingflickr").hide("fast");for(var f=0;f<d;f++){var a=e.ysearchresponse.resultset_images[f],b=a.refererurl,c=a.title;if(c.length>20)c=c.substring(0,20)+"...";if(b&&b.length>40)b=b.substring(0,40);if(b.indexOf("http://www")>-1)b=b.substring(11,b.length);g.append('<div class="imagedisplay"><a href="'+a.url+'" class="launchimage" target="_blank"></a><a class="thumbpreview" href="'+a.refererclickurl+'" target="_blank" imgurl="'+a.url+'"><img src="'+a.thumbnail_url+'" border="0" align="top" width="'+a.thumbnail_width+'" height="'+a.thumbnail_height+'" /><br /><span style="position:absolute;bottom:7px;width: 240px;left:2px;"><span style="color:#555">'+c+"</span><br />"+b+" ("+a.width+"x"+a.height+")</span></a></div>")}}searcher._imageWrapper.handleNoResults(d)});$.getJSON(this.buildSearchUri(a),function(a){$("#searchingflickr").hide("fast");if(a&&a.photos&&a.photos.photo&&a.photos.photo.length>0){searcher._imageWrapper.parseFlickrResult(a.photos.photo);this.numResults+=a.photos.photo.length;a.photos.pages>0&&searcher._imageWrapper.displayPager(a.photos.pages)}searcher._imageWrapper.handleNoResults(a.photos.photo.length)})},displayPager:function(e){var c=this._searchPage,b="";if(c<1)c=1;else if(c>1)b+='<a href="#'+(c-1).toString()+'" onclick="javascript:searcher._imageWrapper.prevPage()" id="pagerPrev" title="Previous Page" class="havehistory">Prev</a>';else b+='<span id="pagerPrev" class="nextprev">Prev</span>';for(var d=0,f=Math.max(1,c-5),a=f;a<=e;a++){if(c==a)b+='<span href="#" title="Current Page" class="nextprev">'+a+"</span>";else b+='<a href="#'+a+'" onclick="javascript:searcher._imageWrapper.loadPage('+a.toString()+')" title="View Page '+a+'" class="havehistory">'+a+"</a>";d++;if(d>=10)break}if(c<e)b+='<a href="#'+(a+1).toString()+'" onclick="javascript:searcher._imageWrapper.nextPage()" id="pagerNext" title="Next Page">Next</a>';else b+='<span id="pageNext" class="nextprev">Next</span>';$("#pager").html(b);this.imagePreview()},imagePreview:function(){$("a.thumbpreview").hover(function(a){var e=$(document).width(),d=$(document).height(),b=5,c=-100;if(e-a.pageX<400)b=-600;if(d-a.pageY<300)c=-500;$(this).parent().css("border","2px solid #8AC103");$(this).parent().css("color","#8AC103");this.t=this.title;this.title="";var f=this.t!=""?"<br/>"+this.t:"";$("body").append("<p id='thumbpreview'><img src='"+$(this).attr("imgurl")+"' width='400' alt='Loading Image from Original Source...' />"+f+"</p>");$("#thumbpreview").css("top",a.pageY+c+"px").css("left",a.pageX+b+"px").fadeIn("fast")},function(){$(this).parent().css("border","2px solid #ECECEC");$(this).parent().css("color","#3E8EB3");this.title=this.t;$("#thumbpreview").remove()});$("a.thumbpreview").mousemove(function(a){var e=$(document).width(),d=$(document).height(),b=5,c=-100;if(e-a.pageX<400)b=-600;if(d-a.pageY<300)c=-500;$("#thumbpreview").css("top",a.pageY+c+"px").css("left",a.pageX+b+"px")})},setSearchPage:function(a){if(a<1)a=1;this._searchPage=a},parseFlickrResult:function(c){this.endTime=(new Date).getTime();$("#time").html("Search for "+searcher.search_query+"("+(this.endTime-this.startTime)/1e3+" seconds)");if(c){var j=c.length;searcher.hideSearching();for(var i=$("#results"),d=0;d<j;d++){var a=c[d],h="http://farm"+a.farm+".static.flickr.com/"+a.server+"/"+a.id+"_"+a.secret+"_m.jpg",e="http://farm"+a.farm+".static.flickr.com/"+a.server+"/"+a.id+"_"+a.secret+".jpg",g="http://www.flickr.com/photos/"+a.owner+"/"+a.id,b=a.title;if(b.length>30)b=b.substring(0,30);var f='<span style="color:#555">'+b+"</span><br />"+a.ownername+" ";if(a.o_width)f+="("+a.o_width+"x"+a.o_height+")";i.append('<div class="imagedisplay"><a href="'+e+'" class="launchimage" target="_blank"></a><a class="thumbpreview" href="'+g+'" target="_blank" imgurl="'+e+'"><img src="'+h+'" border="0" align="top" /><br /><span style="position:absolute;bottom:7px;width: 246px;left:2px;">'+f+"</span></a></div>")}}},prevPage:function(){$("#results").empty();$("#pager").empty();searcher._imageWrapper._searchPage--;searcher._imageWrapper.search(searcher.search_query)},nextPage:function(){$("#results").empty();$("#pager").empty();searcher._imageWrapper._searchPage++;searcher._imageWrapper.search(searcher.search_query)},loadPage:function(a){searcher._imageWrapper.clearSearch();searcher._imageWrapper._searchPage=a;searcher._imageWrapper.search(searcher.search_query)}};FlickrImageWrapper=function(){this._searchPage=1};FlickrImageWrapper.prototype={completedCallback:function(a){this.parseResult(a)},buildSearchUri:function(b){var a="1";if(!userSettings.disableSafeSearch)a="3";return"http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key="+this.getApiKey()+"&format=json&text="+encodeURIComponent(b)+"&privacy_filter=interestingness-desc&safe_search="+a+"&per_page=50&page="+this._searchPage+"&jsoncallback=?&owner_name%2C+icon_server%2C+views"},getApiKey:function(){return"58fa746f5973b117b63051c3b3d197be"},search:function(a){this.startTime=(new Date).getTime();$.getJSON(this.buildSearchUri(a),function(a){$("#searchingflickr").hide("fast");if(a&&a.photos&&a.photos.photo&&a.photos.photo.length>0){searcher._imageWrapper.parseResult(a.photos.photo);a.photos.pages>0&&searcher._imageWrapper.displayPager(a.photos.pages)}else $("#results").html(searcher.getNoResultsDisplay())})},displayPager:function(e){var c=this._searchPage,b="";if(c>1)b+='<a href="#" onclick="javascript:searcher._imageWrapper.prevPage()" id="pagerPrev" title="Previous Page">Prev</a>';else b+='<span id="pagerPrev" class="nextprev">Prev</span>';for(var d=0,f=Math.max(1,c-5),a=f;a<=e;a++){if(c==a)b+='<span href="#" title="Current Page" class="nextprev">'+a+"</span>";else b+='<a href="#" onclick="javascript:searcher._imageWrapper.loadPage('+a.toString()+')" title="View Page '+a+'">'+a+"</a>";d++;if(d>=10)break}if(c<e)b+='<a href="#" onclick="javascript:searcher._imageWrapper.nextPage()" id="pagerNext" title="Next Page">Next</a>';else b+='<span id="pageNext" class="nextprev">Next</span>';$("#pager").html(b)},setSearchPage:function(a){this._searchPage=a},parseResult:function(d){this.endTime=(new Date).getTime();$("#time").html("Search for "+searcher.search_query+"("+(this.endTime-this.startTime)/1e3+" seconds)");if(d){var c=d,h=c.length;searcher.hideSearching();var e=$("#results");e.empty();$("#pager").empty();for(var a,b=0;b<h;b++){a=c[b];var g="http://farm"+a.farm+".static.flickr.com/"+a.server+"/"+a.id+"_"+a.secret+"_m.jpg",f="http://www.flickr.com/photos/"+a.owner+"/"+a.id;e.append('<div class="imagedisplay"><a href="'+f+'" target="_blank"><img src="'+g+'" border="0" align="top" /><br />'+c[b].title+"</a></div>")}}},prevPage:function(){$("#results").empty();$("#pager").empty();searcher._imageWrapper._searchPage--;searcher._imageWrapper.search(searcher.search_query)},nextPage:function(){$("#results").empty();$("#pager").empty();searcher._imageWrapper._searchPage++;searcher._imageWrapper.search(searcher.search_query)},loadPage:function(a){$("#results").empty();$("#pager").empty();searcher._imageWrapper._searchPage=a;searcher._imageWrapper.search(searcher.search_query)}};function youtubeVideoSearch(){$.ajax({url:"/services/getVideos/",data:{query:searcher.search_query,page:searcher.currentPage+1},type:"post",cache:false,dataType:"json",success:function(e){var g=$("#results"),h=0;if(e){var d=e.videos;h=d.length;searcher.hideSearching();g.empty();var i=$("#pager");i.empty();for(var a=0;a<h;a++)g.append('<div class="imagedisplay" style="text-align:center"><a href="'+d[a].url+'" target="_blank">  <img src="'+d[a].thumbnail+'" alt=""> <span style="position:absolute;bottom:7px;width: 240px;left:2px;"><span style="color:#555">'+d[a].title+"</span><br />"+d[a].length+" min </span></a></div>");if(e.total_videos>50){this.numPages=Math.ceil(e.total_videos/50);if(this.numPages>20)this.numPages=20;var f=this.currentPage,b="";if(f>1)b+='<a href="/search/video/'+searcher.search_query+"/"+(f-1)+'/" id="pagerPrev" title="Previous Page">Prev</a>';else b+='<span id="pagerPrev" class="nextprev">Prev</span>';for(var c=1;c<=this.numPages;c++)b+='<a href="/search/video/'+searcher.search_query+"/"+(c-1).toString()+'/" title="View Page '+c+'">'+c+"</a>";if(f<this.numPages)b+='<a href="/search/video/'+searcher.search_query+"/"+(f+1)+'/" id="pagerPrev" title="Previous Page">Prev</a>';else b+='<span id="pageNext" class="nextprev">Next</span>';$("#pager").append(i)}}h==0&&g.html(searcher.getNoResultsDisplay())}})}function LiveSearchClass(){}LiveSearchClass.prototype.search=function(f,d){var b=this.__trimParamValue(f);if(b=="")throw"You must provide a query!";var e=userSettings.numMSNResults,c="strict";if(userSettings.disableSafeSearch)c="off";var a="http://search.live.com/json.aspx?q="+escape(b);a+="&lang=en-us&adlt=strict&count="+parseInt(e);a+="&first=0&sourcetype=web&form=popfly&adult="+c;$.getScript(a,function(){try{var b=LiveSearchGetResponse();if(b&&b.web){b=b.web.results;for(var f=userSettings.msnWeight/100,g=b.length,c=b,e,a=0;a<g;a++){e=new SearchResult(c[a].url,c[a].title,c[a].description,SearchEngineEnum.MSN,a+1,c[a].displayUrl,c[a].cacheUrl,-1,"");e.score=Math.pow(1.3,10-a)*f;d.addResult(e)}}searcher.callbackEngineWebSearchComplete(SearchEngineEnum.MSN)}catch(h){searcher.callbackEngineWebSearchComplete(SearchEngineEnum.MSN)}searcher.havemsn=true});setTimeout("handleMSNTimeout()",6e3);return};LiveSearchClass.prototype.__trimParamValue=function(a){return!a?"":!isNaN(a)?a:a.trim()};LiveSearchClass.prototype.__getUserLanguage=function(){var a="";if(navigator.userAgent.indexOf("Firefox")!=-1)a=navigator.language;else if(navigator.userAgent.indexOf("MSIE")!=-1)a=navigator.browserLanguage;else a="en-us";return a};function handleVoteCheckTimeout(){!searcher.haveScour&&searcher.callbackEngineWebSearchComplete(SearchEngineEnum.Scour)}function handleGoogleTimeout(){!searcher.haveGoogle&&searcher.callbackEngineWebSearchComplete(SearchEngineEnum.Google)}function handleOneRiotTimeout(){!searcher.haveOneRiot&&searcher.callbackEngineWebSearchComplete(SearchEngineEnum.OneRiot)}function handleYahooTimeout(){!searcher.haveYahoo&&searcher.callbackEngineWebSearchComplete(SearchEngineEnum.Yahoo)}function handleMSNTimeout(){!searcher.haveMSN&&searcher.callbackEngineWebSearchComplete(SearchEngineEnum.MSN)}var feedback={message:null,open:function(a){$.browser.mozilla&&$("#feedback-container .feedback-button").css({"padding-bottom":"2px"});$.browser.safari&&$("#feedback-container .feedback-input").css({"font-size":".9em"});var b=$("#feedback-container .feedback-title").html();$("#feedback-container .feedback-title").html("Loading...");a.overlay.fadeIn(200,function(){a.container.fadeIn(200,function(){a.data.fadeIn(200,function(){$("#feedback-container .feedback-content").animate({height:450},function(){$("#feedback-container .feedback-title").html(b);$("#feedback-container form").fadeIn(200,function(){$("#feedback-container #feedback-name").focus();$.browser.msie&&$.browser.version<7&&$("#feedback-container .feedback-button").each(function(){if($(this).css("backgroundImage").match(/^url[("']+(.*\.png)[)"']+$/i)){var a=RegExp.$1;$(this).css({backgroundImage:"none",filter:'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+a+'", sizingMethod="crop")'})}})})})})})})},show:function(){$("#feedback-container .feedback-send").click(function(b){b.preventDefault();if(feedback.validate()){$("#feedback-container .feedback-message").fadeOut(function(){$("#feedback-container .feedback-message").removeClass("feedback-error").empty()});$("#feedback-container .feedback-title").html("Sending...");$("#feedback-container form").fadeOut(200);$("#feedback-container .feedback-content").animate({height:"80px"},function(){$("#feedback-container .feedback-loading").fadeIn(200,function(){$.ajax({url:"/feedback/send",data:$("#feedback-container form").serialize(),type:"post",cache:false,dataType:"json",complete:function(a){$("#feedback-container .feedback-loading").fadeOut(200,function(){$("#feedback-container .feedback-title").html("Thank you!");$("#feedback-container .feedback-message").html(a.responseText).fadeIn(200)})},error:feedback.error})})})}else if($("#feedback-container .feedback-message:visible").length>0){var a=$("#feedback-container .feedback-message div");a.fadeOut(200,function(){a.empty();feedback.showError();a.fadeIn(200)})}else $("#feedback-container .feedback-message").animate({height:"30px"},feedback.showError)})},close:function(a){$("#feedback-container .feedback-message").fadeOut();$("#feedback-container .feedback-title").html("Thanks!");$("#feedback-container form").fadeOut(200);$("#feedback-container .feedback-content").animate({height:40},function(){a.data.fadeOut(200,function(){a.container.fadeOut(200,function(){a.overlay.fadeOut(200,function(){$.modal.close()})})})})},error:function(){},validate:function(){feedback.message="";if(!$("#feedback-container #feedback-name").val())feedback.message+="Name is required. ";var a=$("#feedback-container #feedback-email").val();if(!a)feedback.message+="Email is required. ";else if(!feedback.validateEmail(a))feedback.message+="Email is invalid. ";if(!$("#feedback-container #feedback-section").val())feedback.message+="Topic is required.";if(!$("#feedback-container #feedback-message").val())feedback.message+="Message is required.";return feedback.message.length>0?false:true},validateEmail:function(b){var d=b.lastIndexOf("@");if(d<1||d+1===b.length)return false;if(/(\.{2,})/.test(b))return false;var c=b.substring(0,d),a=b.substring(d+1);if(c.length<1||c.length>64||a.length<4||a.length>255)return false;if(/(^\.|\.$)/.test(c)||/(^\.|\.$)/.test(a))return false;if(!/^"(.+)"$/.test(c))if(!/^[-a-zA-Z0-9!#$%*\/?|^{}`~&'+=_\.]*$/.test(c))return false;return!/^[-a-zA-Z0-9\.]*$/.test(a)||a.indexOf(".")===-1?false:true},showError:function(){$("#feedback-container .feedback-message").html($('<div class="feedback-error">').append(feedback.message)).fadeIn(200)}};function showdemo(f,e,d,c,a){var b;if(a=="center"){magauche=screen.width?(screen.width-d)/2:100;monhaut=screen.height?(screen.height-c)/2:100}else if(a!="center"||a==null){magauche=+0;monhaut=+0}reglages="width="+d+",height="+c+",top="+monhaut+",left="+magauche+",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";b=window.open(f,e,reglages);b.focus()}var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(a){var f="",g,b,c,i,j,h,d,e=0;a=Base64._utf8_encode(a);while(e<a.length){g=a.charCodeAt(e++);b=a.charCodeAt(e++);c=a.charCodeAt(e++);i=g>>2;j=(g&3)<<4|b>>4;h=(b&15)<<2|c>>6;d=c&63;if(isNaN(b))h=d=64;else if(isNaN(c))d=64;f=f+this._keyStr.charAt(i)+this._keyStr.charAt(j)+this._keyStr.charAt(h)+this._keyStr.charAt(d)}return f},decode:function(b){var a="",g,h,i,j,e,d,f,c=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(c<b.length){j=this._keyStr.indexOf(b.charAt(c++));e=this._keyStr.indexOf(b.charAt(c++));d=this._keyStr.indexOf(b.charAt(c++));f=this._keyStr.indexOf(b.charAt(c++));g=j<<2|e>>4;h=(e&15)<<4|d>>2;i=(d&3)<<6|f;a=a+String.fromCharCode(g);if(d!=64)a=a+String.fromCharCode(h);if(f!=64)a=a+String.fromCharCode(i)}a=Base64._utf8_decode(a);return a},_utf8_encode:function(c){c=c.replace(/\r\n/g,"\n");for(var b="",d=0;d<c.length;d++){var a=c.charCodeAt(d);if(a<128)b+=String.fromCharCode(a);else if(a>127&&a<2048){b+=String.fromCharCode(a>>6|192);b+=String.fromCharCode(a&63|128)}else{b+=String.fromCharCode(a>>12|224);b+=String.fromCharCode(a>>6&63|128);b+=String.fromCharCode(a&63|128)}}return b},_utf8_decode:function(c){var d="",a=0,b=c1=c2=0;while(a<c.length){b=c.charCodeAt(a);if(b<128){d+=String.fromCharCode(b);a++}else if(b>191&&b<224){c2=c.charCodeAt(a+1);d+=String.fromCharCode((b&31)<<6|c2&63);a+=2}else{c2=c.charCodeAt(a+1);c3=c.charCodeAt(a+2);d+=String.fromCharCode((b&15)<<12|(c2&63)<<6|c3&63);a+=3}}return d}},errorMsg={length:"Please enter a longer comment, a minimum of 30 characters.",repeatlines:"Your comment plays like a broken record. Please update your comment.",repeatletters:'What is "#offense#"? Please update your comment, thanks!',sparsevowels:'What is "#offense#"? Please update your comment, thanks!',wordrepeat:"Woah, too much repetition, please be more detailed",manysymbols:"That's a lot of symbols. Please update your comment, thanks!",repeatsymbols:'What is "#offense#"? Please update your comment, thanks!',repeatnumbers:'What is "#offense#"? Please update your comment, thanks!',linebreaks:"That is a lot of lines for that much content.",manylinks:"You're posting too many links.",wordlengthtoolong:'What is "#offense#"? Please update your comment, thanks!',urllengthtoolong:"Very sorry but we do not allow urls longer than 100 characters."};function watchTextarea(e){var a=e.parent(),c=e;a.find(".addCommentPostPos").click(function(g){g.preventDefault();$(this).hide();var b=c.val();if(!d(b)){$(this).show();return false}var f=a.parent().parent().find(".resultUrl").text(),e=b.replace(/ /g,"").length;if(e<30||e>500){a.find(".addCommentErrorsText").text("Your comment must be between 30 and 500 characters.");a.find(".addCommentErrors").show();$(this).show()}else{a.find(".addCommentErrorsText").text("");a.find(".addCommentErrors").hide();addComment(b,f,1,c,$(this))}});a.find(".addCommentPostNeg").click(function(g){g.preventDefault();$(this).hide();var b=c.val();if(!d(b)){$(this).show();return false}var f=a.parent().parent().find(".resultUrl").text(),e=b.replace(/ /g,"").length;if(e<30||e>500){a.find(".addCommentErrorsText").text("Your comment must be between 30 and 500 characters.");a.find(".addCommentErrors").show();$(this).show()}else{a.find(".addCommentErrorsText").text("");a.find(".addCommentErrors").hide();addComment(b,f,0,c,$(this))}});function b(c,d){var b;if(d!=undefined)b=errorMsg[c].replace(/#offense#/g,d);else b=errorMsg[c];a.find(".addCommentErrorsText").text(b);a.find(".addCommentErrors").show()}function f(){a.find(".addCommentErrorsText").text("");a.find(".addCommentErrors").hide();a.find(".addCommentPosted").hide()}function d(c){var o=c.split("\n").length,g=c.replace(/ /g,"").length,h=c.match(/http[^ ]+/gi);c=c.replace(/http[^ ]+/gi," ");for(var d=c.split(" "),i=0;i<d.length;i++)d[i]=d[i].toString();f();a.find(".currentCharacters").text(g.toString());if(g<30||g>500){a.find(".addCommentCharacters").removeClass("addCommentCharactersGood");a.parent().find(".addCommentPostNeg").removeClass("addCommentPostNegGood");a.parent().find(".addCommentPostPos").removeClass("addCommentPostPosGood")}else{a.find(".addCommentCharacters").addClass("addCommentCharactersGood");a.parent().find(".addCommentPostNeg").addClass("addCommentPostNegGood");a.parent().find(".addCommentPostPos").addClass("addCommentPostPosGood")}for(var e in h)if(h[e].length>100){b("urllengthtoolong",h[e]);return false}for(var e in d)if(d[e].length>35){b("wordlengthtoolong",d[e]);return false}a.find(".currentCharacters").text(g.toString());var n=c.match(/([^ ])\1\1\1/g);if(n){for(var e in d)if(d[e].toString().indexOf(n[0])>=0){var j=d[e];if(j!=undefined)break}if(j!=undefined){b("repeatletters",j);return false}}var k=c.replace(/ /g,"").match(/[0-9 ]{6,}/g);if(k){var s=k[0];b("repeatnumbers",s);return false}if(c.replace(/ /g,"").match(/([a-z]{2,})\1\1/gi)){b("wordrepeat");return false}var l=c.match(/([qwrtplkjhgfdszxcvbnm]{5,})/gi);if(l){for(var e in d)if(d[e].toString().indexOf(l[0])>=0){var q=d[e];break}b("sparsevowels",q);return false}if(c.replace(/[a-z0-9 \.\,\?\!\(\)\;\:\/]/gi,"").length>10){b("manysymbols");return false}var m=c.replace(/ /g,"").match(/([^a-z0-9\/\.\,\?\!\(\)\;\:\\\n/]{4,})/i);if(m){var p=m[0];b("repeatsymbols",p);return false}if(h)if(h.length>3){b("manylinks");return false}if(o>3&&g/o<15){b("linebreaks");return false}var r=c.match(/^(.*)\n\1\n\1/gm);if(r){b("repeatlines");return false}return true}$(e).keydown(function(a){(a.which!=86&&!a.ctrlKey||!a.ctrlKey)&&d($(this).val())})}$(document).ready(function(){var c=$("#txtSearch");$("#filter").css("opacity",.9);var a=false;$("#results").dblclick(function(e){if(a)return;var d={x:e.pageX,y:e.pageY},c=$.trim(getSelected());if(c.match(/\s+/g))return;if(c.length<3)return;var f=d.y+9,b=d.x-88;if(b<=20)b=20;$("#filter").css({top:f+"px",left:b+"px"});$("#filterKeyword").val(c);$("#filter").show("fast");a=true});$(document).click(function(c){if(!a)return;if(c.target.id=="filter"||c.target.parentNode.id=="filter")return;b()});$("#filterInclude").click(function(i){i.preventDefault();for(var d=$("#filterKeyword").val(),j=c.val(),h=j.split(" "),a=[],g=false,f=0;f<h.length;f++){var e=h[f];if(e.toLowerCase()==d.toLowerCase())return;if(e.toLowerCase()=="-"+d.toLowerCase()){a.push(d);g=true}else a.push(e)}!g&&a.push(d);c.val(a.join(" "));b();window.location.href="/search/web/"+a.join(" ")+"/related/"});$("#filterExclude").click(function(i){i.preventDefault();for(var d=$("#filterKeyword").val(),j=c.val(),h=j.split(" "),a=[],g=false,f=0;f<h.length;f++){var e=h[f];if(e.toString().toLowerCase()=="-"+d.toLowerCase())return;if(e.toString().toLowerCase()==d.toLowerCase()){a.push("-"+d);g=true}else a.push(e)}!g&&a.push("-"+d);c.val(a.join(" "));b();window.location.href="/search/web/"+a.join(" ")+"/related/"});function b(){a=false;$("#filter").hide("fast")}$("#filterKeyword").hover(function(){$(this).css("borderColor","#f0f0f0")},function(){$(this).css("borderColor","#fff")});$("#filterKeyword").focus(function(){$(this).css("borderColor","#f0f0f0")},function(){$(this).css("borderColor","#fff")});$("#filterClose").click(function(){b()})});$(document).ready(function(){$("#reportform-submit").click(function(){$.ajax({url:"/services/reportcomment/",data:{commentid:$("#reportform-commentid").text(),"reportcomment-type":$("input[@name='abusetype']:checked").val(),message:$("#report-form-info").val()},type:"post",cache:false,dataType:"json",success:function(){$.modal.close()}})})});$(document).ready(function(){$("#loginform-join").click(function(){window.location.href="/signup/"});$("#header_signin").click(function(a){a.preventDefault();showLoginModal()});$("#loginform-login").click(function(a){a.preventDefault();$.ajax({url:"/services/login/",data:{username:$("#login-username").val(),password:$("#login-password").val()},type:"post",cache:false,dataType:"json",success:function(a){if(a.success){userSettings.userid=a.id;userSettings.username=a.username;cookies.saveSettings();$("#sign_in_user").hide();$("#new_user").hide();$("#welcome_user_name").html(userSettings.username);$("#welcome_user").show();$("#points_logout").show();searcher.loadElements();searcher.search(gTerm);$.modal.close()}else $("#loginform-error").text(a.message)}})});$("#login-username, #login-password").keydown(function(a){if(a.keyCode==27)$.modal.close();else a.keyCode==13&&$("#loginform-login").click()})});function showLoginModal(){$("#loginmodal").modal({close:false,overlayId:"login-overlay",containerId:"login-container",onOpen:login_screen.open});$("#login-username").focus()}var login_screen={open:function(a){a.overlay.fadeIn(300,function(){a.container.fadeIn(300,function(){a.data.fadeIn(300,function(){})})})}};function getSelected(){var a;if($.browser.msie){a=document.selection.createRange().text;document.selection.empty();return a}else return window.getSelection()+""}function numberFormatWithCommas(c){c+="";var b=c.split("."),a=b[0],e=b.length>1?"."+b[1]:"",d=/(\d+)(\d{3})/;while(d.test(a))a=a.replace(d,"$1,$2");return a+e}function handleSearchPage(){$("#searchform").keypress(function(a){a.which==13&&$.scour.homepage.search()});$("#searchformB").keypress(function(a){a.which==13&&$.scour.homepage.search("B")});var b=$("#txtSearchB").get(0);b.value=gTerm;var c=$("#txtSearch").get(0);c.value=window.gTerm;searcher.loadElements();searcher.setSearchType(gType);searcher.currentPage=gPage;searcher.search(gTerm);$("#nSearch-container").addClass("hasLocalSearchInput");$("#nSearch-container").addClass("hasLocalSearch");var d=$("#nSearch-container")[0];$("#localSearchArea").val(userSettings.lastLocation);$("#nSearch-tabs div").click(function(){var a=this.id.match(/-./)[0];$("#nSearch-container").removeClass("nSearch-w").removeClass("nSearch-i").removeClass("nSearch-v").removeClass("nSearch-l").addClass("nSearch"+a);var b=$("#txtSearch").val();b.trim()!=""&&a!="-l"&&$.scour.homepage.search()});var a=$("#nSearch-containerB")[0];a&&$("#nSearch-tabsB div").click(function(){a.className="nSearch"+this.id.match(/-./)[0];var b=$("#txtSearchB").val();b.trim()!=""&&$.scour.homepage.search("B")});$("#nSearch-button").click(function(a){a.preventDefault();$.scour.homepage.search()});$("#nSearch-buttonB").click(function(a){a.preventDefault();$.scour.homepage.search("B")});!userSettings.surveyVisited&&$("#topcornerfeedback").show();try{document.title=gTerm+" - Scour Search"}catch(e){}if(userSettings.username!=""){$("#welcome_user_name").html(userSettings.username);$("#welcome_user").show();$("#points_logout").show()}else{$("#sign_in_user").show();$("#new_user").show()}$("#nSearch-tabs>div").click(function(){if($("#nSearch-container").hasClass("nSearch-l")){$txt=$("#txtSearch");$txt.val()==""&&$txt.addClass("grey").val("ex: pizza, dentist, salon");$txt=$("#localSearchArea");$txt.val()==""&&$txt.addClass("grey").val("ex: Los Angeles, CA or 90025")}else{$txt=$("#txtSearch");$txt.val()=="ex: pizza, dentist, salon"&&$txt.removeClass("grey").val("");$txt=$("#localSearchArea");$txt.val()=="ex: Los Angeles, CA or 90025"&&$txt.removeClass("grey").val("")}});$("#txtSearch").focus(function(){if($("#nSearch-container").hasClass("nSearch-l")){$txt=$("#txtSearch");$txt.val()=="ex: pizza, dentist, salon"&&$txt.removeClass("grey").val("")}});$("#txtSearch").blur(function(){if($("#nSearch-container").hasClass("nSearch-l")){$txt=$("#txtSearch");$txt.val()==""&&$txt.addClass("grey").val("ex: pizza, dentist, salon")}});$("#localSearchArea").focus(function(){if($("#nSearch-container").hasClass("nSearch-l")){$txt=$("#localSearchArea");$txt.val()=="ex: Los Angeles, CA or 90025"&&$txt.removeClass("grey").val("")}});$("#localSearchArea").blur(function(){if($("#nSearch-container").hasClass("nSearch-l")){$txt=$("#localSearchArea");$txt.val()==""&&$txt.addClass("grey").val("ex: Los Angeles, CA or 90025")}});gSubID==0&&userSettings.showSerpsRealtimeNoticePsst&&$("#scour-tip").fadeIn("slow");$("#pager-count-close-tip").click(function(a){a.preventDefault();userSettings.showPageNumberHint=false;cookies.saveSettings();$("#pagerinfo").fadeOut("slow")});$(".scour-tip-close, #psstInvites").click(function(a){a.preventDefault();$("#scour-tip").fadeOut("slow");userSettings.showSerpsRealtimeNoticePsst=false;cookies.saveSettings()});$("#verifyEmailNow, #verifyaccount-header-link").click(function(a){a.preventDefault();$("#verifyemailmodal").modal({close:false,overlayId:"report-overlay",containerId:"report-container"})});$("#verifymodal-resendverification").click(function(a){a.preventDefault();$.ajax({url:"/services/resendverification",data:null,type:"post",cache:false,dataType:"json",complete:function(){$("#verifymodal-notificationsent").fadeIn()}})});$.historyInit(searchPageLoaded,window.location.href);$(".havehistory").live("click",function(){var a=this.href;a=a.replace(/^.*#/,"");$.historyLoad(a);return false})}$(document).ready(function(){if(false&&window.userSettings.checkBCT){var a=document.createElement("script");a.src="/js/bct-min.js";a.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(a)}});function searchPageLoaded(b){var a=Number(b);if(searcher.searchType=="web")searcher.showPage(a-1);else searcher.searchType=="images"&&searcher._imageWrapper.loadPage(a)}function showSignupPopup(){$("#wannasignup").modal({overlayId:"wannasignup-overlay",containerId:"wannasignup-container"});$("#wannasignup-close, #wannasignup-no").click(function(a){a.preventDefault();userSettings.showpostfirstsearchpopup=false;cookies.saveSettings();$.modal.close()});$("#wannasignup-overlay").click(function(){$.modal.close()});$("#wannasignup-yes").click(function(a){a.preventDefault();$.modal.close();showSignupModal()})}function showSignupModal(){$("#signupinitial").modal({overlayId:"signup-overlay",onClose:showPostFirstSearchPopupClose,onOpen:showPostFirstSearchPopupOpen});$("#signupinitial").html('<center><iframe id="signupinitialpopup" height="700" width="730" frameborder="0" marginwidth="0" src="http://scour.com/signup/popup"></iframe></center>')}function closeSignupPopup(){userSettings.showpostfirstsearchpopup=false;cookies.saveSettings();$.modal.close()}function showPostFirstSearchPopupOpen(b){b.overlay.fadeIn(200);var a=710;if($(window).height()<a+50)a=$(window).height()-50;b.container.animate({height:a});$("#signupinitialpopup").animate({height:a});$("#signupinitial").animate({height:a/2})}function showPostFirstSearchPopupClose(a){userSettings.showpostfirstsearchpopup=false;cookies.saveSettings();a.data.fadeOut("slow",function(){a.container.slideUp("slow",function(){a.overlay.fadeOut("slow",function(){$.modal.close()})})})}var pageTracker=null;function gaSSDSLoad(d){var c="https:"==document.location.protocol?"https://ssl.":"http://www.",a;a=document.createElement("script");a.src=c+"google-analytics.com/ga.js";a.type="text/javascript";a.onloadDone=false;function b(){pageTracker=_gat._getTracker(d);pageTracker._trackPageview()}a.onload=function(){a.onloadDone=true;b()};a.onreadystatechange=function(){if(("loaded"===a.readyState||"complete"===a.readyState)&&!a.onloadDone){a.onloadDone=true;b()}};document.getElementsByTagName("head")[0].appendChild(a)}Date.prototype.formatDate=function(a){var c=this;if(!a)a="MM/dd/yyyy";var e=c.getMonth()+1,d=c.getFullYear();a=a.replace("MM",e.toString().padL(2,"0"));if(a.indexOf("yyyy")>-1)a=a.replace("yyyy",d.toString());else if(a.indexOf("yy")>-1)a=a.replace("yy",d.toString().substr(2,2));a=a.replace("dd",c.getDate().toString().padL(2,"0"));var b=c.getHours();if(a.indexOf("t")>-1)if(b>11)a=a.replace("t","pm");else a=a.replace("t","am");if(a.indexOf("HH")>-1)a=a.replace("HH",b.toString().padL(2,"0"));if(a.indexOf("hh")>-1){if(b>12)b-12;if(b==0)b=12;a=a.replace("hh",b.toString().padL(2,"0"))}if(a.indexOf("mm")>-1)a=a.replace("mm",c.getMinutes().toString().padL(2,"0"));if(a.indexOf("ss")>-1)a=a.replace("ss",c.getSeconds().toString().padL(2,"0"));return a};String.repeat=function(d,c){for(var a="",b=0;b<c;b++)a+=d;return a};String.prototype.padL=function(a,b){if(!a||a<1)return this;if(!b)b=" ";var c=a-this.length;return c<1?this.substr(0,a):(String.repeat(b,c)+this).substr(0,a)};String.prototype.padR=function(a,b){if(!a||a<1)return this;if(!b)b=" ";var c=a-this.length;c<1&&this.substr(0,a);return(this+String.repeat(b,c)).substr(0,a)};var localsearchmap={map:null,directions:null,attachMarker:function(e,d,c){var b={},a=new GMarker(e,b);GEvent.addListener(a,"click",function(){a.openInfoWindowHtml("<div><strong>"+c+"</strong></div>"+d)});localsearchmap.map.addOverlay(a)},clear:function(){$("#map").html("").show();$("#direction_messages").html("").show();$("#directions").html("").show()},directionsLoaded:function(){},handleDirectionsError:function(){var b=localsearchmap.directions.getStatus().code,a="ddd";if(b==G_GEO_UNKNOWN_ADDRESS)a="No corresponding location could be found for one of the specified addresses. This can be caused by the address being relatively new, or it may be incorrect. Please check your address again.";else if(b==G_GEO_SERVER_ERROR)a="Your request failed to process correctly.  Please try again.";else if(b==G_GEO_MISSING_QUERY)a="You must enter a start address. Please try again.";else if(b==G_GEO_BAD_REQUEST)a="We were not able to locate the address you entered please update your location and try again.";else a="Unknown error occurred. Please try again.";a!=""&&$("#direction_messages").html(a).fadeIn("slow")},initialize:function(){localsearchmap.map=new GMap2(document.getElementById("map"));localsearchmap.map.enableScrollWheelZoom();localsearchmap.map.addControl(new GLargeMapControl);localsearchmap.map.addControl(new GMapTypeControl);var a=$("#start-location").val(),b=$("#location-address").val(),c=$("#location_name").val();if(a!=undefined&&a!=""){localsearchmap.directions=new GDirections(localsearchmap.map,document.getElementById("directions"));GEvent.addListener(localsearchmap.directions,"error",localsearchmap.handleDirectionsError);GEvent.addListener(localsearchmap.directions,"load",localsearchmap.directionsLoaded);localsearchmap.directions.load(a+" to "+b,{locale:"en_US"})}else localsearchmap.showAddress(b,c)},showAddress:function(a,b){var c=new GClientGeocoder;c.getLatLng(a,function(c){if(c){localsearchmap.map.setCenter(c,14);localsearchmap.attachMarker(c,a,b)}else{$("#direction_messages").html("Unable to load address.");$("#map").hide()}})}}