// JavaScript Document
	jQuery(function() {
		/* --------------------------------------------------------
		
			左サイドバーの位置設定(Leftの値)
			
		----------------------------------------------------------- */
		var ua = navigator.userAgent;       // ユーザーエージェント
		var nWidth, nHeight,sidebar_position,totop_position,totop_position_bg;                   // サイズ
		var nHit = ua.indexOf("MSIE");     // 合致した部分の先頭文字の添え字
		var bIE = (nHit >=  0);                 // IE かどうか
		var bVer6 = (bIE && ua.substr(nHit+5, 1) == "6");  // バージョンが 6 かどうか
		var bStd = (document.compatMode && document.compatMode=="CSS1Compat");
		                                                                   // 標準モードかどうか
		if (bIE) {
			if (bVer6 && bStd) {
				nWidth = document.documentElement.clientWidth;
				nHeight = document.documentElement.clientHeight;
			} else {
				nWidth = document.body.clientWidth;
				nHeight = document.documentElement.clientHeight;
			}
			/* サイドバーとトップへのボタンの位置設定 */
			sidebar_position = ( nWidth - 1000 ) / 2;
			//Totop左からの位置
			totop_position = 880 + sidebar_position;
		} else {
			nWidth = window.innerWidth;
			nHeight = window.innerHeight;

			/* サイドバーとトップへのボタンの位置設定 */
			sidebar_position = ( nWidth - 1000 ) / 2;
			//Totop左からの位置
			totop_position = 880 + sidebar_position;
		}

		
		//サイドバーの位置指定
		jQuery("#BlockLeftside").css("left",sidebar_position + "px");
		
		//トップへ戻るボタンの位置指定
		jQuery("#ToTopBox a").css("left",totop_position + "px");
		jQuery("#ToTopBg2").css("padding-left",totop_position + "px");



		/* ----------------------------------------------------------------

			ログインかログアウトか判定してテキスト・リンク修正

		------------------------------------------------------------------- */
/*
		var xmlHttp;

		xmlHttp = new XMLHttpRequest();
		xmlHttp.open("GET", "http://maidreamin.com/member/members/memberbox", false);
		xmlHttp.send(null);
		
		var login_no = "";
		login_no = xmlHttp.responseText;
		//alert(login_no);
		if(login_no == "" ) {
			$("#MemberRegist a").text("会員登録");
			$("#MemberRegist a").attr("href","/member/users/add");
			$("#Login a").text("ログイン");
			$("#Login a").attr("href","/member/users/login");
			$("#photos #BlockRightcontent").css("display","none");
		}
		else {
			$("#MemberRegist a").text("会員メニュー");
			$("#MemberRegist a").attr("href","/member/users/index");
			$("#Login a").text("ログアウト");
			$("#Login a").attr("href","/member/users/logout");
		}
*/
		var httpObj = jQuery.get("http://maidreamin.com/member/members/memberbox", null, function(){
			//alert(httpObj.responseText);
			if(httpObj.responseText == "" ) {
				$("#MemberRegist a").text("会員登録");
				$("#MemberRegist a").attr("href","/member/users/add");
				$("#Login a").text("ログイン");
				$("#Login a").attr("href","/member/users/login");
				$("#photos #BlockRightcontent").css("display","none");
			}
			else {
				$("#MemberRegist a").text("会員メニュー");
				$("#MemberRegist a").attr("href","/member/users/index");
				$("#Login a").text("ログアウト");
				$("#Login a").attr("href","/member/users/logout");
			}
			//document.getElementById("text").innerHTML = httpObj.responseText;
		});

	});

	/* ------------------------------------------------------------------------

		リサイズイベントを受け取ったら実行
	
	--------------------------------------------------------------------------- */
	jQuery( window ).resize(function(){
			/* --------------------------------------------------------
			
				左サイドバーの位置設定(Leftの値)
				
			----------------------------------------------------------- */
			var ua = navigator.userAgent;       // ユーザーエージェント
			var nWidth, nHeight, totop_position,totop_position_bg,sidebar_position;                   // サイズ
			var nHit = ua.indexOf("MSIE");     // 合致した部分の先頭文字の添え字
			var bIE = (nHit >=  0);                 // IE かどうか
			var bVer6 = (bIE && ua.substr(nHit+5, 1) == "6");  // バージョンが 6 かどうか
			var bStd = (document.compatMode && document.compatMode=="CSS1Compat");
			                                                                   // 標準モードかどうか
			if (bIE) {
				if (bVer6 && bStd) {
					nWidth = document.documentElement.clientWidth;
					nHeight = document.documentElement.clientHeight;
				} else {
					nWidth = document.body.clientWidth;
					nHeight = document.documentElement.clientHeight;
				}
				sidebar_position = ( nWidth - 1000 ) / 2;
				//Totopボタンの左からの位置
				totop_position = 880 + sidebar_position;

			} else {
				nWidth = window.innerWidth;
				nHeight = window.innerHeight;

				sidebar_position = ( nWidth - 1000 ) / 2;
				//Totopボタンの左からの位置
				totop_position = 880 + sidebar_position;
			}
			//var width = document.documentElement.clientWidth;
			//サイドバーの位置指定
			jQuery("#BlockLeftside").css("left",sidebar_position + "px");

			//トップへ戻るボタンの位置指定
			jQuery("#ToTopBox a").css("left",totop_position + "px");
			
			jQuery("#ToTopBg2").css("padding-left",totop_position + "px");
	});


	/* --------------------------------------------------------------------------

		画像がアップロードされたときにコンテンツの高さなどを設定する

	----------------------------------------------------------------------------- */
	function resizeall(contents_height) {
		//alert(contents_height);
		/* -----------------------------------------------------------

				サイドバーの高さを指定
				コンテンツの高さにあわせて調整

		-------------------------------------------------------------- */
		jQuery("#BoxLeftsideOuter").css("height",contents_height + 360);
		/* --------------------------------------------------------
		
			コンテンツの高さ設定(バックグラウンドをそろえるため)
			
		----------------------------------------------------------- */

		if (contents_height % 120 == 0 ) {
			jQuery("#BlockContent").css("height",contents_height + "px");
		}
		else {
			contents_height = 120 * Math.ceil(contents_height / 120 );
			jQuery("#BlockContent").css("height",contents_height + "px");
		}
	}

	/* -------------------------------------------------------------------

		ページが読み込まれたときに実行

	---------------------------------------------------------------------- */
	function jQueryLoad() {
		var contents_height = jQuery("#BlockContent").height();
		var sidebar_height = jQuery("#BoxLeftsideInner").height();
		
		/* --------------------------------------------------------
		
			コンテンツの高さ設定(バックグラウンドをそろえるため)
			
		----------------------------------------------------------- */
		//var contents_height = jQuery("#BlockContent").height();
		if (contents_height < 1000 ) {
			jQuery("#BlockContent").css("height","1200px");
			contents_height = 1200;
		}
		else {
			if (contents_height % 120 == 0 ) {
				jQuery("#BlockContent").css("height",contents_height + "px");
			}
			else {
				contents_height = 120 * Math.ceil(contents_height / 120 );
				jQuery("#BlockContent").css("height",contents_height + "px");
			}
		}
		/* -----------------------------------------------------------

				サイドバーの高さを指定
				コンテンツの高さにあわせて調整

		-------------------------------------------------------------- */
		//alert(contents_height);
		if(contents_height > 600 ){
			var sidebarHeight = contents_height - sidebar_height + 140;
			//alert(sidebarHeight);
			jQuery("#BoxLeftsideInner").css("padding-bottom",sidebarHeight + "px");
		}

		//twitterのスクロール指定
/*
		jQuery('.Scroll1 #tweet').jScrollPane({
			showArrows:true,
			scrollbarWidth:7
		});
*/
	}


	/* -------------------------------------------------------

		キャスト紹介の検索js

	---------------------------------------------------------- */
	function cText(obj){
		if(obj.value==obj.defaultValue){
		obj.value="";
		//obj.style.color="#000";
		}
	}

	function sText(obj){
		if(obj.value==""){
		obj.value=obj.defaultValue;
		//obj.style.color="#999";
		}
	}
	function showMessage() {
		//document.getElementById("img01").style.display = "block";
		return false;
	}

