var TCN = "";

var Amax = 3;
var Bmax = 10;
var Cmax = 10;

var TCS = "";
var ACS = "";
var BCS = "";
var CCS = "";

var CWW = 950;
var CW = 1400;
var S1WW = 900;
var S1W = 3000;

/*------------------------------ピックアップスライド関数-------------------------*/

var S1LP = 0;
var S1skipdistance = 0; 

function S1Ron()
  {
    if(S1LP == S1WW - S1W){document.getElementById('s1right').style.backgroundPosition = "0px" + " " + "-50px";}
	else{document.getElementById('s1right').style.backgroundPosition = "0px" + " " + "-25px";}
  }

function S1Roff()
{
  if(S1LP < 0)
      {
        if(S1LP == S1WW - S1W){document.getElementById('s1right').style.backgroundPosition = "0px" + " " + "-50px";}
		else{document.getElementById('s1right').style.backgroundPosition = "0px" + " " + "0px";}
      }
  else{document.getElementById('s1right').style.backgroundPosition = "0px" + " " + "0px";}
}

function S1Rskip()
{	
  if(S1LP > S1WW-S1W){
                      S1Rskipmove();
                     }
}

function S1Rskipmove()
{
 	if(S1skipdistance < 300)
		 {
		   S1skipdistance = S1skipdistance + 10;
		   document.getElementById('pickupslider').style.left = S1LP - S1skipdistance + "px";
           document.getElementById('s1right').style.backgroundPosition = "0px" + " " + "-25px";
		   setTimeout("S1Rskipmove()", 10);
		 }
    else {
           S1LP = S1LP - S1skipdistance;
		   document.getElementById('pickupslider').style.left = S1LP + "px";
           S1skipdistance = 0;       
           document.getElementById('s1right').style.backgroundPosition = "0px" + " " + "0px";
		   document.getElementById('s1left').style.backgroundPosition = "0px" + " " + "-25px";
		   if(S1LP < S1WW-S1W)
		       {
			     document.getElementById('s1right').style.backgroundPosition = "0px" + " " + "-50px";
			   }
         }
}

function S1Lon()
{
 if(S1LP < 0){document.getElementById('s1left').style.backgroundPosition = "0px" + " " + "-50px";}
 else{document.getElementById('s1left').style.backgroundPosition = "0px" + " " + "0px";}
}

function S1Loff()
{
   if(S1LP < 0){document.getElementById('s1left').style.backgroundPosition = "0px" + " " + "-25px";}
   else{document.getElementById('s1left').style.backgroundPosition = "0px" + " " + "0px";}
}

function S1Lrev()
{
  document.getElementById('s1left').style.backgroundPosition = "0px" + " " + "-50px";
	 if(S1LP < 0)
		 {
		   S1LP = S1LP + 20;
		   document.getElementById('pickupslider').style.left = S1LP + "px";
           setTimeout("S1Lrev()", 10);
		 }
	else
	     {
           document.getElementById('s1left').style.backgroundPosition = "0px" + " " + "0px";
		   document.getElementById('s1right').style.backgroundPosition = "0px" + " " + "0px";
		 }
}

/*----------------------------------------カラムアクション関数-----------------------------------*/
var CLP = 0;
var CSI = "0"

function menuAllhidden()
{
 document.getElementById('menuA').style.visibility = "hidden";
 document.getElementById('menuB').style.visibility = "hidden";

}

function menuAllvisible()
{
 document.getElementById('menuA').style.visibility = "visible";
 document.getElementById('menuB').style.visibility = "visible";
}

/*------------------------------カラムスライドＣ-------------------------*/
function ColumnSlideC()
{     
                CSI = CWW - CW;
                document.getElementById('backbutton').style.visibility = "hidden";
                if(TCS == 'T2'){menuAllhidden();}
                ColumunSlideCaction();
}

function ColumunSlideCaction()
{
 if(CLP >  CSI)
                    {
                     CLP = CLP - 15;
                     document.getElementById('columnbox').style.left = CLP + "px";
		             setTimeout("ColumunSlideCaction()", 10);
                    }
		         else
			        {

					 document.getElementById('backbutton').style.backgroundPosition = "0px" + " " + "-35px";
					 document.getElementById('backbutton').style.visibility = "visible";
					 document.getElementById('backbutton').style.cursor = "pointer";
					 document.getElementById("mainview").style.display = "block";
                     menuAllvisible();
			        }
}

/*------------------------------カラムバック-------------------------*/
function Columunback()
{document.getElementById("mainview").style.display = "none";
 if(CLP < 0)
     {
      if(TCS == 'T2'){menuAllhidden();}
	  document.getElementById('backbutton').style.backgroundPosition = "0px" + " " + "0px";
	  document.getElementById('backbutton').style.cursor = "normal";

	  Columunbackaction();
	 }
}

function Columunbackaction()
{
  if(CLP < 0)
      {
		CLP = CLP + 15;
		document.getElementById('columnbox').style.left = CLP + "px";
		setTimeout("Columunbackaction()", 10);
	   }
  else
      {
       menuAllvisible();
      }
}

