/* ===========================================
 * R-Security Inc.
 * -------------------------------------------
 * Home
 * -------------------------------------------
 * 2011.06.27
=========================================== */


/* TabChange
=========================================== */

var tabcng = {
	getCookie : function(){
		tabcng.c = $.cookie("crm_tabcng");
		if(!tabcng.c) tabcng.c = "tab01";
		tabcng.setCookie();
	},
	setCookie : function(){
		$.cookie("crm_tabcng", tabcng.c, { expires:365, path:'/' });
	},
	setInit : function(){
		tabcng.setImg();
		$("#tabs>p>a").each(function(){
			$(this).click(function(){
				tabcng.set($(this).parent().attr("class"));
				return false;
			});
			$(this).focus(function(){
				this.blur();
			});
		});
	},
	setImg : function(){
		$("#tboxs>div").each(function(){
			if($(this).attr("id") == tabcng.c) $(this).removeClass("hide");
			else $(this).addClass("hide");
		});
		$("#tabs>p>a>img").each(function(){
			if($(this).parents("p:first").attr("class") == tabcng.c){
				this.src = this.src.replace("_n.", "_s.").replace("_o.", "_s.");
			} else {
				this.src = this.src.replace("_s.", "_n.");
			}
		});
	},
	set : function(id){
		if(id != tabcng.c){
			tabcng.c = id;
			tabcng.setCookie();
			tabcng.setImg();
		}
	}
}
tabcng.getCookie();


/* ===========================================
 * START
=========================================== */

$(document).ready(function(){
	// TabChange
	tabcng.setInit();

});


