/* Index----------------------------

   1. Cookie
   2. Font Changer
   3. Image Window
   4. Region Search
   5. Accordion System
   6. CheckBox Selector
   7. Balloon
   8. Advertisement
   9. Script Flow
  10. Jitsuryoku Sort
  11. Site Search

--------------------------------- */



/* ---------------------------------
   1. Cookie
--------------------------------- */

var chkPath = "/";

function setCookie(ajxName, numValue, endDay) {
	expDay = "Wed, 01 Jan 2020 23:59:59 GMT";
	setDomain = ".yomidr.yomiuri.co.jp";
	
	if (endDay != null) {

		endDay = eval(endDay);
		setDay = new Date();
		setDay.setTime(setDay.getTime() + (endDay * 1000 * 60 * 60 * 24));
		expDay = setDay.toGMTString();
		
		document.cookie = ajxName + "=" + escape(numValue) + ";expires=" + expDay + ";path=" + chkPath + ";domain=" + setDomain;

	} else {

		document.cookie = ajxName + "=" + escape(numValue)  + ";path=" + chkPath + ";domain=" + setDomain;

	}
	return true;
}

function delCookie(ajxName) {
	document.cookie = ajxName + "=;expires=Thu,01-Jan-70 00:00:01 GMT";
	return true;
}

function getCookie(ajxName) {
	ajxName += "=";
	theCookie = document.cookie + ";";
	start = theCookie.indexOf(ajxName);
	if(start != -1) {
		end = theCookie.indexOf(";", start);
		return unescape(theCookie.substring(start+ajxName.length,end));
	}
	return false;
}


/* ------------------------------ */



/* ---------------------------------
   2. Font Changer
--------------------------------- */

var fcSystem = "FontChanger";
var setFont = new Array("80%", "100%", "120%");
var setSize;
var endDay = "30";

function chgSize(setSize) {
	var fntSize = setFont[setSize];
	document.body.style.fontSize = fntSize;
	chgHtml(setSize);
	setCookie(fcSystem, setSize, endDay);
}

function chgFont() {
	// Font Changer
	if(getCookie(fcSystem)) setSize = getCookie(fcSystem);
	else setSize = 1;
	chgSize(setSize);
}

function chgHtml(setSize) {
	if(document.layers) return;
	var html = '';
	html += '<dl>';
	html += '<dt>文字</dt>';
	html += '<dd><ul>';
	html += '<li';
	if(setSize == 0) {
		html += ' class="select"';
	}
	html += '><a href="javascript:chgSize(0);" class="small">小</a></li>';
	html += '<li';
	if(setSize == 1) {
		html += ' class="select"';
	}
	html += '><a href="javascript:chgSize(1);" class="middle">中</a></li>';
	html += '<li';
	if(setSize == 2) {
		html += ' class="select"';
	}
	html += '><a href="javascript:chgSize(2);" class="large">大</a></li>';
	html += '</ul></dd>';
	html += '</dl>';
	if(document.getElementById("fontchg"))
	{
			document.getElementById("fontchg").innerHTML = html;
	}
}


/* ------------------------------ */



/* ---------------------------------
   3. Image Window
--------------------------------- */
function imgWin(tarPage) {
	var imgPopup = window.open(tarPage, 'imgWindow', 'left = 0, top = 0, width = 1, height = 1, status = 1, scrollbars = 1, menubar = 0, location = 0, toolbar = 0, resizable = 1');
}

function imgWinResizer() {
	var broHeight;
	var imgWidth;
	
	// Set window width
	if (navigator.userAgent.indexOf("Windows NT 6.0") != -1) {
		// for Vista
		imgWidth = document.images[0].width + 80;
	} else {
		// for other OS
		imgWidth = document.images[0].width + 70;
	}

	// Set window height
	if (navigator.userAgent.indexOf("MSIE") != -1) {
		if (navigator.userAgent.indexOf("MSIE 6.0") != -1) {
			broHeight = 110;
		} else {
			broHeight = 130;
		}

		// Only for Vista + IE
		if (navigator.userAgent.indexOf("Windows NT 6.0") != -1) {
			broHeight += 10;
		}
	} else {
		broHeight = 140;
	}
	
	var imgHeight = document.getElementsByTagName('div')[0].offsetHeight + broHeight;

	document.getElementsByTagName('div')[0].style.width = document.images[0].width;
	document.getElementsByTagName('p')[0].style.width = document.images[0].width;
	resizeTo(imgWidth, imgHeight);
}


