function themeSwitch(id){
//	for (var i = 1; i < 7; i ++) {
//		document.getElementById('tm' + i).className = '';
//		document.getElementById('tm' + i + 'List').style.display = 'none';
//	}
        if (id == null || id == 'null') { id = 'tm1'; }
	var i = 1;
	while (true) {
	if (!(i < 4)) break;
		document.getElementById('tm' + i).className = '';
		document.getElementById('tm' + i + 'List').style.display = 'none';
		document.getElementById('tm' + i + 'Link').style.display = 'none';
		i ++;
	}
	document.getElementById(id).className = 'menuOn';
	document.getElementById(id + 'List').style.display = 'block';
	document.getElementById(id + 'Link').style.display = 'block';
	setPortalTab('themeEl', id);
}
function entriesSwitch(id){
        if (id == null || id == 'null') { id = 'en1'; }
	var i = 1;
	while (true) {
	if (!(i < 3)) break;
		document.getElementById('en' + i).className = '';
		document.getElementById('en' + i + 'List').style.display = 'none';
		document.getElementById('en' + i + 'Link').style.display = 'none';
		i ++;
	}
	document.getElementById(id).className = 'menuOn';
	document.getElementById(id + 'List').style.display = 'block';
	document.getElementById(id + 'Link').style.display = 'block';
	setPortalTab('entriesEl', id);
}
function officialSwitch(id){
        if (id == null || id == 'null') { id = 'of1'; }
	var i = 1;
	while (true) {
	if (!(i < 3)) break;
		document.getElementById('of' + i).className = '';
		document.getElementById('of' + i + 'List').style.display = 'none';
		document.getElementById('of' + i + 'Link').style.display = 'none';
		i ++;
	}
	document.getElementById(id).className = 'menuOn';
	document.getElementById(id + 'List').style.display = 'block';
	document.getElementById(id + 'Link').style.display = 'block';
	setPortalTab('officialEl', id);
}
function userSwitch(id){
        if (id == null || id == 'null') { id = 'us1'; }
	var i = 1;
	while (true) {
	if (!(i < 3)) break;
		document.getElementById('us' + i).className = '';
		document.getElementById('us' + i + 'List').style.display = 'none';
		document.getElementById('us' + i + 'Link').style.display = 'none';
		i ++;
	}
	document.getElementById(id).className = 'menuOn';
	document.getElementById(id + 'List').style.display = 'block';
	document.getElementById(id + 'Link').style.display = 'block';
	setPortalTab('userEl', id);
}
function setPortalTab(targetEl,id,init) {
  var cookieDomain = 'blog.so-net.ne.jp';
  var cookieId   = targetEl;
  var cookiePath = '/';
  var cookieName = 'YAHOO.seesaa.Portal';
  if (!YAHOO.seesaa.PortalCookieJar) {
    YAHOO.seesaa.PortalCookieJar = new cookiejar(cookieName);
  }
  var cookieJar = YAHOO.seesaa.PortalCookieJar;
  cookieJar.domain = cookieDomain;
  cookieJar.path   = cookiePath;
  cookieJar.setExpiration(1, 0, 0, 0, 0, 0) ;
  var val = cookieJar.getCookie(cookieId);
  if (init && val) {
      if (targetEl == 'afpbbEl')    { afpbbSwitch(val) }
      if (targetEl == 'themeEl')    { themeSwitch(val) }
      if (targetEl == 'entriesEl')  { entriesSwitch(val) }
      if (targetEl == 'officialEl') { officialSwitch(val) }
      if (targetEl == 'userEl')     { userSwitch(val) }
  }
  var setId = id ? id : val;
  cookieJar.delCookie(cookieId,setId);
  cookieJar.setCookie(cookieId,setId);
  cookieJar.write();
  var val = cookieJar.getCookie(cookieId);
}
window.onload = function(){
        setPortalTab('themeEl','','init');
    setPortalTab('entriesEl','','init');
    setPortalTab('officialEl','','init');
    setPortalTab('userEl','','init');
}