$(function() {
	setupTabView(".notification");
	setupTabView(".recommendedplan");
});

// タブビューの初期設定を行う
// tabview: タブビュー外枠のセレクタ
function setupTabView(tabview) {
	$(tabview + " .tabview .tab").click(function() {	//タブクリック時
		hideAllTabs(tabview);
		unsetAllTabFocus(tabview);
		setTabFocus(this);
		$($(this).attr("href")).show();		//hrefに記載の要素を表示

		return false;
	});
}

// タブビュー中の全てのタブを非表示にする
// tabview: タブビュー外枠のセレクタ
function hideAllTabs(tabview) {
	$(tabview + " .content").hide();
}


// 全てのタブを非選択状態にする
// tabview: タブビュー外枠のセレクタ
function unsetAllTabFocus(tabview) {
	$(tabview + " a.tab img").each(function() {
		$(this).attr("src", $(this).attr("src").replace("_yes.", "_no."));
	});
}

// 指定されたタブを選択状態にする
// tab: タブのDOMオブジェクト
function setTabFocus(tab) {
	$(tab).find("img").each(function() {
		$(this).attr("src", $(this).attr("src").replace("_no.", "_yes."));
	});
}