/* ------------------------------ */



/* ---------------------------------
   4. Region Search
--------------------------------- */

function chgFigure(i, c) {
	if(document.all) document.all(i).className = c;
	else if(document.getElementById) document.getElementById(i).className = c; 
}

var stkList = 0;
var listNum = 0;

function chgList(listNum) {
	if(stkList == 0) {
		stkList = "list00";
		if(document.getElementById) {
			document.getElementById(stkList).style.display = "none";
		} else if(document.all) {
			document.all(stkList).style.display = "none";
		}
	}

	if(listNum < 10) {
		clkList = "list0" + listNum;
	} else {
		clkList = "list" + listNum;
	}

	if(document.getElementById) {
		if(stkList != clkList) {
			if(stkList != 0) document.getElementById(stkList).style.display = "none";
			document.getElementById(clkList).style.display = "block";
			stkList = clkList;
		}
	} else if(document.all) {
		if(stkList != clkList) {
			if(stkList != 0) document.all(stkList).style.display = "none";
			document.all(clkList).style.display = "block";
			stkList = clkList;
		}
	}
}


/* ------------------------------ */



/* ---------------------------------
   5. Accordion System
--------------------------------- */

var bodyId, cookieId, acdBtn, acdTxt;

function acdLoad(kijiType) {
	bodyId = kijiType;
	if(bodyId == "zenkoku") {
		// Jitsuryoku Kiji Execute
		cookieId = bodyId;
		acdBtn = bodyId + "-btn";
		acdTxt = bodyId + "-txt";

		if(document.getElementById(acdTxt)) {
			if(getCookie(cookieId) != false) {
				if(getCookie(cookieId) == 1) {
					if(document.getElementById) {
						document.getElementById(acdTxt).style.display = "none";
						document.getElementById(acdBtn).style.backgroundPosition = "center top";
					} else if(document.all) {
						document.all(acdTxt).style.display = "none";
						document.all(acdBtn).style.backgroundPosition = "center top";
					}
				}
			}
		}
	} else if (bodyId == "taizen") {
		// Only Taizen Kiji Execute
		acdBtn = bodyId + "-btn";
		acdTxt = bodyId + "-txt";
		cookieId = bodyId;
		
		document.getElementById(acdTxt).style.display = "none";
		document.getElementById(acdBtn).style.backgroundPosition = "center top";

		btnStatus = 1;
		setCookie(cookieId, btnStatus);

	} else if (bodyId == "taizen_list") {
		// Only Taizen List Execute
		bodyId = "taizen";
		acdBtn = bodyId + "-btn";
		acdTxt = bodyId + "-txt";
		cookieId = bodyId;
		
		document.getElementById(acdTxt).style.display = "block";
		document.getElementById(acdBtn).style.backgroundPosition = "center bottom";

		btnStatus = 0;
		setCookie(cookieId, btnStatus);
	}

}

function acdSys(setId) {
	/* cookieId = document.getElementsByTagName("body")[0].id + "-" + setId; */
	cookieId = setId;
	acdBtn = setId + "-btn";
	acdTxt = setId + "-txt";
	btnStatus = 0;

	if(getCookie(setId) == 0) {
		if(document.getElementById) {
			document.getElementById(acdTxt).style.display = "none";
			document.getElementById(acdBtn).style.backgroundPosition = "center top";
		} else if(document.all) {
			document.all(acdTxt).style.display = "none";
			document.all(acdBtn).style.backgroundPosition = "center top";
		}
		btnStatus = 1;
	} else {
		if(document.getElementById) {
			document.getElementById(acdTxt).style.display = "block";
			document.getElementById(acdBtn).style.backgroundPosition = "center bottom";
		} else if(document.all) {
			document.all(acdTxt).style.display = "block";
			document.all(acdBtn).style.backgroundPosition = "center bottom";
		}
		btnStatus = 0;
	}
	
	setCookie(cookieId, btnStatus);

}


/* ------------------------------ */



/* ---------------------------------
   6. CheckBox Selector
--------------------------------- */

function delAll() {
	var inpCount = document.delForm.elements.length;
	if(document.delForm.allCheck.checked) {
		for(i = 1; i < inpCount; i++) document.delForm.elements[i].checked = true;
	} else {
		for(i = 1; i < inpCount; i++) document.delForm.elements[i].checked = false;
	}
}


