/************************************
女の子検索結果ページングでの画面遷移用
*************************************/
function pageChange(type, nextpage, order) {
	if(type == 'maniac') {
		document.search2.reset();
		document.search2.page.value = nextpage;
		document.search2.order.value = order;
		document.search2.submit();
	} else {
		document.search1.reset();
		document.search1.page.value = nextpage;
		document.search1.order.value = order;
		document.search1.submit();
	}
}

/************************************
女の子検索結果並べ替えでの画面遷移用
*************************************/
function pageSort(type, nextpage, order) {
	if(type == 'maniac') {
		document.search2.reset();
		document.search2.page.value = nextpage;
		document.search2.order.value = order;
		document.search2.sort.value = "on";
		document.search2.submit();
	} else {
		document.search1.reset();
		document.search1.page.value = nextpage;
		document.search1.order.value = order;
		document.search1.sort.value = "on";
		document.search1.submit();
	}
}

/************************************
マニアック検索入力エリア数字チェック用
*************************************/
function inputCheck() {
	var age = document.search2.m_age.value;
	var height = document.search2.m_height.value;
	var bust = document.search2.m_bust.value;
	var waist = document.search2.m_waist.value;
	var hip = document.search2.m_hip.value;
	
	if( age.match( /[^0-9０-９]+/ ) ||
	 height.match( /[^0-9０-９]+/ ) ||
	 bust.match( /[^0-9０-９]+/ ) ||
	 waist.match( /[^0-9０-９]+/ ) ||
	 hip.match( /[^0-9０-９]+/ ) 
	) {
		alert("数字のみで入力して下さい。");
		return false;
	}
	document.search2.m_age.value = toHalfNum(age);
	document.search2.m_height.value = toHalfNum(height);
	document.search2.m_bust.value = toHalfNum(bust);
	document.search2.m_waist.value = toHalfNum(waist);
	document.search2.m_hip.value = toHalfNum(hip);
	return true;
}

/************************************
マニアック検索全角数字→半角数字変換用
*************************************/
function toHalfNum(src) {
	return src.replace(/[．０-９]/g, function (wc){var zen="．。０１２３４５６７８９",han = "..0123456789";return han[zen.indexOf(wc)];});
}

/************************************
検索ボックスクリア用1
*************************************/
function clearForm(form) {
	for(var i=0; i<form.elements.length; ++i) {
		clearElement(form.elements[i]);
	}
}

/************************************
検索ボックスクリア用2
*************************************/
function clearElement(element) {
	switch(element.type) {
		case "hidden":
		case "submit":
		case "reset":
		case "button":
		case "image":
			return;
		case "file":
			return;
		case "text":
		case "password":
		case "textarea":
			element.value = "";
			return;
		case "checkbox":
		case "radio":
			element.checked = false;
			return;
		case "select-one":
		case "select-multiple":
			element.selectedIndex = 0;
			return;
		default:
	}
}

