var getpage_cgi_path = "/cgi-bin/files/gethtml.cgi";
var site_key = "bnhd_blog";
var site_root_path = "";

//----------------------------------------------------
function setSidemenu( sidemenu_id ){

	// idチェック
	if(sidemenu_id == "" || sidemenu_id == undefined ){
		return;
	}

	// 表示するHTMLのパス
	var sidemenu_html = "/sidemenu.html";

	// 表示HTMLの取得
	new Ajax.Request(sidemenu_html, {
		method: "get",
		parameters: "",
		asynchronous: false,
		onSuccess: function(transport){

			//成功の場合
			$(sidemenu_id).innerHTML = transport.responseText;

		},
		onFailure: function(transport){
			// htmlのロードエラー時
//			alert("htmlの読み込みに失敗しました。");
		},
		onException: function(transport){
			// htmlのロードエラー時
//			alert("timeout? "+ transport.responseText);
		}
	});

	
	
}

//----------------------------------------------------
function setUtilHTML(id, html_path){

	// ファイルパスのチェック
	if( html_path.indexOf("..") > -1 ){
		return;
	}

	// 小文字変換して、拡張子チェック
	html_path.toLowerCase();
	if( html_path.indexOf(".html") == -1 ){
		return;
	}

	// ルートパスの結合
	html_path = site_root_path + html_path;
	
	// 頭に/は、いらない。
	if( html_path.indexOf("/") == 0 ){
		html_path = html_path.substring(1);
	}

	var html="";
	new Ajax.Request(getpage_cgi_path, {
		method: "post",
		parameters:"key=" + site_key + "&path=" + html_path,
		asynchronous: false,
		onSuccess: function(transport){
			html = transport.responseText;
		},
		onFailure: function(transport){
			// htmlのロードエラー時
		},
		onException: function(transport){
			// htmlのロードエラー時
		}
	});
	
	$(id).innerHTML = html;
}