/* ------------------------------ */



/* ---------------------------------
   7. Balloon
--------------------------------- */

function balloon(blname) {
	document.getElementById(blname).style.display = "block";
}

function balloonclose(blname) {
	document.getElementById(blname).style.display = "none";
}


/* ------------------------------ */



/* ---------------------------------
   8. Advertisement
--------------------------------- */

function showSuperBanner() {
	ADimp = (typeof(ADimp)=='undefined') ? new Object() : ADimp;
	ADimp.impAserver = "http://as.yl.impact-ad.jp";
	ADimp.SB = new Object();
	ADimp.SB.impAtarget = "/SITE=YOMIDR/AREA=BANNER/AAMSZ=728X90/OENCJP=UTF8";

	ADimp.impArnd = Math.round(Math.random() * 100000000);
	if (!ADimp.impApid) ADimp.impApid = Math.round(Math.random() * 100000000);

	document.write('<scr');
	document.write('ipt type="text/javascript" language="JavaScript" src="' + ADimp.impAserver + '/jserver/acc_random=' + ADimp.impArnd + ADimp.SB.impAtarget + '/pageid=' + ADimp.impApid + '">');
	document.write('</scr');
	document.write('ipt>');

	document.write('</script><noscript><iframe src="http://as.yl.impact-ad.jp/hserver/SITE=YOMIDR/AREA=BANNER/AAMSZ=728X90/OENCJP=UTF8" noresize scrolling=no hspace=0 vspace=0 frameborder=0 marginheight=0 marginwidth=0 width=728 height=90 allowTransparency="true"></iframe></noscript>');

}

function setTileAdParam1() {
	ADimp = (typeof(ADimp)=='undefined') ? new Object() : ADimp;
	ADimp.impAserver = "http://as.yl.impact-ad.jp";
	ADimp.TL = new Object();
	ADimp.TL.impAnum = 2;
	ADimp.TL.impAtarget = '';
	ADimp.TL.random = true;
	for(var i=0;i<ADimp.TL.impAnum;i++){
		ADimp.TL.impAtarget += "/AAMB"+i+"/SITE=YOMIDR/AREA=TILE"+(i+1)+"/AAMSZ=300X55/OENCJP=UTF8";
	}

	ADimp.impArnd = Math.round(Math.random() * 100000000);
	if (!ADimp.impApid) ADimp.impApid = Math.round(Math.random() * 100000000);

	document.write('<scr');
	document.write('ipt type="text/javascript" language="JavaScript" src="' + ADimp.impAserver + '/bservers/AAMALL/acc_random=' + ADimp.impArnd + '/pageid=' + ADimp.impApid + ADimp.TL.impAtarget + '">');
	document.write('</scr');
	document.write('ipt>');

}

function setTileAdParam2() {
	ADimp.TL.impAads = new Array(ADimp.TL.impAnum);
	for(var i=0;i<ADimp.TL.impAnum;i++){
	eval('ADimp.TL.impAads[' + i + '] = (typeof(AAMB' + i + ')) != "undefined" ? AAMB' + i + ':"";');

	if(ADimp.TL.impAads[i].indexOf('AEYL') == -1){
		ADimp.TL.impAads[i] = ADimp.TL.impAads[i].replace("<!--", "<!--\n");
	}else{
		ADimp.TL.impAads[i] = "";
		}
	}

	if(ADimp.TL.random){
		ADimp.i = ADimp.TL.impAnum;
		while(--ADimp.i){
		var j = Math.floor(Math.random()*(i));
		if(ADimp.i ==j) continue;
			var k = ADimp.TL.impAads[ADimp.i]; ADimp.TL.impAads[ADimp.i] = ADimp.TL.impAads[j]; ADimp.TL.impAads[j] = k;
		}
	}
	
}

function showTileAd1() {
	if(typeof(ADimp.TL.impAads[0]) != 'undefined' && ADimp.TL.impAads[0] != ''){
		document.write(ADimp.TL.impAads[0]);
	}
}

function showTileAd2() {
	if(typeof(ADimp.TL.impAads[1]) != 'undefined' && ADimp.TL.impAads[1] != ''){
		document.write(ADimp.TL.impAads[1]);
	}
}