function Columunbackfast()
{document.getElementById("mainview").style.display = "none";
 if(CLP < 0)
     {
	  CLP = 0;
	  document.getElementById('columnbox').style.left = CLP + "px";
	  document.getElementById('backbutton').style.backgroundPosition = "0px" + " " + "0px";
	  document.getElementById('backbutton').style.cursor = "normal";
	 }
}



/*-------------------------メニューAリセット関数-------------------------*/
function menuAreset()
{
 for(a=1; a<=Amax; ++a)
                   {
                    document.getElementById("A" + [a]).style.backgroundImage = "none";
                    document.getElementById("A" + [a]).style.color = "#999999";
                    document.getElementById("A" + [a]).style.fontWeight = "normal";
					document.getElementById("A" + [a] + "B").style.display = "none";
                   }
}

/*------------------------------メニューAイベント関数------------------------------*/
/*------------------------------クリックA-------------------------*/
/*---------------セレクトA---------------*/
function downmenuA(AX)
{ 
 menuAreset();
 ACS = AX;
 document.getElementById(AX).style.backgroundImage = "url(images/base_images/menubutton.png)";
 document.getElementById(AX).style.color = "#000000";
 document.getElementById(AX).style.fontWeight = "bold";
 document.getElementById(AX + "B").style.display = "block";
 document.getElementById("menuC").style.display = "none";
 document.getElementById("mainview").style.display = "none";

 BCS = "";
 for(b=1; b<=Bmax; ++b)
                    {
                     document.getElementById(AX + "B" + [b]).style.backgroundImage = "none";
					 document.getElementById(AX + "B" + [b]).style.color = "#999999";
					 document.getElementById(AX + "B" + [b]).style.fontWeight = "normal";
                    } 
}

/*------------------------------オンA-------------------------*/
function onmenuA(AX){
					 if (AX != ACS)
											{
												document.getElementById(AX).style.color = "#000000" ;
												document.getElementById(AX).style.fontWeight = "bold" ;
										 	}
										 }

/*------------------------------オフA-------------------------*/
function offmenuA(AX){
					  if (AX != ACS)
												{
												document.getElementById(AX).style.color = "#999999" ;
												document.getElementById(AX).style.fontWeight = "normal" ;
												}
					  else
												{
												document.getElementById(AX).style.color = "#000000" ;
												document.getElementById(AX).style.fontWeight = "bold" ;
												}
											}

/*------------------------------メニューBイベント関数------------------------------*/
/*------------------------------クリックB-------------------------*/
function downmenuB(AX,BX,menuCreplace)
{
 new Ajax.Updater("menuC",menuCreplace,{method:'get'});
 document.getElementById("menuC").style.display = "block";
 document.getElementById("mainview").style.display = "none";
 BCS = BX;
 for(b=1; b<=Bmax; ++b) {
											if ("B"+[b] == BX)
													{
                                                        document.getElementById(AX + BX).style.backgroundImage = "url(images/base_images/menubutton.png)";
														document.getElementById(AX + BX).style.color = "#000000";
														document.getElementById(AX + BX).style.fontWeight = "bold";                                                        
													}
											else
													{
														document.getElementById(AX + "B" + [b]).style.backgroundImage = "none";
														document.getElementById(AX + "B" + [b]).style.color = "#999999";
														document.getElementById(AX + "B" + [b]).style.fontWeight = "normal";                                                        
													}
					    } 
}

/*------------------------------オンB-------------------------*/
function onmenuB(AX,BX){
											if (BX != BCS)
											{
												document.getElementById(AX + BX).style.color = "#000000" ;
												document.getElementById(AX + BX).style.fontWeight = "bold" ;
										 	}
										 }
/*------------------------------オフB-------------------------*/
function offmenuB(AX,BX){
											if (BX != BCS)
												{
												document.getElementById(AX + BX).style.color = "#999999" ;
												document.getElementById(AX + BX).style.fontWeight = "normal" ;
												}
												else
												{
												document.getElementById(AX + BX).style.color = "#000000" ;
												document.getElementById(AX + BX).style.fontWeight = "bold" ;
												}
											}

/*------------------------------メニューCイベント関数------------------------------*/
/*------------------------------クリックC-------------------------*/
function selectC(AX,BX,CX,mainviewreplace)
{
 new Ajax.Updater("mainview",mainviewreplace,{method:'get'});
 ColumnSlideC();
 CCS = CX;
 		for(c=1; c<=Cmax; ++c) 
		                    {
											if ("C" +[c] == CX)
													{
														document.getElementById(AX + BX + CX).style.backgroundImage = "url(images/base_images/selectC.png)";
													}
											else
													{
														document.getElementById(AX + BX + "C" + [c]).style.backgroundImage = "none";                                                                                                               
													}
                            } 
}

