md_version ="  md_main2.js 80510a";


/* サブファイルから参照する配列 */
 
    change_style = []; last_comn  = []; last_image = [];
    ms_photo1 = [];  ms_photo2 = [];  ms_photo3 = [];  ms_photo4 = [];
    ms_cmnt1 = [];   ms_cmnt2 = [];   ms_cmnt3 = [];   ms_cmnt4 = [];
    photo_area = []; photo_size = []; photo_holder = [];
    shut_image = []; shut_time = [];
    shut_sound = []; shut_volume = []; slide_speed = [];
    sub_color = [];  sub_title = [] ; sub_button = [];

    for(i=0 ; i<5 ;i++){ 
        change_style[i] = "|0|0|0|0|"; 
 	last_comn[i]  = "";
        last_image[i] = "";
        photo_area[i] = "";
        photo_size[i] = "";
        photo_holder[i] = "";
        shut_image[i] = "";
        shut_time[i] = 100;
        shut_sound[i] = "";
        shut_volume[i] = 0;
        slide_speed[i] = 0;
        sub_color[i] = "";
        sub_title[i] = "";
        sub_button[i] = "";
    }


/* メインファイルの既定値 */
    sub_button = ["","","",""];
    tm_border = [];
    tm_over = ["","","",""];
    tm_out = ["","","",""];
    tm_over_out = ["ms_none","ms_none","ms_none","ms_none"];
    tm0_str = ["","","",""]
    tm_title = [0,0,0,0]
    tm_padding = [0,0,0,0];
    tm_magin = [0,0,0,0];
    tm0_width = ["","","",""]
    tm0_height = ["","","",""]
    tm1_width = [128,128,128,128]
    tm1_height = [96,96,96,96]

tmPara = { "bg_color":"1" , "border_style":"2" , "border_color":"3" , "ms_filter":"4" , "bak_image":"5",  "bdr_color":"6","bak_color":"7","over_out":"8","ms_shadow":"9","dr_shadow":"10","ms_glow":"11" }

tm_style = ["","sty_no1","sty_no2","sty_no3","sty_no4","sty_no5","sty_no6","sty_no7","sty_no8","sty_no9","sty_no10","sty_no11","sty_no12","sty_no13","sty_no14","sty_no15","sty_no16" ]

tdw = []; tdh = []; tm_tate = []; tm_yoko = [];
tm_color = [] ;
pa_photo = [];
photo_data = [];
subfile_name = [];
thmb_Data = [];

tm_Poss = []; tm_Phh = [];  tm_Textt = []; tm_Styy = []; tm_Lnkk = []; tm_Mss = []; 
tm_Pos = [];  tm_Ph = [];   tm_Text = []; tm_Sty = [];  tm_Lnk = [];  tm_Ms = [];

thmb_lnk = []; thmb_sty = [];
for(var k=0 ; k< 65 ; k++){ thmb_sty[k] = 1 ; thmb_lnk[k] = k+1 }


rgb_st = [[],[]]
rgb_hx = [[],[]]
rgb_str = []
rgb_hex = []

title_len = 0
grno = 1;  pgno = 1; tmMode = 0;

NaviInfo()
window.status = version + ":   "+ md_version;

/* フルウインド オープン */
function fm(url){

var scw = screen.availWidth;
var sch = screen.availHeight;
var para3
    if((version > 6)&&(location.protocol == "http:")&&(screen.height < 800)){

         sWin = window.open(url,"fm","fullscreen=yes ,scrollbars=1");
    }else{
         para3 = "width="+scw+", height="+sch+", top=0,left=0 ,scrollbars=1,status=1,resizable=1 ";
         sWin = window.open(url,"fm",para3);
         if(url.indexOf("//",0) == -1){ sWin.resizeTo(scw,sch) ; sWin.moveTo(0,0) ;  sWin.focus();}
    }
}


/*  サブウインド オープン（写真No ，何段目 , サブボタン） */
function phs(phn,grn){ 
 
    fm(subfile_name[grn] +"?"+phn+"&"+grn+"&"+sub_button[grn]);
}


