// JavaScript Document
(function($){
	$.fn.switchTab = function(){
		var ___jQueryObj = this;
		
		function __init() {
			__start(this,___jQueryObj); // This, in this context, refer to object (link) which the user have clicked
			return false; // Avoid the browser following the link
		}
		
		function __start(___objClicked,___jQueryObj) {
			if(___objClicked.getAttribute('class') != 'selected'){
				___jQueryObj.each(function(index){
					if($(this).attr('class') == 'selected'){
						$(this).removeClass('selected');
						$($(this).attr('href')).hide();
					}
				});
				$(___objClicked).addClass('selected');
				if($(___objClicked).attr('id') == 'gianhang_daxem_li'){
					$("li.m2").hide();
					$("li.m1").addClass('m1_1');
				} else {
					$("li.m2").show();
					$("li.m1").removeClass('m1_1');
				};
				$($(___objClicked).attr('href')).show();
			}
		}
		
		return this.unbind('click').click(__init);
	}
})(jQuery);
