/*global jQuery */

/**
	REFRESH_APP is the global namespace container
	@namespace
	@requires jQuery.js
*/

/**
	@class 
	@description homepage 
*/
REFRESH_APP.homepage = {
	init: function() {
		REFRESH_APP.post.hover();
		if(REFRESH_APP.post.isHomepage()) {
			$("div.post").each(function() {
				var link = $(this).find("a.more-link").attr("href");
				var img = $(this).find("img").parent();
				img.attr("href", link);
			});
		}
	}
}

/**
	@class 
	@description Profanity Filter
*/
REFRESH_APP.profanityFilter = {
	init: function(checkString) {
		if(checkString != "") {
			return this.filterText(checkString);
		}
	},
	filterText: function(myString) {
			var badWords = /Anus|anuses|arse|ass|ass lick|asses|asshole|assholes|asskisser|asskissers|asswipe|asswipes|b s|Badass|badasses|balls|bastard|bastards|beastial|beastiality|beastility|beaver|belly whacker|bestial|bestiality|bimbo|bimbos|bitch|bitcher|bitchers|bitches|bitchin|bitching|blow job|blow jobs|blowjob|blowjobs|boink|boinks|Bollix|Bollock|bollocks|bone|bonehead|boner|bones|Boob|boobies|boobs|booby|brown eye|browneye|browntown|bs|bucket cunt|Bufu|bull shit|Bulldager|Bullhell|bullshit|bum|Bummer|bung|bung hole|bunghole|burn in hell|burning in hell|burns in hell|butch|butt|butt breath|butt fucker|butt hair|buttface|buttfuck|buttfucker|butthead|butthole|buttpicker|chinaman|chink|chinks|chola|cholas|cholo|cholos|christ|circle jerk|clam|clit|clits|cobia|cock|cocks|cocksuck |cocksucked |cocksucker|cocksucking|cocksucks |Coolie|coolies|cooter|cooters|crap|Craven Moorehead|Cravin Moorehead|crotch|crotches|cum|cummer|cumming|cums|cumshot|cunilingus|cunillingus|cunnilingus|cunt|cuntlick |cuntlicker |cuntlicking |cunts|cyberfuc|cyberfuck |cyberfucked |cyberfucker|cyberfuckers|cyberfucking |damn |damn her|damn him|damn them|damn you|Damned|damns|dick|Dick Head|dickhead|dickhead|dickheads|dike|dike|dikes|dildo|dildos|Dilldoe|Dilldos|dink|dinks|dipshit|dirt bag|dirt bags|dirtbag|dirtbags|Doggie Style|doggy style|dong|douche|douche bag|douchebag|dumbass|dumbasses|dyke|dykes|ejaculat|ejaculate|ejaculated|ejaculates|ejaculates |ejaculating |ejaculatings|ejaculation|f her|f him|f it|f that|f the|f them|f you|fag|fagget|fagging|faggit|faggot|faggs|Faggy|Fagit|fagot|fagots|fags|fanny|fart |farted |farting |fartings |farts|farty |fatass|fatasses|fatso|Fatso|felatio |fellatio|fingerfuck |fingerfucked |fingerfucker |fingerfuckers|fingerfucking |fingerfucks |fistfuck|fistfucked |fistfucker |fistfuckers |fistfucking |fistfuckings |fistfucks |flaming|Foreskin|Friggin|fuck|fucked|fucker|fuckers|fuckface|fuckhead|fuckin|fucking|fuckings|fuckme |fucks|fuk|fuks|furburger|gangbang|gangbanged |gangbangs |gaysex |gazongers|genital|genitals|GNAA|go down on|go to hell|goddamn|goes down on|goes to hell|going down on|gonad|gonads|gook|gooks|guinne|Guinne|hard on|hardass|hardasses|hardcoresex |Haywood Jablowme|he sucks|hell |Heywood Jablowme|hide the salami|homo|homos|honkies|Honky|hooker|horniest|horny|hotsex|Hugh Jass|hussies|hussy|hymen|hymens|idiot|idiots|jack off|Jack off|Jack you|jack-off |jackass|jackasses|jacked off|Jacking|jacking off|jackoff|jacks off|jap|japs|jerk|jerk off|jerk-off |jerked off|jerks|jerks off|jesus|jesus christ|jew|Jewed|jism|jiz |jizm |jizz|kickass|kike|kikes|knacker|knacker|knackers|knob|kock|kondum|kondums|kraut|krauts|kum|kummer|kumming|kums|kunilingus|lesbian|lesbo|lesbos|Lessy|lmao|lmfao|loser|lust|lusting|Masterbate|masterbated|masterbates|masterbation|masturbate|masturbated|masturbates|masturbation|merde|mick|mick|Mike Rotch|mothafuck|mothafucka|mothafuckas|mothafuckaz|mothafucked |mothafucker|mothafuckers|mothafuckin|mothafucking |mothafuckings|mothafucks|motherfuck|motherfucked|motherfucker|motherfuckers|motherfuckin|motherfucking|motherfuckings|motherfucks|mound|muff|muffdiver|mufflicker|muffs|nerd|nig|nigga|niggaz|nigger|niggers |nincompoop|ninny|orgasim |orgasims |orgasm|orgasms |pecker|peckers|pederast|pedophile|penis|penises|pervert|perverted|perverts|phonesex|phuk|phuked|phuking|phukked|phukking|phuks|phuq|Pillock|pimp|pimped|pimps|piss|pissed|pisser|pissers|pisses |pissin |pissing|pissoff |Plonker|Polack|Poo poo|Poontang|poop|Pootang|pootietang|porn|porno|pornography|pornos|prick|pricks |prostitute|punk|punkass|Puntang|puss|pussies|pussy|pussys |queer|Quefe|Quief|rectal|rectum|rectums|retard|retard|retarded|retards|rot in hell|rots in hell|s-h-i-t|schlong|schmuck|screw|screwed|screws|Semen|sex|sexual|sexually|shag|shag|shagger|shags|she sucks|sheeny|sheister|Sheister|shit|shite|shite|shited|shitface|shitfaced|shitfull|shithead|shiting|shitings|shits|shitted|shitter|shitters |shittier|shitting|shittings|shitty |Shlong|Shmegma|shyt|skag|skank|skanks|skanky|skinhead|skinheads|slag|sleaze|slut|sluts|slutty|Smagna|smut|snatch|sodom|sodomite|sodomize|spaca|spacca|spacca|spank it|spank the monkey|Sperm|Spic|spics|spunk|suck my|suck this|they suck|throw some D|Throw that D|thug|thugs|tit|tits|Titty|tossa|tosser|Tramp|turd|twat|Twat|twerp|twit|urinate|urine|vagina|vaginal|vaginas|Vertical Taco|vibrator|vibrators|Wang|wanger|Wanker|Wanker|wetback|Wetback|wetbacks|what the f|White trash|whore|whore|whores|whoring|wop|wop|wops|you suck/g;
			return myString.replace(badWords, function (string2) {
				return string2.replace(/./g, "");
	});
	}
}


