// JavaScript Document
$(function() {
	// hover function for tabs
	$('.tab').hover(
		function(){
			if(!$(this).hasClass("isactive")){
				$(this).addClass("hovactive");
			}
		},
		function(){ // this second part is the fallback (basically the rollout).
			if($(this).hasClass('hovactive'))$(this).removeClass("hovactive");
		});
	// click function for tabs
	$('.tab').click(function(e){
		var tabarray = Array("tab1","tab2","tab3"); // I'm building an array with my tab ids
		//console.log(tabarray.length);
		for(i=1;i<=tabarray.length;i++){ //looping for each element in my array
			if(tabarray[i-1]!=this.id){ // if the element is not the one that has been clicked
				if($("#tab"+i).hasClass("isactive")){ // if it has the 'isactive' class
					$("#tab"+i).removeClass("isactive"); // remove it.
				}
				$("#tab-"+i).css("display","none"); // hidding other contents
			} else {				
				$("#tab-"+i).css("display","block"); // showing the content for active tab with nice fade
				$("#tab-"+i).hide();
				$("#tab-"+i).fadeIn("slow");
				//alert("#tab-"+i);
			}
			$(this).addClass("isactive"); // add the 'isactive' class to the tab that has been clicked.
		}
	});
	$(".addComment").click(function(e){
		var entryId = $(this).attr('name');
		//alert(entryId);
		$("#commentBox_"+entryId).show('slow');
		//$("#commentBox_"+entryId).css("background-color","blue");
	});		   
	$('.wallField').autogrow();   
});
function updateMembers(response){
	document.getElementById('memberList').innerHTML=response;
}
function updateFriends(response){
	document.getElementById('friendList').innerHTML=response;
}
function nl2enter(msg) {
	msg=msg.replace(new RegExp( "\\n", "g" ),"%0a");
	return msg;
}
function updateCustom(response){
	//alert(response);
	document.getElementById('customsContent').innerHTML=response;
}
function updateStrikers(response){
	//alert(response);
	document.getElementById('strikersContent').innerHTML=response;
}