/* 表示データのコピー */
function subData(){

var tm_Pos1 = []; var tm_Ph1 = []; var tm_Text1 = []; 
var tm_Pos2 = []; var tm_Ph2 = []; var tm_Text2 = [];
var tm_Pos3 = []; var tm_Ph3 = []; var tm_Text3 = []; 
var tm_Pos4 = []; var tm_Ph4 = []; var tm_Text4 = []; 

var tm_Sty1 = []; var tm_Lnk1 = []; var tm_Ms1 = [];
var tm_Sty2 = []; var tm_Lnk2 = []; var tm_Ms2 = [];
var tm_Sty3 = []; var tm_Lnk3 = []; var tm_Ms3 = [];
var tm_Sty4 = []; var tm_Lnk4 = []; var tm_Ms4 = [];

    CopyComn();
    jno = 0;
    if(pgno == 1){
        for(var i=0 ; i< pa_photo.length-1 ; i = i+3){
            ms_photo1[jno] = pa_photo[i+1];
            ms_cmnt1[jno] = pa_photo[i+2];
            jno++;
            tm_split = pa_photo[i].split("|");

            if(tm_split[0] != ""){
                 tm_Ph1[jno] = photo_holder[1] + tm_split[0];  
            }else{
                 if((pa_photo[i+1].indexOf("|") >0)||(pa_photo[i+1].indexOf("#") >0)){
                      if(pa_photo[i+1].indexOf("#") >0){
                           tm_tmp1 =  pa_photo[i+1].split("#");
                           tm_tmp =  tm_tmp1[0].split(".");
                      }else{
                           tm_tmp1 =  pa_photo[i+1].split("|");
                           tm_tmp =  tm_tmp1[0].split(".");
                      }
                 }else{
                      tm_tmp =  pa_photo[i+1].split(".");
                 }  
                 tm_Ph1[jno] = photo_holder[1] + tm_tmp[0]+"s."+tm_tmp[1];
            }

            tm_Text1[jno] = "" ; tm_Ms1[jno] = "";
            if(tm_split.length == 2){
                 if(tm_title[1] == 3){
                      tm_Ms1[jno] = photo_holder[1] + tm_split[1];
                 }else{  
                      tm_Text1[jno] = tm_split[1];
                 }  
            }
            if(tm_title[1] == 4){ tm_Text1[jno] = pa_photo[i+2]; }
         }

         for(var i in thmb_Data){ tm_Pos1[i] = thmb_Data[i]; }
         if(thmb_sty.length <= 2){
              for(var i in pa_photo){ tm_Sty1[i] = thmb_sty[0]; } 
         }else{
              for(var i in thmb_sty){ tm_Sty1[i] = thmb_sty[i]; } 
         }
         for(var i in thmb_lnk){ tm_Lnk1[i] = thmb_lnk[i]; } 

         tm_Poss[1] =tm_Pos1 ; tm_Phh[1] =tm_Ph1 ; tm_Textt[1] = tm_Text1; 
         tm_Styy[1] =tm_Sty1 ; tm_Lnkk[1] =tm_Lnk1 ; tm_Mss[1] = tm_Ms1; 
    }

    if(pgno == 2){
        for(var i=0 ; i< pa_photo.length-1 ; i = i+3){
            ms_photo2[jno] = pa_photo[i+1];
            ms_cmnt2[jno] = pa_photo[i+2];
            jno++;
            tm_split = pa_photo[i].split("|");

            if(tm_split[0] != ""){
                 tm_Ph2[jno] = photo_holder[2] + tm_split[0];
            }else{
                 tm_tmp =  pa_photo[i+1].split(".");
                 tm_Ph2[jno] = photo_holder[2] + tm_tmp[0]+"s."+tm_tmp[1];
            }

            tm_Text2[jno] = "" ; tm_Ms2[jno] = "";
            if(tm_split.length == 2){
                 if(tm_title[2] == 3){
                      tm_Ms2[jno] = photo_holder[2] + tm_split[1];
                 }else{  
                      tm_Text2[jno] = tm_split[1];
                 }  
            }
            if(tm_title[2] == 4){ tm_Text2[jno] = pa_photo[i+2]; }
         }
 
         for(var i in thmb_Data){ tm_Pos2[i] = thmb_Data[i]; }
         if(thmb_sty.length <= 2){
              for(var i in pa_photo){ tm_Sty2[i] = thmb_sty[0]; } 
         }else{
              for(var i in thmb_sty){ tm_Sty2[i] = thmb_sty[i]; } 
         }
         for(var i in thmb_lnk){ tm_Lnk2[i] = thmb_lnk[i]; } 

         tm_Poss[2] =tm_Pos2 ; tm_Phh[2] =tm_Ph2 ; tm_Textt[2] = tm_Text2; 
         tm_Styy[2] =tm_Sty2 ; tm_Lnkk[2] =tm_Lnk2 ; tm_Mss[2] = tm_Ms2; 

    }

    if(pgno == 3){
        for(var i=0 ; i< pa_photo.length-1 ; i = i+3){
            ms_photo3[jno] = pa_photo[i+1];
            ms_cmnt3[jno] = pa_photo[i+2];
            jno++;
            tm_split = pa_photo[i].split("|");

            if(tm_split[0] != ""){
                 tm_Ph3[jno] = photo_holder[3] + tm_split[0];
            }else{
                 tm_tmp =  pa_photo[i+1].split(".");
                 tm_Ph3[jno] = photo_holder[3] + tm_tmp[0]+"s."+tm_tmp[1];
            }

            tm_Text3[jno] = "" ; tm_Ms3[jno] = "";
            if(tm_split.length == 2){
                 if(tm_title[3] == 3){
                      tm_Ms3[jno] = photo_holder[3] + tm_split[1];
                 }else{  
                      tm_Text3[jno] = tm_split[1];
                 }  
            }
            if(tm_title[3] == 4){ tm_Text3[jno] = pa_photo[i+2]; }
         }

         for(var i in thmb_Data){ tm_Pos3[i] = thmb_Data[i]; }
         if(thmb_sty.length <= 2){
              for(var i in pa_photo){ tm_Sty3[i] = thmb_sty[0]; } 
         }else{
              for(var i in thmb_sty){ tm_Sty3[i] = thmb_sty[i]; } 
         }
         for(var i in thmb_lnk){ tm_Lnk3[i] = thmb_lnk[i]; } 

         tm_Poss[3] =tm_Pos3 ; tm_Phh[3] =tm_Ph3 ; tm_Textt[3] = tm_Text3; 
         tm_Styy[3] =tm_Sty3 ; tm_Lnkk[3] =tm_Lnk3 ; tm_Mss[3] = tm_Ms3; 
    }

    if(pgno == 4){
        for(var i=0 ; i< pa_photo.length-1 ; i = i+3){
            ms_photo4[jno] = pa_photo[i+1];
            ms_cmnt4[jno] = pa_photo[i+2];
            jno++
            tm_split = pa_photo[i].split("|");

            if(tm_split[0] != ""){
                 tm_Ph4[jno] = photo_holder[4] + tm_split[0];
            }else{
                 tm_tmp =  pa_photo[i+1].split(".");
                 tm_Ph4[jno] = photo_holder[4] + tm_tmp[0]+"s."+tm_tmp[1];
            }

            tm_Text4[jno] = "" ; tm_Ms4[jno] = "";
            if(tm_split.length == 2){
                 if(tm_title[4] == 3){
                      tm_Ms4[jno] = photo_holder[4] + tm_split[1];
                 }else{  
                      tm_Text4[jno] = tm_split[1];
                 }  
            }
            if(tm_title[4] == 4){ tm_Text4[jno] = pa_photo[i+2]; }
        }

         for(var i in thmb_Data){ tm_Pos4[i] = thmb_Data[i]; }
         if(thmb_sty.length <= 2){
              for(var i in pa_photo){ tm_Sty4[i] = thmb_sty[0]; } 
         }else{
              for(var i in thmb_sty){ tm_Sty4[i] = thmb_sty[i]; } 
         }
         for(var i in thmb_lnk){ tm_Lnk4[i] = thmb_lnk[i]; } 

         tm_Poss[4] =tm_Pos4 ; tm_Phh[4] =tm_Ph4 ; tm_Textt[4] = tm_Text4; 
         tm_Styy[4] =tm_Sty4 ; tm_Lnkk[4] =tm_Lnk4 ; tm_Mss[4] = tm_Ms4; 
    }

    for(var k=0 ; k< 65 ; k++){ thmb_sty[k] = 1 ; thmb_lnk[k] = k+1; }
    thmb_Data = [];
    photo_data = [];
    pa_photo = [];
    pgno++;
}