/**
	@class 
	@description Hero
*/
REFRESH_APP.hero = {
	init:function() {
		$("img.ambassador-name").hover(function() {
			$("span.line").show();
		},
		function() {
			$("span.line").hide();
		})
	}

}


/**
	@class
	@description Given an identifier, countsdown the number of characters allowed for a particular textfield; Expects 'textarea' and '.count' contained within the identifier.
*/
REFRESH_APP.charCountdown = {

	/**
		Initializes charCountdown
	*/
	init: function(x) {
		if ( $(x).length ){
			$(x).each( function() {
				var set = $(this).parents('fieldset');
				var counter = $(this).find('.count');
				var countLimit = parseInt(counter.html() );
				var textarea = $("#commentsForm textarea");
				REFRESH_APP.charCountdown.updateCount(counter, textarea, countLimit);
				REFRESH_APP.charCountdown.watchText(counter, textarea, countLimit);
			});
		}
	},
	
	/**
		Monitors the textarea via 'keyup'
	*/
	watchText: function(counter, textarea, countLimit) {
		textarea.keyup( function() {
			REFRESH_APP.charCountdown.updateCount(counter, textarea, countLimit);
		});
	},
	
	/**
		Updates the character count limit on screend
	*/
	updateCount: function(counter, textarea, countLimit) {
		var shortenText = '<span class="shorten"> (please shorten)';
		var text = $(textarea).val();
		var newNum = countLimit - text.length;
		var p = counter.parents('p.textarea-help');
		counter.html( newNum );
		if (newNum < 0) {
			p.addClass('bad-count');
			if (!p.find('span.shorten').length) {
				p.append(shortenText);
			}
		} else if (p.hasClass('bad-count')) {
			p.removeClass('bad-count').find('span.shorten').remove();
		}
	}
	
};

