function conf(){
	if(true == $("confDisplay_summary").checked){
		var display_type = "summary";
		var display = "none";
	}
	if(true == $("confDisplay_all").checked){
		var display_type = "all";
		var display = "";
	}

	url = "ajaxs/session_write/confDisplay/" + display_type;
	new Ajax.Request(
		url, 
		{ 
			method: 'get',
			onComplete : function(req){
				res = req.responseText;
			}
		}
	);

	i = 0
	while(1){
		if(null == $("Post_" + i)){
			break;
		}
		$("Post_" + i).style.display = display;
		i++;
	}
	
}


/*
* 指定IDの中に囲まれた全てのチェックボックスをtypeによりON/OFFする関数
*
*/
function checkAll(ID , type){
	list = document.getElementById(ID).document.getElementsByTagName("input");
	for(i=0;i<=list.length;i++){
		if(list[i].type == "checkbox"){
			list[i].checked = type;
		}
	}//for
}

/**
* 表示/非表示を切り替える関数
*
* target_idが非表示の場合→表示、表示の場合→非表示に変更
* display_str/hidden_strが指定されている場合、"{$target_id}_link"のテキストを
* 　非表示にした場合：hidden_str
* 　表示にした場合：display_str
* に変更します
*/
function changeDisplay( target_id , display_str , hidden_str ){
	tid = document.getElementById(target_id);
	if(tid.style.display=="none"){
		tid.style.display = "";
		if(display_str){
			document.getElementById(target_id + "_link").innerHTML = display_str;
		}
	}else{
		tid.style.display = "none";
		if(hidden_str){
			document.getElementById(target_id + "_link").innerHTML = hidden_str;
		}
	}
}
/**
 * リセット
 * @author Akabane 
 * @date 
 */
function formReset(){
	$("PostCategoryPath").value ="";
	$("PostUserId").value ="";
	$("PostKeyword").value = "";
	submitSearch();
}

function submitSearch(){
	var str = Form.serialize('postSearchForm');
	
	if($('PostCategoryPath').value){
		dirname = $('PostCategoryPath').value;
		$("SearchDir").innerHTML = $('dirName_' + dirname).innerHTML;
	}else{
		$("SearchDir").innerHTML =  "全般";
	}
	$("SearchKeyword").innerHTML = $("PostKeyword").value  ? $('PostKeyword').value : "無し";

	url = "ajaxs/post_lists/";
	new Ajax.Request(
		url, 
		{ 
			method: 'post',
			parameters: str,
			onComplete : function(req){
				res = req.responseText;
				$("postArea").innerHTML = res;
			}
		}
	);
}


/**
 *
 * @author Akabane 
 * @date 
 */
function resetDir(){
	no = 1;
	while(1){
		if(null==$("dir_" + no)){
			break;
		}
		$("dir_" + no).style.display = "none";
		no++;
	}
}

//カテゴリ変更
function changeCat(path){
	$("PostCategoryPath").value = path;
	submitSearch();
	return false;
}

//著者変更
function changeUsert(user_id){
	$("PostUserId").value = user_id;
	submitSearch();
	return false;
}


//パス指定で表示切り替え
start = false
txt_cache = "";
function changeText(){
	if(start === false){
		setInterval( _changeText, 1000);
	}
}
function _changeText(){
	val = $("PostKeyword").value;
	if(val!=txt_cache){
		submitSearch();
	}
	txt_cache = val;
	start = true;
}


// scroller

function scroller(ps){
		scroller_up(ps,250);
}
	
function scroller_up(ps,y){
	y = y + (ps - y)*.1;
	window.scroll(0,y);
	if (((ps - y) <= .5)&&((ps - y) >= -.5))
	{					
		y = ps;
	}else{
		setTimeout("scroller_up("+ps+","+y+")",1);
	}
}

function scroller_e(ps){
	y = 1;
	kyoukai = ps*.5;
	while(y <= kyoukai)
	{
		window.scroll(0,y);
		y = y + (y*.05);
	// speed
    }
	while(y != ps)
	{
		window.scroll(0,y);
		y = y + (ps-y)*.05;
		// speed
		if (((ps - y) <= .5)&&((ps - y) >= -.5))
		{					
			y = ps;
		}		
	}
}

