MM_preloadImages('images/top_budget1_on.gif', 'images/top_budget2_on.gif', 'images/top_budget3_on.gif', 'images/top_budget4_on.gif', 'images/top_budget5_on.gif', 'images/top_industory1_on.gif', 'images/top_industory2_on.gif', 'images/top_industory3_on.gif');

function fncSearch() {
	var count = 0;

	if (document.searchform.type1.value != '') count++;
	if (document.searchform.type2.value != '') count++;
	if (document.searchform.type3.value != '') count++;
	if (document.searchform.type4.value != '') count++;
	if (document.searchform.pref.value != '') count++;
	if (document.searchform.icon3.checked) count++;
	if (document.searchform.icon4.checked) count++;
	if (document.searchform.icon9.checked) count++;
	if (document.searchform.icon10.checked) count++;

	if (count == 0) {
		alert('検索条件を指定してください。');
		document.searchform.type4.focus();
	} else {
		return true;
	}

	return false;
}

function fncType2Disable() {
	document.searchform.type2.disabled = true;
}

var type2_array = new Array(0);
type2_array[''] = new Array(0);
type2_array[''][1] = new Option("　　　　　", "");
type2_array['R'] = new Array(0);
type2_array['R'][1] = new Option("", "");
type2_array['R'][2] = new Option("コンビニエンスストア", "1");
type2_array['R'][3] = new Option("チケットショップ", "3");
type2_array['R'][4] = new Option("ガラス工芸", "4");
type2_array['R'][5] = new Option("書籍・CD・DVD", "6");
type2_array['R'][6] = new Option("はんこ屋", "7");
type2_array['R'][7] = new Option("自動車関連", "8");
type2_array['R'][8] = new Option("その他", "19");
type2_array['S'] = new Array(0);
type2_array['S'][1] = new Option("", "");
type2_array['S'][2] = new Option("保育・学習・教育", "23");
type2_array['S'][3] = new Option("衛生サービス", "21");
type2_array['S'][4] = new Option("ハウスクリーニング", "22");
type2_array['S'][5] = new Option("ペットビジネス", "32");
type2_array['S'][6] = new Option("ネットビジネス", "24");
type2_array['S'][7] = new Option("理容・美容・健康", "26");
type2_array['S'][8] = new Option("リフォーム", "27");
type2_array['S'][9] = new Option("リサイクルショップ", "28");
type2_array['S'][10] = new Option("ネットカフェ", "30");
type2_array['S'][11] = new Option("探偵・興信所", "31");
type2_array['S'][12] = new Option("介護・福祉", "25");
type2_array['S'][13] = new Option("運送", "35");
type2_array['S'][14] = new Option("建築・不動産", "36");
type2_array['S'][15] = new Option("収納ビジネス", "37");
type2_array['S'][16] = new Option("セキュリティ", "60");
type2_array['S'][17] = new Option("その他", "39");
type2_array['F'] = new Array(0);
type2_array['F'][1] = new Option("", "");
type2_array['F'][2] = new Option("居酒屋", "53");
type2_array['F'][3] = new Option("ラーメン・中華", "46");
type2_array['F'][4] = new Option("お好み焼き・たこ焼", "43");
type2_array['F'][5] = new Option("宅配・テイクアウト", "44");
type2_array['F'][6] = new Option("弁当・惣菜", "51");
type2_array['F'][7] = new Option("和食・定食", "49");
type2_array['F'][8] = new Option("菓子店", "42");
type2_array['F'][9] = new Option("その他", "59");

function fncType2Change() {
	// type2セレクトボックス内の消去
	var i_type2 = document.searchform.type2.options.length - 1;
	var flg_type2 = 1;
	if (i_type2 > -1) {
		while(flg_type2 == 1) {
			document.searchform.type2.options[i_type2] = null;
			i_type2--;
			if (i_type2 < 0) {
				flg_type2 = 0;
			}
		}
	}

	// type2セレクトボックス内にtype4のvalue値に対応する項目を追加
	var val = document.searchform.type4.value;
	if (type2_array[val] != undefined) {
		for (j=1; j<type2_array[val].length; j++) {
			document.searchform.type2.options[j-1] = type2_array[val][j];
		}
	}

	// デフォルト選択を空にする
	document.searchform.type2.options[0].selected = true;

	// type4が空の場合、選択不能状態にする
	if (val != "") {
		document.searchform.type2.disabled = false;
	}else {
		document.searchform.type2.disabled = true;
	}
}