/**
	@class
	@author page for ambassador
*/
REFRESH_APP.author = {
	init: function() {		
		if(REFRESH_APP.post.isAuthor()) {
			$("div.ambassador-picks").show();
			$('.ambassador-image').ifixpng();

			
   			
   			//get link to ambassadors picks page
			var UrlToPreviousPicksPage = $(".ambassador-picks ul li:first a").attr("href");
			if(UrlToPreviousPicksPage != "undefined") {
				$("a.previous-picks").attr("href",UrlToPreviousPicksPage);
				$(".ambassador-picks ul").remove();
			} else {
				$(".ambassador-picks").remove();
			}
		}
	}

}

/**
	@class
	@author page for ambassador
*/
REFRESH_APP.authorPicksPage = {
	init: function() {
		if(REFRESH_APP.post.isAuthorPicksPage()) {
			$("#header").addClass("author-header");
		}
	}

}

/**
	@class
	@scroll to comments
*/
REFRESH_APP.scroller = {
	init:function() {
		this.scroll("a.leave-a-comment");
		//this.scroll("a.go-to-comments");
	},
	scroll: function(obj) {
		$(obj).click(function(e){
			//prevent the default action for the click event
			e.preventDefault();

			//get the full url - like mysitecom/index.htm#home
			var full_url = this.href;

			//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
			var parts = full_url.split("#");
			var trgt = parts[1];
		
			//get the top offset of the target anchor
			var target_offset = $("#"+trgt).offset();
			var target_top = target_offset.top;
		
			//goto that anchor by setting the body scroll top to anchor top
			$('html, body').animate({scrollTop:target_top}, 500);
		});	
	}
}

/**
	@class
	@description Sidebar Modules
*/
REFRESH_APP.sidebar = {
	/**
		Initializes sidebar modules
	*/
	init: function() {
		if(REFRESH_APP.post.isHomepage()) {
			this.twitter.init();	
			this.topTen.init();
		}
	},
	/**
		Init Twitter
	*/
	twitter: {
		init: function() {
			var url = "http://search.twitter.com/search.json?callback=REFRESH_APP.twitter.showTwitterFeed&q=pepsirefresh&rpp=5";
			jQuery.getScript(url);			
		}
	},
	/**
	 top 10 module
	*/
	topTen: {
		/**
		Initializes top 10 module
		*/
		init: function() {
			
			REFRESH_APP.sidebar.topTen.mostDiscussed.init();
			REFRESH_APP.sidebar.topTen.mostShared.init();
			
			$("#sidebar ul.catogory-header li a").click(function(e) {
				e.preventDefault();
				REFRESH_APP.sidebar.topTen.setActive($(this));
			});
		},
		/**
		Set Category Active / Inactive
		*/
		setActive: function(obj) {
			$("#sidebar ul li").removeClass("active");
			
			obj.parent().addClass("active");
			$("#sidebar div.list").hide();
			$("#sidebar div." + obj.attr("class")).show();
		},
		/**
		Get most discussed posts
		*/
		mostDiscussed: {
			init:function() {
				jQuery.getJSON(baseUrl + "comments/getMostDiscussedPosts/", function(data){
					var output = '';
					
					$(data).each(function(i) {
						var postDate = REFRESH_APP.sidebar.topTen.buildPostSlugUrl.formatDate(data[i].post_date);
						
          				output += "<li><a  href='" + baseUrl + "blog/" + postDate + "/" + data[i].post_name + "'><span class='wpp-post-title'>" + data[i].post_title + "</span></a></li>";					
          			});
					$("div.discussed ol").html(output);
        		});
        	}
		},
		/**
		Get most shared posts
		*/
		mostShared: {
			init:function() {	
				jQuery.getJSON(baseUrl + "comments/getMostSharedPosts/", function(data){
					var output = '';
					
          			$(data).each(function(i) {
          				//console.log(data[i].post_date);
          				
          				var postDate = REFRESH_APP.sidebar.topTen.buildPostSlugUrl.formatDate(data[i].post_date);
          				
          				output += "<li><a href='" + baseUrl + "blog/" + postDate + "/" + data[i].post_name + "'><span class='wpp-post-title'>" + data[i].post_title + "</span></a></li>";				
          			});
          			$("div.shared ol").html(output);
        		});
			}
		},
		buildPostSlugUrl: {
			formatDate: function(postDate) {
				var post_date = postDate.split(" ");
          		post_date = post_date[0].split("-");
          		post_date = post_date[0] + "/" + post_date[1] + "/" + post_date[2];				
				return post_date;
			}
		}
	}
};