function showRectangleAd() {
	ADimp = (typeof(ADimp)=='undefined') ? new Object() : ADimp;
	ADimp.impAserver = "http://as.yl.impact-ad.jp";
	ADimp.RC = new Object();
	ADimp.RC.impAtarget = "/SITE=YOMIDR/AREA=RECTANGLE/AAMSZ=300X250/OENCJP=UTF8";

	ADimp.impArnd = Math.round(Math.random() * 100000000);
	if (!ADimp.impApid) ADimp.impApid = Math.round(Math.random() * 100000000);

	document.write('<scr');
	document.write('ipt type="text/javascript" language="JavaScript" src="' + ADimp.impAserver + '/jserver/acc_random=' + ADimp.impArnd + ADimp.RC.impAtarget + '/pageid=' + ADimp.impApid + '">');
	document.write('</scr');
	document.write('ipt>');

	document.write('<noscript>');
	document.write('<iframe src="http://as.yl.impact-ad.jp/hserver/SITE=YOMIDR/AREA=RECTANGLE/AAMSZ=300X250/OENCJP=UTF8" noresize scrolling=no hspace=0 vspace=0 frameborder=0 marginheight=0 marginwidth=0 width=300 height=250 allowTransparency="true">');
	document.write('</iframe>');
	document.write('</noscript>');
}

/* ------------------------------ */



/* ---------------------------------
   9. Script Flow
--------------------------------- */

function jsFlow() {
// IE6 RollOver Image
	try {
		document.execCommand('BackgroundImageCache', false, true);
	} catch(e) {}
}

// Execute jsFlow
if (window.addEventListener) { //for W3C DOM
  window.addEventListener("load", jsFlow, false);
} else if (window.attachEvent) { //for IE
  window.attachEvent("onload", jsFlow);
} else  {
  window.onload = jsFlow;
}

/* ---------------------------------
  10. Jitsuryoku Sort
--------------------------------- */

function list_sort(target) {
	if (L_Search("sort_target") == null) {
		location.href = location.href + "?sort_target=" + target;
	} else {
		location.href = location.href.substr(0, location.href.lastIndexOf("?")) + "?sort_target=" + target;
	}
	
	return true;
}

function set_sort() {
	
	var element_count = 0;
	var element_num;
	while(1) {
		++element_count
	
		if (element_count < 10) {
			element_num = "0" + element_count;
		} else {
			element_num = element_count;
		}
		if (document.getElementById("sort_up" + element_num)) {
			document.getElementById("sort_up" + element_num).className = "up";
			document.getElementById("sort_down" + element_num).className = "down";
		} else {
			break;
		}
	}

	var target_number = L_Search("sort_target");
	
	if (target_number != null) {
		if (target_number.charAt(2) == "0") {
			document.getElementById("sort_up" + target_number.substr(0,2)).className = "up-selected";
		} else {
			document.getElementById("sort_down" + target_number.substr(0,2)).className = "down-selected";
		}
	} else {
		document.getElementById("sort_up01").className = "up-selected";
	}
	
	return true;
	
}

L_Search = function(vars){
        if(location.search.length<2)return null;
        var LS_data = location.search.substr(1,location.search.length-1).split("&");
        var l = 0;
        for(;l<LS_data.length;l++){
                if(LS_data[l].indexOf("=")>-1)LS_data[l] = LS_data[l].split("=");
                else LS_data[l] = [LS_data[l],"default"];
        }
        for(l=0;l<LS_data.length;l++)if(LS_data[l][0]==vars)return LS_data[l][1];
        return null;
}
/* ------------------------------ */

/* ---------------------------------
  11. Site Search
--------------------------------- */
function menu_search() {

        document.write("<form action='http://search.yomiuri.co.jp/yomidr.html' class='popin_test' method='GET'>");
        document.write("<input type='text' name='q' value='' size='30' id='selectquery' class='inp'>");
        document.write("<input type='submit' value=' 検 索 ' class='button'>");
        document.write("<ul>");
        document.write("<li>");
        document.write("<input id='selectall' type='radio' name='ch' value='' checked>");
        document.write("<label for='selectall'>全体</label>");
        document.write("</li>");
        document.write("<li>");
        document.write("<input id='completeworks' type='radio' name='ch' value='医療大全'>");
        document.write("<label for='completeworks'>医療大全</label>");
        document.write("</li>");
        document.write("<li>");
        document.write("<input id='consulation' type='radio' name='ch' value='医療相談室'>");
        document.write("<label for='consulation'>医療相談室</label>");
        document.write("</li>");
        document.write("</ul>");
        document.write("</form>");

}

