/* ホストネームチェック */
var hokende_hostname;
page_hostname = new Array();
page_hostname = location.hostname.split("." , 3);

if(page_hostname[0].match("kai")) {
	hokende_hostname = "http://kai.www.hokende.com";
} else if(page_hostname[0].match("iccheck")) {
	hokende_hostname = "http://iccheck.www.hokende.com";
} else {
	if(location.href.match("https://")) {
		hokende_hostname = "https://www.hokende.com";
	} else {
		hokende_hostname = "http://www.hokende.com";
	}
}


// パパっと比較
function submitFormSimulation(myForm) {
	var genre	= ""
	var nenrei   = myForm.newnenrei.value
	var seibetsu = myForm.newseibetsu.value

//	for (i=0; i<7; i++) if (myForm.newgenreid[i].checked) genre = myForm.newgenreid[i].value;
	
	genre = myForm.newgenreid.options[myForm.newgenreid.selectedIndex].value;
	
	if (genre ==""){
		genre = "2"
	}
	
//	alert(genre + "," + nenrei + "," + seibetsu + ",");
	
	document.baseForm.newgenreid.value = genre;
	document.baseForm.newnenrei.value = nenrei;
	document.baseForm.newseibetsu.value = seibetsu;

	document.baseForm.submit();
}

/* 年齢プルダウン 複数設置対応型 */
function select_nenrei_firstval(firstval){
	select_nenrei(null,null,null,null,firstval);
}

/* 年齢プルダウン 複数設置対応型 onchange指定*/
function select_nenrei_onchange(onchange){
	select_nenrei(null,null,null,null,null, onchange);
}


/* 年齢プルダウン 複数設置対応型 */
function select_nenrei(count_number,default_select,first_age,last_age,firstval, onchange){// 個別認識用,初期値,開始値,終了値
	if(!count_number) count_number = "";
	if(!first_age) first_age = "0";
	if(!last_age) last_age = "80";
	if(!firstval) firstval = "年齢";
	if(!onchange) onchange = "";
	document.write('<select style="height:20px;" name="newnenrei' + count_number + '" class="select-nenrei" id="newnenrei' + count_number + '" onchange="' + onchange + '">');
	document.write('<option style="color:#888888" value="">' + firstval + '</option>');
	for (i = first_age; i <= last_age; i++) {
		if(i == default_select) {
			document.write('<option value="' + i + '" selected>' + i +' 歳</option>');
		} else {
			document.write('<option value="' + i + '">' + i +' 歳</option>');
		}
	}
	document.write('</select>');
}

/* 性別プルダウン 複数設置対応型 */

function select_seibetsu_firstval(firstval) {
	select_seibetsu(null,null,firstval);
}


/* 性別プルダウン 複数設置対応型 */
function select_seibetsu(count_number,default_select,firstval) {
	if(!count_number) {
		count_number = "";
	}
	if(!firstval) {
		firstval = "性別";
	}
	document.write('<select  style="height:20px;" name="newseibetsu' + count_number + '" class="select-seibetsu" id="newseibetsu' + count_number + '">');
	document.write('<option style="color:#888888" value="">' + firstval + '</option>');
	if (default_select == 1) {
		document.write('<option value="1" selected>男性</option>');
	} else {
		document.write('<option value="1">男性</option>');
	}
	if (default_select == 2) {
		document.write('<option value="2" selected>女性</option>');
	} else {
		document.write('<option value="2">女性</option>');
	}
	document.write('</select>');
}


function submitSearch(myForm){

//alert("testa");
	myForm.action = './../../info/search.html';
	myForm.method = 'GET';
	myForm.submit();
}

function select_todofuken_onchange(onchange){
	select_todofuken(onchange);
}

