/*!
 * jQuery.drhyme - Plugin for www.d-rhyme.de
 * Copyright 2009-2011, Dirk Koester 
 * Version 1.54
 * Last modified: 31.01.2012 
 * http://www.dirkoester.de/
 */
(function(a){var k=[],g=!1,h=!0,j=!1,l=[8,32,37,39,59,219,192,222];Array.prototype.has=function(a){for(i=0;i<this.length;i++)if(this[i]==a)return!0;return!1};a.fn.panorama=function(b){var c=this,e=(void 0==b?"":b)+"img/dheader_"+a.random(1,19)+".gif";a("<img />").attr("src",e).load(function(){c.each(function(){a(this).css("backgroundImage","url("+e+")");a(this).hide().fadeIn("slow")})});return this};a.fn.onlyCharacters=function(){return this.each(function(){a(this).keydown(function(a){var c=a.which; (65>c||90<c)&&!l.has(c)&&a.preventDefault()})})};a.fn.loadFrame=function(b,c){return this.each(function(){a(this).attr("src",b);a(this).load(function(){a.isFunction(c)&&c.call(this)})})};a.fn.limitTheChars=function(b,c){return this.each(function(){a(this).keypress(function(e){var d=a(this).val(),f=d.length;if(a.isReturn(e)&&a(this).val().split("\n").length>=a(this).attr("rows"))return!1;if(f>b)return a(this).val(d.substr(0,b)),!1;a("#"+c).html(b-f+" Zeichen \u00fcbrig.");return!0});a(this).bind("paste", function(){a.cutText(a(this),c,b)})})};a.cutText=function(b,c,e){setTimeout(function(){var d=b.val(),f=d.length;if(f>e)return b.val(d.substr(0,e)),!1;a("#"+c).html(e-f+" Zeichen \u00fcbrig.");return!0},100)};a.random=function(a,c){return a+parseInt(Math.random()*(c-a+1))};a.isReturn=function(a){return 13==a.which?!0:!1};a.checkQuery=function(b,c){a.isReturn(b)&&c()};a.executeQuery=function(b){b=null==b?a("#query-inputtext").val():b;0<b.length?(a("#query-submit-button").removeClass("icon"),a("#query-submit-button").addClass("spin"), a("#footer").hide(),a("#news").fadeOut("fast"),a("#last").fadeOut("fast"),a.performRequest(b)):a("#query-inputtext").focus()};a.executeWord=function(){var b=a("#query-inputtext-word").val();if(0<b.length){a("#query-submit-button").removeClass("icon");a("#query-submit-button").addClass("spin");var c=a("input[name='dword_radio']:checked").val();a.performRequestWord(b,c)}else a("#query-inputtext-word").focus()};a.executeAnagram=function(){var b=a("#query-anagram-text").val();if(0<b.length){a("#query-submit-button-anagram").removeClass("icon"); a("#query-submit-button-anagram").addClass("spin");var c=a("input[name='danagram_radio']:checked").val();a.performRequestAnagram(b,c)}else a("#query-anagram-text").focus()};a.executeGap=function(){a("#submit-gap").addClass("spin");var b=a.getGaptext();a.get("../src/get-gap.php",{gap:b},function(b){a("#result-con").html(b);a("#result").fadeIn();a.goolTip();a("#submit-gap").removeClass("spin")})};a.executeGenerator=function(){a("#query-submit-button").removeClass("icon");a("#query-submit-button").addClass("spin"); var b=a("input[name='dlab_radio']:checked").val(),c=a("select.dlan option:selected").val();a.get("../src/get-wordgenerator.php",{len:b,lan:c},function(b){a("#result-con").html(b);a("#result").fadeIn();a.goolTip();a("#query-submit-button").removeClass("spin");a("#query-submit-button").addClass("icon")})};a.executeNameGenerator=function(){a("#query-submit-button-name").removeClass("icon");a("#query-submit-button-name").addClass("spin");var b=a("input[name='dlab_radio_sex']:checked").val(),c=a("select.dname option:selected").val(); a.get("../src/get-namegenerator.php",{flavor:c,sex:b},function(b){a("#result-con").html(b);a("#result").fadeIn();a.goolTip();a("#query-submit-button-name").removeClass("spin");a("#query-submit-button-name").addClass("icon")})};a.getGaptext=function(){var b="";a(".gap-container").each(function(){var c=a(this).find(".gapElement");b+=""==c.val()?"*":c.val()});return x=b.replace(/[^a-zA-Z\u00f6\u00e4\u00fc\u00dc\u00c4\u00d6\u00df]/g,".{1}")};a.performRequest=function(b){var c=null;g&&(c=a.getSelectedCheckboxes()); a.get("src/get-rhyme.php",{rhyme:b,"aparams[]":c},function(b){a("#result-con").html(b);a("#result").show();a.goolTip();a("#query-submit-button").removeClass("spin");a("#query-submit-button").addClass("icon");a("#footer").show()})};a.goolTip=function(){a("#table").find("td").click(function(){window.open("http://www.google.de/#hl=de&q="+a(this).html(),"_blank")});a("#table").find("td").hover(function(b){a("body").append("<div id='tooltip'><div id='google' class='s-icon'></div> <span class='tt'>"+a(this).html()+ "</span></div>");a("#tooltip").css("top",b.pageY-15+"px").css("left",b.pageX+15+"px").fadeIn("fast")},function(){a("#tooltip").remove()})};a.fn.hinttip=function(b){a(this).hover(function(c){a("body").append("<div id='hinttip'>Finde ich "+b+"!</div>");a("#hinttip").css("top",c.pageY-10+"px").css("left",c.pageX+10+"px").fadeIn("fast")},function(){a("#hinttip").remove()})};a.performRequestWord=function(b,c){var e=null;g&&(e=a.getSelectedCheckboxes());a.get("../src/get-word.php",{word:b,mode:c,"aparams[]":e}, function(b){a("#result-con").html(b);a("#result").fadeIn();a.goolTip();a("#query-submit-button").removeClass("spin");a("#query-submit-button").addClass("icon")})};a.performRequestAnagram=function(b,c){var e=a("#wkey").val(),d=a("#container").data("ukey");a.get("../src/get-anagram.php",{ana:b,mode:c,wkey:e,ukey:d},function(b){a("#result-con").html(b);a("#result").show();a.goolTip();a("#query-submit-button-anagram").removeClass("spin");a("#query-submit-button-anagram").addClass("icon")})};a.gapMinus= function(){a(".gap-container").last().remove();a.validateGap()};a.gapPlus=function(){$newgap=a(".gap-container").first().clone().appendTo("#gap-area").find(".gapElement");$newgap.val("").onlyCharacters();$newgap.bind("keypress",function(b){a.checkQuery(b,a.executeGap)});$newgap.parent().click(function(){a(this).find(".gapElement").select()});a.validateGap()};a.validateGap=function(){var b=a(".gap-container").length;2>=b?(j=!0,a("#bn-minus").unbind("click"),a("#bn-minus").addClass("disabled")):10<= b?(j=!0,a("#bn-plus").unbind("click"),a("#bn-plus").addClass("disabled")):j&&(a("#bn-plus").removeClass("disabled"),a("#bn-minus").removeClass("disabled"),a("#bn-minus").unbind("click"),a("#bn-plus").unbind("click"),a("#bn-minus").click(function(){a.gapMinus()}),a("#bn-plus").click(function(){a.gapPlus()}),j=!1)};a.assembleNews=function(a){for(var c="",e=a.length,d=0;d<e;d++)c+="<div class='news-icon icon'></div><span class='news-date'>"+a[d].date+"</span><div class='news-title'>"+a[d].title+"</div><div class='news-text'>"+ a[d].text+"</div>";return c};a.assembleLast=function(b){for(var c="",e=b.length,d=0;d<e;d++)c+="<span class='lqs ia t"+a.random(1,4)+"'>"+b[d]+" </span>";return c};a.categorySelectAll=function(){a("[name=Kategorien]").attr("checked",!0);a("[name=iscat]").attr("disabled",!1);a("#category_select_txt").html(" Auswahl aufheben");a("#category_select_bn").unbind("click");a("#category_select_bn").click(function(){a.categoryDeselectAll()});a("#category_select_bn").addClass("deselect")};a.categoryDeselectAll= function(){a("[name=Kategorien]").attr("checked",!1);a("[name=iscat]").attr("disabled",!0);a("[name=iscat]").attr("checked",!0);a("#category_select_txt").html(" Alle ausw\u00e4hlen");a("#category_select_bn").removeClass("deselect");a("#category_select_bn").unbind("click");a("#category_select_bn").click(function(){a.categorySelectAll()})};a.getSelectedCheckboxes=function(){var b=[],c=[],e="null";a(".ckcat:checked").each(function(){b.push(a(this).val())});a("#chkpp").is(":checked")?a(".cktyp:checked").each(function(){c.push(a(this).val())}): c.push("null");a(".cksyl").is(":checked")&&(e=a(".myradios:checked").val());return[b,c,e]};a.advancedSearch=function(b){b=void 0==b||!1==b?"":"../";g&&h?(g=h=!1,a("#query-advanced").slideUp("slow",function(){a("#query-advanced-button").removeClass("standard");h=!0})):!g&&h&&(h=!1,g=!0,a("#query-submit-button").removeClass("icon"),a("#query-submit-button").addClass("spin"),a.get(b+"src/advanced-searchoptions.php",{},function(b){a("#query-advanced").hide().html(b);a("#query-submit-button").removeClass("spin"); a("#query-submit-button").addClass("icon");a("[name=iscat]").attr("disabled",!0);a("#category_select_bn").click(function(){a.categorySelectAll()});a("#query-advanced-button").addClass("standard");a("[name=Kategorien]").click(function(){var b=a("[name=Kategorien]:checked").length,c=a("[name=Kategorien]").length;0==b?(a("[name=iscat]").attr("disabled",!0),a("[name=iscat]").attr("checked",!0),a.categoryDeselectAll()):b==c?a.categorySelectAll():a("[name=iscat]").attr("disabled",!1)});a("[name=typ]").click(function(){0== a("[name=typ]:checked").length&&(a("#chkpp").val(0),a("#chkpp").attr("checked",!1),a("[name=typ]").attr("disabled",!0))});a("#chky").change(function(){0==a(this).val()?(a(this).val(1),a(".myradios").attr("disabled",!1)):(a(this).val(0),a(".myradios").attr("disabled",!0))});a("#chkpp").change(function(){0==a(this).val()?(a(this).val(1),a(".cktyp").attr("checked",!0),a(".cktyp").attr("disabled",!1)):(a(this).val(0),a(".cktyp").attr("disabled",!0))});a("#query-advanced").fadeIn();h=!0}))};a.voteTipp= function(b,c,e,d){a.post("../src/vote-store.php",{id:b,key:c,date:e},function(a){"SUCCESS"==a?(a="+"+(parseInt(d.html().substring(1))+1).toString(),d.html(a)):d.find(".vote-loader").remove()})};a.voteLyric=function(b,c,e,d,f){a.post(f+"../src/vote-store-lyric.php",{id:b,key:c,date:e},function(a){"SUCCESS"==a?(a="+"+(parseInt(d.html().substring(1))+1).toString(),d.html(a)):d.find(".vote-loader").remove()})};a.showSocial=function(){var b=window.innerWidth;void 0==b&&(b=document.body.offsetWidth);1069< b?1260<b?(a("#site-right").fadeIn(),a("#site-left").fadeIn()):(a("#site-right").fadeOut(),a("#site-left").fadeOut()):(a("#site-right").fadeOut(),a("#site-left").fadeOut())};a.shadowbox_show=function(b){var c={width:"720px",height:"680px",player:"html",options:{overlayOpacity:0.65,overlayColor:"#000",viewportPadding:0,enableKeys:!1,displayNav:!1}};b&&a.extend(c,b);Shadowbox.open(c)};a.shadowbox_modal=function(a,c){Shadowbox.open({content:"<div id='hint-sub-con'>"+a+"</div>",width:"320px",height:"130px", player:"html",options:{overlayOpacity:0.65,overlayColor:"#000",viewportPadding:0,displayNav:!1}});c&&0!=c&&setTimeout("Shadowbox.close();",c)};a.initVotes=function(){var b=a("#stoken").val();a.getJSON("../src/vote-gateway.php",{token:b},function(b){if("true"==b[0].status){var e=b[0].dis;a(".hint").each(function(){-1==a.inArray(a(this).data("id"),e)&&($vc=a(this).find(".vote-con"),$vc.removeClass("disabled"),$vc.hinttip("hilfreich"),$vc.click(function(){$pa=a(this).parent().parent();a(this).unbind("click"); a(this).addClass("disabled");a.voteTipp($pa.data("id"),$pa.data("key"),$pa.data("date"),a(this));$vl=a("<div class='vote-loader'></div>");a(this).append($vl)}))})}})};a.initVotesLyric=function(b){var b=void 0==b?"":b,c=a("#ltoken").val();a.getJSON(b+"../src/vote-lyric-gateway.php",{token:c},function(c){if("true"==c[0].status){var d=c[0].dis;a(".lyric").each(function(){-1==a.inArray(a(this).data("id"),d)&&($vc=a(this).find(".vote-con"),$vc.removeClass("disabled"),$vc.hinttip("gut"),$vc.click(function(){$pa= a(this).parent().parent();a(this).unbind("click");a(this).addClass("disabled");a.voteLyric($pa.data("id"),$pa.data("key"),$pa.data("date"),a(this),b);$vl=a("<div class='vote-loader'></div>");a(this).append($vl)}))})}})};a.fn.borderDefault=function(){return this.each(function(){a(this).css("border","1px solid #8B92A0")})};a.fn.borderHighlight=function(){return this.each(function(){a(this).css("border","1px solid #ff0000")})};a.newHintRequest=function(){if(a.checkHintSubmit()){a("#hint-fb").addClass("hint-fb-loading"); var b=a("#hint-sub-con").data("skey"),c=a("#hint-select-type").find("option:selected").val(),e=a("#hint-select-cat").find("option:selected").val(),d=a("#hint-select-title").val(),f=a("#hint-select-content").val(),g=a("#hint-select-name").val(),h=a("#hint-select-web").val(),j=a("#hint-anonymus").attr("checked")?!0:!1;a.post("../src/hint-gateway.php",{key:b,type:c,cat:e,title:d,cnt:f,name:g,web:h,anonymus:j},function(b){a("#hint-fb").removeClass("hint-fb-loading");"SUCCESS"==b?a("#hint-fb").html("Deine Daten wurden erfolgreich \u00fcbertragen."): a("#hint-fb").html("Es trat ein Fehler auf.");setTimeout("Shadowbox.close();",1500)})}};a.newLyricRequest=function(b){if(a.checkLyricSubmit()){a("#hint-fb").addClass("hint-fb-loading");var c=a("#hint-sub-con").data("skey"),e=a("#lyric-select-title").val(),d=a("#lyric-select-content").val(),f=a("#lyric-select-name").val(),g=a("#lyric-select-web").val(),h=a("#lyric-anonymus").attr("checked")?!0:!1;a.post(b+"../src/lyric-gateway.php",{key:c,title:e,cnt:d,name:f,web:g,anonymus:h},function(b){"SUCCESS"== b?(Shadowbox.close(),location.reload()):(a("#hint-fb").html("Es trat ein Fehler auf."),setTimeout("Shadowbox.close();",1500))})}};a.executeHintSearch=function(){var b=a("#query-hint-text").val();a("#query-submit-button-anagram").addClass("spin");a.get("../src/hint-search.php",{q:b},function(b){a("#query-submit-button-anagram").removeClass("spin");"EMPTY"==b?a.shadowbox_modal("<br />Die Suche lieferte leider kein Ergebnis. <br />Nimm bitte einen anderen Suchbegriff.",3E3):a("#hints").fadeOut("fast", function(){a(this).html(b).fadeIn("fast");a.initVotes()})})};a.suggestNewHint=function(){a("#hint-new-button").addClass("spin");a.get("../src/hint-mask.php",function(b){a("#hint-new-button").removeClass("spin");a.shadowbox_show({content:b,options:{enableKeys:!1,onFinish:function(){a("#hint-select-content").limitTheChars(500,"hint-content-limit");a("#hint-btn-abort").click(function(){Shadowbox.close()});a("#hint-btn-submit").click(function(){a.newHintRequest()});a("#hint-anonymus").click(function(){a(this).attr("checked")? a("#hint-personal-data").slideUp("fast"):a("#hint-personal-data").slideDown("fast")});a("#hint-select-type").change(function(){a(this).find("option:first").remove();a(this).unbind("change")});a("#hint-select-cat").change(function(){a(this).find("option:first").remove();a(this).unbind("change")})}}})})};a.suggestNewLyric=function(b){b=void 0==b?"":b;a("#hint-new-button").addClass("spin");a.get(b+"../src/lyric-mask.php",function(c){a("#hint-new-button").removeClass("spin");a.shadowbox_show({content:c, height:"600px",options:{enableKeys:!1,onFinish:function(){a("#lyric-select-content").limitTheChars(400,"lyric-content-limit");a("#lyric-btn-abort").click(function(){Shadowbox.close()});a("#lyric-btn-submit").click(function(){a.newLyricRequest(b)});a("#lyric-anonymus").click(function(){a(this).attr("checked")?a("#lyric-personal-data").slideUp("fast"):a("#lyric-personal-data").slideDown("fast")})}}})})};a.checkLyricSubmit=function(){var b=!0;$title=a("#lyric-select-title");$content=a("#lyric-select-content"); $accept=a("#lyric-accept");$title.borderDefault();$content.borderDefault();a(".lyric-check:first").css("color","#39414A");""==a.trim($title.val())&&(b=!1,$title.borderHighlight());""==a.trim($content.val())&&(b=!1,$content.borderHighlight());$accept.attr("checked")||(b=!1,a(".lyric-check:first").css("color","#ff0000"));!b&&""==a("#lyric-select-name").val()&&(a("#lyric-anonymus").attr("checked","true"),a("#lyric-personal-data").slideUp("fast"));return b};a.checkHintSubmit=function(){var b=!0;$title= a("#hint-select-title");$content=a("#hint-select-content");$cat=a("#hint-select-cat");$type=a("#hint-select-type");$accept=a("#hint-accept");$title.borderDefault();$content.borderDefault();$cat.borderDefault();$type.borderDefault();a(".hint-check:first").css("color","#39414A");""==a.trim($title.val())&&(b=!1,$title.borderHighlight());""==a.trim($content.val())&&(b=!1,$content.borderHighlight());-1==$cat.find("option:selected").val()&&(b=!1,$cat.borderHighlight());-1==$type.find("option:selected").val()&& (b=!1,$type.borderHighlight());$accept.attr("checked")||(b=!1,a(".hint-check:first").css("color","#ff0000"));!b&&""==a("#hint-select-name").val()&&(a("#hint-anonymus").attr("checked","true"),a("#hint-personal-data").slideUp("fast"));return b};a.preload=function(){for(var a=arguments.length;a--;){var c=document.createElement("img");c.src=arguments[a];k.push(c)}}})(jQuery);