function fncLogin() {
	if(document.loginform.btn.value == "login" || document.loginform.btn.value == "edit") {
		return true;
	}



	if (isSpace(document.loginform.email.value)) {
		alert('メールアドレスを指定してください');
		document.loginform.email.focus();
	} else if (!isEmail(document.loginform.email.value)) {
		alert('メールアドレスの指定に誤りがあります。');
		document.loginform.email.focus();
	} else if (isSpace(document.loginform.pwd.value)) {
		alert('パスワードを指定してください');
		document.loginform.pwd.focus();
	} else {
		return true;
	}

	return false;
}

function fncPassword() {
	if (isSpace(document.passwdform.email.value)) {
		alert('メールアドレスを指定してください');
		document.passwdform.email.focus();
	} else if (!isEmail(document.passwdform.email.value)) {
		alert('メールアドレスの指定に誤りがあります。');
		document.passwdform.email.focus();
	} else {
		return true;
	}

	return false;
}

function fncAddAll(fids) {
	var cookies = new Array();
	var fidlist;
	var element;
	var str;
	var i;
	var j;

	if (document.cookie) {
		element = document.cookie.split('; ');
		for (i = 0; i < element.length; i++) {
			str = element[i].split('=');
			cookies[str[0]] = str[1];
		}
	}
	if (cookies['selectedfid']) {
		fidlist = unescape(cookies['selectedfid']);
		element1 = fids.split(',');
		element2 = fidlist.split(',');
		
		for (i = 0; i < element1.length; i++) {
			for (j = 0; j < element2.length; j++) {
				if (element1[i] == element2[j]) break;
			}
			if (element1[i] != element2[j]) {
				fidlist += ',' + element1[i];
				if (document.getElementById('button' + element1[i])) {
					html = '<IMG SRC="images/lst_applied.gif" HSPACE=5 VSPACE=5 ALT="資料請求リストに追加済み">';
					if(document.getElementById('button' + element1[i])) {
						document.getElementById('button' + element1[i]).innerHTML = html;
					}else{
						//無視
					}
				}
			}
		}
	} else {
		fidlist = fids;
		element1 = fids.split(',');
		for (i = 0; i < element1.length; i++) {
			if (document.getElementById('button' + element1[i])) {
				html = '<IMG SRC="images/lst_applied.gif" HSPACE=5 VSPACE=5 ALT="資料請求リストに追加済み">';
				if(document.getElementById('button' + element1[i])) {
					document.getElementById('button' + element1[i]).innerHTML = html;
				}else{
					//無視
				}
			}
		}
	}
	document.cookie='selectedfid=' + escape(fidlist) + '; path=/;'
	element = fidlist.split(',');
	html = '<SPAN CLASS="r12b">' + element.length + '件の企業</SPAN>が、<BR>資料請求リストに入っています。';
	document.getElementById('message1').innerHTML = html;
	document.getElementById('message2').innerHTML = html;
	if (element.length > 0) {
		html = '<A HREF="demand1.php"><IMG SRC="images/rlt_apply_button.gif" BORDER=0></A>';
		if (document.getElementById('button1')) document.getElementById('button1').innerHTML = html;
		if (document.getElementById('button2')) document.getElementById('button2').innerHTML = html;
	}
		location.href='demand1.php';
}

function chkFcChecks () {
	var curLists = new Array(
		'140','141','148','152','164','168','221','237','281','310','319','321','336','340','342','346','347','359','362','370','373','384','162','391','351','224','313','318','328','341','277','389','381','368','377','270','309','323','169','409', '402','407','417','414','423','425','427','434','435','436','437','438','485','514','398','355','366','156','360','310','345','336','534','542','537','542','539','538', '155','486','117','519','453','543','492','421', '459', '551', '429', '361', '553', '558', '562', '536', '563', '378', '283'
	);
	var cnum = 0;
	for (n = 0; n < curLists.length; n++) {
		try {
			var id = 'sel' + curLists[n];
			var o = document.getElementById(id);
			if (o.checked == true) {
				cnum++;
				fncAdd(curLists[n], 'int');
			}
		} catch (e) {}
	}
	
	if (cnum > 0) {
		location.href='demand1.php';
	}
	else {
		fncAlert();
	}
}

