// isCommTab

jqN(document).ready(function() {
// Default State of the Comments

setComments();



// The changing state of the comments.


jqN(".additional_story").click(function(){
jqN(this).remove();
jqN("#text form").show();
});
});


function setComments(){
	commentHash = window.location.toString().split('#')[1];
	if (commentHash == "comment"){
		jqN('.tab-trigger').eq(1).addClass('selected');
		jqN('.tab-content').eq(1).show();
	}else{
		jqN('.tab-content').eq(0).show();
		jqN('.tab-trigger').eq(0).addClass('selected');
	}
	jqN('.tab-trigger').bind('click',toggleComments);
}

function toggleComments(){
	if(!jqN(this).hasClass('selected')){
		jqN('.tab-trigger').removeClass('selected');
		jqN('.tab-content').hide();
		var index = jqN('.tab-trigger').index(this);
		jqN('.tab-content').eq(index).show();
		jqN(this).addClass('selected');
	}
}
function displayRating(id)
		{			
			var result = nbcu.sn.rating.getRatingByContent(null, 'BLOG_POST-'+id, null, null, 'SS_BLOG');
			/*alert("Avg Rating value: " + result["avgRatingValue"] + " | Rating count: " + result["ratingCount"]);*/
			
			var avg = result['avgRatingValue'];
			
			var rnd = Math.round(avg);
			var per = rnd*20;
			
			jqN("#"+id+" .current-rating").css({"width":per+"%"});
			jqN("#"+id+" .current-rating").html("Currently "+rnd+" out of 5 stars.");
			
		}

// clear news from you form
jqN.fn.clearForm = function(){
	return this.each(function(){
		var type = this.type, tag = this.tagName.toLowerCase();
		if(tag == 'form')
			return jqN(':input',this).clearForm();
		if(type == 'text' || type == 'password' || tag == 'textarea')
			this.value = '';
		else if(type == 'checkbox' || type == 'radio')
			this.checked = false;
		else if(tag == 'select')
			this.selectedIndex = -1;		
	});
}

 