/* 複数行コメントの処理 */
function CopyComn(){

var k = -1;
    for(var i = 0 ; i < photo_data.length-1 ; i++){
         br_flg = photo_data[i].substr(0,1);
         if(br_flg != "#"){
              k++; 
              pm_p = photo_data[i];
         }else{
              pm_p = pa_photo[k] + photo_data[i].substr(1,photo_data[i].length-1);
         }
         pa_photo[k] = pm_p;
    }
}


/* サムネイル表示 */
function Dspthmb(){

    tmMode = tmPara[tm_over_out[grno]] ;
    if((tmMode == 6)||(tmMode == 7)){
       if(grno >2){
           alert('この効果のサムネイル表示は２段までです') ;
           return ;
       }
    }
    if(tmMode == 6){ initBgColor();}
    if(tmMode == 7){ initBgColor();}
    if(tmMode == 9){ initShadow();}
    if(tmMode == 10){ initDshadow();}
    if(tmMode == 11){ initGlow();}
 
    tm_Pos = tm_Poss[grno] ; tm_Ph = tm_Phh[grno] ;   tm_Text = tm_Textt[grno]; 
    tm_Sty = tm_Styy[grno] ; tm_Lnk = tm_Lnkk[grno] ; tm_Ms = tm_Mss[grno]; 

    bdr2_mgn_tate = (tm_border[grno] + tm_padding[grno])*2  + tm_tate[grno];
    bdr2_mgn_yoko = (tm_border[grno] + tm_padding[grno])*2  + tm_yoko[grno];

    if(tm0_width[grno] == 0){
         td0_width = 0;
    }else{
         td0_width = tm0_width[grno] + bdr2_mgn_yoko;
    }
    if(tm0_height[grno] == 0){
         td0_height = 0;
    }else{
        td0_height = tm0_height[grno] + bdr2_mgn_tate;
    }
    tdw[1] = tm1_width[grno]; tdh[1] = tm1_height[grno];

    bdr_mgn_tate = tm_border[grno]*2 + tm_tate[grno]*2 + tm_padding[grno]*2;
    bdr_mgn_yoko = tm_border[grno]*2 + tm_yoko[grno]*2 + tm_padding[grno]*2;

    tdw[2] = tdw[1]*2 + bdr_mgn_yoko;
    tdh[2] = tdh[1]*2 + bdr_mgn_tate;
    tdw[3] = tdw[1]*3 + bdr_mgn_yoko*2;
    tdh[3] = tdh[1]*3 + bdr_mgn_tate*2;
    tdw[4] = tdw[1]*4 + bdr_mgn_yoko*3;
    tdh[4] = tdh[1]*4 + bdr_mgn_tate*3;

    tdno = 1; 
    s ="";
    s +="<table cellpadding=0 cellspacing=0 border=0 ID='tm_frm"+grno+"'>";
    s +="<tbody><tr><td nowrap>";
    s +="<TABLE cellpadding=0 cellspacing=0 border=0><TBODY>";
    DocWrite(s);
    tclass = 0;

    for(var tmcol=0 ; tmcol < tm_Pos.length-1 ; tmcol++){
      if(tm_Pos[tmcol].charAt(0) == " "){
             /* サムネイル間文字 */
             s ="<TR><TD colspan=8 class='tdstr"+tclass+"'>"+tm_Pos[tmcol]+"</TD></TR>";
             DocWrite(s);
        }else{
             tmstr = "t"+tm_Pos[tmcol]+"d";
             Dspthmb1(tmstr,grno,tmcol);
             tclass++;
        }
    }
    s ="</TBODY></TABLE></td></tr></tbody></table>";
    DocWrite(s);
    grno++
}


