/**
 * 賢者.tv　一覧・検索部
 *
 * @author  Shigeaki Kurimoto <kurimoto@y-enjin.co.jp>
 * @create  2010/06/16
 * @version 1.00
 */

/* -------------------------------------------------------------------- */

/**
 * 検索フォーム ロードアクション
 */
function searchform_onload(){
	
	$("idSearchItemInputName").onkeypress      = searchform_keydown;
	$("idSearchItemInputKigyo").onkeypress     = searchform_keydown;
	$("idSearchItemInputKenid").onkeypress     = searchform_keydown;
	$("idSearchItemInputAcademic").onkeypress  = searchform_keydown;
	$("idSearchItemInputSexid").onkeypress     = searchform_keydown;
	$("idSearchItemInputAge").onkeypress       = searchform_keydown;
	$("idSearchItemInputGene").onkeypress      = searchform_keydown;
	$("idSearchItemInputNationid").onkeypress  = searchform_keydown;
	$("idSearchItemInputHonsyaid").onkeypress  = searchform_keydown;
	$("idSearchItemInputGyousyuid").onkeypress = searchform_keydown;
}

/**
 * 検索フォーム マウスアクション
 */
function searchform_keydown(e)
{
	 e = e || window.event;

	 if (e.keyCode == 13){
		searchform_result();
		return false;
	}
}

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;
	$('idSearchItemInputAcademic').value          = "";
	$('idSearchItemInputSexid').selectedIndex     = 0;
	$('idSearchItemInputAge').selectedIndex       = 0;
	$('idSearchItemInputGene').selectedIndex      = 0;
	$('idSearchItemInputNationid').selectedIndex  = 0;
	$('idSearchItemInputHonsyaid').selectedIndex  = 0;
	$('idSearchItemInputGyousyuid').selectedIndex = 0;
	$('idSearchItemInputFreeword').value          = "";
	$('idHeadFreeword').value                     = "サイト内検索";
}

/* -------------------------------------------------------------------- */

/**
 * 検索ページネーション マウスアクション
 */
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;
		}
	});
}


