//http://www.developersnippets.com/2009/06/04/jquery-ajax-tabs-with-thickbox-enabled/
var reqPageUrl = new Array();			
reqPageUrl[1] = "donoma.html";
reqPageUrl[2] = "kalinda_a.html";
reqPageUrl[3] = "kalinda_b.html";
reqPageUrl[4] = "kalinda_c.html";

function loadTab(id)
{
	if (reqPageUrl[id].length > 0)
	{
		$("#preloader").show();
		$.ajax(
		{
			url: reqPageUrl[id], 
			cache: true,
			error: function(XMLHttpRequest, textStatus, errorThrown)
			{
				$('#tabmenu a').removeClass('active'); //remove all class='active' for all anchors
				$("#content_tab"+id).toggleClass('active'); //add class to the current one
				$("#content").empty().append('Error in Loading page, please do check with the path');//if there is any error in the request
				$("#preloader").hide();//hide the preloader
			},
			success: function(message) 
			{
				$('#tabmenu a').removeClass('active'); //remove all class='active' for all anchors
				$("#content_tab"+id).toggleClass('active'); //add class to the current one
				$("#content").empty().append(message);//first empty the content, then append content
				$("#preloader").hide();//hide the preloader
				tb_init('a.thickbox, area.thickbox, input.thickbox'); //call tb_init function to initiate ThichBox into your respective tab panels
			}
			
		});			        
	}
}

$(document).ready(function()
{
	loadTab(1); //After page loading, active tab 1
	$("#preloader").hide();
	$("#content_tab1").click(function(e){e.preventDefault(); loadTab(1);}); //Here e.preventDefault(); is to prevent the respective href from going the user off the link, that is the href url '#' which is appending to the URL will going off 
	$("#content_tab2").click(function(e){e.preventDefault(); loadTab(2);});
	$("#content_tab3").click(function(e){e.preventDefault(); loadTab(3);});
	$("#content_tab4").click(function(e){e.preventDefault(); loadTab(4);});
});
