_qoptions = {
    qacct:"p-11lnUuPOz_qQQ"
};
document.write('<' + 'script language="javascript" type="text/javascript" src="http://edge.quantserve.com/quant.js" ' + '>' +'</' + 'script'+ '>');

var rotatingList = function(el) {
	this.list = null;
	this.items = null;
	this.active = null;
	this.timer = null;
	this.init(el);
};

rotatingList.prototype.init = function(el) {
	this.list = el;
	this.items = $(this.list).children('li');
	this.showItem(0);
	this.startTimer();
	var self = this;
	$(this.list).hover(function(){clearTimeout(self.timer);self.showList();},function(){self.hideList();self.showItem(0);self.startTimer();});
};

rotatingList.prototype.showItem = function(idx) {
	this.active = idx;
	$(this.items).each(function(i,el){(i==idx)?$(el).show():$(el).hide();});
};

rotatingList.prototype.showList = function() {
	$(this.list).addClass('active');
	$(this.items).each(function(i,el){$(el).show();});
};

rotatingList.prototype.hideList = function() {
	$(this.list).removeClass('active');
};

rotatingList.prototype.startTimer = function() {
	var self = this;
	i = (this.active+1==this.items.length)?0:this.active+1;
	this.timer = setTimeout(function(){self.showItem(i);self.startTimer();},5000);
};



$(document).ready(function(){
	// initRotatingList();
	var rl = new rotatingList( $('#superNav .list') );
	
	$(".fav_item div").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "0"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "0"}, "fast");
	});
	
	$(".view a").hover(function() {
		$(".view_choice").slideToggle("fast").fadeTo(5000,1);
	}, function() {
		$(".view_choice").slideToggle("slow");
	});
	
	$(".view_choice li").click(function() {
	    window.location=$(this).find("a").attr("href");return false;
	});

	$('#comment-text').one("focus", function() {
		$('#comment-text').parent().after('<div id="preview-box"><div class="comment-by">Preview</div><div id="live-preview">Your preview will show up below. Start Typing!</div><div id="live-author"></div><p>*Tags allowed: a href, b, i, br/, p, strong, em, ul, ol, li, blockquote, pre</p></div>');
	});
	
	var $userCookie = getCommenterName();
	var $comment = ''; 
	$('#comment-text').keyup(function() {
		$comment = $(this).val();
		$comment = $comment.replace(/\n/g, "<br />")
		.replace(/\n\n+/g, '<br /><br />');
		$('#live-preview').html( $comment );
		//$('#live-author').html('posted by ' + $userCookie);
	});
	$(".tag-slide").click(function(){
		$(this).parents("div").next(".entry-tags").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
	$('#share-dropdown li.share-links').hover(
		function() { $('ul', this).css('display', 'block'); },
		function() { $('ul', this).css('display', 'none'); });
});

function viewToggle(view){
	var expdate = new Date(); 
	expdate.setTime(expdate.getTime() + 1000 * 60 * 60 * 24 * 30);
	if (view == 'summary') {
		mtSetCookie("HomepageView","summary",expdate, '/');
	} else if (view == 'full'){
		mtSetCookie("HomepageView","full",expdate, '/');
	}
	window.location.reload();
}