function Dspthmb1(tmstr,grno,tmcol){

var s = ""; var r = "";
    tmstr_len = tmstr.length ;
    if(tm_title[grno] == 2){ r +="<TR>"; }

    for(var j=0; j < tmstr_len ;j++){
         kt = tm_style[tm_Sty[tdno-1]]; 
         kp = tm_Lnk[tdno-1];
         tmstr1 = tmstr.charAt(j);
         if(tmstr1 == "t"){ s +="<TR>"; }
         if(tmstr1 == "0"){
               if((td0_width+td0_height)>0){ 
                    s +="<TD align='center' width="+td0_width+" height="+td0_height+">"+tm0_str[grno]+"</TD>";
               }else{      
                    s +="<TD align='center'>"+tm0_str[grno]+"</TD>";
               }
          }
          if(tmstr1 == "x"){ tdno++; }

          if((tmstr1 == "1")||(tmstr1 == "2")||(tmstr1 == "3")||(tmstr1 == "4")){
                s +="<TD align=center colspan="+tmstr1+" ROWSPAN="+tmstr1+" class='td_style' >"; 
                s +="<table cellpadding=0 cellspacing=0 border=0 class='"+kt+"' ";
                s +=" style=' border-width:"+tm_border[grno]+";padding:"+tm_padding[grno]+";";
                s +=" margin:"+tm_tate[grno]+" "+tm_yoko[grno]+" "+tm_tate[grno]+" "+tm_yoko[grno]+"'";
                s += " onMouseover='thmbOver(this,"+grno+")' onMouseout='thmbOut(this,"+grno+")' ";
                s +="><tbody><tr><td nowrap>";
                if(tm_Ms[kp] != ""){
                     s +="<img src='"+ tm_Ms[kp] + "' onClick=phs("+kp+","+grno+") class='tm_photo' ";
                     s += "onMouseover='this.src="+ '"' + tm_Ph[kp] +'"'+"' "; 
                     s += "onMouseout='this.src="+ '"' + tm_Ms[kp] +'"'+"' ";                      
                }else{ 
                     s +="<img src='"+ tm_Ph[kp] + "' onClick=phs("+kp+","+grno+") class='tm_photo' ";
                }
                if(tmstr1 != "1"){ s +="width="+tdw[tmstr1]+" height="+tdh[tmstr1]+" ";}
                if((tm_title[grno] == 1)||(tm_title[grno] == 4)){ s +=" title='"+tm_Text[kp]+"'"; } 
                s +="></td></tr></tbody></table></TD>";
                if(tm_title[grno] == 2){ r +="<TD align=center class='tm_title2'>"+tm_Text[kp]+"　</TD>"; }
                tdno++;
          }
          if(tmstr1 == "d"){ s +="</TR>"; }
    }
    DocWrite(s);
    if(tm_title[grno] == 2){ r += "</TR>"; document.open(); document.write(r); document.close(); } }