function select_todofuken(onchange){

//alert(onchange);
	
	if(!onchange) onchange = "";
	
	document.write('<select class="select-todofuken" id="hoken-ichiba-guide" name="selectCmbTodofuken" style="height:20px;width:200px;" onchange="' + onchange + '">');
	document.write('<option style="color:#888888" value="">都道府県を選択</option>');
	document.write('<option style="color:#888888" value="">【北海道・東北】---</option>');
	document.write('<option value="http://hokkaido.hoken-ichiba.com/">北海道</option>');
	document.write('<option value="http://aomori.hoken-ichiba.com/">青森県</option>');
	document.write('<option value="http://miyagi.hoken-ichiba.com/">宮城県</option>');
	document.write('<option value="http://akita.hoken-ichiba.com/">秋田県</option>');
	document.write('<option value="http://yamagata.hoken-ichiba.com/">山形県</option>');
	document.write('<option value="http://fukushima.hoken-ichiba.com/">福島県</option>');
	document.write('<option style="color:#888888" value="">【関東】-----------</option>');
	document.write('<option value="http://ibaraki.hoken-ichiba.com/">茨城県</option>');
	document.write('<option value="http://tochigi.hoken-ichiba.com/">栃木県</option>');
	document.write('<option value="http://gunma.hoken-ichiba.com/">群馬県</option>');
	document.write('<option value="http://saitama.hoken-ichiba.com/">埼玉県</option>');
	document.write('<option value="http://chiba.hoken-ichiba.com/">千葉県</option>');
	document.write('<option value="http://tokyo.hoken-ichiba.com/">東京都</option>');
	document.write('<option value="http://kanagawa.hoken-ichiba.com/">神奈川県</option>');
	document.write('<option style="color:#888888" value="">【信越・北陸】-----</option>');
	document.write('<option value="http://niigata.hoken-ichiba.com/">新潟県</option>');
	document.write('<option value="http://toyama.hoken-ichiba.com/">富山県</option>');
	document.write('<option value="http://ishikawa.hoken-ichiba.com/">石川県</option>');
	document.write('<option value="http://fukui.hoken-ichiba.com/">福井県</option>');
	document.write('<option value="http://nagano.hoken-ichiba.com/">長野県</option>');
	document.write('<option style="color:#888888" value="">【東海】-----------</option>');
	document.write('<option value="http://gifu.hoken-ichiba.com/">岐阜県</option>');
	document.write('<option value="http://shizuoka.hoken-ichiba.com/">静岡県</option>');
	document.write('<option value="http://aichi.hoken-ichiba.com/">愛知県</option>');
	document.write('<option value="http://mie.hoken-ichiba.com/">三重県</option>');
	document.write('<option style="color:#888888" value="">【近畿】-----------</option>');
	document.write('<option value="http://shiga.hoken-ichiba.com/">滋賀県</option>');
	document.write('<option value="http://kyoto.hoken-ichiba.com/">京都府</option>');
	document.write('<option value="http://osaka.hoken-ichiba.com/">大阪府</option>');
	document.write('<option value="http://hyogo.hoken-ichiba.com/">兵庫県</option>');
	document.write('<option value="http://nara.hoken-ichiba.com/">奈良県</option>');
	document.write('<option value="http://wakayama.hoken-ichiba.com/">和歌山県</option>');
	document.write('<option style="color:#888888" value="">【中国】-----------</option>');
	document.write('<option value="http://tottori.hoken-ichiba.com/">鳥取県</option>');
	document.write('<option value="http://shimane.hoken-ichiba.com/">島根県</option>');
	document.write('<option value="http://okayama.hoken-ichiba.com/">岡山県</option>');
	document.write('<option value="http://hiroshima.hoken-ichiba.com/">広島県</option>');
	document.write('<option value="http://yamaguchi.hoken-ichiba.com/">山口県</option>');
	document.write('<option style="color:#888888" value="">【四国】-----------</option>');
	document.write('<option value="http://tokushima.hoken-ichiba.com/">徳島県</option>');
	document.write('<option value="http://ehime.hoken-ichiba.com/">愛媛県</option>');
	document.write('<option style="color:#888888" value="">【九州・沖縄】-----</option>');
	document.write('<option value="http://fukuoka.hoken-ichiba.com/">福岡県</option>');
	document.write('<option value="http://saga.hoken-ichiba.com/">佐賀県</option>');
	document.write('<option value="http://nagasaki.hoken-ichiba.com/">長崎県</option>');
	document.write('<option value="http://kumamoto.hoken-ichiba.com/">熊本県</option>');
	document.write('<option value="http://oita.hoken-ichiba.com/">大分県</option>');
	document.write('<option value="http://miyazaki.hoken-ichiba.com/">宮崎県</option>');
	document.write('<option value="http://kagoshima.hoken-ichiba.com/">鹿児島県</option>');
	document.write('<option value="http://okinawa.hoken-ichiba.com/">沖縄県</option>');
	document.write('</select>');
}

function select_newgenreid(){
	document.write('<select style="height:20px;" id="newgenreid" name="newgenreid">');
	document.write('<option style="color:#888888" value="" selected>保険ジャンル</option>');
	document.write('<option value="2">医療保険</option>');
	document.write('<option value="3">生命保険</option>');
	document.write('<option value="11">女性保険</option>');
	document.write('<option value="6">学資保険</option>');
	document.write('<option value="1">がん保険</option>');
	document.write('<option value="14">年金保険</option>');
	document.write('<option value="4">シニア保険</option>');
	document.write('</select>');
}

