/*
 * 右ナビゲーションを出力する
 * 出力先はid属性が"sidebar"
 *
 * pageId	ページID
 *
 */
function showRightBar(pageId){
	new Ajax.Request("/ajax_rightbar.do", {
		method : "post",
		parameters : "page_id=" + pageId,
		onComplete :function(httpObj){
			var target = document.getElementById("sidebar");
			target.innerHTML = httpObj.responseText;
			
			showRightTopBanner(pageId);
			showRightButtomBanner(pageId);
		}
	});
}

/*
 * 右ナビゲーション上部のバナーを出力する
 * 出力先はid属性が"side_top_banner"
 *
 * pageId	ページID
 *
 */
function showRightTopBanner(pageId){
	new Ajax.Request("/side_top_banner.html", {
		method : "post",
		parameters : "page_id=" + pageId,
		onComplete :function(httpObj){
			var target = document.getElementById("side_top_banner");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * 右ナビゲーション下部のバナーを出力する
 * 出力先はid属性が"side_buttom_banner"
 *
 * pageId	ページID
 *
 */
function showRightButtomBanner(pageId){
	new Ajax.Request("/side_buttom_banner.html", {
		method : "post",
		parameters : "page_id=" + pageId,
		onComplete :function(httpObj){
			var target = document.getElementById("side_buttom_banner");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * 検索用のリンク一覧を出力する
 * 出力先はid属性が"search_link_box"
 *
 */
function showSearchLinkList(){
	new Ajax.Request("/search_link.html", {
		method : "post",
		onComplete :function(httpObj){
			var target = document.getElementById("search_link_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * クラシス運営サイトを出力する
 * 出力先はid属性が"direction_site_box"
 *
 */
function showDirectionSite(){
	new Ajax.Request("/direction_site.html", {
		method : "post",
		onComplete :function(httpObj){
			var target = document.getElementById("direction_site_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * 個人情報の取り扱いについて出力する
 * 出力先はid属性が"privacy_box"
 *
 */
function showPrivacy(){
	new Ajax.Request("/privacy/privacy.html", {
		method : "post",
		onComplete :function(httpObj){
			var target = document.getElementById("privacy_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * 会員登録フォーム用個人情報の取り扱いについて出力する
 * 出力先はid属性が"privacy_box"
 *
 */
function showPrivacyForUserEntry(){
	new Ajax.Request("/privacy/privacy_regi.html", {
		method : "post",
		onComplete :function(httpObj){
			var target = document.getElementById("privacy_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * 案件応募フォーム用個人情報の取り扱いについて出力する
 * 出力先はid属性が"privacy_box"
 *
 */
function showPrivacyForOfferEntry(){
	new Ajax.Request("/privacy/privacy_entry.html", {
		method : "post",
		onComplete :function(httpObj){
			var target = document.getElementById("privacy_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * 求人依頼フォーム用個人情報の取り扱いについて出力する
 * 出力先はid属性が"privacy_box"
 *
 */
function showPrivacyForOfferRequest(){
	new Ajax.Request("/privacy/privacy_client.html", {
		method : "post",
		onComplete :function(httpObj){
			var target = document.getElementById("privacy_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * メルマガフォーム用個人情報の取り扱いについて出力する
 * 出力先はid属性が"privacy_box"
 *
 */
function showPrivacyForMailMagazine(){
	new Ajax.Request("/privacy/privacy_mail.html", {
		method : "post",
		onComplete :function(httpObj){
			var target = document.getElementById("privacy_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
* 問い合わせフォーム用個人情報の取り扱いについて出力する
* 出力先はid属性が"privacy_box"
*
*/
function showPrivacyForContact(){
	new Ajax.Request("/privacy/privacy_contact.html", {
		method : "post",
		onComplete :function(httpObj){
			var target = document.getElementById("privacy_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * フリーダイヤルを出力する
 * 出力先はid属性が"freedial_box"
 *
 */
function showFreedial(){
	new Ajax.Request("/freedial.html", {
		method : "post",
		onComplete :function(httpObj){
			var target = document.getElementById("freedial_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * 登録バナーを出力する
 * 出力先はid属性が"regist_banner_box"
 *
 * pageId	ページID
 *
 */
function showRegistBanner(pageId){
	new Ajax.Request("/ajax_regist_banner.do", {
		method : "post",
		parameters : "page_id=" + pageId,
		onComplete :function(httpObj){
			var target = document.getElementById("regist_banner_box");
			target.innerHTML = httpObj.responseText;
		}
	});
}

/*
 * マイページのヘッダ部を出力する
 * 出力先はid属性が"mypage_head"
 *
 * pageId	ページID
 *
 */
function showMyPageHeader(pageId){
	new Ajax.Request("/ajax_mypage_header.do", {
		method : "post",
		parameters : "page_id=" + pageId,
		onComplete :function(httpObj){
			var target = document.getElementById("mypage_head");
			target.innerHTML = httpObj.responseText;
		}
	});
}

function login(){
	var pageId = document.getElementById("page_id").value;
	new Ajax.Request("/ajax_login.do", {
		method : "post",
		parameters : Form.serialize('login_form') + "&page_id=" + pageId,
		onComplete :function(httpObj){
			var target = document.getElementById("sidebar");
			target.innerHTML = httpObj.responseText;
			
			showRightTopBanner(pageId);
			showRightButtomBanner(pageId);

			showRegistBanner(pageId);
		}
	});
}

function logout(){
	var pageId = document.getElementById("page_id").value;
	new Ajax.Request("/ajax_logout.do", {
		method : "post",
		parameters : "page_id=" + pageId,
		onComplete :function(httpObj){
			var target = document.getElementById("sidebar");
			target.innerHTML = httpObj.responseText;
			
			showRightTopBanner(pageId);
			showRightButtomBanner(pageId);

			showRegistBanner(pageId);
		}
	});
}