/* マウス Over */
function thmbOver(thisOver,tover){

var  tmMode1 = tmPara[tm_over_out[tover]] ;
     switch(tmMode1){
        case "1" : thisOver.style.backgroundColor =  tm_over[tover] ; break ;
        case "2" : thisOver.style.borderStyle =  tm_over[tover] ; break ; 
        case "3" : thisOver.style.borderColor =  tm_over[tover] ; break ; 
        case "4" : thisOver.style.filter =  tm_over[tover] ; break ;
        case "5" : thisOver.style.backgroundImage =  tm_over[tover] ; break ;
        case "6" : overColor1(thisOver,tover)  ; break ;
        case "7" : overColor2(thisOver,tover)  ; break ;
        case "8" : msOver(thisOver)  ; break ;
        case "9" : overShadow(thisOver,tover)  ; break ;
        case "10" : overDshadow(thisOver,tover)  ; break ;
        case "11" : overGlow(thisOver,tover)  ; break ;
    }
}


/* マウス Out */
function thmbOut(thisOut,tout){

var tmMode2 = tmPara[tm_over_out[tout]] ;
    switch(tmMode2){
        case "1" : thisOut.style.backgroundColor = tm_out[tout] ; break ; 
        case "2" : thisOut.style.borderStyle = tm_out[tout] ; break ;
        case "3" : thisOut.style.borderColor = tm_out[tout] ; break ; 
        case "4" : thisOut.style.filter = tm_out[tout] ; break ; 
        case "5" : thisOut.style.backgroundImage =  tm_out[tout] ; break ; 
        case "6" : outColor1(thisOut,tout)  ; break ;
        case "7" : outColor2(thisOut,tout)  ; break ;
        case "8" : msOut(thisOut)  ; break ;
        case "9" : outShadow(thisOut,tout)  ; break ;
        case "10" : outDshadow(thisOut,tout)  ; break ;
        case "11" : outGlow(thisOut,tout)  ; break ;
    }
}

function bgTimer0(thisOver0){

    if(tm_step <= 0){ 
         clearInterval(timer0);
    }else{
         thisOver0.style.filter = tm_color[tm_step];
    }
    tm_step-- ;
}

/* Ｓｈａｄｏｗ変化 */
function overShadow(thisOver,tout){

    thisOver3 = thisOver;
    tm_ctr = 0;
    timer3 = setInterval("bgTimer3(thisOver3)",tm_bg_speed);
}

function outShadow(thisOut,tout){

    clearInterval(timer3);
    thisOut.style.filter = sdwColor[0];
}

function bgTimer3(thisOver3){

    tm_ctr++;
    if(tm_ctr >= 8){ 
         clearInterval(timer3); 
    }else{
         thisOver3.style.filter = sdwColor[tm_ctr];
    }
}


/* ＤｒｏｐＳｈａｄｏｗ変化 */
function outDshadow(thisOut,tout){

    clearInterval(timer4);
    thisOut.style.filter = dsdwColor[0];
}

function bgTimer4(thisOver4){

    tm_ctr++;
    if(tm_ctr >= 8){ 
         clearInterval(timer4);
    }else{
         thisOver4.style.filter = dsdwColor[tm_ctr];
    }
}

function overDshadow(thisOver,tout){

    thisOver4 = thisOver;
    tm_ctr = 0;
    timer4 = setInterval("bgTimer4(thisOver4)",tm_bg_speed);
}

/* Ｇｌｏｗ変化 */
function outGlow(thisOut,tout){

    clearInterval(timer5);
    thisOut.style.filter = glowColor[0];
}

function bgTimer5(thisOver5){

    tm_ctr++;
    if(tm_ctr >= 8){ 
         clearInterval(timer5);
    }else{
         thisOver5.style.filter = glowColor[tm_ctr];
    }
}

function overGlow(thisOver,tout){

    thisOver5 = thisOver;
    tm_ctr = 0;
    timer5 = setInterval("bgTimer5(thisOver5)",tm_bg_speed);
}


/* 枠色の変化 */
function outColor1(thisOut,tout){

    clearInterval(timer1);
    thisOut.style.borderColor = tm_out[tout];
}