function select_ranking_genre_firstval(strStyle, firstval){
	select_ranking_genre(strStyle, firstval);
}

function select_nenrei_hani(onchange){
	
	if(!onchange) onchange = "";
	
	document.write('<select style="height:20px;" id="newnenrei" name="newnenrei" onchange="' + onchange + '">');
	document.write('<option style="color:#888888" value="" selected>年齢</option>');
	document.write('<option value="1">0歳～5歳</option>');
	document.write('<option value="2">6歳～10歳</option>');
	document.write('<option value="3">11歳～15歳</option>');
	document.write('<option value="4">16歳～20歳</option>');
	document.write('<option value="5">21歳～25歳</option>');
	document.write('<option value="6">26歳～30歳</option>');
	document.write('<option value="7">31歳～35歳</option>');
	document.write('<option value="8">36歳～40歳</option>');
	document.write('<option value="9">41歳～45歳</option>');
	document.write('<option value="10">46歳～50歳</option>');
	document.write('<option value="11">51歳～55歳</option>');
	document.write('<option value="12">56歳～60歳</option>');
	document.write('<option value="13">61歳～65歳</option>');
	document.write('<option value="14">66歳～70歳</option>');
	document.write('<option value="15">71歳～80歳</option>');
	document.write('</select>');
}

function select_ranking_genre(strStyle,firstval){
	if(!firstval) firstval = '保険ジャンル';
	
	document.write('<select name="ranking_dst" class="select-ranking-genre" style="'+ strStyle +'">');
	document.write('<option style="color:#888888" value="' + hokende_hostname + '/ranking/ranking.html">' + firstval + '</option>');
	document.write('<option value="' + hokende_hostname + '/ranking/iryou/ranking.html">医療保険</option>');
	document.write('<option value="' + hokende_hostname + '/ranking/seimei/ranking.html">生命保険</option>');
	document.write('<option value="' + hokende_hostname + '/ranking/josei/ranking.html">女性保険</option>');
	document.write('<option value="' + hokende_hostname + '/ranking/kodomo/ranking.html">学資保険</option>');
	document.write('<option value="' + hokende_hostname + '/ranking/gan/ranking.html">がん保険</option>');
	document.write('<option value="' + hokende_hostname + '/ranking/tsumitate/ranking.html">積立保険</option>');
	document.write('<option value="' + hokende_hostname + '/ranking/kazai/ranking.html">家財保険</option>');
	document.write('<option value="' + hokende_hostname + '/ranking/shogai/ranking.html">傷害保険</option>');
	document.write('<option value="' + hokende_hostname + '/ranking/senier/ranking.html">シニア保険</option>');
	document.write('</select>');
}

/* ジャンル ラジオボタン 複数設置対応型 */
function select_papatto_radio(count_number,linefeed_position){
	if(!count_number) {
		count_number = "";
	}
	if(!linefeed_position) {
		linefeed_position = "";
	}
	document.write('<input type="radio" name="newgenreid' + count_number + '" value="2"  id="g02' + count_number + '"><label for="g02' + count_number + '" class="labelsel">医療保険</label>&nbsp;&nbsp;&nbsp;&nbsp;');
		if(String(linefeed_position).match("1")){document.write('<br>');}
	document.write('<input type="radio" name="newgenreid' + count_number + '" value="3"  id="g03' + count_number + '"><label for="g03' + count_number + '" class="labelsel">生命保険</label>&nbsp;&nbsp;&nbsp;&nbsp;');
		if(String(linefeed_position).match("2")){document.write('<br>');}
	document.write('<input type="radio" name="newgenreid' + count_number + '" value="11" id="g11' + count_number + '"><label for="g11' + count_number + '" class="labelsel">女性保険</label>&nbsp;&nbsp;&nbsp;&nbsp;');
		if(String(linefeed_position).match("3") || !linefeed_position){document.write('<br>');}
	document.write('<input type="radio" name="newgenreid' + count_number + '" value="6"  id="g06' + count_number + '"><label for="g06' + count_number + '" class="labelsel">学資保険</label>&nbsp;&nbsp;&nbsp;&nbsp;');
		if(String(linefeed_position).match("4")){document.write('<br>');}
	document.write('<input type="radio" name="newgenreid' + count_number + '" value="1"  id="g01' + count_number + '"><label for="g01' + count_number + '" class="labelsel">がん保険</label>&nbsp;&nbsp;&nbsp;&nbsp;');
		if(String(linefeed_position).match("5")){document.write('<br>');}
	document.write('<input type="radio" name="newgenreid' + count_number + '" value="14" id="g14' + count_number + '"><label for="g14' + count_number + '" class="labelsel">年金保険</label>&nbsp;&nbsp;&nbsp;&nbsp;');
		if(String(linefeed_position).match("6") || !linefeed_position){document.write('<br>');}
	document.write('<input type="radio" name="newgenreid' + count_number + '" value="4"  id="g04' + count_number + '"><label for="g04' + count_number + '" class="labelsel">シニア保険</label>&nbsp;&nbsp;&nbsp;&nbsp;');
}