/**
	@class
	@description Partial Content
*/
REFRESH_APP.partials = {
	init: function() {
		this.getBasePath();
		
	},
	//get header and footer base path
	getBasePath: function() {
		
		jQuery.ajax({
   			type: "GET",
   			url: baseUrl + "blogassistant/getphasepath/",
   			success: function(data){
   				REFRESH_APP.partials.showHeader(data);
   				REFRESH_APP.partials.showFooter(data);
   				
   				
   				
   				
   				
   			},
   			error: function(msg) {
   				
   				
   			}	
 		});	
	},
	showFooter: function(basePath) {
		//console.log("ajax_proxy.php?host=" + baseUrl + basePath + "navigation-footer.phtml");
		$("#footer").load(baseUrl + basePath + "navigation-footer.phtml", function() {
			REFRESH_APP.pepsiAnimation.init();
		});	
		
		
	},
	showHeader: function(basePath) {
		$("#nav-container").load(baseUrl + basePath + "navigation-header.phtml",function() {
			REFRESH_APP.morebox.init();
		});
	}
	
}

/**
	@class
	@description Comments Counter
*/
REFRESH_APP.comments = {
	init: function() {
	
		//count homepage comments
		if(REFRESH_APP.post.isHomepage() || REFRESH_APP.post.isCategory()) {
			REFRESH_APP.comments.countHomepageComments();
		}
		
		//show comments for single blog post
		if(REFRESH_APP.post.isSingle() || REFRESH_APP.post.isAuthor()) {
			this.show();
			$("#commentsSubmit").live("click", this.save);
			$("a.flag").live("click", this.flag);
			$("#commentsText").val("Leave your comment here");
 		
		}
		
		this.count();
	},
	/**
	Count Comments Homepage
	*/
	countHomepageComments: function() {
		var post_id = "";
		$("#posts div.post").each(function() {
			post_id += $(this).attr("id");
			post_id = post_id.replace("post-","/postid/");
		});
		//alert(baseUrl + "comments/getCommentsCountPerPost" + post_id + "/");
		jQuery.getJSON(baseUrl + "comments/getCommentsCountPerPost" + post_id + "/", function(data){
			var num_comments = '';
         	$(data).each(function(i) {
         		if(data[i] != null) {
	         		num_comments = data[i].num_comments;
	         		if(data[i].post_id != 0) {
	            		$("#post-" + data[i].post_id + " .share-comments span").text(num_comments);
	            		
	            		if(REFRESH_APP.post.isSingle()) {
	            			$("#comments .share-comments span").text(num_comments);
	            		}
	            		
	            		if(num_comments == 1) {
	            			$("#post-" + data[i].post_id + " .share-comments strong").text("Comment");
	            			
	            			if(REFRESH_APP.post.isSingle()) {
	            				$("#comments .share-comments strong").text("Comment");
	            			}
	           			} else {
	           				$("#post-" + data[i].post_id + " .share-comments strong").text("Comments");
	           			}
	            	}
            	}
            	
            });
            $("#posts .post .share-comments").show();	
            
		});
	},
	/**
	Count Comments
	*/
	count: function() {
		var commentsCount = $("#comments-content .comment").length;
		$("div.share-comments a span").text(commentsCount);
	},
	show: function() {
		
			var commentsUrl = baseUrl + "comments/getcomments/postid/" + REFRESH_APP.post.getID();
			var href = document.location.href;
			
			if(href.indexOf("?clear=1") != -1) {
				commentsUrl += "?clear=1";
			}
		
			jQuery.ajax({
   				type: "GET",
   				url: commentsUrl,
   				success: function(data){
   					jQuery("#comments-ajax").html(data);
   					$('img.comments-header-loader').hide();
					REFRESH_APP.comments.count();

					$("#commentsText").focus(function() {
			         	$(this).val("");
			         	$("span.count").text("300");
			         		REFRESH_APP.charCountdown.init('.textarea-help');
			    	});   
			    		
					$("#commentsText").blur(function () {
						var commentsText = $(this).val();
			         	if(commentsText == "") {
			         		$("#commentsText").val("Leave your comment here");	
			         	}
			    	});  
	    		
   				},
   				error: function(msg) {
   					jQuery("#comments-ajax").html("<p>Could not retrieve comments</p>");
   					$('img.comments-header-loader').hide();
   				}	
 			});
	},
	save: function(e) {
		var defaultCommentText = "Leave your comment here";
		e.preventDefault();
		$("#comments span.loader").show();
					
		$("#commentsForm p.error").remove();
			
		var commentsText = $("#commentsText").val();
		var ideaID = $("#ideaid").val();
		var postID = $("#p").val();
		var userIP = $("#userip").val();
		var firstname = $("#firstname").val();
		var lastname = $("#lastname").val();
		var author_name = firstname;
		if(commentsText != "" && commentsText != defaultCommentText) {
			jQuery.ajax({
   				type: "POST",
   				url: baseUrl + "comments/save",
            	data: {"commentsText":commentsText,p:postID},
   				success: function(data){
   						if(data != "timeover") {
   							$("#comments-content").prepend(data);
   							//REFRESH_APP.comments.show();
   							$("#commentsForm p.error").remove();
   							$("#commentsText").val(defaultCommentText);
   							$("#comments span.loader").hide();
   							REFRESH_APP.comments.count();
   							
   							//tracking
   							pageTracker._trackEvent('User Submission', 'user comment',document.title);
   							
   							
   						} else {
   							$("#commentsForm").prepend("<p class='error'>Slow down! You've gone over your comments allowed per minute.<br/>Take a deep breath and try again in another minute.</p>");
   							$("#comments span.loader").hide();
   							
   							//tracking
   							pageTracker._trackEvent('User Submission', 'user comment',document.title);

   						}
   				},
   				error: function(msg) {
   					$("#commentsForm").prepend("<p class='error'>Could not add new comment</p>");
   					$("#comments span.loader").hide();
   				}		
 			});
 		} else {
 			$("#commentsForm").prepend("<p class='error'>Please enter a comment</p>");
 			$("#comments span.loader").hide();
 		}		
	},
	flag: function(e) {
		e.preventDefault();
        var obj = $(this);
        var commentID = obj.closest("div.comment");
        commentID = commentID.attr("id");
        commentID = commentID.replace("comment-","");
        var postid = $("#posts").attr("class");	
		jQuery.ajax({
   			type: "POST",
   			url: baseUrl + "comments/flag/commentid/" + commentID,
            data: {"commentid":commentID,"postid":postid},
   			success: function(data){
   				obj.replaceWith("<span class='flagged'>Thanks, we'll look into it</span>");
   			},
   			error: function(msg) {
   				alert("Could not flag comment");
   			}	
 		});						
	}
}