function bgTimer1(thisOver1,tover1){

    tm_ctr++;
    if(tm_ctr >= 8){ 
         clearInterval(timer1);
    }else{
         thisOver1.style.borderColor = rgb_st[tover1][tm_ctr]
    }
}


function overColor1(thisOver,tover){

    thisOver1 = thisOver;
    tover1 = tover - 1
    tm_ctr = 0;
    timer1 = setInterval("bgTimer1(thisOver1,tover1)",tm_bg_speed);
}


/* 背景色の変化 */
function outColor2(thisOut,tout){

    clearInterval(timer2);
    thisOut.style.backgroundColor = tm_out[tout];
}


function bgTimer2(thisOver1,tover1){

    tm_ctr++;
    if(tm_ctr >= 8){ 
         clearInterval(timer2);
    }else{
        thisOver1.style.backgroundColor = rgb_st[tover1][tm_ctr];
    }
}

function overColor2(thisOver,tover){

    thisOver1 = thisOver;
    tover1 = tover - 1
    tm_ctr = 0;
    timer2 = setInterval("bgTimer2(thisOver1,tover1)",tm_bg_speed);
}


/* サムネイル配色初期化 */
function initBgColor(){

    sp_color1 = tm_out[grno].split("|");
    sp_color2 = tm_over[grno].split("|");
    tm_bg_color1 = sp_color1[0];
    tm_bg_color2 = sp_color2[0];

    over_red = parseInt("0x"+tm_bg_color2.substring(1,3));
    over_grn = parseInt("0x"+tm_bg_color2.substring(3,5));
    over_blu = parseInt("0x"+tm_bg_color2.substring(5,7));

    out_red = parseInt("0x"+tm_bg_color1.substring(1,3));
    out_grn = parseInt("0x"+tm_bg_color1.substring(3,5));
    out_blu = parseInt("0x"+tm_bg_color1.substring(5,7));

    over_out_red = (over_red - out_red)/8;
    over_out_grn = (over_grn - out_grn)/8;
    over_out_blu = (over_blu - out_blu)/8;

    for(var i=0 ; i<=8 ; i++){
        red_d = Math.ceil(out_red + over_out_red*i);
        grn_d = Math.ceil(out_grn + over_out_grn*i);
        blu_d = Math.ceil(out_blu + over_out_blu*i);
       rgbs ="rgb("+red_d+","+grn_d+","+blu_d+")";
        if(grno == 1){ rgb_st[0][i] = rgbs } ;
        if(grno == 2){ rgb_st[1][i] = rgbs } ;
        rgb_str[i] =  rgbs 
        red_h = red_d.toString(16);
        if(red_h.length == 1){red_h = "0"+red_h;}
        grn_h = grn_d.toString(16);
        if(grn_h.length == 1){grn_h = "0"+grn_h;}
        blu_h = blu_d.toString(16);
        if(blu_h.length == 1){blu_h = "0"+blu_h;}
        hexs ="#"+red_h+grn_h+blu_h ;

        if(grno == 1){ rgb_hx[0][i] = hexs };
        if(grno == 2){ rgb_hx[1][i] = hexs };
        rgb_hex[i] = hexs
    }
}
    pdtfm = "progid:DXImageTransform.Microsoft.";
    sdwColor = [];
    dsdwColor = [];
    glowColor = [];

function initShadow(){

    initBgColor();
    ms_para2 = tm_out[grno].split("|");
    ms_para1 = tm_over[grno].split("|");
    sdwColor[0] =  pdtfm +"Shadow(color="+rgb_hex[0] + ", direction ="+ms_para2[1]+", strength="+ms_para2[2]+")";
    for(var i=1 ; i<=8 ; i++){
       sdwColor[i] =  pdtfm +"Shadow(color="+rgb_hex[i] + ", direction ="+ms_para1[1]+", strength="+ms_para1[2]+")";
    }
}


function initDshadow(){

    initBgColor();
    ms_para2 = tm_out[grno].split("|");
    ms_para1 = tm_over[grno].split("|");
    dsdwColor[0] = pdtfm +"DropShadow(color="+rgb_hex[0] + ", offx ="+ms_para2[1]+",  offy="+ms_para2[2]+")";
    for(var i=1 ; i<=8 ; i++){
       dsdwColor[i] = pdtfm +"DropShadow(color="+rgb_hex[i] + ", offx ="+ms_para1[1]+", offy="+ms_para1[2]+")";
    }
}


function initGlow(){

    initBgColor();
    ms_para2 = tm_out[grno].split("|");
    ms_para1 = tm_over[grno].split("|");
    glowColor[0] = pdtfm +"Glow(color="+rgb_hex[0] + ", strength ="+ms_para2[1]+")";
    for(var i=1 ; i<=8 ; i++){
        glowColor[i] =  pdtfm +"Glow(color="+rgb_hex[i] + ", strength ="+ms_para1[1]+")";
    }
}