function taizen_search() {

        document.write("<form class='popin_test' action='http://search.yomiuri.co.jp/yomidr.html' method='GET'>");
        document.write("<input type='text' name='q' value='' size='30' class='text'>");
        document.write("<input type='hidden' name='ch' value='医療大全'>");
        document.write("<input type='submit' value=' 検 索 ' class='button'>");
        document.write("</form>");

}

function soudan_search() {

        document.write("<form class='popin_test' action='http://search.yomiuri.co.jp/yomidr.html' method='GET'>");
        document.write("<input type='text' name='q' value='' size='30' class='text'>");
        document.write("<input type='hidden' name='ch' value='医療相談室'>");
        document.write("<input type='submit' value=' 検 索 ' class='button'>");
        document.write("</form>");

}

function top_search() {

        document.write("<form action='http://search.yomiuri.co.jp/yomidr.html' class='popin_test' method='GET'>");
        document.write("<ul><li>検索する</li></ul>");
        document.write("<input type='text' name='q' value='' size='30' id='allquery' class='inp'>");
        document.write("<input type='submit' value=' 検 索 ' id='allsearch' class='button'>");
        document.write("</form>");

}

function top_common_search() {

        document.write("<form action='http://search.yomiuri.co.jp/yomidr.html' class='popin_test' method='GET' id='searchForm'>");
        document.write("<input type='text' name='q' value='' size='30' id='allquery' class='inp'>&nbsp;");
        document.write("<input type='button' value=' 検 索 ' id='allsearch' class='button' onclick='searchWords()'>");
        document.write("<div>");
        document.write("<input id='selectall' type='radio' name='ch' value='' checked>");
        document.write("<label for='selectall'>全体</label>");
        document.write("<input id='completeworks' type='radio' name='ch' value='医療大全'>");
        document.write("<label for='completeworks'>医療大全</label>");
        document.write("<input id='consulation' type='radio' name='ch' value='医療相談室'>");
        document.write("<label for='consulation'>医療相談室</label>");
        document.write("<input id='medicine' type='radio' name='ch' value='薬'>");
        document.write("<label for='medicine'>薬</label>");
        document.write("</div>");
        document.write("</form>");

}

function searchWords() {
	var selectedItems, textValue, formItem, inputItem1, inputItem2, inputItem3, inputItem4;

	selectedItems = document.getElementsByName("ch");
	for(var i = 0; i < selectedItems.length; i++) {
		if(selectedItems[i].checked) {

			formItem = document.getElementById("searchForm")
			if(selectedItems[i].value == "薬") {

				textValue = document.getElementById("allquery").value;

				formItem = document.createElement("form");
				formItem.setAttribute("action", "http://www.qlife.jp/yol/red2.php");
				formItem.setAttribute("method", "post");
				formItem.setAttribute("target", "qlife_drug");
				formItem.setAttribute("id","searchForm");

				inputItem1 = document.createElement("input");
				inputItem1.setAttribute("name", "enc");
				inputItem1.setAttribute("value", "utf-8");
				formItem.appendChild(inputItem1);

				inputItem2 = document.createElement("input");
				inputItem2.setAttribute("name", "target");
				inputItem2.setAttribute("value", "meds");
				formItem.appendChild(inputItem2);

				inputItem3 = document.createElement("input");
				inputItem3.setAttribute("id", "h");
				inputItem3.setAttribute("name", "keyword");
				inputItem3.setAttribute("value", textValue);
				formItem.appendChild(inputItem3);

				document.getElementsByTagName("body")[0].appendChild(formItem);
				
			}
			
			formItem.submit();
			break;
		}
	}
}

/* ------------------------------ */

/* ---------------------------------
  12. Change Content-Title 
--------------------------------- */
function changeTitle() {
	var title = document.title;
	var rCategory = document.getElementsByName("r_category")[0].content;
	var yomiDr = "yomiDr./ヨミドクター(読売新聞)";
	var delimeter = " : ";
	var newTitle = "";
	if(title != undefined && title !="") {
		newTitle += title;
	}
	if(rCategory != undefined && rCategory !="") {
		if(newTitle == "") {
			newTitle += rCategory;
		} else {
			newTitle += delimeter + rCategory;
		}
	}
	if(newTitle == "") {
		newTitle += yomiDr;
	} else {
		newTitle += delimeter + yomiDr;
	}
	document.title = newTitle;
}