/**
	@class
	@description Post
*/
REFRESH_APP.post = {
	getID: function() {
		var post_id = '';
		post_id = $("#posts div.post").attr("id");
		if(post_id != "" && post_id != undefined) {
			post_id = post_id.replace("post-","");
			return post_id;			
		}
	
	},
	// check if its a single blog post
	isSingle: function() {
		if($("body.single").length != 0) {
			return true;
		} else {
			return false;
		}
	},
	// check if its a single blog post
	isAuthor: function() {
		if($("body.author").length != 0) {
			return true;
		} else {
			return false;
		}
	},
	// check if its a single blog post
	isCategory: function() {
		if($("body.category").length != 0) {
			return true;
		} else {
			return false;
		}
	},
	isHomepage: function() {
		if($("body.home").length != 0) {
			return true;
		} else {
			return false;
		}
	},
	isAuthorPicksPage: function() {
		if($("body.page-template-ambassador_picks-php").length != 0) {
			return true;
		} else {
			return false;
		}		
	},
	hover: function() {
		$("#posts div.post div.outer-content").hover(
  			function () {
    			$(this).addClass("hover");
  			},
  			function () {
    			$(this).removeClass("hover");
  			}
		);
	},
	click: function() {
		$("#posts div.post div.outer-content").click(
  			function (e) {
  				e.preventDefault();
  				location.href = $('.post-title a',this).attr('href');
  			}
		);
	}	
	
	
}