function AX(apcode){
    document.open() ; document.write(apcode) ; document.close();
}


var btn_txt = "Home";

/* Ｈｏｍｅ ボタン */
function HomeBtn(hpurl){

    hpurl2 = "location.href='" +hpurl +"'";
    as ="<form style = 'margin:0'>";
    as += "<input type='button' onClick="+hpurl2;
    as += " value= '"+btn_txt+"'  onfocus='this.blur()' class='btn_style'>";
    as +="</form>";
    document.open(); document.writeln(as); document.close();
}


/* ＢＧＭ関係 */ 

    sound_onoff = [];
    bgm_icon_onoff = [];
    bgm_title_onoff = [];
    bgm_titles =[];
    bgm_font_color = [];
    bgm_back_color = [];
    bgm_bodr_color = [];


/* １ボタンＢＧＭ */
function BGM(BGMstart){

    bgm_on_off = BGMstart;
    initBGM();
    if(bgm_button == 1){
         bgm_icon_onoff[1] = bgm_icon_off;
         bgm_icon_onoff[0] = bgm_icon_on;
         s ="<IMG src='"+bgm_icon_on+"' ID='bicon' onClick='bgmB()' title='"+onoff_alt+"'>";
         DocWrite(s);
         button_Id = $("bicon");
         button_Id.src = bgm_icon_onoff[bgm_on_off];
         button_Id.style.cursor = "pointer";
    }else{
         bgm_titles[0] = bgm_title_on;
         bgm_titles[1] = bgm_title_off;
         s  ="<form style= 'margin:0 ;'>";
         s +="<input type='button' ID='ficon3' value='"+bgm_titles[bgm_on_off]+"' onClick ='bgmF()' ";
         s +="onfocus='this.blur()' style = 'cursor:pointer'>";
         s +="</form>";
         DocWrite(s);

         text_Id3 = $("ficon3");
         text_Id3.style.fontFamily = bgm_font_family;
         text_Id3.style.fontSize = bgm_font_size;
         text_Id3.style.width = bgm_btn_width;
         text_Id3.style.padding = bgm_btn_padding;
         text_Id3.style.borderStyle = bgm_border_style;
         text_Id3.style.borderWidth = bgm_border_width;
         text_Id3.style.color = bgm_font_color[bgm_on_off];
         text_Id3.style.backgroundColor = bgm_back_color[bgm_on_off];
         text_Id3.style.borderColor = bgm_bodr_color[bgm_on_off];
    }
}


/* ２ボタンＢＧＭ */
function BGM2(BGMstart){

    bgm_on_off = BGMstart;
    initBGM();
    if(bgm_button == 1){
         bgm_icon_onoff[1] = bgm_icon_off;
         bgm_icon_onoff[0] = bgm_icon_on;
         s  ="<IMG src='"+bgm_icon_on+"' ID='bicon1' onClick='bgmCont(1)' title='"+on_alt+"'>&nbsp;";
         s +="<IMG src='"+bgm_icon_off+"' ID='bicon0' onClick='bgmCont(0)' title='"+off_alt+"'>";
         DocWrite(s);
         button_Id = $("bicon");
    }else{
         s  ="<form style= 'margin:0 ;'  ID='ficon'>";
         s +="<input type='button' ID='ficon1' value='"+bgm_title_on+"' onClick ='bgmCont(1)' ";
         s +="onfocus='this.blur()' style = 'cursor:pointer'> &nbsp;";
         s +="<input type='button' ID='ficon0'  value='"+bgm_title_off+"' onClick ='bgmCont(0)' ";
         s +="onfocus='this.blur()' style = 'cursor:pointer'>";
         s +="</form>";
         DocWrite(s);

         text_Id = $("ficon");
         text_Id.style.fontFamily = bgm_font_family;
         text_Id.style.fontSize = bgm_font_size;

         text_Id1 = $("ficon1");
         text_Id0 = $("ficon0");
         text_Id1.style.width = bgm_btn_width;
         text_Id0.style.width = bgm_btn_width;
         text_Id1.style.padding = bgm_btn_padding;
         text_Id0.style.padding = bgm_btn_padding;
         text_Id1.style.borderStyle = bgm_border_style;
         text_Id0.style.borderStyle = bgm_border_style;
         text_Id1.style.borderWidth = bgm_border_width;
         text_Id0.style.borderWidth = bgm_border_width;
         text_Id1.style.color = bgm_font_color[1];
         text_Id0.style.color = bgm_font_color[0];
         text_Id1.style.backgroundColor = bgm_back_color[1];
         text_Id0.style.backgroundColor = bgm_back_color[0];
         text_Id1.style.borderColor = bgm_bodr_color[1];
         text_Id0.style.borderColor = bgm_bodr_color[0];
    }
}


