text: ;var tamer={curT:-1,curC:-1,curU:-1,popObjs:{},loading:!1,logout:function(){var i=document.cookie.split(";");for(var e=0;e<i.length;e++){var t=i[e],a=t.indexOf("="),r=a>-1?t.substr(0,a):t;document.cookie=r+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT"}},updateAllEvents:function(){taFormer.applySubmitCheck();tamer.searchPopLinks(document);tamer.initAutoPagination();taFormer.applyCommentEvents();tamer.scaleImages($("#centerWell"))},changeGroup:function(t){var e=tautils.upParam("cgid",t);location.href=e},initAutoPagination:function(){tamer.loading=!1;$(window).scroll(function(){var t=$(".paginationBtn:first");if(t.length<1)return!1;if(tamer.loading===!0)return!1;var a=$(window).scrollTop(),i=t.offset().top;if(a+$(window).height()-t.height()>i){var e=parseInt(t.attr("data-want"));if(e<1){$(window).unbind("scroll");return!1};tamer.loading=!0;t.click()}})},playlistPagination:function(t){tautils.showPagePreloader(!0);var o=t.attr("id"),e=parseInt(t.attr("data-want")),a=parseInt(t.attr("data-from")),r=parseInt(t.attr("data-total"));a+=e;if(a>=r){t.attr("data-want",0);t.hide();$(window).unbind("scroll")}
  else{var i=r-a;if(i-e<=0){e=i;t.attr("data-want",e);$(window).unbind("scroll");t.hide()}
  else{if(i<=e){e=i;t.find(".ctaBtn").html("Show Last "+e)}
  else t.find(".ctaBtn").html("Show Next "+e);t.find(".pagerLoader").hide();t.attr("data-want",e);t.attr("data-from",a)};$.ajax({type:"GET",crossDomain:!0,url:t.attr("data-method"),data:{"from":a,"want":e},dataType:"html"}).done(function(t){$(t).insertBefore("#"+o);tamer.scaleImages($("#centerWell"))}).always(function(){$("#pagePreloader").fadeOut("fast");tamer.loading=!1})}},trackPagination:function(t){tautils.showPagePreloader(!0);var r=t.attr("data-cid"),i=parseInt(t.attr("data-from")),a=parseInt(t.attr("data-want")),e=t.attr("data-total"),o=t.attr("data-method");if(e<=0)t.hide();$.ajax({type:"POST",crossDomain:!0,url:o,data:{"cid":r,"from":(i+a),"want":a},dataType:"html"}).done(function(r){$(".olPlaylist").append(r);t.find(".pagerLoader").hide();e=(e-(i+a));if(e<=0)t.hide();else{t.find(".ctaBtn").html("Show More ("+e+")");t.attr("data-from",i+a)}}).always(function(){$("#pagePreloader").fadeOut("fast")})},awardPagination:function(t){var e=t.attr("data-cid"),a=t.attr("data-exid");tautils.showPagePreloader(!0);$.ajax({type:"POST",crossDomain:!0,url:"/awards/getAwardsByChallenge",data:{"cid":e,"exid":a},dataType:"html"}).done(function(e){t.parents(".listAwardsBlock:first").append(e);t.parents(".topPad:first").remove()}).always(function(){$("#pagePreloader").fadeOut("fast")})},adjCompare:function(t,e){if(t.adj>e.adj)return-1;if(t.adj<e.adj)return 1;return 0},rateCompare:function(t,e){if(t.rat>e.rat)return-1;if(t.rat<e.rat)return 1;return 0},sortChallenges:function(t){var n=t.parent();$(n).find(".cSorter").each(function(){$(this).removeClass("current")});var a=t.attr("data-action"),i=t.attr("data-sdir");t.addClass("current");var r=tautils.qParam("csort"),o=tautils.qParam("sdir");if(a==r&&o==i){return tautils.showNotice("You're already sorting like this")};var e="csort="+a+"&sdir="+i;document.location.href+=(document.location.href.indexOf("?")>-1)?"&"+e:"?"+e},sortPlaylist:function(t){var o=t.parent();$(o).find(".tSorter").each(function(){$(this).removeClass("current")});var i=t.parents(".playlistHolder:first").find(".olPlaylist:first"),r=t.attr("data-action");t.addClass("current");if(r=="myfavs"){tautils.showPagePreloader(!0);$.ajax({type:"GET",crossDomain:!0,url:"/pop/playlist?tar=doAjax&csort=myfavs&cid="+i.attr("data-cid"),dataType:"html"}).done(function(e){t.parents(".playlistsBlock:first").replaceWith(e)}).always(function(){$("#pagePreloader").fadeOut("fast")});return!1};var e=[];$(i).find(".trackItem").each(function(){var t={dom:$(this).clone(!0)};t.adj=$(this).find(".group_adjusted:first").length>0?parseFloat($(this).find(".group_adjusted:first").html()):0;t.rat=$(this).find(".your_rating:first").length>0?parseInt($(this).find(".your_rating:first").html()):0;e.push(t)});if(r=="random")e.sort(function(){return 0.5-Math.random()});else if(r=="adjusted")e.sort(this.adjCompare);else e.sort(this.rateCompare);i.css({height:i.height()});i.html("");for(var a=0;a<e.length;a++){if(e[a]==null)continue;$(e[a].dom).find(".tracknum:first").html(a+1);if(r=="adjusted"){$(e[a].dom).find(".group_adjusted:first").show();$(e[a].dom).find(".your_rating:first").hide()}
  else{$(e[a].dom).find(".group_adjusted:first").hide();$(e[a].dom).find(".your_rating:first").show()};i.append(e[a].dom)}},applySliderEvents:function(){var t=Math.max($(window).height()/1.2,300);$(".pSlideBody").height(t);$("#playerSlide").css({top:-1*t});document.getElementById("pSlideHead").onclick=function(t){var e=0;if(parseInt(document.getElementById("playerSlide").style.top)==0){var e=$(".pSlideBody").height()};$("#playerSlide").animate({top:-1*e},{duration:500})}},toggleProfileImg:function(t,e,i){if(i==!0){document.getElementById("profilepic").value="";$("#menuProfileForm .thumbHolder").html("<span class=\"tmmss camera\"></span>");$("#sampleResetter").hide()}
  else{var a=e.src;if(a.indexOf("/wwwroot")>-1){a=a.substring(a.indexOf("/wwwroot"))};document.getElementById("profilepic").value=t;var r="<img src='"+a+"' />";$("#sampleResetter").show();$("#menuProfileForm .imgInpHolder").html(r);tautils.showNotice("Now close this window and click 'submit' to save your changes.")}},toggleSampleImg:function(t,e){if(e==!0){var o=$(t).parents("form:first");if(o.attr("id")=="cameraForm")document.forms["cameraForm"]["challenge_image"].value="";var r=$("#"+o.attr("id")+" .thumbHolder:first");r.html("<span class=\"tmmss camera\"></span>");if($("#sampleResetter").length>0)$("#sampleResetter").hide();if(typeof FileReader!="undefined"&&typeof t.files!="undefined"&&t.files.length){try{var i=new FileReader();i.onload=function(t){console.log("FileReader loaded"+i.result);r.html("<img width=\"100%\" src=\""+t.target.result+"\" />");tamer.scaleImages(r)};i.readAsDataURL(t.files[0])}catch(n){tautils.tracer(n,"ERROR: filereader failing")}}
  else{}}
  else{var a=t.src;if(a.indexOf("/wwwroot")>-1){a=a.substring(a.indexOf("/wwwroot"))};document.forms["cameraForm"]["challenge_image"].value=a;$("#sampleResetter").show();$("#cameraForm .thumbHolder").html("<img width=\"100%\" src=\""+a+"\" />");tamer.scaleImages($("#cameraForm .thumbHolder"))};return!0},slideSamples:function(){var t=0;if(parseInt(document.getElementById("sampleBlock").style.right)==0){t=-157};$("#sampleBlock").animate({right:t},{duration:500})},loadFBAlbums:function(){tautils.showPagePreloader(!0);$.ajax({type:"GET",crossDomain:!0,url:"/pop/fb/pics",dataType:"json"}).done(function(t){var e=$(obj).parents(".fbPics:first");e.html(t);tamer.searchPopLinks(e)}).always(function(){$("#pagePreloader").fadeOut("fast")})},loadFBPhotos:function(t,e){tautils.showPagePreloader(!0);$.ajax({type:"GET",crossDomain:!0,url:"/pop/fb/pics?album_id="+t,dataType:"json"}).done(function(t){e.html(t)}).always(function(){$("#pagePreloader").fadeOut("fast")})},updateRating:function(t,e,i){if(typeof e=="object"&&typeof e.error=="string"){tautils.showNotice("<p>"+e.error+"</p>")}
  else{var a="<span class=\"instruct\">You rated "+e.uRated+"%</span><p>The new average is "+e.avg+"% from "+e.count+" ratings.</p>";if(typeof e.usercount=="number"){a+="<span class=\"instruct\">The adjusted group average from "+e.count+" vote";a+=(e.count>1)?"s":"";a+=" / "+e.usercount+" eligible = "+parseFloat(e.adj).toFixed(2)+"%</span>"};if(e.count>=(e.usercount/2)&&e.avg>85)a+="<p class=\"instruct\">This challenge has enough votes to start. The Group Admin and Author are setting up the schedule now. Come back soon!</p>";tautils.showNotice(a);var r=(i=="track")?"data-tid":"data-cid";$(".starHolder").each(function(){var a=$(this).attr(r);if(t==a){$(this).find(".starFill:first").attr("style","width:"+(e.avg-5)+"%");$(this).parent().parent().find(".your_rating:first").html(e.avg+"%")}})};tautils.closeNoticeIf()},manageMyProfile:function(t){var o=$("#proPic");if(t=="fbprofilepic"){$("#profilepic").val("fbprofilepic");return!1}
  else if(t=="browse"){$("#profilepic").val("");$("#imageInp").trigger("click");$("#imageInp").change(function(){$(".imgInpHolder:first").html("<span id='proPic' class='tmmss taCharacter'></span>"+$(this).val())});$(".imgInpHolder:first").html("<span id='proPic' class='tmmss taCharacter'></span>");return!1};var r=t.options[t.selectedIndex],a=$(r).attr("data-action"),e=$("#imageInp");if(a=="")return!1;var i=($(r).attr("data-src"))?$(r).attr("data-src"):"";if(i!=""){if(o.prop("tagName").toLowerCase()=="img"){o.attr("src",i)}
  else{o.parent().html("<img id=\"proPic\" class=\"regImg\" src=\""+i+"\" alt=\"profile image\" />")}};if(a=="useavatar"){e.replaceWith(e=e.clone(!0))}
  else if(a=="revokeemails"){}
  else if(a=="suspendaccount"){e.replaceWith(e=e.clone(!0))}
  else return!1},manageMyChallenge:function(t){var i=$(t).parents(".listViewItem:first");if(i.length==0)i=$(t).parents(".gridViewItem:first");if(i.length==0){return!1};var n=$(i).attr("data-title"),a=$(t).val(),r=$(t).get(0),o=$(i).attr("data-cid");if(!a||a=="")return;var e=r.options[r.selectedIndex].innerHTML.toLowerCase();if(e=="schedule"){a=$(t).attr("data-gid");var s={"gid":a,"cid":o};taFormer.getForm("POST","/forms/challenge-scheduler",s);return}
  else if(e=="edit"){taFormer.getForm("GET","/forms/challenge-builder?action=edit&cid="+o+"&gid="+$(i).attr("data-gid"));return}
  else if(!parseInt(a)){if(confirm("Are you sure you want to "+e+" "+n+"?")){if(e=="delete"||(document.location.pathname.indexOf("my-profile")==-1&&e=="hide")){i.attr("id","todelete-c"+o)};tautils.showPagePreloader(!0);$.ajax({type:"GET",crossDomain:!0,url:"/manage/music/move-challenge?cid="+o+"&action="+e,dataType:"json"}).done(function(t){var a="Unknown Error in Managing Challenges";if(typeof t.error=="string")a=t.error;else if(typeof t.msg=="string")a=t.msg;tautils.showNotice(a);if(typeof t.error!="string"){if(e=="delete"||(document.location.pathname.indexOf("my-profile")==-1&&e=="hide")){$("#todelete-c"+t.cid).remove()};if(e=="hide")r.innerHTML="Publish";else if(e=="publish")r.innerHTML="Hide"}}).always(function(){$("#pagePreloader").fadeOut("fast")})}}
  else if(parseInt(a)){if(confirm("Are you sure you want to copy "+n+" into "+e+"?")){tautils.showPagePreloader(!0);$.ajax({type:"POST",crossDomain:!0,url:"/manage/music/dup-challenge",data:{"cid":$(t).attr("data-cid"),"gid":a},dataType:"json"}).done(function(t){var e="Unknown Error in Copying Challenge";if(typeof t.error=="string")e=t.error;else if(typeof t.msg=="string"){e=t.msg};tautils.showNotice(e)}).always(function(){$("#pagePreloader").fadeOut("fast")})}}
  else{}},starClicked:function(t){var e=t.attr("data-status"),n=t.offset().left,o=t.width();if(t.hasClass("bigStarHolder")){n+=20;o-=40}
  else{o-=2};var i=parseInt(((tautils.mouseBounds.x-n)/o)*100),r="",a=t.attr("data-tid");if(e=="track"){t.parents(".track_meta:first").find(".my_rating:first").html("<span class='tmmss checkGreen'></span>"+i+"%");r="/manage/ratings/rateTrack?id="+a+"&rating="+i}
  else if(e=="challenge"||e=="playlist"){a=t.attr("data-cid");r="/manage/ratings/rateChallenge?id="+a+"&rating="+i}
  else{alert("illegal: "+e);return!1};$.ajax({type:"GET",crossDomain:!0,url:r,dataType:"json"}).done(function(t){tamer.updateRating(a,t,e)})},focusRaters:function(t){var i=t.offset().left,a=t.width();if(t.hasClass("bigStarHolder")){i+=20;a-=40}
  else{a-=2};var r=t.find(".starFocus:first"),e=parseInt(((tautils.mouseBounds.x-i)/a)*100);if(e<0)e=0;if(e>100)e=100;r.attr("style","width:"+e+"%");t.attr("title",e);t.mouseleave(function(){tamer.blurRaters(t)})},blurRaters:function(t){t.find(".starFocus:first").attr("style","width:0;")},deleteComment:function(t){var e=t.attr("data-comid");tautils.showPagePreloader(!0);$.ajax({type:"POST",crossDomain:!0,url:"/manage/comments/delete",data:{"comid":e},dataType:"json"}).done(function(t){if(typeof t.errors=="string"){tautils.showNotice(t.errors)}
  else if(typeof t.comid=="number"||typeof t.comid=="string"){$(".comid"+t.comid).remove()}}).always(function(){$("#pagePreloader").fadeOut("fast")})},deleteTrack:function(t){var e=t.attr("data-tid"),a=t.attr("title");if(confirm("Are you sure you want to delete "+a+"?")){t.parents(".mediablock:first").attr("id","todelete-t"+e);tautils.showPagePreloader(!0);$.ajax({type:"GET",crossDomain:!0,url:"/manage/music/delete-track?tid="+e,dataType:"json"}).done(function(t){var e="Unknown Error in Deleting Track";if(typeof t.error=="string")e=t.error;else if(typeof t.msg=="string")e=t.msg;tautils.showNotice(e);if(typeof t.error!="string"&&typeof t.tid=="number"){$("#todelete-t"+t.tid).remove()}}).always(function(){$("#pagePreloader").fadeOut("fast")})}},playOnClick:function(t){var a=tautils.absUGC(t.attr("data-src")),e=t.attr("data-video"),l=t.hasClass("sTitlePlayer");if((!e||e=="")&&a&&a!=""){var s=audiojs.instances["audiojs"+(audiojs.instanceCount-1)];s.load(a);s.play()};if(l){$(".olPlaylist .itemPlaying").addClass("itemNotPlaying");$(".olPlaylist .itemPlaying").removeClass("itemPlaying");var o=t.parents(".trackItem:first");$(o).removeClass("itemNotPlaying");$(o).addClass("itemPlaying");var d=$(o).attr("data-tid");tamer.trackTabById(d,!0)}
  else if(e&&e!=""){var n=t.attr("data-cid"),i=$("#cOverlay"+n);i.html("<span onclick=\"$('#cOverlay"+n+"').fadeOut().html('');\" class=\"closeTrigger tmmss closeG\"></span> <div class=\"vidHolder\"></div>");var r=t.position();r.width=t.width();r.height=t.height();i.css(r).show();i.animate({width:"100%",height:"320px",top:0,left:0,},500,"swing",function(){});youtuber.playYoutube(i.get(0),e);$.ajax({type:"GET",crossDomain:!0,url:"/pop/track/details?tid="+t.attr("data-tid")+"&tar=doAjax",dataType:"html"}).done(function(t){i.append(t)}).fail(tamer.jsonFailure);return!1};if(l){}
  else{tamer.getTrackJson(t.attr("data-tid"),a)};if((!a||a=="")&&(!e||e=="")){tautils.showNotice("The user did not provide the MP3 or Video for this song yet. Please try another")}},json2Player:function(t){if(t==null||typeof t.error!="undefined"||typeof t.track_id=="undefined")return tamer.jsonFailure(t);if((t.track_location==null||t.track_location=="")&&(t.track_youtube==null||t.track_youtube=="")){var l="The user did not provide the MP3 or Video for this song yet. We'll try another.",a=parseInt($("#rStatus").attr("data-skip"));if(!a)a=0;a++;if(a>4){l="It appears this challenge is empty. Click around or change challenges."}
  else{$("#rStatus").attr("data-skip",a);tamer.getNextCTrack(a)};tautils.showNotice(l);return!1};var s=$("#playerSlide").data("track");$("#playnow").html(t.track_title+", <em>"+t.track_artist+"</em>");var n=$("#playerSlide").find(".starFill:first");n.attr("style","width:"+t.track_rating_avg+"%");n.attr("data-tid",t.track_id);$("#playerSlide").find(".starHolder:first").attr("data-tid",t.track_id);$("#playerSlide").find(".your_rating:first").html(t.track_rating_avg+"%");var o=audiojs.instances["audiojs"+(audiojs.instanceCount-1)];if(tautils.absUGC(document.getElementById("audioEl").src)!=tautils.absUGC(t.track_location)){o.load(t.track_location);o.play()}
  else if(o.playing==!1&&t.track_youtube&&t.track_youtube!=""){$(".playerErrorMsg:first").html("<span class='instruct'>Play video using youtube below</span>")}
  else if(o.playing==!1){$(".playerErrorMsg:first").html("<span class='instruct'>click the arrow to play</span>")};if(!t.track_image||t.track_image==""){$("#pDetails").find(".tImage:first").remove()}
  else{if($("#pDetails").has(".tImage").length>0){$("#pDetails").find(".tImage:first").attr("src",t.track_image)}
  else{var r=document.createElement("IMG");r.src=t.track_image;r.className="tImage";r.align="left";$("#pDetails").find(".imgTxtWrap:first").prepend(r)}};var e=$("#pDetails").find(".player_caption");e.find(".track_artist:first").html("<span class='instruct'>Artist:</span> "+t["track_artist"]);if(t.track_album&&t.track_album!="")e.find(".track_album:first").html(" <span class='instruct'>Album:</span> "+t["track_album"]);if(t.track_released&&t.track_released>1000)e.find(".track_released:first").html(" ("+t["track_released"]+")");e.find(".track_added:first").html("<span class='instruct'>Added: "+tautils.fDate(t.track_added,"year")+"</span>");if(typeof s!="object"||s.challenge_id!=t.challenge_id){$("#playerSlide").find(".challenge_title:first").html(t.challenge_title);$("#playerSlide").find(".challenge_title:first").html(t.challenge_title)};var i=e.find(".user:first");if(t.track_status=="example"||t.challenge_status=="compilation"){if(typeof t["track_reason"]=="string"&&t["track_reason"]!="")e.find(".track_reason:first").html(" <span class='instruct'>Reason:</span> "+t["track_reason"]);if(t.win_rating&&t.win_rating>0)e.find(".win_rating:first").html("<span class='instruct'>Win Rating:</span>"+t["win_rating"]+"%");if(typeof t["user_screenname"]=="string"&&t["user_screenname"]!=""){e.find(".user_screenname:first").html(t["user_screenname"]);i.find(".popInfo:first").attr("data-uid",t.user_id);i.show()}
  else i.hide()}
  else i.hide();$("#playerSlide").data("track",t)},jsonFailure:function(t){var e="Unknown Error";if(typeof t=="object"&&typeof t.error=="string")e=t.error;else if(typeof t=="string")e=t;if(e=="")e="Unknown Error. Try refreshing the page.";tautils.showNotice("<p>"+e+"</p>")},getGroupTrack:function(){$.ajax({type:"GET",crossDomain:!0,url:"/json/grouptrack",dataType:"json"}).done(function(t){var e=audiojs.instances["audiojs"+(audiojs.instanceCount-1)];e.load(t.track_location);tamer.json2Player(t)}).fail(tamer.jsonFailure)},getTrackJson:function(t,e){if(!t)return tamer.jsonFailure({"error":"Invalid Track Id."});var i=audiojs.instances["audiojs"+(audiojs.instanceCount-1)],a=$("#playerSlide").data("track"),r={"tid":t};if(typeof a=="object"&&t==a.track_id){if(i.playing==!0&&i.source.volume<.5){tamer.jsonFailure({"error":"Click the speaker icon in the player to raise the volume."})};return!1}
  else if(e&&tautils.absUGC(document.getElementById("audioEl").src)!=tautils.absUGC(e)){i.load(e)};if(typeof a=="object"&&typeof a.challenge_id!="undefined"){r["cCid"]=a.challenge_id};$.ajax({type:"GET",crossDomain:!0,url:"/json/track",data:r,dataType:"json"}).done(tamer.json2Player).fail(tamer.jsonFailure)},getNextCTrack:function(t){if(!t)t=1;var e=$("#playerSlide").data("track");if(typeof e!="object")return!1;var a={"tid":e.track_id,"cid":e.challenge_id,"ord":"rand","dir":t};$.ajax({type:"GET",crossDomain:!0,url:"/json/nexttrack",data:a,dataType:"json"}).done(tamer.json2Player).fail(tamer.jsonFailure)},toggleDetails:function(t){var e=t.attr("data-action"),i=t.parents(".playlistHolder:first"),a=$("#playerSlide").data("track");$(i).find(".trackItem").each(function(){var t=$(this);if(e=="expandall"){t.find(".track_info.track_tab").each(function(){if(!$(this).hasClass("selected_tab")){tamer.trackTabClick($(this))}})}
  else{var i=t.attr("data-tid");if(typeof a=="object"&&a.track_id==i)return!0;t.find(".track_info.track_tab").each(function(){if($(this).hasClass("selected_tab")){tamer.trackTabClick($(this))}})}});if(e=="expandall"){t.html("Hide All Details");t.attr("data-action","collapseall")}
  else{t.html("Show All Details");t.attr("data-action","expandall")}},trackTabClick:function(t){if(t.hasClass("selected_tab"))t.removeClass("selected_tab");else t.addClass("selected_tab");var o=t.attr("data-tid"),e=$("#tInfo"+o);if(e.is(":visible")){e.slideUp()}
  else{var r=e.find(".track_image:first");if(r&&r.length>0){var a=document.createElement("IMG");a.src=r.attr("data-src");a.height=150;a.width=150;a.className="tImage";r.replaceWith(a)};if(t.attr("data-video")&&e.find("iframe:first").length==0){youtuber.playYoutube(t.parents(".trackItem:first").get(0),t.get(0))};var i=e.find(".commentsBlock");if(i&&i.length>0&&i.find(".tCommentList").length==0){$.ajax({type:"GET",crossDomain:!0,url:"/pop/track/comments?tar=doAjax&tid="+o,dataType:"html"}).done(function(t){$(".newComment"+o).before(t)});i.show()};e.slideDown()}},trackTabById:function(t,e){if(!t)return;$(".trackItem").each(function(){var a=$(this);if(a.attr("data-tid")==t){a.removeClass("itemNotPlaying");a.addClass("itemPlaying");a.find(".track_tab").each(function(){if(!$(this).hasClass("selected_tab")){tamer.trackTabClick($(this))}});if(a.attr("data-video")&&a.find("iframe:first").length==0){youtuber.playYoutube(a.get(0),a.attr("data-video"))}}
  else if(e){a.addClass("itemNotPlaying");a.removeClass("itemPlaying");a.find(".track_tab").each(function(){if($(this).hasClass("selected_tab")){tamer.trackTabClick($(this))}})}
  else{a.addClose("itemNotPlaying");a.removeClass("itemPlaying")}})},buildPopLink:function(t,a,e){if(t.hasClass("tipPrompt"))e=t.next(".blockInstructions").get(0);else if(e=="new"){if($(".taWin:last").length>0&&$(".taWin:last").html()=="")e=$(".taWin:last").get(0);else{e=document.createElement("DIV");e.className="taWin";e.id="taWin"+$(".taWin").length;e.style.display="none";$("#pagePreloader").before(e)}}
  else if(!e)e=$("#taWin0").get(0);if(t.attr("data-tid")||(t.attr("href")&&t.attr("href").indexOf("/pop/track?")>-1)){var r=t.attr("data-cid");if(document.getElementById("cOverlay"+r)){e=document.getElementById("cOverlay"+r)}};var i=t.get(0);if(!i.id||i.id!=""){tamer.showPopPreloader(i);i.id="pop-"+new Date().getTime();tamer.popObjs[i.id]={"el":i,"stat":"waiting","targ":e};setTimeout(function(){tamer.showLink(i.id)},a)}},searchPopLinks:function(t){$(t).find(".popInfo, .tipPrompt").each(function(){if(!$(this).attr("data-events")||$(this).attr("data-events").indexOf("mouseover")>-1){$(this).mouseover(function(){var t=$(this).parents(".taWin"),e=(t.length>0)?"new":null;tamer.buildPopLink($(this),250,e)})};$(this).click(function(){var t=$(this).parents(".taWin"),e=(t.length>0)?"new":null;tamer.buildPopLink($(this),0,e)})})},showPopPreloader:function(t){var e=document.getElementById("popLinkPre"),o=TMM_HTTP+"wwwroot/images/287.gif",i=-6,r=-7;if($(t).hasClass("miniCharacter")||$(t).hasClass("miniGroup")){i=-3,r=-5};if(!e){e=document.createElement("IMG");e.id="popLinkPre";e.src=o;document.body.appendChild(e)};e.onclick=function(){$(t).click()};var a=$(t).offset();$(e).css({"left":a.left+i,"top":a.top+r,"display":""})},stopPopPreloader:function(t){if(t&&tamer.hitTestLink(t)===!0){return!0};var e=document.getElementById("popLinkPre");if(e)e.style.display="none"},showLink:function(t){if(typeof tamer.popObjs[t]!="object")return!1;var i=document.getElementById(t);if(!i||tamer.popObjs[t].stat!="waiting"){tamer.resetLink(t);return!1};var d=!i.hasAttribute("data-noautoclose");if(d&&tamer.hitTestLink(i,window.event)==!1){tamer.resetLink(t);return!1};if(typeof tamer.popObjs[t]!="object")tamer.popObjs[t]={};tamer.popObjs[t].stat="loading";var a=tamer.popObjs[t].targ,l=$(i).offset();if($(i).hasClass("tipPrompt")){if($(a).parents(".taWin").length==0){var s=$(i).position();if(l.left>$(window).width()/2)s.left=s.left-$(a).width()+$(i).width();$(a).css({"left":s.left-5,"top":s.top+27})};$(a).fadeIn();eDispatcher.eDispatch("popInfo",a);tamer.stopPopPreloader();tamer.popObjs[t].stat="displayed";if(!d){$(a).mouseleave(function(){setTimeout(function(){tamer.testCloseLink(t)},400)})};$(a).find(".closeTrigger:first").click(function(){tamer.clickClose(t)});tamer.scrollToPop(a);return!0};var e=i.getAttribute("data-type");if(i.href&&i.href.indexOf("youtube.com")<0){e=i.href;if(e.indexOf("/track/details?")>-1){e+="&tar=doAjax"}}
  else if(e=="user")e="/pop/users/profile?uid="+i.getAttribute("data-uid");else if(e=="ratings")e="/pop/users/ratings?uid="+i.getAttribute("data-uid");else if(e=="awards")e="/pop/awards?cid="+i.getAttribute("data-cid");else if(e=="track"){e="/pop/track/details?tid="+i.getAttribute("data-tid")+"&tar=doAjax"}
  else if(e=="playlist"||e=="challenge"||e=="compilation")e="/pop/playlist?cid="+i.getAttribute("data-cid");else{tamer.resetLink();return!1};if(e.indexOf("doAjax")<0){e+="&tar=pop"};var c="";if($(a).parents(".taWin").length==0){var o=$(window).width(),r=l.left,u=l.top+25,n=o-10;if(n>600&&o>600){n=600};if(o<600){r=5}
  else{if(r>o/2)r=r-n+50;else r-=50};if(r+n>o){r=o-n-10}
  else if(r<5){r=5};var f=Math.round($(window).height()-$(window).height()/3);$(a).css({"left":r,"top":u,"height":f,"width":n,"position":"absolute"});c="<div style='left:"+(l.left-r-5)+"px' class='popPointer triAbove tmmss'></div>"}
  else{tautils.showPagePreloader(!0)};$.ajax({type:"GET",url:e,dataType:"html"}).done(function(i){if(typeof tamer.popObjs[t]!="object"||tamer.popObjs[t].stat!="loading"){return tamer.resetLink(t)};$(a).html(c+i);if(e.indexOf("comments")>-1)taFormer.applyCommentEvents(a);eDispatcher.eDispatch("popInfo",a);tamer.stopPopPreloader();tamer.popObjs[t].stat="displayed";if($(a).parents(".taWin").length==0&&d&&e.indexOf("tar=page")==-1&&e.indexOf("tar=html")==-1){$(a).mouseleave(function(){setTimeout(function(){tamer.testCloseLink(t)},400)})};$(a).fadeIn();$(a).find(".closeTrigger:first").click(function(){tamer.clickClose(t)});$(a).find(".collapseTrigger:first").click(function(){tamer.clickCollapse(t,$(this).get(0))});tamer.searchPopLinks(a);tamer.scrollToPop(a)}).always(function(){if($(a).parents(".taWin").length>0)$("#pagePreloader").fadeOut("fast")})},showBlockOverlay:function(){},scaleImages:function(t){if(!t)t=$(".bigBox");else if(!t.hasClass("thumbHolder"))t=t.find(".bigBox");if(t.length>0){t.each(function(){var t=$(this).find(".bigGridImg img:first");if(t.length>0)tamer.scaleImg(t.get(0))})}},scaleImg:function(t){var a=t.naturalHeight,i=t.naturalWidth;pH=300,pW=300;if(a<10||i<10){var e=t.getAttribute("data-attempts");if(!e)e=0;else e=parseInt(e);if(e<3){t.setAttribute("data-attempts",e+1);console.log(e+" attempts measuring: "+t.getAttribute("src"));setTimeout(function(){tamer.scaleImg(t)},250)};return!1}
  else if(i==pW&&a==pH){$(t).attr("data-scaled","noNeed");return!1};var o=(i/a);if(o>(pW/pH)){t.style.height=pH+"px";t.style.width="auto";i=$(t).width();if(i>pW){var r=-1*Math.floor((i-pW)/2);t.style.marginLeft=r+"px";t.style.marginTop="0px"}}
  else{t.style.width=pW+"px";t.style.height="auto";a=$(t).height();if(a>pH){var r=-1*Math.floor((a-pH)/2);t.style.marginTop=r+"px";t.style.marginLeft="0px"}};$(t).attr("data-scaled",!0)},scrollToPop:function(t){var a=$(t).offset().top-30,i=$(window).scrollTop()+$(window).height()-100;if(a>i){var e=0;if($(t).height()<$(window).height())e=$(window).scrollTop()+$(t).height();else e=a-30;$("html, body").animate({scrollTop:e},500)}},resetLink:function(t){var e=document.getElementById(t);delete tamer.popObjs[t];if(e)e.id="";tamer.stopPopPreloader(e)},clickCollapse:function(t,e){if(typeof t==="string"&&typeof tamer.popObjs[t]=="object"){tamer.popObjs[t].stat="hidden";t=tamer.popObjs[t].targ};if($(e).hasClass("minus15")){$(t).find(".popPointer").hide();$(t).find(".dialog_content").slideUp("fast",function(){$(t).animate({top:$(window).scrollTop+$(window).height()-40,left:0,width:200},500,"linear",function(){$(t).css({position:"fixed",top:$(window).height()-40})})});$(e).removeClass("minus15").addClass("plus15")}
  else{$(e).removeClass("plus15").addClass("minus15");var a=Math.min(600,$(window).width()-40);$(t).find(".dialog_content").slideDown();$(t).animate({left:Math.round($(window).width()/2-a/2),top:30,width:a},500,"linear",function(){$(t).css({position:"absolute",top:$(window).scrollTop()+30})})}},clickClose:function(t){if(typeof tamer.popObjs[t]!="object")return!1;$(tamer.popObjs[t].targ).html("").hide();tamer.resetLink(t)},testCloseLink:function(t){if(!t||typeof tamer.popObjs[t]!="object")return!1;var e=document.getElementById(t);if(!e)e=tamer.popObjs[t].link;if(tamer.popObjs[t].stat=="displayed"&&tamer.hitTestLink(e)==!1&&tamer.hitTestLink(tamer.popObjs[t].targ)==!1){$(tamer.popObjs[t].targ).html("").hide();tamer.resetLink(t);return!1}},hitTestLink:function(t,e){if(!t)return!1;else if(typeof(t)=="string")t=$(t).get(0);var r=tautils.mouseBounds.x,o=tautils.mouseBounds.y,a=tautils.getRegion(t),i=10;if(r>=a.left-i&&r<=a.right+i&&o>=a.top-i&&o<=a.bottom+i){return!0}
  else{return!1}}};var youtuber={vheight:250,vwidth:300,vsrc:null,isReady:!1,player:null,apiLoaded:!1,vidHolder:".vidHolder",playYoutube:function(t,e){youtuber.vidHolder=($(t).hasClass("vidHolder"))?t:$(t).find(".vidHolder").get(0);youtuber.vheight=250;youtuber.vwidth=Math.max(300,$(youtuber.vidHolder).width()-150);youtuber.isReady=!1;youtuber.vsrc=(typeof e=="string")?e:$(e).attr("data-video");if(youtuber.apiLoaded==!1){var a=document.createElement("script");a.src="//www.youtube.com/iframe_api";$("script:first").before(a)}
  else{onYouTubeIframeAPIReady()}},onPlayerReady:function(t){youtuber.isReady=!1;t.target.playVideo()},onPlayerStateChange:function(t){if(t.data==YT.PlayerState.PLAYING&&!youtuber.isReady){youtuber.isReady=!0;console.log("YT player state started");console.log(t)}
  else if(t.data==YT.PlayerState.ENDED){youtuber.isPlaying=!1;console.log("YT player state change ended");console.log(t.data)}
  else if(t.data==YT.PlayerState.PAUSED){youtuber.isPlaying=!1;console.log("YT player state change paused");console.log(t.data)}
  else if(t.data==YT.PlayerState.PLAYING){youtuber.isPlaying=!0}},stopVideo:function(){youtuber.player.stopVideo()},injectPlayerFrame:function(t,e){var a=document.createElement("IFRAME");a.src=e+"?version=3&enablejsapi=1&color=white";a.setAttribute("frameborder",0);a.setAttribute("scrolling",0);a.setAttribute("seamless",1);a.setAttribute("width",$(t).width());a.setAttribute("height",Math.max(300,$(t).height()));$(t).html(a)},onLoadError:function(t){youtuber.isReady=!0;tautils.tracer(t,"ERROR: youtube code")}};function onYouTubeIframeAPIReady(){youtuber.apiLoaded=!0;youtuber.isReady=!1;var t=(typeof youtuber.vidHolder=="string")?$(youtuber.vidHolder).get(0):youtuber.vidHolder,e=youtuber.vsrc.substring(youtuber.vsrc.lastIndexOf("/")+1);youtuber.player=new YT.Player(t,{height:youtuber.vheight,width:youtuber.vwidth,videoId:e,playerVars:{loop:1},events:{"onReady":youtuber.onPlayerReady,"onStateChange":youtuber.onPlayerStateChange,"onError":youtuber.onLoadErrror}})};if(document.location.href.indexOf("http")!==0){document.addEventListener("deviceready",function(t){tamer.updateAllEvents();if(document.location.hash&&document.location.hash.indexOf("#!href=")>-1){var e=document.location.hash;href=e.substring(e.indexOf("#!href=")+"#!href=".length);tautils.ajaxPage(href)}},!0)}
  else{$(document).ready(function(){tamer.updateAllEvents();var t=tautils.qParam("prompt");if(t&&t!=""){t=t.split("|");for(var e=0;e<t.length;e++){if(t[e]=="psw"||t[e]=="remind"||t[e]=="fbAlbums"||t[e]=="linkFB"){taFormer.popBuilder("getProfileForm","edit-profile"+document.location.search,document.body);break};if(t[e]=="stopemails"){tautils.showNotice("We will stop sending you emails. Email your group admin to change this");break}}}})};