/**
	@class
	@description Share
*/
REFRESH_APP.share = {
	init: function() {
	
		$("div.sharing a.sharing-facebook").live('click',function(e) {
			
			e.preventDefault();
			REFRESH_APP.share.countSharing("facebook");
			var title = escape( $('h2.post-title').text() );
			var href = escape( location.href );
			
			var win = 'http://www.facebook.com/sharer.php?u='+href+'&t='+title;
			window.open(win,'facebook_share','toolbar=0,status=0,width=626,height=436');
			
			
			
		});
		$("div.sharing a.sharing-twitter").live('click',function(e) {
		
			e.preventDefault();
			REFRESH_APP.share.countSharing("twitter");
			var title = escape( $('h2.post-title').text() );
			var href = escape( location.href );
			
			var win = '/index/share#' + title + '||' + href;
			window.open(win,"twitter_share");
			
			

		});	
		
		
	},
	countSharing: function(shareType) {
		jQuery.ajax({
   			type: "POST",
   			url: baseUrl + "comments/incrementPostShares/sharetype/" + shareType + "/postid/" + REFRESH_APP.post.getID() + "/",
   			success: function(data){
   					
   			},
   			error: function(msg) {}	
 			}
 		);
	}
}

/**
	@class
	@description Handle the status bar
*/
REFRESH_APP.statusBar = {
	/**
		Initializes datepicker
	*/
	init: function() {
		
		$('#status-bar').load( baseUrl + '/status/index', {}, function() {
			//alert('yeah');
			if ( jQuery.browser.msie && jQuery.browser.version == 6 && !$('body').hasClass('submission') ) {
				REFRESH_APP.statusBar.initIE6();
			}
		});
	},
	/**
		Initializes for IE6
	*/
	initIE6: function() {
		var $bar = $('#status-bar');
		var $window = $(window);
		var $wrapper = $('#status-bar-ie6-wrapper');
		// insert and set
		$bar.addClass('ie6').insertAfter('.extra-tracking:first');
		REFRESH_APP.statusBar.resizeContainer();
		// detect window events
		$window.scroll( function() {
			REFRESH_APP.statusBar.resizeContainer();
		});
		$window.resize( function() {
			$bar.hide();
			setTimeout(REFRESH_APP.statusBar.resizeContainer, 300);
		});
	},
	resizeContainer: function() {
		var $bar = $('#status-bar');
		var $window = $(window);
		var newHeight = $window.scrollTop() + $window.height() - $bar.height();
		$bar.css({
			'margin-top' : newHeight+'px'
		}).show();
	}
};

/**
	@class
	@description Twitter Module
*/
REFRESH_APP.twitter = {
	/**
	Init Twitter Module
	*/
	init: function() {
	},
	showTwitterFeed: function(data) {
		
		var output = "";
		
		for(i in data.results) {
			if(i <= 5) {
			    var text = data.results[i].text;
			    text = text.replace("#pepsirefresh"," ");
			    var user = data.results[i].from_user;
			    var date = data.results[i].created_at;
			    var link = "http://twitter.com/" + data.results[i].from_user + "/status/" + data.results[i].id;
			    if(i == 0) {
			    	output += "<li class='bubble'><div class='twitter-bubble'>";
			    	output += "<div class='twitter-bubble-header'>&nbsp;</div>";
					output += "<div class='twitter-bubble-content'><a target=\"_blank\" href=\"" +link+ "\">" + REFRESH_APP.profanityFilter.init(text) + "</a>";
					output += "<span class='date'>" + data.results[i].created_at + " from " + data.results[i].from_user + "</span></div>";
					output += "<div class='twitter-bubble-footer'>&nbsp;</div>";
					output += "</div></li>";
			    } else {
			    	output += "<li>";
			    	output += "<a target=\"_blank\" href=\"" +link+ "\">" + text + "</a>";
			    	output += "<span class='date'>" + data.results[i].created_at + " from " + data.results[i].from_user + "</span>";
			    	output += "</li>";
			    }
			}
		}
		$("div.tweets ul.tweet-container").html(output);
        $("div.tweets span.loader").hide();
        $("div.tweets").show();
	}
}

jQuery(function($) {	
	REFRESH_APP.sidebar.init();
	REFRESH_APP.comments.init();
	REFRESH_APP.partials.init();
	REFRESH_APP.share.init();
	REFRESH_APP.scroller.init();
	REFRESH_APP.author.init();
	REFRESH_APP.authorPicksPage.init();
	REFRESH_APP.hero.init();
	REFRESH_APP.homepage.init();
	DD_roundies.addRule('.rounded', '10px', true);
	$('.png').ifixpng();
});