/*------------------------------オンC-------------------------*/
function onmenuC(AXBXCX) {AXBXCX.style.color = "#000000" ;}

/*------------------------------オフC-------------------------*/
function offmenuC(AXBXCX) {AXBXCX.style.color = "#aaaaaa" ;}

/*------------------------------クリックCp-------------------------*/
function downmenuCp(AXBXCX) {AXBXCX.style.color = "#aaaaaa" ;}



/*------------------------------メインビュータブチェンジ------------------------------*/
function mvTABselect(MVT,Name)
{
 document.getElementById('mvtabbox').style.backgroundPosition = "0px" + " " + [-48*(MVT - 1)] + "px";
 if(MVT == 1)
     {
      document.getElementById('mvtab1').style.display = "block";
      document.getElementById('mvtab2').style.display = "none";
      document.getElementById('mvtab3').style.display = "none";
     }

 if(MVT == 2)
     {
      document.getElementById('mvtab1').style.display = "none";
      document.getElementById('mvtab2').style.display = "block";
      document.getElementById('mvtab3').style.display = "none";
     }

 if(MVT == 3)
     {
      document.getElementById('mvtab1').style.display = "none";
      document.getElementById('mvtab2').style.display = "none";
      document.getElementById('mvtab3').style.display = "block";
     }
}


/*---------------------------------------------リモートセレクト関数---------------------------------------------*/
function remoteselect(TX,AX,BX,menuCreplace,mainviewreplace)
{

		   if(TX == 'T1')
             {
              changemaxT1(); document.getElementById("tabcss").href = "stylesheets/T1.css"; TCN = 1;
              document.getElementById('tab01').style.backgroundPosition = "0px" + " " + "0px";
              document.getElementById('tab02').style.backgroundPosition = "0px" + " " + "0px";
             }
		   if(TX == 'T2')
             {
              changemaxT2(); document.getElementById("tabcss").href = "stylesheets/T2.css"; TCN = 2;
              document.getElementById('tab01').style.backgroundPosition = "0px" + " " + "-25px";
              document.getElementById('tab02').style.backgroundPosition = "0px" + " " + "-45px";
             }
		   if(TX == 'T3')
             {
              changemaxT3(); document.getElementById("tabcss").href = "stylesheets/T6.css"; TCN = 3;
              document.getElementById('tab01').style.backgroundPosition = "0px" + " " + "-50px";
              document.getElementById('tab02').style.backgroundPosition = "0px" + " " + "-90px";
             }
		   if(TX == 'T4')
             {
              changemaxT4(); document.getElementById("tabcss").href = "stylesheets/T6.css"; TCN = 4;
              document.getElementById('tab01').style.backgroundPosition = "0px" + " " + "-75px";
              document.getElementById('tab02').style.backgroundPosition = "0px" + " " + "-135px";
             }
		   if(TX == 'T5')
             {
              changemaxT5(); document.getElementById("tabcss").href = "stylesheets/T6.css"; TCN = 5;
              document.getElementById('tab01').style.backgroundPosition = "0px" + " " + "-100px";
              document.getElementById('tab02').style.backgroundPosition = "0px" + " " + "-180px";
             }
		   if(TX == 'T6')
             {
              changemaxT6(); document.getElementById("tabcss").href = "stylesheets/T6.css"; TCN = 6;
              document.getElementById('tab01').style.backgroundPosition = "0px" + " " + "-125px";
              document.getElementById('tab02').style.backgroundPosition = "0px" + " " + "-225px";
             }

 tabreplace="contents/menuAB/" + TX + ".html";
 new Ajax.Request(tabreplace,{method: 'get',onComplete: 
     function(httpObj)
         {
	       $("twinmenubox").innerHTML = httpObj.responseText;
           new Ajax.Updater("menuC",menuCreplace,{method:'get'});
           new Ajax.Updater("mainview",mainviewreplace,{method:'get'});

           TCS = TX;
           ACS = AX;
           BCS = BX;
           menuAreset();
           document.getElementById(AX).style.backgroundImage = "url(images/base_images/menubutton.png)";
		   document.getElementById(AX).style.color = "#000000";
           document.getElementById(AX).style.fontWeight = "bold";
           document.getElementById(AX + "B").style.display = "block";
		   document.getElementById("menuC").style.display = "block";
		   if(mainviewreplace != 'contents/mainview/null.html'){ColumnSlideC();}

 		   for(b=1; b<=Bmax; ++b) {
											if ("B"+[b] == BX)
													{
													  document.getElementById(AX + BX).style.backgroundImage = "url(images/base_images/menubutton.png)";
														document.getElementById(AX + BX).style.color = "#000000";
														document.getElementById(AX + BX).style.fontWeight = "bold";
													}
											else
													{
														document.getElementById(AX + "B" + [b]).style.backgroundImage = "none";
														document.getElementById(AX + "B" + [b]).style.color = "#999999";
														document.getElementById(AX + "B" + [b]).style.fontWeight = "normal";
													}
						           }

	       }
	  });
}