function initBGM(){

    bgm_emb = "<EMBED src='"+bgm_file+"' hidden='true' loop='true' height=0 ";
    sound_onoff[1] = bgm_emb + "autostart='true'>";
    sound_onoff[0] = bgm_emb + "autostart='false'>";
    s ="<SPAN ID ='bgm_id'> </SPAN>";
    DocWrite(s);
    sound_Id = $("bgm_id");
    sound_Id.innerHTML = sound_onoff[bgm_on_off];
}


function bgmF(){

    bgm_on_off = 1 - bgm_on_off; 
    text_Id3.style.color = bgm_font_color[bgm_on_off];
    text_Id3.style.borderColor = bgm_bodr_color[bgm_on_off];
    text_Id3.style.backgroundColor = bgm_back_color[bgm_on_off];
    text_Id3.value = bgm_titles[bgm_on_off];
    sound_Id.innerHTML = sound_onoff[bgm_on_off];
}


function bgmCont(bonoff){

    sound_Id.innerHTML = sound_onoff[bonoff];
}


function bgmB(){

    bgm_on_off = 1 - bgm_on_off;
    sound_Id.innerHTML = sound_onoff[bgm_on_off];
    button_Id.src = bgm_icon_onoff[bgm_on_off];
}


/* ＢＧＭ 文字ボタン */

    bgm_title_on ="BGM on ";
    bgm_title_off ="BGM off";
    bgm_font_family = "monospace";
    bgm_font_size = 12;
    bgm_btn_width = 70;
    bgm_btn_padding = "2 0 0 1";
    bgm_border_style ="ridge";
    bgm_border_width = 1;


/* ＢＧＭ 画像ボタン */

    bgm_icon_on   = "bgm1_on.gif";
    bgm_icon_off  = "bgm1_off.gif";
    on_alt = "BGMon";
    off_alt = "BGMoff";
    onoff_alt = "BGM on-off";
    tm_bg_speed = 50;
    bgm_button = 0;


/* 共通ライブラリ */
function NaviInfo(){
    aName  = navigator.appName.toUpperCase();
    if(aName.indexOf("MICROSOFT",0) >= 0){
           msie = 1;
           appVer = navigator.userAgent;
           s = appVer.indexOf("MSIE ",0) + 5;
           e = appVer.indexOf(";",s);
          version = eval(appVer.substring(s,e));
          if(window.navigator.userAgent.indexOf("SV1") >= 0){ version = version + 0.5; }
    }else{
         msie = 0 ; version = 5;
    }
}


function ltrim(str){
    return str.replace(/^\s+/,"");
}

function rtrim(str){
    return str.replace(/\s+$/,"");
}

function trim(str){
    var str2 = str.replace(/^\s+/,"");
    return str2.replace(/\s+$/,"");
}

function $(arg){
    return document.getElementById(arg);
}

function DocWrite(s){
    document.open(); document.write(s); document.close();
}

/* サムネイル配色計算 */
function calcBgColor(tm_bg_color1,tm_bg_color2,tm_bg_step){

    over_red = parseInt("0x"+tm_bg_color2.substring(1,3));
    over_grn = parseInt("0x"+tm_bg_color2.substring(3,5));
    over_blu = parseInt("0x"+tm_bg_color2.substring(5,7));

    out_red = parseInt("0x"+tm_bg_color1.substring(1,3));
    out_grn = parseInt("0x"+tm_bg_color1.substring(3,5));
    out_blu = parseInt("0x"+tm_bg_color1.substring(5,7));

    over_out_red = (over_red - out_red)/8;
    over_out_grn = (over_grn - out_grn)/8;
    over_out_blu = (over_blu - out_blu)/8;

    for(i=0 ; i<=tm_bg_step ; i++){
        red_d = Math.ceil(out_red + over_out_red*i);
        grn_d = Math.ceil(out_grn + over_out_grn*i);
        blu_d = Math.ceil(out_blu + over_out_blu*i);
        rgb_str[i] ="rgb("+red_d+","+grn_d+","+blu_d+")";

        red_h = red_d.toString(16);
        if(red_h.length == 1){red_h = "0"+red_h;}
        grn_h = grn_d.toString(16);
        if(grn_h.length == 1){grn_h = "0"+grn_h;}
        blu_h = blu_d.toString(16);
        if(blu_h.length == 1){blu_h = "0"+blu_h;}
        rgb_hex[i] ="#"+red_h+grn_h+blu_h;
    }
    document.write(rgb_hex)
    alert(rgb_hex)
}


/*  (c) M.Takahashi   http://jalk.sakura.ne.jp  */ 