var headerHeight = 0;
function memoryHeaderHeight()
{
	headerHeight = $('lheader').offsetHeight;
}
function resizeBodyHeight()
{
	//alert('document height:'+document.height);
	//var headerHeight = $(lheader).style.height.replace('px','');
	//var headerHeight = getHeaderHeight();
	//alert('header height:'+headerHeight);
	//alert('body height:'+$(lbody).style.height);
	$('lbody').style.height='1px';				// Safariでウィンドウ縮小時に正しくリサイズさせるため
    var clientSize = getClientSize();   // クロスブラウザ向けサイズ取得
    //alert('clientSize.height:'+clientSize.height);
    //alert('clientSize.width:'+clientSize.width);
    //$('lbody').style.height=(document.height-headerHeight)+'px';
    $('lbody').style.height=(clientSize.height-headerHeight)+'px';
}

// 参考：http://zombiebook.seesaa.net/article/25296994.html
function getClientSize(){
  if(document.compatMode == "CSS1Compat" && !window.opera && document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth)
    getClientSize = function (){
      return {'width':document.documentElement.clientWidth, 'height':document.documentElement.clientHeight};
    }
  else
    getClientSize = function (){
      return {'width':document.body.clientWidth, 'height':document.body.clientHeight};
    }
  return getClientSize();
}

var timerIdAnchor = null;
function setAnchorTimer()
{
	timerIdAnchor = setTimeout("expiredAnchorTimer()", 700);
}
var currentAnchor = null;
function expiredAnchorTimer()
{
	if (currentAnchor != document.location.hash)
	{
		currentAnchor = document.location.hash;
		//var query = "";
		//if (!currentAnchor)
		//{
		//	section = "Top";
		//	query = "menu=Top";
		//}
		//else
		var section = "Top";
        var query = "menu=Top";
        //alert('currentAnchor='+currentAnchor);
        if ((currentAnchor)&&(currentAnchor!="#")){
			//Creates the  string callback. This converts the url URL/#main&id=2 in URL/?section=main&id=2
			var splits = currentAnchor.substring(1).split('&');
			//Get the section
			var section = splits[0];
			delete splits[0];
			//Create the params string
			var params = splits.join('&');
			var query = "menu=" + section + params;
		}

		var title = "";
		if (section == "Top"){
			title = "リベルテ マンドリンアンサンブル／マンドリンオーケストラ";
			$("aboutimg").src="img/about_n.gif";
			$("concertimg").src="img/concert_n.gif";
			$("cdimg").src="img/cd_n.gif";
			$("contactimg").src="img/contact_n.gif";
		}
		else if (section == "About"){
			title = "リベルテについて : リベルテ マンドリンアンサンブル／マンドリンオーケストラ";
			$("aboutimg").src="img/about_h.gif";
			$("concertimg").src="img/concert_n.gif";
			$("cdimg").src="img/cd_n.gif";
			$("contactimg").src="img/contact_n.gif";
		}
		else if (section == "Concert"){
			title = "コンサート情報 : リベルテ マンドリンアンサンブル／マンドリンオーケストラ";
			$("aboutimg").src="img/about_n.gif";
			$("concertimg").src="img/concert_h.gif";
			$("cdimg").src="img/cd_n.gif";
			$("contactimg").src="img/contact_n.gif";
		}
		else if (section == "Concert_History"){
			title = "コンサート情報 : リベルテ マンドリンアンサンブル／マンドリンオーケストラ";
			$("aboutimg").src="img/about_n.gif";
			$("concertimg").src="img/concert_n.gif";
			$("cdimg").src="img/cd_n.gif";
			$("contactimg").src="img/contact_n.gif";
		}
		else if (section == "Cd"){
			title = "CDのご案内 : リベルテ マンドリンアンサンブル／マンドリンオーケストラ";
			$("aboutimg").src="img/about_n.gif";
			$("concertimg").src="img/concert_n.gif";
			$("cdimg").src="img/cd_h.gif";
			$("contactimg").src="img/contact_n.gif";
		}
		else if (section == "Contact"){
			title = "お問い合わせ : リベルテ マンドリンアンサンブル／マンドリンオーケストラ";
			$("aboutimg").src="img/about_n.gif";
			$("concertimg").src="img/concert_n.gif";
			$("cdimg").src="img/cd_n.gif";
			$("contactimg").src="img/contact_h.gif";
		}
		else if (section == "Recruit"){
			title = "新メンバー募集のお知らせ : リベルテ マンドリンアンサンブル／マンドリンオーケストラ";
			$("aboutimg").src="img/about_n.gif";
			$("concertimg").src="img/concert_n.gif";
			$("cdimg").src="img/cd_n.gif";
			$("contactimg").src="img/contact_n.gif";
		}
		document.title = title;
		//Send the petition
		//$("#loading").show();
		//$.get("callbacks.php",query, function(data){
		//	$("#content").html(data);
		//	$("#loading").hide();
		//});

		//var myAjax = new Ajax.Updater({success:"lbody"},
		//	"echo.php?"+query, {method: "get"}
		//);
        //alert('section='+section);
        //alert('query='+query);
		var myAjax = new Ajax.Request("echo.php?"+query,
										{
											method:"get",
											onSuccess:function(request){
												$("lbody").innerHTML=request.responseText;
												//eval(request.responseText);
											}
										}
									);

	}
	//if (typeof doTWTR == "function")
	//{
	//	alert("function");
	//}
	timerIdAnchor = setTimeout("expiredAnchorTimer()", 700);
}
function clearAnchorTimer()
{
}

