$(document).ready(function(){var g=0;function e(){var m=setInterval(function(){if($("#home-feature-container ul li:animated").length==0){clearInterval(m);if($("#home-feature-container ul li").length-1==g){b(0);$("#home-feature-container ul li:first").clone().attr("id","lastloop").appendTo("#home-feature-container ul");g++;$("#home-feature-container ul li").animate({left:"-="+$("#home-feature-container ul li").width()},500,function(){$("#home-feature-container ul li").css("left","0px");$("#lastloop").remove();g=0;o()})}else{g++;$("#home-feature-container ul li").animate({left:"-="+$("#home-feature-container ul li").width()},500);b(g)}o()}},200)}function i(m){var r=0;$("#home-feature-container ul li").each(function(x){if(x==m){return false}r+=$(this).width()});g=m;$("#home-feature-container ul li").animate({left:-r},500);b(m);o()}function o(){var m=$("#home-feature-container ul li:eq("+g+")").data("headline");var r=$("#home-feature ul li:eq("+g+") a").attr("href");$("#home-feature > h1").html('<a href="'+r+'">'+m+"</a>");h()}function q(){$("#home-feature ul.dots").empty();for(var m=0;m<$("#home-feature-container ul li").length;m++){$("#home-feature > ul.dots").append("<li />")}$("#home-feature > ul.dots li:first").addClass("selected");c();h()}function c(){$("#home-feature > ul.dots li").each(function(m){$(this).click(function(){i(m)})})}function b(m){$("#home-feature > ul.dots li").removeClass("selected").eq(m).addClass("selected");h()}var s;var l=true;function v(){s=setInterval(function(){e()},7500);l=true}function h(){clearInterval(s);v()}function w(){if(l){clearInterval(s);l=false}}function k(){if(!l){v()}}var u=$("#home-feature-container ul");u.width((u.children("li").length+1)*(u.parent().width()+10));q();c();k();var t=$("#community > a.jump");$("#community > nav li a").click(function(x){x.preventDefault();$("#community > section").hide();var r=$(this).parent();var m=r.data("section-id");$("#"+m).show();$("#community > nav li").removeClass("selected");r.addClass("selected");if(m=="community-board-posts"){t.attr("href","/boards").text("Go to the Boards").removeAttr("data-external")}else{if(m=="community-comments"){t.attr("href","/boards").text("Go to the Boards").removeAttr("data-external")}else{if(m=="community-tweets"){t.attr("href","http://twitter.com/cincy_music").text("Visit us on Twitter").attr("data-external","")}}}});if($("#poll").length>0){var f=$("#poll input[name=poll_id]").val();var j=a("poll"+f);if(j!==null){p(false)}else{$("#poll form ul").each(function(){var x=$(this);var m=x.children("li");m.sort(function(){return(Math.round(Math.random())-0.5)});x.remove("li");for(var r=0;r<m.length;r++){x.append(m[r])}});$("#poll form").submit(function(m){m.preventDefault();if($("input[type=radio]:checked",$(this)).length==0){alert("Choose an option, silly!");return}$.ajax({url:"/home/poll.ajax",dataType:"json",data:$(this).serialize(),type:"POST",error:function(){$(this).unbind("submit").submit()},success:function(r){if(r.success!=true){if(r.error=="POLL_DUPLICATE_ENTRY"){alert("You've already submitted an entry for this one!");n("poll"+f,1,30);p(false)}else{alert("Something weird happened and we couldn't record your entry!")}}else{n("poll"+f,1,30);p(false);_gaq.push(["_trackEvent","Poll","Vote",$("#poll h2.question").text()])}}})})}$("#poll a.poll-results").click(function(m){m.preventDefault();p(true)});function p(m){d();var x=$("#poll form");var r=$("#poll-results");if(m!=true){x.remove()}else{x.hide();r.append('<a href="#" class="poll-form button-blue-large">Back to Form</a>');$("a.poll-form",r).click(function(y){y.preventDefault();x.show();r.hide();$(this).remove()})}r.show()}function d(){$.ajax({url:"/home/poll-results.ajax",dataType:"json",data:{poll_id:$("#poll form input[name=poll_id]").val()},type:"GET",success:function(A){if(typeof A.total_responses=="number"){var x=$("<ul />");for(var y in A.results){var r=A.results[y];if(y==0){var z=100*A.total_responses/r.count}var B=$("<li />");var m=$('<div class="poll-bar" />');if(y==0){m.addClass("top-response")}m.css("width",((r.count*z/A.total_responses).toFixed(1)).toString()+"%");B.append(m);B.append("<span>"+r.title+" ("+((r.count*100/A.total_responses).toFixed(1)).toString()+"%)</span>");x.append(B)}$("#poll-results ul").replaceWith(x)}}})}}function n(x,y,z){if(z){var r=new Date();r.setTime(r.getTime()+(z*24*60*60*1000));var m="; expires="+r.toGMTString()}else{var m=""}document.cookie=x+"="+y+m+"; path=/"}function a(r){var y=r+"=";var m=document.cookie.split(";");for(var x=0;x<m.length;x++){var z=m[x];while(z.charAt(0)==" "){z=z.substring(1,z.length)}if(z.indexOf(y)==0){return z.substring(y.length,z.length)}}return null}});