function chkFcChecks2 () {
	var curLists = new Array(
		'140','141','148','152','164','168','221','237','281','310','319','321','336','340','342','346','347','359','362','370','373','384','162','391','351','224','313','318','328','341','277','389','381','368','377','270','309','323','169','409', '402','407','417','414','423','425','427','434','435','436','437','438','485','514','398','355','366','156','360','310','345','336','534','542','537','542','539','538', '155','486','117','519','453','543','492','421', '459', '551', '429', '361', '553', '558', '562', '378', '423'
	);
	var cnum = 0;
	for (n = 0; n < curLists.length; n++) {
		try {
			var id = 'sel2_' + curLists[n];
			var o = document.getElementById(id);
			if (o.checked == true) {
				cnum++;
				fncAdd(curLists[n], 'int');
			}
		} catch (e) {}
	}
	if (cnum > 0) {
		location.href='demand1.php';
	}
	else {
		fncAlert();
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function openMap(sid, width, height) {
	param = 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=' + width + ', height=' + height;
	window.open("map.php?SID=" + sid, 'map', param);
}

function fncCall() {
	if (isSpace(document.callform.email.value)) {
		alert('メールアドレスを指定してください');
		document.callform.email.focus();
	} else if (!isEmail(document.callform.email.value)) {
		alert('メールアドレスの指定に誤りがあります。');
		document.callform.email.focus();
	} else if (isSpace(document.callform.pwd.value)) {
		alert('パスワードを指定してください');
		document.callform.pwd.focus();
	} else {
		return true;
	}

	return false;
}

function fncSubmit() {

	if (!document.demandform.type[0].checked && !document.demandform.type[1].checked) {
		alert('個人・法人を指定してください。');
		document.demandform.type[0].focus();
	} else if (document.demandform.type[1].checked && isSpace(document.demandform.company.value)) {
		alert('法人名を指定してください。');
		document.demandform.company.focus();
	} else if (document.demandform.type[1].checked && isSpace(document.demandform.section.value)) {
		alert('部署名を指定してください。');
		document.demandform.section.focus();
	} else if (isSpace(document.demandform.lname.value)) {
		alert('氏名（姓）を指定してください。');
		document.demandform.lname.focus();
	} else if (isSpace(document.demandform.fname.value)) {
		alert('氏名（名）を指定してください。');
		document.demandform.fname.focus();
	} else if (document.demandform.birthyear.value == '') {
		alert('生年月日（年）を指定してください。');
		document.demandform.birthyear.focus();
/*
	} else if (document.demandform.birthmonth.value == '') {
		alert('生年月日（月）を指定してください。');
		document.demandform.birthmonth.focus();
	} else if (document.demandform.birthday.value == '') {
		alert('生年月日（日）を指定してください。');
		document.demandform.birthday.focus();
*/
	} else if (isSpace(document.demandform.zip1.value)) {
		alert('郵便番号（１）を指定してください。');
		document.demandform.zip1.focus();
	} else if (!isNumber(document.demandform.zip1.value)) {
		alert('郵便番号（１）は半角数字で指定ください。');
		document.demandform.zip1.focus();
	} else if (isSpace(document.demandform.zip2.value)) {
		alert('郵便番号（２）を指定してください。');
		document.demandform.zip2.focus();
	} else if (!isNumber(document.demandform.zip2.value)) {
		alert('郵便番号（２）は半角数字で指定ください。');
		document.demandform.zip2.focus();
	} else if (document.demandform.prefecture.value == '') {
		alert('都道府県を指定してください。');
		document.demandform.prefecture.focus();
	} else if (isSpace(document.demandform.addr1.value)) {
		alert('市区町村を指定してください。');
		document.demandform.addr1.focus();
	} else if (isSpace(document.demandform.tel.value)) {
		alert('電話番号を指定してください。');
		document.demandform.tel.focus();
	} else if (!isTelNum(document.demandform.tel.value)) {
		alert('電話番号は半角数字とハイフンで指定ください。');
		document.demandform.tel.focus();
	} else if (!isSpace(document.demandform.fax.value) && !isTelNum(document.demandform.fax.value)) {
		alert('FAXは半角数字とハイフンで指定ください。');
		document.demandform.fax.focus();
	} else if (isSpace(document.demandform.email1.value)) {
		alert('メールアドレスを指定してください。');
		document.demandform.email1.focus();
	} else if (!isEmail(document.demandform.email1.value)) {
		alert('メールアドレスの指定に誤りがあります。。');
		document.demandform.email1.focus();
/*
	} else if (document.demandform.email1.value != document.demandform.email2.value) {
		alert('メールアドレスとメールアドレス確認が不一致です。');
		document.demandform.email1.focus();
*/
	} else if (document.demandform.budget.value == '') {
		alert('開業準備金を指定してください。');
		document.demandform.budget.focus();
	} else if (document.demandform.start.value == '') {
		alert('開業時期を指定してください。');
		document.demandform.start.focus();
	} else if (!document.demandform.legal.checked) {
		alert('利用規約に同意してください。');
		document.demandform.legal.focus();
	} else {
		return true;
	}

	return false;
}

function openLegal() {
	param = 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=400, height=500';
	window.open("legal.php", 'legal', param);
}



