// Function to swap the tab on the myaccount and myprofile pages
//
function showTab(tab_id,page_id)
{

	// Hide all tab content
	var elems = jQuery('.tab_content');
	for(var i=0;i<elems.length;i++) {
		if ((elems[i].getAttribute("id")!=null) && (elems[i].getAttribute("id")!='')) {
			jQuery('#'+elems[i].getAttribute("id")).hide();
		}
	}
	
	var elems = jQuery('#'+page_id+'_tabs > li > a');
	for (i=0; i<elems.length; i++) {
		jQuery(elems[i]).addClass("tabnotselected");
	}

	// Store the chosen tab in a cookie
	jQuery.cookie('last'+page_id+'tab', tab_id);
	
	// Highlight the chosen tab
	jQuery('#'+tab_id+'_link').removeClass("tabnotselected");
	jQuery('#'+tab_id+'_link').addClass("tabselected");
	
	// Show the selected tab content
	jQuery('#'+tab_id).show();
}