/* ---------------------------------
  13. Acording Close
--------------------------------- */
function acdLoad_close(id) {
	acdBtn = id + "-btn";
	acdTxt = id + "-txt";

	document.getElementById(acdTxt).style.display = "none";
	document.getElementById(acdBtn).style.backgroundPosition = "center top";

	btnStatus = 1;
	setCookie(id, btnStatus);

}



/* ---------------------------------
  14. Taizen Search Acordion
--------------------------------- */
function searchBuiAcdLoad(buiId) {
	for(i = 1; i < 15; i++) {
		if(i < 10) {
			setId = buiId + "0" + i;
		} else {
			setId = buiId + i;
		}
		
		cookieId = setId;
		acdBtn01 = setId + "-btn01";
		acdBtn02 = setId + "-btn02";
		acdTxt = setId + "-txt";

		if(document.getElementById) {
			document.getElementById(acdTxt).style.display = "none";
			document.getElementById(acdBtn01).style.backgroundPosition = "center top";
			document.getElementById(acdBtn02).style.backgroundPosition = "";
		} else if(document.all) {
			document.all(acdTxt).style.display = "none";
			document.all(acdBtn01).style.backgroundPosition = "center top";
			document.all(acdBtn02).style.backgroundPosition = "";
		}

		btnStatus = 1;
		setCookie(cookieId, btnStatus);
	}
}

function searchConditionAcdLoad(conId) {
	for(i = 1; i < 13; i++) {
		if(i < 10) {
			setId = conId + "0" + i;
		} else {
			setId = conId + i;
		}
		
		cookieId = setId;
		acdBtn01 = setId + "-btn01";
		acdBtn02 = setId + "-btn02";
		acdTxt = setId + "-txt";

		if(document.getElementById) {
			document.getElementById(acdTxt).style.display = "none";
			document.getElementById(acdBtn01).style.backgroundPosition = "center top";
			document.getElementById(acdBtn02).style.backgroundPosition = "";
		} else if(document.all) {
			document.all(acdTxt).style.display = "none";
			document.all(acdBtn01).style.backgroundPosition = "center top";
			document.all(acdBtn02).style.backgroundPosition = "";
		}

		btnStatus = 1;
		setCookie(cookieId, btnStatus);
	}
}

function searchAcdSys(setId) {
	cookieId = setId;
	acdBtn01 = setId + "-btn01";
	acdBtn02 = setId + "-btn02";
	acdTxt = setId + "-txt";

	if(getCookie(setId) == 0) {
		if(document.getElementById) {
			document.getElementById(acdTxt).style.display = "none";
			document.getElementById(acdBtn01).style.backgroundPosition = "center top";
			document.getElementById(acdBtn02).style.backgroundPosition = "";
		} else if(document.all) {
			document.all(acdTxt).style.display = "none";
			document.all(acdBtn01).style.backgroundPosition = "center top";
			document.all(acdBtn02).style.backgroundPosition = "";
		}
		btnStatus = 1;
	} else {
		if(document.getElementById) {
			document.getElementById(acdTxt).style.display = "block";
			document.getElementById(acdBtn01).style.backgroundPosition = "center -18px";
			document.getElementById(acdBtn02).style.backgroundPosition = "center -20px";
		} else if(document.all) {
			document.all(acdTxt).style.display = "block";
			document.all(acdBtn01).style.backgroundPosition = "center -18px";
			document.all(acdBtn02).style.backgroundPosition = "center -20px";
		}
		btnStatus = 0;
	}
	
	setCookie(cookieId, btnStatus);

}


