/**
 * 覚悟の瞬間　一覧・検索部
 *
 * @author  Shigeaki Kurimoto <kurimoto@kenja.tv>
 * @create  2009/11/20
 * @version 1.00
 */

/* -------------------------------------------------------------------- */

/**
 * 検索フォーム マウスアクション
 */
function set_color_check(num)
{
	$("idSearchItemInputColor"+num).checked = !$("idSearchItemInputColor"+num).checked;
}

function searchform_keydown()
{
	if ( window.event.keyCode == 13 ) {
		searchform_result();
	}
}

function searchform_result()
{
	new Ajax.Request(ROOTPATH + "/index.php?c=search&m=result",{
		method     : "POST",
		parameters : $('idSearchItemForm').serialize(),
		onSuccess  : function(httpObj){
			$('idSearchListRight').innerHTML = httpObj.responseText;
		}
	});
}

function searchform_clear()
{
	$('idSearchItemInputName').value     = "";
	$('idSearchItemInputKigyo').value    = "";
	$('idSearchItemInputKenid').selectedIndex = 0;
	$('idSearchItemInputSex1').checked   = false;
	$('idSearchItemInputSex2').checked   = false;
	$('idSearchItemInputSex3').checked   = false;
	$('idSearchItemInputBloodid').value  = "";
	$('idSearchItemInputAge').selectedIndex  = 0;
	$('idSearchItemInputGene').selectedIndex = 0;
	$('idSearchItemInputFreeword').value = "";
	$('idHeadFreeword').value            = "サイト内検索";

	for ( var i=1; i<65; i++ ) {
		$('idSearchItemInputColor'+i).checked = false;
	}
}

/* -------------------------------------------------------------------- */

/**
 * 検索結果 マウスアクション
 */
function searchbox_mouseover(clsname,id,bid)
{
	$(bid).setStyle( { backgroundColor : '#ECECEC'} );
	$(id).addClassName(clsname);
}

function searchbox_mouseout(clsname,id,bid)
{
	$(bid).setStyle( { backgroundColor : '#FFFFFF'} );
	$(id).removeClassName(clsname);
}

function searchbox_click(url,id)
{
	if ( id != 0 ){
		location.href=url;
	}
}

/* -------------------------------------------------------------------- */

/**
 * 検索ページネーション マウスアクション
 */
function search_pagenum_over(id)
{
	$(id).removeClassName("clsSearchListPageNum");
}

function search_pagenum_out(id)
{
	$(id).addClassName("clsSearchListPageNum");
}

function search_pagechange(p)
{
	new Ajax.Request(ROOTPATH + "/index.php?c=search&m=result",{
		method     : "POST",
		parameters : $('idSearchItemForm').serialize() + "&p=" + p,
		onSuccess  : function(httpObj){
			$('idSearchListRight').innerHTML = httpObj.responseText;
		}
	});
}

/* -------------------------------------------------------------------- */

/**
 * ヒストリー ページネーション
 */
function detail_history_page_click(num)
{
	$$("p.clsSearchDetailHistoryListPage","p.clsSearchDetailHistoryListPageOn").each(function(ele){
		var id = "idSearchDetailHistoryListPageNum" + num;
		if ( ele.id == id ) {
			ele.removeClassName("clsSearchDetailHistoryListPage");
			ele.addClassName("clsSearchDetailHistoryListPageOn");
		} else {
			ele.removeClassName("clsSearchDetailHistoryListPageOn");
			ele.addClassName("clsSearchDetailHistoryListPage");
		}
	});

	$$("div.clsSearchDetailHistoryListVisible","div.clsSearchDetailHistoryListHidden").each(function(ele){
		var id = "idSearchDetailHistoryListId" + num;
		if ( ele.id == id ) {
			ele.removeClassName("clsSearchDetailHistoryListHidden");
			ele.addClassName("clsSearchDetailHistoryListVisible");
		} else {
			ele.removeClassName("clsSearchDetailHistoryListVisible");
			ele.addClassName("clsSearchDetailHistoryListHidden");
		}
	});
}

function detail_history_prev_click()
{
	$$("p.clsSearchDetailHistoryListPageOn").each(function(ele){
		var num = ele.id.replace('idSearchDetailHistoryListPageNum','');
		if ( num > 0 ) num--;
		detail_history_page_click(num);
	});
}

function detail_history_next_click(max)
{
	$$("p.clsSearchDetailHistoryListPageOn").each(function(ele){
		var num = ele.id.replace('idSearchDetailHistoryListPageNum','');
		if ( num < max ) num++;
		detail_history_page_click(num);
	});
}

/* -------------------------------------------------------------------- */

/**
 * プロフィール マウスアクション
 */
function profile_mouseover()
{
	$('idSearchDetailRightProfile').setStyle( { zIndex : '101' } );
}

function profile_mouseout()
{
	$('idSearchDetailRightProfile').setStyle( { zIndex : '99' } );
}




