$(document).ready(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); 
		//Remove any "active" class
		
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

});


var globalclick=0;
var imgid;



$(document).ready(function() {

	//Default Action
	$(".tab_content2").hide(); //Hide all content
	$("ul.tabs2 li:first").addClass("active").show(); //Activate first tab
	$(".tab_content2:first").show(); //Show first tab content
	globalclick=0
	//On Click Event
	$("ul.tabs2 li").click(function() {

		//Remove any "active" class
			
			var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
			//alert($(this).attr('class'));
			$(".tab_content2").hide();
			imgid="imgcomment-"+activeTab.substring(1,activeTab.length);	
			var tabid=activeTab.substring(1,activeTab.length);
			document.getElementById("imgcomment-tab2").src="Theme/default/images/user-comment.gif";
			document.getElementById("imgcomment-tab3").src="Theme/default/images/community-speak.gif";
			if($(this).attr('class')=="active")
			{
				globalclick=0;
				$(activeTab).fadeIn();
				$("ul.tabs2 li").removeClass("active");				
				if(tabid=="tab2")
				{
				document.getElementById(imgid).src="Theme/default/images/user-comment-up.gif";
				}
				else if(tabid=="tab3")
				{
				document.getElementById(imgid).src="Theme/default/images/community-speak-up.gif";
				}
				
			}
			else
			{			
				globalclick=1;
				$(this).addClass("active"); 
				$(activeTab).hide();

				if(tabid=="tab2")
				{
				document.getElementById(imgid).src="Theme/default/images/user-comment.gif";
				}
				else if(tabid=="tab3")
				{
				document.getElementById(imgid).src="Theme/default/images/community-speak.gif";
				}
			}
			


		//Add "active" class to selected tab
	//	$(".tab_content2").hide(); //Hide all tab content
		 //Fade in the active content
		return false;
	});

});