/* ---------------------------------
  15. Jitsuryoku Enquete Acordion
--------------------------------- */
function enqueteacdLoad() {
	for(i = 1; i < 15; i++) {
		if(i < 10) {
			setId = "B0" + i;
		} else {
			setId = "B" + i;
		}
		
		cookieId = setId;
		acdBtn01 = setId + "-btn01";
		acdBtn02 = setId + "-btn02";
		acdTxt = setId + "-txt";

		if(document.getElementById) {
			if(! document.getElementById(acdTxt)) {
				continue;
			} else {
				document.getElementById(acdTxt).style.display = "none";
			}
			
			if(! document.getElementById(acdBtn01)) {
				continue;
			} else {
				document.getElementById(acdBtn01).style.backgroundPosition = "center top";
			}
			
			if(! document.getElementById(acdBtn02)) {
				continue;
			} else {
				document.getElementById(acdBtn02).style.backgroundPosition = "";
			}
		} else if(document.all) {
			if(! document.all(acdTxt)) {
				continue;
			} else {
				document.all(acdTxt).style.display = "none";
			}

			if(! document.getElementById(acdBtn01)) {
				continue;
			} else {
				document.all(acdBtn01).style.backgroundPosition = "center top";
			}
			
			if(! document.getElementById(acdBtn02)) {
				continue;
			} else {
				document.all(acdBtn02).style.backgroundPosition = "";
			}
		}

		btnStatus = 1;
		setCookie(cookieId, btnStatus);
	}
}

function enqueteAcdSys(setId) {
	cookieId = setId;
	acdBtn01 = setId + "-btn01";
	acdBtn02 = setId + "-btn02";
	acdTxt = setId + "-txt";

	if(getCookie(setId) == 0) {
		if(document.getElementById) {
			document.getElementById(acdTxt).style.display = "none";
			document.getElementById(acdBtn01).style.backgroundPosition = "center top";
			document.getElementById(acdBtn02).style.backgroundPosition = "";
		} else if(document.all) {
			document.all(acdTxt).style.display = "none";
			document.all(acdBtn01).style.backgroundPosition = "center top";
			document.all(acdBtn02).style.backgroundPosition = "";
		}
		btnStatus = 1;
	} else {
		if(document.getElementById) {
			document.getElementById(acdTxt).style.display = "block";
			document.getElementById(acdBtn01).style.backgroundPosition = "center -18px";
			document.getElementById(acdBtn02).style.backgroundPosition = "center -20px";
		} else if(document.all) {
			document.all(acdTxt).style.display = "block";
			document.all(acdBtn01).style.backgroundPosition = "center -18px";
			document.all(acdBtn02).style.backgroundPosition = "center -20px";
		}
		btnStatus = 0;
	}
	
	setCookie(cookieId, btnStatus);

}

function setEnqueteValue(id, text) {
	var objTextarea = document.getElementsByName("selectedEnqueteName")[0];
	objTextarea.value = text;
	document.BJ_enqueteCheck.selectedEnqueteId.value=id;
	objTextareaTop = document.getElementById("selected_enquete").offsetTop;
	window.scroll(0,objTextareaTop - 80);
}

/* ---------------------------------
  16. Top
--------------------------------- */
var elementTop, elementOnly, elementRestricted;

function mainImageChange(category) {
	elementTop = document.getElementById("topImage");
	elementOnly = document.getElementById("only");
	elementRestricted = document.getElementById("restricted");

	switch(category) {
		case "taizen":
			elementTop.style.backgroundImage = "url(./common/img/top/img_maingroup_back_taizen.gif)";
			elementOnly.style.backgroundImage = "url(./common/img/top/img_maingroup_parts_charge.gif)";
			elementRestricted.style.backgroundImage = "none";
			document.getElementById("taizenTxt").style.backgroundPosition = "center bottom"
			document.getElementById("jitsuryokuTxt").style.backgroundPosition = "center top"
			document.getElementById("sodanTxt").style.backgroundPosition = "center top"
			document.getElementById("columnblogTxt").style.backgroundPosition = "center top"
			break;
		case "jitsuryoku":
			elementTop.style.backgroundImage = "url(./common/img/top/img_maingroup_back_jitsuryoku.gif)";
			elementOnly.style.backgroundImage = "url(./common/img/top/img_maingroup_parts_charge.gif)";
			elementRestricted.style.backgroundImage = "none";
			document.getElementById("taizenTxt").style.backgroundPosition = "center top"
			document.getElementById("jitsuryokuTxt").style.backgroundPosition = "center bottom"
			document.getElementById("sodanTxt").style.backgroundPosition = "center top"
			document.getElementById("columnblogTxt").style.backgroundPosition = "center top"
			break;
		case "sodan":
			elementTop.style.backgroundImage = "url(./common/img/top/img_maingroup_back_sodan.gif)";
			elementOnly.style.backgroundImage = "none";
			elementRestricted.style.backgroundImage = "url(./common/img/top/img_maingroup_parts_chargetext.gif)";
			document.getElementById("taizenTxt").style.backgroundPosition = "center top"
			document.getElementById("jitsuryokuTxt").style.backgroundPosition = "center top"
			document.getElementById("sodanTxt").style.backgroundPosition = "center bottom"
			document.getElementById("columnblogTxt").style.backgroundPosition = "center top"
			break;
		case "columnblog":
			elementTop.style.backgroundImage = "url(./common/img/top/img_maingroup_back_columnblog.gif)";
			elementOnly.style.backgroundImage = "none";
			elementRestricted.style.backgroundImage = "url(./common/img/top/img_maingroup_parts_chargetext.gif)";
			document.getElementById("taizenTxt").style.backgroundPosition = "center top"
			document.getElementById("jitsuryokuTxt").style.backgroundPosition = "center top"
			document.getElementById("sodanTxt").style.backgroundPosition = "center top"
			document.getElementById("columnblogTxt").style.backgroundPosition = "center bottom"
			break;
		default:
			break;
	}
}