function select_mokuteki(){
document.write('<select style="height:20px;" name="lstMokuteki" class="select-mokuteki">');
document.write('<option style="color:#888888" value="">お選びください</option>');
document.write('<option value="001">日常</option>');
document.write('<option value="001">レジャー</option>');
document.write('<option value="001">旅行</option>');
document.write('<option value="002">通勤</option>');
document.write('<option value="002">通学</option>');
document.write('<option value="003">業務使用</option>');
document.write('</select>');
}

function popJumpSW(selOBJ)
{
	/*n = selOBJ.selectedIndex;*/
	/*if (n == "") alert("都道府県を選択して下さい");*/
	n = selOBJ.selectedIndex;
	x = selOBJ.options[n].value;
	if (x == "") alert("都道府県を選択して下さい");
	else window.open(selOBJ.options[n].value,"_blank");
}

function Ranking_go(frm){
	//alert(eval('document.' + frm + '.ranking_dst.value'));
	window.open( eval('document.' + frm + '.ranking_dst.value') );
}

// パパっと比較
function submitFormPapattoGenreRadio(myForm) {
	var genre	= ""
	var nenrei   = myForm.newnenrei.value
	var seibetsu = myForm.newseibetsu.value

	for (i=0; i<7; i++) if (myForm.newgenreid[i].checked) genre = myForm.newgenreid[i].value;

	if (genre ==""){
		genre = "2"
	}

//alert(genre + "," + nenrei + "," + seibetsu)
	document.baseForm.newgenreid.value = genre;
	document.baseForm.newnenrei.value = nenrei;
	document.baseForm.newseibetsu.value = seibetsu;

	document.baseForm.submit();
}

function Go_Mitsumori(){Go_Mitsumori4("frm_go_auto");}
function Go_Mitsumori4(form_name,procd,window_open){



	var genre_id = "";
	var purpose = "";
	var manufacturer = "";
	getCookie_procd();
	if(procd) {
		procd = "&sSpcd=" + procd;
		genre_id = "7i3";/* プロモーションコードをgetより取得 */
	} else if(cookie_procd) {
		procd = "&sSpcd=" + cookie_procd;
		genre_id = "7i3";/* プロモーションコードをgetより取得 */
	} else {
		procd = "";
		genre_id = "7i2";/* プロモーションコードをcookieより取得 */
	}
	if(eval("document." + form_name + ".lstMokuteki")) {
		purpose = "&mokuteki=" + eval("document." + form_name + ".lstMokuteki.value");
	}
	if(eval("document." + form_name + ".maker")) {
		manufacturer = "&maker=" + eval("document." + form_name + ".maker.value");
	}
	if(window_open == "_blank") {
		window.open(hokende_hostname + "/select_start.asp?newgenreid=" + genre_id + purpose + manufacturer + procd, window_open);
	} else {
		location.href = hokende_hostname + "/select_start.asp?newgenreid=" + genre_id + purpose + manufacturer + procd;
	}
}

// プロモーションコードを取得
var cookie_procd = "";
function getCookie_procd() {
	if(getCookie("pro_cd") != undefined) {
		cookie_procd = getCookie("pro_cd");
	} else if(getCookie("pro%5Fcd") != undefined) {
		cookie_procd = getCookie("pro%5Fcd");
	}
}

//クッキーを抽出する 2004/7/27
/* 引数
 * key      取り出したいクッキーのキー
 * 利用例
 * getCookie("pro_cd");
 */

function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
	tmp1 = " " + document.cookie + ";";
	xx1 = xx2 = 0;
	len = tmp1.length;
	while (xx1 < len) {
		xx2 = tmp1.indexOf(";", xx1);
		//アンエスケープ追加
		tmp2 = unescape(tmp1.substring(xx1 + 1, xx2));
		xx3 = tmp2.indexOf("=");
		if (tmp2.substring(0, xx3) == key) {
			return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
		}
		xx1 = xx2 + 1;
	}
	return("");
}

function ranking_menu(myFormItem) {

	if (myFormItem.options[myFormItem.selectedIndex].value == "") {

		return;
	}

	location.href=myFormItem.options[myFormItem.selectedIndex].value;
}
