var displayNotLoggedInError;var closeDialogWindow;var openLoginWindow;var openRegistrationWindow;var openAddFavoriteWindow;var addTagToUserTagsInput;var searchBarRewrite;var IE6=false
/*@cc_on || @_jscript_version < 5.7 @*/
;$(document).ready(function(){jQuery.fn.centerScreen=function(E){var F=this;if(!E){F.css("top",$(window).height()/2-this.height()/2);F.css("left",$(window).width()/2-this.width()/2);$(window).resize(function(){F.centerScreen(!E)})}else{F.stop();F.animate({top:$(window).height()/2-this.height()/2,left:$(window).width()/2-this.width()/2},200,"linear")}};jQuery.fn.clearOnClick=function(){this.blur();this.removeAttr("onclick");this.click(function E(){return false})};jQuery.fn.switchTexts=function(E){this.fadeOut();this.queue(function(){$(this).text(E);$(this).dequeue()});this.fadeIn()};activateInput=function(E){inputBox=$("#"+E);if(inputBox.attr("class")=="inactive"){inputBox.attr("class","active");inputBox.attr("value","")}};updateDialogWindow=function(F,G,E){if(typeof E=="undefined"){E=new Object()}if(E.bIsHTML){$("#dialogContent").html(F)}else{if(E.bIsIFrame){$("#dialogContent").html("<iframe scrolling='no' frameborder='0' width='"+E.iIFrameWidth+"' height='"+E.iIFrameHeight+"' src='"+F+"'></iframe>")}else{if(E.bIsImage){$.get(F,{},function(H){$("#dialogContent").html("<img src='"+F+"'>");setTimeout('$("#modalContainer").centerScreen(true)',200)})}else{$.get(F,{},function(H){$("#dialogContent").html(H);$("#modalContainer").centerScreen(true)})}}}if(G){$(".dialogTitle").html("<p>"+G+"</p>")}else{$(".dialogTitle").html("")}$("#dialogWindow").modal();$("#modalOverlay").click(function(){closeDialogWindow()});$("#modalContainer").centerScreen();if(IE6){scroll(0,0)}};closeDialogWindow=function(){$.modal.close()};displayNotLoggedInError=function(){updateDialogWindow('<p>You must be a registered user to do this.</p><p style="line-height: 20px;">Please <a href="#" onclick="openRegistrationWindow();return false;" class="strongLink">register</a>, or <a href="#" onclick="openLoginWindow();return false;" class="strongLink">log in</a>, it\'s free, takes a sec and<br />will allow you to enjoy all premium QuotesDaddy features.</p>',"Please login",options={bIsHTML:true})};openLoginWindow=function(){updateDialogWindow("/login","Login to QuotesDaddy")};openEditProfileWindow=function(){updateDialogWindow("/edit_profile","Edit your profile",options={bIsIFrame:true,iIFrameWidth:645,iIFrameHeight:365})};openRegistrationWindow=function(){updateDialogWindow("/registration","Join Quotes Daddy")};openAddFavoriteWindow=function(F,E){updateDialogWindow("/quote/add_favorite/"+F+"/"+E,"Add to favorites")};openEmbedQuoteWindow=function(F,E){updateDialogWindow("/widgets/embed_code/"+F+"/"+E,"Embed Quote")};openDeleteQuoteWindow=function(F,E){updateDialogWindow("/delete/quote/"+F+"/"+E,"Delete a Quote")};openShareQuoteWindow=function(F,E){updateDialogWindow("/quote/share/"+F+"/"+E,"")};openSearchHelpWindow=function(){updateDialogWindow('<div style="width:725px; margin: 10px;"><p><strong>You can search Quotes Daddy:</strong></p><br /><p><strong>by tag</strong>, to find all quotes tagged with one or more of the tags you enter.</p><br /><p><small>*Tags, those words or phrases you see under each quote, are simply words that describe what the quote is about or related to. Tags are chosen by QuotesDaddy users like you, and make finding quotes easier and more intuitive. When you add a quote to your favorites, tag it with words that will help you find it next time you need it.</small></p><br /><p>For example: to find <strong>funny</strong> quotes about <strong>love</strong> enter "<strong>love</strong>, <strong>funny</strong>" into the search box.</p><br /><p><strong>By author</strong>, to find all quotes by a specific author.</p><br /><p><strong>By quote</strong>, to find a quote when you remember only a part of it. Just enter the part of the quote you do remember, and we\'ll find the complete quote for you.</p><br /><p>You can also try our <a href="/search_advanced">advanced search</a>.</p></div>',"",options={bIsHTML:true})};openReportQuoteWindow=function(F,E){updateDialogWindow("/report_problem/"+F+"/"+E,"")};openWidgetCodeWindow=function(F){var E=new Array("tag","title","username");url="/widgets/code";for(i in E){if(F.hasOwnProperty(E[i])){value=$.trim(F[E[i]]);if(value.length==0){value="null"}url+="/"+value}else{url+="/null"}}updateDialogWindow(url,"")};openGreetingLinkWindow=function(E){url="/greeting/show_link/"+encodeURIComponent(E.replace(/\./g,"___"));updateDialogWindow(url,"")};initUserTagsInput=function(){$("#popularTagsList a").each(function(E,F){jQuery(F).removeClass("selectedTag")});value=$("#user_tags").val();tags=value.split(",");$.each(tags,function(E,F){$("#popularTagsList a").each(function(G,H){if(jQuery(H).text().toLowerCase()==$.trim(F).toLowerCase()){jQuery(H).addClass("selectedTag")}})})};addTagToUserTagsInput=function(E){E=$.trim(E);value=$("#user_tags").val();tags=value.split(",");results=[];foundTag=false;$.each(tags,function(F,G){G=$.trim(G);if(G.length>0&&G!=E){results.push(G)}if(G==E){foundTag=true}});if(!foundTag){results.push(E)}$("#user_tags").val(results.join(", "));initUserTagsInput()};searchBarRewrite=function(G,F,E){E=$.trim(E);if(E.length>=2&&E!="enter your search here"){E=encodeURIComponent(E);newUrl=F;newUrl=newUrl.replace("__search_phrase__",E);G.action=newUrl;location.href=newUrl;return false}else{alert("Please enter a search phrase at least 3 letters long.");return false}};toggleLoading=function(G,F,E){set_indicator_status(true,G);if(F.length>0){disableButton(F,E)}};set_indicator_status=function(E,F){if(F==null){F="load_indicator"}if(E){$("#"+F).show()}else{$("#"+F).hide()}};disableButton=function(F,E){button=$("#"+F);button.attr("disabled","disabled");if(E!=null&&E.length>0){button.val(E)}return true};toggleSearchTypeChange=function(){iSearchTypeSelected=$("#searchType").val();$("div#searchType_0_help").hide();$("div#searchType_1_help").hide();$("div#searchType_2_help").hide();$("div#searchType_"+iSearchTypeSelected+"_help").show();for(i=0;i<=2;i++){if($("#searchphrase").val()!=""){$("#searchphrase_"+i).val($("#searchphrase").val())}if(i==iSearchTypeSelected){$("#searchphrase_"+i).show()}else{$("#searchphrase_"+i).hide()}}$("div#searchType_"+iSearchTypeSelected+"_help").show()};$("#searchType").change(function(){toggleSearchTypeChange()});$("#searchphrase_0").keypress(function(){$("#searchphrase").val($("#searchphrase_0").val())});$("#searchphrase_1").keypress(function(){$("#searchphrase").val($("#searchphrase_1").val())});$("#searchphrase_2").keypress(function(){$("#searchphrase").val($("#searchphrase_2").val())});$("#searchphrase_1").autocomplete("/autocomplete/author",{minChars:2,matchSubset:0,matchContains:1,cacheLength:10,onItemSelect:B,formatItem:C,selectOnly:1});$("#searchphrase_0").autocomplete("/autocomplete/tag",{minChars:2,matchSubset:0,matchContains:1,cacheLength:10,onItemSelect:D,formatItem:A,selectOnly:1});function B(E){$("#searchphrase").val($("#searchphrase_1").val())}function D(E){sNewTag=$(E).text();aOldTags=$("#searchphrase").val();aOldTags=aOldTags.split(",");if(aOldTags.length){aOldTags.pop();aOldTags.push(sNewTag)}sNewTagString="";$.each(aOldTags,function(F,G){sNewTagString+=$.trim(G)+", "});$("#searchphrase_0").val(sNewTagString);$("#searchphrase").val(sNewTagString);$("#searchphrase_0").focus()}function C(E){return E[0]+" <i>"+E[1]+"</i>"}function A(E){return E[0]}toggleSearchTypeChange()});