var categoryNum = 0;
var changeTime;

function mainImageChangeAuto(time) {
	elementTop = document.getElementById("topImage");
	elementOnly = document.getElementById("only");
	elementRestricted = document.getElementById("restricted");

	categoryNum += 1;

	switch(categoryNum) {
		case 1:
			elementTop.style.backgroundImage = "url(./common/img/top/img_maingroup_back_taizen.gif)";
			elementOnly.style.backgroundImage = "url(./common/img/top/img_maingroup_parts_charge.gif)";
			elementRestricted.style.backgroundImage = "none";
			document.getElementById("taizenTxt").style.backgroundPosition = "center bottom"
			document.getElementById("jitsuryokuTxt").style.backgroundPosition = "center top"
			document.getElementById("sodanTxt").style.backgroundPosition = "center top"
			document.getElementById("columnblogTxt").style.backgroundPosition = "center top"
			break;
		case 2:
			elementTop.style.backgroundImage = "url(./common/img/top/img_maingroup_back_jitsuryoku.gif)";
			elementOnly.style.backgroundImage = "url(./common/img/top/img_maingroup_parts_charge.gif)";
			elementRestricted.style.backgroundImage = "none";
			document.getElementById("taizenTxt").style.backgroundPosition = "center top"
			document.getElementById("jitsuryokuTxt").style.backgroundPosition = "center bottom"
			document.getElementById("sodanTxt").style.backgroundPosition = "center top"
			document.getElementById("columnblogTxt").style.backgroundPosition = "center top"
			break;
		case 3:
			elementTop.style.backgroundImage = "url(./common/img/top/img_maingroup_back_sodan.gif)";
			elementOnly.style.backgroundImage = "none";
			elementRestricted.style.backgroundImage = "url(./common/img/top/img_maingroup_parts_chargetext.gif)";
			document.getElementById("taizenTxt").style.backgroundPosition = "center top"
			document.getElementById("jitsuryokuTxt").style.backgroundPosition = "center top"
			document.getElementById("sodanTxt").style.backgroundPosition = "center bottom"
			document.getElementById("columnblogTxt").style.backgroundPosition = "center top"
			break;
		case 4:
			elementTop.style.backgroundImage = "url(./common/img/top/img_maingroup_back_columnblog.gif)";
			elementOnly.style.backgroundImage = "none";
			elementRestricted.style.backgroundImage = "url(./common/img/top/img_maingroup_parts_chargetext.gif)";
			document.getElementById("taizenTxt").style.backgroundPosition = "center top"
			document.getElementById("jitsuryokuTxt").style.backgroundPosition = "center top"
			document.getElementById("sodanTxt").style.backgroundPosition = "center top"
			document.getElementById("columnblogTxt").style.backgroundPosition = "center bottom"
			break;
		default:
			break;
	}

	if(categoryNum > 4) {
		categoryNum = 0;
	}
	
	setTimeout("mainImageChangeAuto('" + time + "')", time * 1000);
}

/* ---------------------------------
  17. Change Content-Title Kaisetsu
--------------------------------- */
function changeTitleKaisetsu() {

	var newTitle = document.getElementById("title").innerHTML;

	newTitle += "：医療大全：yomiDr./ヨミドクター(読売新聞)";
	document.title = newTitle;
}


