function double_check(bt_name)
{
	document.getElementById(bt_name).disabled=true;
	return true;
}


function setPayment(){
	if(!document.confirm.agreement1[0].checked){
		window.alert('「キャンセル・中止について」に同意してください');
		return false;
	}
	if(!document.confirm.agreement2[0].checked){
		window.alert('「個人情報保護方針」に同意してください');
		return false;
	}
	return true;
}

function go_course_page(ctrl, base_url) {
	location.href = base_url + ctrl.options[ctrl.selectedIndex].value;
}


function MD_change_result_view(order, page)
{
	obj_form = document.form_search;

	if (order != -1) {	
		obj_sort = obj_form.sort_order;
		obj_sort_list = document.getElementById('sort_order_list');
		if (order == 0) {
			obj_sort.value = obj_sort_list.options[obj_sort_list.selectedIndex].value;
		} else {
			obj_sort.value = order;
		}
	}

	obj_page = obj_form.page_num;
	obj_page_list = document.getElementById('page_num_list');
	if (page == 0) {
		obj_page.value = obj_page_list.options[obj_page_list.selectedIndex].value;
	} else {
		obj_page.value = page;
	}

	obj_form.submit();
}

function MD_prev_result_page(page)
{
	if (page == undefined) {
		page = 0;
	}
	
	obj_form = document.form_search;	

	obj_page_list = document.getElementById('page_num_list');
	max_page = obj_page_list.options.length;
	current_page = obj_page_list.options[obj_page_list.selectedIndex].value;
	
	if (0 < current_page) {
		MD_change_result_view(page, parseInt(current_page) - 1);
	}
}

function MD_next_result_page(page)
{
	if (page == undefined) {
		page = 0;
	}
	obj_form = document.form_search;

	obj_page_list = document.getElementById('page_num_list');
	max_page = obj_page_list.options.length;
	current_page = obj_page_list.options[obj_page_list.selectedIndex].value;
	
	if (current_page < max_page) {
		MD_change_result_view(page, parseInt(current_page) + 1);
	}
}

function MD_change_page()
{
	obj_form_search = document.form_search;
	
	obj_sort_order = obj_form_search.sort_order;
	obj_sort_order_list = document.getElementById('sort_order_list');
	obj_sort_order.value=obj_sort_order_list.options[obj_sort_order_list.selectedIndex].value;

	obj_page_num = obj_form_search.page_num;
	obj_page_num_list = document.getElementById('page_num_list');
	obj_page_num.value=obj_page_num_list.options[obj_page_num_list.selectedIndex].value;

	obj_form_search.submit();
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



var flashVersion=false;
var nn=(navigator.appName.charAt(0)=="N" && navigator.userAgent.indexOf("Safari") == -1) || false;
var n6=(document.getElementById && nn) || false;
var ie=(document.all && !nn) || false;
var safari=(navigator.userAgent.indexOf("Safari")!=-1) || false;
var mac=(navigator.userAgent.indexOf("Mac")!=-1) || false;
var ver=""+navigator.appVersion;
var fno=ver.indexOf(" ");
var macChecked=0;
ver=eval(ver.substring(0,fno));
var macIE5=(mac && navigator.userAgent.indexOf("MSIE 5")!=-1) || false;

if (ie && !mac){
	var flashVersion=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").FlashVersion();
	flashVersion=Math.floor(flashVersion / 0x10000);
}

if (!flashVersion){
	if (nn && !document.plugins &&!safari) flashVersion=false;
	else if ((nn || n6 || safari || macIE5) && navigator.plugins) flashVersion=navigator.plugins["Shockwave Flash"].description.charAt(16);
	else flashVersion=false;
}
if (ie && mac && !macIE5) {
	window.onload=chkMac;
}
function chkMac(){
	if (window["sample"]) flashVersion=((window["sample"].FlashVersion() & 0xffff0000) >> 16);
	macChecked=1;
	(window["sample"]);
	flashD();
}


/**
 * toppageFlashがなかった場合は、toppageImgを表示する
 **/
function toppage(){
	if (mac && ie && !macIE5 && macChecked==0){
		 toppageFlash();
	}	
	if (!flashVersion) {
		toppageImg();
	}else if (flashVersion < 4){
		 toppageFlash();
	}else if (flashVersion >= 5){
		 toppageFlash();
	}else {
		toppageImg();
	}
}

function toppageFlash(){

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="496" height="278">');
	document.write('<param name="movie" value="/images/top_key_spring.swf" />');
	document.write('<param name="quality" value="best" />');
	document.write('<embed src="/images/top_key_spring.swf" quality="best" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="496" height="278"></embed>');
	document.write('</object>');

}

function toppageImg(){
	document.write('<img src="./images/top_key.gif" alt="" width="496" height="278" border="0" usemap="#Map" />');
	document.write('<map name="Map" id="Map">');
	document.write('	<area shape="rect" coords="0,0,164,278" href="/course/special.html" alt="新春大キャンペーン" />');
	document.write('	<area shape="rect" coords="165,0,496,46" href="/index.php?c=search&m=item_detail&id=87039" alt="契約書作成講座" />');
	document.write('	<area shape="rect" coords="165,47,496,92" href="/index.php?c=search&m=item_detail&id=87041" alt="ビジネス著作権検定" />');
	document.write('	<area shape="rect" coords="165,93,496,138" href="/index.php?c=search&m=item_detail&id=87043" alt="ビジネス実務法務検定" />');
	document.write('	<area shape="rect" coords="165,139,496,184" href="/index.php?c=search&m=item_detail&id=87045" alt="行政書士試験対策" />');
	document.write('	<area shape="rect" coords="165,185,496,231" href="/index.php?c=search&m=item_detail&id=87047" alt="宅地建物取引主任者試験対策" />');
	document.write('	<area shape="rect" coords="165,232,496,278" href="/index.php?c=search&m=item_detail&id=87049" alt="賃金業務取扱主任者" />');
	document.write('</map>');
}