/* ------------------------------------ */
/* Topページ　TitleLogo表示用スクリプト */
/* ------------------------------------ */
delay=20;
colmax = 0;
lgmax = 5;
flg_logo = 0;
flg_comm = 0;
/* 初期化関数 */
w = 0;
h = 0;
mw = 0;
mh = 0;
function init(){
    initCrossBrowserLib();
    w = getWindowWidth ();
    h = getWindowHeight();
	mw = w / 2;
	mh = h / 2;    

    if(_mac&&(_dom==1||_dom==2)){
      if(_dom == 1){ 
 	    moveit(1, -200,  35, 180,   35,  20);        // logo1 = Welcome to
      }else{
 	    moveit(1, -200,  35, 150,   35,  20);        // logo1 = Welcome to
      }
	  moveit(2, w,  70, 140,   70,  40,  30);       // logo2 = atelier
	  moveit(3, -400,  48,  320,   48,  40,  30);   // logo3 = R
	  moveit(4, 170, -10,   170,  113,  50,  110);  // logo4 = WEB Gallery
    }else{
	  moveit(1,     -10,  35,  mw + 25,  35, 20);        // logo1 = Welcome to
	  moveit(2,       w,  70,  mw + 25,  70, 40, 30);   // logo2 = atelier
	  moveit(3,     -10,  48, mw + 248,  48, 40, 30);   // logo3 = R
	  moveit(4, mw + 95, -10,  mw + 95, 113, 50, 110);  // logo4 = WEB Gallery
    }
}
var arMacPos = new Array();
  arMacPos[0]  = new Array('150px', '35px');
  arMacPos[1]  = new Array('270px', '70px');
  arMacPos[2]  = new Array('650px', '48px');
  arMacPos[3]  = new Array('300px', '113px');
function macieEvent(){
  for(var j=1; j< lgmax; j++){
    nm = "logo" + j;
    doc = getDocument(nm);      
    if(doc){
      doc.left= arMacPos[j-1][0];
      doc.top = arMacPos[j-1][1];
      doc.visibility = 'inherit';
      doc.zIndex = 3;
    }
  } 
}
/* リサイズ関数 */
function resize(){
  if(_mac&&(_dom==1||_dom==2)){
    macieEvent();
    return;
  }
  flg_comm = 1; 
  for(var j=1; j<= lgmax; j++){
    nm = "logo" + j;
    doc = getDocument(nm);      
    if(doc){
        doc.visibility = 'hidden';
        doc.zIndex = 0;
    }
  }
  for(var k = 1; k <= colmax; k++){
    nm = "comment" + k;
    doc = getDocument(nm);      
    if(doc){
        doc.visibility = 'hidden';
        doc.zIndex = 0;
    }
  }
  init();
}

/* logo表示実行関数 */
function moveit(was, startx, starty, endx, endy, steps, wait){
    var nm = "logo"+was;
    var doc = getDocument(nm);      

    if(was == 4 && steps <= 0){
      setTimeout('changeWEBGallery()', 500);
      return;
    }
    if(doc){
      if(wait && wait > 0){
	    setTimeout('moveit('+was+','+startx+','+starty+','+endx+','+endy+','+steps+','+(wait-1)+')', delay);
      }else{
        doc.visibility = 'inherit';
        doc.zIndex = 3;
        doc.left = startx;
        doc.top  = starty;
        startx += (endx - startx) / steps;
        starty += (endy - starty) / steps;

        if(steps > 0)
	      setTimeout('moveit('+was+','+startx+','+starty+','+endx+','+endy+','+(steps-1)+',0)', delay);
	  }
    }
}

/* WEB Galleryイメージの色変換関数 */
function changeWEBGallery(){
    var doc  = getDocument("logo4");
    doc.visibility = 'hidden';
    doc.zIndex = 0;

    doc = getDocument("logo5");
    if(_mac&&(_dom==1||_dom==2)){
      doc = getDocument("logo6");
    } 
    doc.visibility = 'inherit';
    doc.zIndex = 3;
    if(_mac&&(_dom==1||_dom==2)){
      doc.left = 170;
    }else{
      doc.left = mw + 95;
    }
    doc.top  = 110;

    flg_comm = 0;
    setTimeout('commentVis(1)', 3000); // logoが終了したらコメント表示させる。
    return; 
}

/* 挨拶表示関数 */
function commentVis(no){
    if(flg_comm == 0){
      nm = "comment" + no;
      var i = no;
      if(i > colmax) return;

      var doc = getDocument(nm);
      if(doc){ 
        doc.visibility = 'inherit';
      }

      setTimeout('commentVis('+ (i + 1) + ')', 1100);
    }
}

/* ドキュメント取得関数 */
function getDocument(nm){
    var doc = null;
    if(document.all){                     // IE
      if(document.getElementById){
        doc = document.getElementById(nm).style;
      } 
      doc = document.all(nm).style;  
    }else if(document.getElementById){    // Mozilla5( NN6 )
        doc = document.getElementById(nm).style;
    }else if (document.layers) {          // NN
        doc = document.layers[nm];          
    } 
    return doc;
}



