  var max = 500;            
  var cout = new Array(max); 
  var str = new Array(max);  
  var ostr = new Array(max); 
  var modes = new Array(max); 
  var scalex    = new Array(max);
  var scaley    = new Array(max);
  var scalez    = new Array(max);
  var rotx      = new Array(max);
  var roty      = new Array(max);
  var rotz      = new Array(max);
  var rotr      = new Array(max);
  var trax      = new Array(max);
  var tray      = new Array(max);
  var traz      = new Array(max);
  var dcolred   = new Array(max);
  var dcolgreen = new Array(max);
  var dcolblue  = new Array(max);
  var scolred   = new Array(max);
  var scolgreen = new Array(max);
  var scolblue  = new Array(max);
  var ecolred   = new Array(max);
  var ecolgreen = new Array(max);
  var ecolblue  = new Array(max);
  var shine     = new Array(max);
  var trapar    = new Array(max);
  var texscx    = new Array(max);
  var texscy    = new Array(max);
  var imgnode   = new Array(max);
  var obottom   = new Array(max);
  var otop      = new Array(max);
  var textin    = new Array(max);
  var soudurl   = new Array(max);
  var linkurl   = new Array(max);
  var link      = new Array(max);
  var urlin     = new Array(max);
  var colls     = new Array(max);
function Begin(){
  for ( i=0; i <= max; i++ ){
    DeleteHen(i);
  }}
function SourceCode(wrlcr){
  for ( i=0; i <= max; i++ ){
    if ( cout[i] == "1" ){
      if ( modes[i] == "box" ){
        ostr[i]='Shape { geometry Box {} \
                        appearance Appearance { material Material { diffuseColor ' +dcolred[i]+ ' ' +dcolgreen[i]+ ' ' +dcolblue[i]+ ' \
                                                                    specularColor ' +scolred[i]+ ' ' +scolgreen[i]+ ' ' +scolblue[i]+ ' \
                                                                    shininess ' +shine[i]+ '\
                                                                    transparency ' +trapar[i]+ '\
                                                                    emissiveColor ' +ecolred[i]+ ' ' +ecolgreen[i]+ ' ' +ecolblue[i]+ ' \
                                                                  } \
                                               texture ' +imgnode[i]+ ' \
                                               textureTransform TextureTransform { scale ' +texscx[i]+ ' '  +texscy[i]+ ' } \
                                              }\
                       }';


     }
    if ( modes[i] == "cylinder" ){

      ostr[i]='Shape { geometry Cylinder{ top ' +otop[i]+ ' bottom ' +obottom[i]+ ' side TRUE } \
                      appearance Appearance { material Material { diffuseColor ' +dcolred[i]+ ' ' +dcolgreen[i]+ ' ' +dcolblue[i]+ ' \
                                                                  specularColor ' +scolred[i]+ ' ' +scolgreen[i]+ ' ' +scolblue[i]+ ' \
                                                                  emissiveColor ' +ecolred[i]+ ' ' +ecolgreen[i]+ ' ' +ecolblue[i]+ ' \
                                                                  shininess ' +shine[i]+ ' \
                                                                  transparency ' +trapar[i]+ ' \
                                                                 } \
                                              texture ' +imgnode[i]+ ' textureTransform TextureTransform { scale ' +texscx[i]+ ' ' +texscy[i]+ ' } \
                                            } \
                    }';
   }

    if ( modes[i] == "sphere" ){

       ostr[i]='Shape { geometry Sphere {} \
                        appearance Appearance { material Material { diffuseColor ' +dcolred[i]+ ' ' +dcolgreen[i]+ ' ' +dcolblue[i]+ ' \
                                                                    specularColor ' +scolred[i]+ ' ' +scolgreen[i]+ ' ' +scolblue[i]+ ' \
                                                                    shininess ' +shine[i]+ '\
                                                                    transparency ' +trapar[i]+ '\
                                                                    emissiveColor ' +ecolred[i]+ ' ' +ecolgreen[i]+ ' ' +ecolblue[i]+ ' \
                                                                  } \
                                               texture ' +imgnode[i]+ ' \
                                               textureTransform TextureTransform { scale ' +texscx[i]+ ' '  +texscy[i]+ ' } \
                                              }\
                       }';

    }
    if ( modes[i] == "cone" ){

      ostr[i]='Shape { geometry Cone { bottom ' +obottom[i]+ ' side TRUE } \
                      appearance Appearance { material Material { diffuseColor ' +dcolred[i]+ ' ' +dcolgreen[i]+ ' ' +dcolblue[i]+ ' \
                                                                  specularColor ' +scolred[i]+ ' ' +scolgreen[i]+ ' ' +scolblue[i]+ ' \
                                                                  emissiveColor ' +ecolred[i]+ ' ' +ecolgreen[i]+ ' ' +ecolblue[i]+ ' \
                                                                  shininess ' +shine[i]+ ' \
                                                                  transparency ' +trapar[i]+ ' \
                                                                 } \
                                              texture ' +imgnode[i]+ ' textureTransform TextureTransform { scale ' +texscx[i]+ ' ' +texscy[i]+ ' } \
                                            } \
                    }';


   }
    if ( modes[i] == "inl" ){ 

      ostr[i]='Inline { url "' +urlin[i]+ '" }'; 

    }
   if ( modes[i] == "text" ){

     ostr[i]='Shape { geometry Text { string "' +textin[i]+ '" } \
                      appearance Appearance { material Material { diffuseColor ' +dcolred[i]+ ' ' +dcolgreen[i]+ ' ' +dcolblue[i]+ ' \
                                                                  specularColor ' +scolred[i]+ ' ' +scolgreen[i]+ ' ' +scolblue[i]+ ' \
                                                                  shininess ' +shine[i]+ '\
                                                                  transparency ' +trapar[i]+ '\
                                                                  emissiveColor ' +ecolred[i]+ ' ' +ecolgreen[i]+ ' ' +ecolblue[i]+ ' \
                                                                } \
                                              texture ' +imgnode[i]+ ' \
                                              textureTransform TextureTransform { scale ' +texscx[i]+ ' '  +texscy[i]+ ' } \
                                           }\
                  }';

   }
   if ( modes[i] == "sound" ){

     ostr[i]='Sound { source AudioClip { loop TRUE  url "' +soudurl[i]+ '"  stopTime -1 } direction 0 0 1 maxFront 50 maxBack 50 minFront 20 minBack 20  } \
              Shape { geometry Sphere { radius 0.05 } \
                      appearance Appearance { material Material { diffuseColor 0.66 0.81 0.92 specularColor 1 1 1 shininess 0.4 }} \
                    }';

   }
   if ( modes[i] == "proto" ){

     ostr[i]='EXTERNPROTO Proto' +i+ ' [ \
                eventIn MFString set_Pimgurl \
                eventIn SFVec2f  set_Ptexsc \
                eventIn SFColor  set_Pdcol \
                eventIn SFColor  set_Pecol \
                eventIn SFFloat  set_Pshine \
                eventIn SFColor  set_Pscol \
                eventIn SFFloat  set_Ptrapar \
              ] "' +urlin[i]+ '" \
              Proto' +i+ '{ set_Pimgurl "' +imgnode[i]+ '" \
                            set_Ptexsc '+texscx[i]+' '+texscy[i]+' \
                            set_Pdcol '+dcolred[i]+' '+dcolgreen[i]+' '+dcolblue[i]+' \
                            set_Pecol '+ecolred[i]+' '+ecolgreen[i]+' '+ecolblue[i]+' \
                            set_Pshine '+shine[i]+' \
                            set_Pscol '+scolred[i]+' '+scolgreen[i]+' '+scolblue[i]+' \
                            set_Ptrapar '+trapar[i]+ ' }';

   }

  }

  else { ostr[i]=''; }

 }

 GetTra(wrlcr);

}
function GetTra(wrlcr){

  for ( i=0; i <= max; i++ ){

    if ( cout[i] == 1 ) {

      if ( link[i] == 1 ) {

        ostr[i]='Transform { children [ \
                                              Anchor { children [ ' +ostr[i]+ ' ] \
                                                      parameter ["target=_blank"] url  "' +linkurl[i]+ '" \
                                            } ' +ostr[i]+ ' ] center 0 0 0 \
                            translation ' +trax[i]+ ' ' +tray[i]+ ' ' +traz[i]+ ' \
                            rotation ' +rotx[i]+ ' ' +roty[i]+ ' ' +rotz[i]+ ' ' +rotr[i]+ ' \
                            scale ' +scalex[i]+ ' ' +scaley[i]+ ' ' +scalez[i]+ '  }';


     }

     else if ( link[i] != 1 ) {

       ostr[i]='Transform { children [ ' +ostr[i]+ ' ] \
                            translation ' +trax[i]+ ' ' +tray[i]+ ' ' +traz[i]+ ' \
                            rotation ' +rotx[i]+ ' ' +roty[i]+ ' ' +rotz[i]+ ' ' +rotr[i]+ ' \
                            scale ' +scalex[i]+ ' ' +scaley[i]+ ' ' +scalez[i]+ '  }';
     }

   }
  }

 OutSource(wrlcr);

}
function OutSource(wrlcr){

  if ( wrlcr == "cr" ) {
    win1 = window.open('','newwin','');
    win1.document.write("WorldInfo { title \"espace.cr\" info [ \"espace factory\" ] }<BR>");
    win1.document.write("NavigationInfo { headlight FALSE  type \"WALK\" wallTrace TRUE collisionDetection \"BOUND\" speed 3 avatarSize 1}<BR>");
    win1.document.write("Cell { description \"空間名\" size 1000 50 1000 }<BR>");
    win1.document.write("Viewpoint { position 0 2 -5 fieldOfView 1.275 description \"Camera\" }<BR>");
    win1.document.write("Background { skyColor  [ 0.3 0.5 0.9 ]  }<BR>");
    win1.document.write("PointLight { ambientIntensity 0.3 color 1.0 1.0 0.8 intensity 0.0 }<BR>");
    win1.document.write("DirectionalLight { color 1.0 1.0 1.0 direction 0.0 -0.6 -0.8 intensity 0.6 }<BR>");
    win1.document.write("DirectionalLight { color 1.0 1.0 1.0 direction -0.7 -0.6 0.4 intensity 0.6 }<BR>");
    win1.document.write("DirectionalLight { color 1.0 1.0 1.0 direction 0.7 -0.6 0.4 intensity 0.6 }<BR>");
    win1.document.write("DirectionalLight { color 1.0 1.0 1.0 direction 0.0 1.0 0.0 intensity 0.5 }<BR>");
    win1.document.write("DEF avatarLayer Transform { children [] }<BR>");
    win1.document.write("#############################################この上まで基本設定<BR><BR>");

    for ( i=0; i <= max; i++ ){
      if ( colls[i] == 1 ){
        win1.document.write("Collision { collide TRUE children [ "+ostr[i]+" ]}<BR>");  
      }
      else { win1.document.write(ostr[i]+"<BR>"); }
    }

  }

  else if ( wrlcr == "wrl" ) {
    win1 = window.open('','newwin','');
    win1.document.write("#VRML V2.0 utf8 <BR><BR>");
    win1.document.write("Viewpoint { position 0 0 0 }<BR>");
    win1.document.write("Background { skyColor  [ 0.3 0.5 0.9 ]  }<BR>");

    for ( i=0; i <= max; i++ ){
      if ( colls[i] == 1 ){
        win1.document.write("Collision { collide TRUE children [ "+ostr[i]+" ]}<BR>");  
      }
      else { win1.document.write(ostr[i]+"<BR>"); } 
    }
  }

win1.document.close();

}
function CheckObj(mode,num) {

  if ( num > max ){
   alert("The maximum value of the number is up to " +max+ ".");
  }

  else if ( cout[num] == 1 ){
    res = confirm("The object already exists in this number.Do you replace it?");
    if ( res == true ) { DeleteObj(num); CreateObj(mode,num); }
    else {}
  }

  else { CreateObj(mode,num); }

}
function CreateObj(mode,num) {
  if ( mode == "box" ){

   cout[num] = 1; 

   if ( document.F1.imagechk.checked == true ) {
     imgurl  = document.F1.ImgTex.value; 
     imgnode[num] = 'ImageTexture { url "' +imgurl+ '" }';
   }
   else { 
     imgurl = ""; 
     imgnode[num] = "ImageTexture { url \"\"}"; 
   }

   str[num]='\
     Shape { geometry Box {}\
             appearance Appearance { material DEF mat' +num+ ' Material { }\
                                     texture ' +imgnode[num]+ ' \
                                     textureTransform DEF textra' +num+ ' TextureTransform { }\
                                   }\
     }';
  }
  else if ( mode == "sphere" ){

   cout[num] = 1; 

   if ( document.F1.imagechk.checked == true ) {
     imgurl  = document.F1.ImgTex.value; 
     imgnode[num] = 'ImageTexture { url "' +imgurl+ '" }';
   }
   else { 
     imgurl=""; 
     imgnode[num] = "ImageTexture { url \"\" }"; 
   }
   str[num]='\
     Shape { geometry Sphere {}\
             appearance Appearance { material DEF mat' +num+ ' Material { }\
                                     texture ' +imgnode[num]+ '\
                                     textureTransform DEF textra' +num+ ' TextureTransform { }\
                                   }\
     }';
  }
 else if ( mode == "cylinder" ){

    cout[num] = 1; 
    obottom[num] = ( document.F1.Bottom.checked == true ) ? "TRUE" : "FALSE";
    otop[num] = ( document.F1.Top.checked == true ) ? "TRUE" : "FALSE";

   if ( document.F1.imagechk.checked == true ) {
     imgurl  = document.F1.ImgTex.value; 
     imgnode[num] = 'ImageTexture { url "' +imgurl+ '" }';
   }
   else { 
     imgurl=""; 
     imgnode[num] = "ImageTexture { url \"\"}"; 
   }
    str[num]='\
      Shape { geometry Cylinder { top ' +otop[num]+ ' bottom ' +obottom[num]+ ' side TRUE }\
              appearance Appearance { material DEF mat' +num+ ' Material { }\
                                      texture ' +imgnode[num]+ '\
                                      textureTransform DEF textra' +num+ ' TextureTransform { }\
                                    }\
      }';
  }
  else if ( mode == "cone" ){

    cout[num] = 1;  
    obottom[num] = ( document.F1.Bottom.checked == true ) ? "TRUE" : "FALSE";

   if ( document.F1.imagechk.checked == true ) {
     imgurl  = document.F1.ImgTex.value; 
     imgnode[num] = 'ImageTexture { url "' +imgurl+ '" }';
   }
   else { 
     imgurl=""; 
     imgnode[num] = "ImageTexture { url \"\"}"; 
   }
   str[num]='\
     Shape { geometry Cone { bottom ' +obottom[num]+ ' side TRUE }\
             appearance Appearance { material DEF mat' +num+ ' Material {}\
                                     texture ' +imgnode[num]+ '\
                                     textureTransform DEF textra' +num+ ' TextureTransform {}\
                                   }\
     }';
  }
  else if ( mode == "inl" ){
 
    cout[num] = 1;

    urlin[num] = document.F1.UrlIn2.value;
    str[num]='Inline { url "' +urlin[num]+ '" }'; 

  }
  else if ( mode == "text" ){

    cout[num] = 1;
    textin[num] = document.F1.TextIn.value;

   if ( document.F1.imagechk.checked == true ) {
     imgurl  = document.F1.ImgTex.value; 
     imgnode[num] = 'ImageTexture { url "' +imgurl+ '" }';
   }
   else { 
     imgurl=""; 
     imgnode[num] = "ImageTexture { url \"\" }"; 
   }


    str[num]='\
      Shape { geometry Text { string "' +textin[num]+ '" }\
              appearance Appearance { material DEF mat' +num+ ' Material {}\
                                      texture ' +imgnode[num]+ '\
                                      textureTransform DEF textra' +num+ ' TextureTransform {}\
                                    }\
      }';
  }

  LastAdd(mode,num);


}
function LastAdd(mode,num){

  if ( document.F1.linkchk.checked == true ){

    linkurl[num] = document.F1.LinkUrl.value;

    str[num] = 'DEF tra' +num+ ' Transform { children [ \
                   LOD { range [ 10, 10 ] \
                         level [  Anchor { children [ ' +str[num]+ ' ] parameter ["target=_blank"] url  "' +linkurl[num]+ '"  } \
                                  ' +str[num]+ ' \
                               ] \
                         center 0 0 0 \
                       } \
                  ] \
    }'

    link[num] = 1;

  }

  else {

    str[num] = 'DEF tra' +num+ ' Transform { children [ ' +str[num]+ ' ] }';
    link[num] = "";

  }

  modes[num] = mode;
  if ( document.F1.collschk.checked == true ){ colls[num] = 1; }

  vrml=parent.frame1.Cortona.Engine.CreateVrmlFromString(str[num]);
  parent.frame1.Cortona.Engine.RootNodes.Add(vrml); 

  HenToForm(num);  

}
  function DeleteCheck(num){

    res = confirm("Delete this object？");
    if ( res == true ) { DeleteObj(num); }
    else {}

  }
  function DeleteObj(num) {

    parent.frame1.Cortona.Engine.RootNodes.Remove('tra'+num);
    DeleteHen(num);
    alert(+num+" object was deleted.");

  }
  function DeleteHen(num){

    cout[num] = "";
    str[num] = "";
    ostr[num] = "";
    modes[num] = "";
    scalex[num] = "";
    scaley[num] = ""; 
    scalez[num] = "";
    rotx[num]   = "";
    roty[num]   = "";
    rotz[num]   = "";
    rotr[num]   = "";
    trax[num]   = "";
    tray[num]   = "";
    traz[num]   = "";
    dcolred[num]   = "";
    dcolgreen[num] = "";
    dcolblue[num]  = "";
    scolred[num]   = "";
    scolgreen[num] = "";
    scolblue[num]  = "";
    ecolred[num]   = "";
    ecolgreen[num] = "";
    ecolblue[num]  = "";
    shine[num]  = "";
    trapar[num] = "";
    texscx[num] = "";
    texscy[num] = "";
    imgnode[num] = "";
    obottom[num] = "";
    otop[num]      = "";
    textin[num]    = "";
    soudurl[num]   = "";
    linkurl[num]   = "";
    link[num]      = "";
    urlin[num]       = "";
    colls[num]	= 0;

  //  GetDef();

  }
  function HenToForm(num){
    scalex[num] = document.F2.ScaleX.value;
    scaley[num] = document.F2.ScaleY.value;
    scalez[num] = document.F2.ScaleZ.value;
    rotx[num] = document.F2.RotX.value;
    roty[num] = document.F2.RotY.value;
    rotz[num] = document.F2.RotZ.value;
    rotr[num] = document.F2.RotR.value;
    trax[num] = document.F2.TraX.value;
    tray[num] = document.F2.TraY.value;
    traz[num] = document.F2.TraZ.value;
    dcolred[num] = document.F2.DRed.value;
    dcolgreen[num] = document.F2.DGreen.value;
    dcolblue[num] = document.F2.DBlue.value;
    scolred[num] = document.F2.SRed.value;
    scolgreen[num] = document.F2.SGreen.value;
    scolblue[num] = document.F2.SBlue.value;
    ecolred[num] = document.F2.ERed.value;
    ecolgreen[num] = document.F2.EGreen.value;
    ecolblue[num] = document.F2.EBlue.value;
    shine[num] = document.F2.Shine.value;
    trapar[num] = document.F2.Trapar.value;
    texscx[num] = document.F2.TexscX.value;
    texscy[num] = document.F2.TexscY.value;

  BrawserToHen(num);

  }
  function BrawserToHen(num){
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('scale').x = scalex[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('scale').y = scaley[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('scale').z = scalez[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('rotation').x = rotx[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('rotation').y = roty[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('rotation').z = rotz[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('rotation').angle = rotr[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').x = trax[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').y = tray[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').z = traz[num];

    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('diffuseColor').Red = dcolred[num];
    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('diffuseColor').Green = dcolgreen[num];
    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('diffuseColor').Blue = dcolblue[num];

    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('specularColor').Red = scolred[num];
    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('specularColor').Green = scolgreen[num];
    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('specularColor').Blue = scolblue[num];
    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('emissiveColor').Red = ecolred[num];
    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('emissiveColor').Green = ecolgreen[num];
    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('emissiveColor').Blue = ecolblue[num];
    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('shininess') = shine[num];

    parent.frame1.Cortona.Engine.Nodes('mat'+num).Fields('transparency') = trapar[num];
 
    parent.frame1.Cortona.Engine.Nodes('textra'+num).Fields('scale').x = texscx[num];
    parent.frame1.Cortona.Engine.Nodes('textra'+num).Fields('scale').y = texscy[num];
 


  }
function GetField(num){
    document.F2.ScaleX.value = scalex[num];
    document.F2.ScaleY.value = scaley[num]; 
    document.F2.ScaleZ.value = scalez[num];


    document.F2.RotX.value = rotx[num];
    document.F2.RotY.value = roty[num];
    document.F2.RotZ.value = rotz[num];
    document.F2.RotR.value = rotr[num];


    document.F2.TraX.value = trax[num];
    document.F2.TraY.value = tray[num];
    document.F2.TraZ.value = traz[num];
    document.F2.DRed.value = dcolred[num];
    document.F2.DGreen.value = dcolgreen[num];
    document.F2.DBlue.value = dcolblue[num];


    document.F2.SRed.value = scolred[num];
    document.F2.SGreen.value = scolgreen[num];
    document.F2.SBlue.value = scolblue[num];
    document.F2.ERed.value = ecolred[num];
    document.F2.EGreen.value = ecolgreen[num];
    document.F2.EBlue.value = ecolblue[num];


    document.F2.Shine.value = shine[num];


    document.F2.Trapar.value = trapar[num];
    document.F2.TexscX.value = texscx[num];
    document.F2.TexscY.value = texscy[num];


  }
   function GetDef(){


    document.F2.ScaleX.value = 1;
    document.F2.ScaleY.value = 1; 
    document.F2.ScaleZ.value = 1;
    document.F2.RotX.value = 0;
    document.F2.RotY.value = 0;
    document.F2.RotZ.value = 0;
    document.F2.RotR.value = 0;
    document.F2.TraX.value = 0;
    document.F2.TraY.value = 0;
    document.F2.TraZ.value = 0;
    document.F2.DRed.value = 1;
    document.F2.DGreen.value = 1;
    document.F2.DBlue.value = 1;
    document.F2.SRed.value = 0;
    document.F2.SGreen.value = 0;
    document.F2.SBlue.value = 0;
    document.F2.ERed.value = 0;
    document.F2.EGreen.value = 0;
    document.F2.EBlue.value = 0;


    document.F2.Shine.value = 0;
    document.F2.Trapar.value = 0;
    document.F2.TexscX.value = 1;
    document.F2.TexscY.value = 1;

  }
  function ChangeObjCheck(num){

    if ( cout[num] == 1 ){ HenToForm(num); }

    else { alert("物体が存在しません。"); }

  }
  function SelectObjCheck(num){

    if ( cout[num] == 1 ){  SelectObj1(num); }

    else { alert("物体が存在しません。"); }

  }

  function SelectObj1(num){

      parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('scale').x = eval(scalex[num])*1.2;
      parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('scale').y = eval(scaley[num])*1.2;
      parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('scale').z = eval(scalez[num])*1.2;
      setTimeout("SelectObj2("+num+")",1000);

  }

  function SelectObj2(num){

    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('scale').x = scalex[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('scale').y = scaley[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('scale').z = scalez[num];

    GetField(num);

  }
  function ObjContCheck1(num,key){

    if ( cout[num] == 1 ){ ObjCont1(num,key); }

    else { alert("物体が存在しません。"); }

  }

  function ObjCont1(num,key){

      movsp = document.F3.MovSp.value;

      if ( document.F3.MovSpXZ.checked == true ) {
        if      ( key == "a" ){ tz = eval(traz[num]) - eval(movsp); parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').z = tz; traz[num]=tz; }
        else if ( key == "b" ){ tx = eval(trax[num]) - eval(movsp); parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').x = tx; trax[num]=tx; }
        else if ( key == "c" ){ tx = eval(trax[num]) + eval(movsp); parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').x = tx; trax[num]=tx; }
        else if ( key == "d" ){ tz = eval(traz[num]) + eval(movsp); parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').z = tz; traz[num]=tz; }
      }

      else if ( document.F3.MovSpXY.checked == true ){
        if      ( key == "a" ){ ty = eval(tray[num]) + eval(movsp); parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').y = ty; tray[num]=ty; }
        else if ( key == "b" ){ tx = eval(trax[num]) - eval(movsp); parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').x = tx; trax[num]=tx; }
        else if ( key == "c" ){ tx = eval(trax[num]) + eval(movsp); parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').x = tx; trax[num]=tx; }
        else if ( key == "d" ){ ty = eval(tray[num]) - eval(movsp); parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('translation').y = ty; tray[num]=ty; }
      }
  
   GetField(num);

   }


  function ObjContCheck2(num){

    if ( cout[num] == 1 ){ ObjCont2(num); }

    else { alert("物体が存在しません。"); }

  }


  function ObjCont2(num){

    rx = document.F3.RotSpX.checked;
    ry = document.F3.RotSpY.checked;
    rz = document.F3.RotSpZ.checked;
    rr = document.F3.RotSpR.value;

    rotx[num] = ( rx == true ) ? 1 : 0;
    roty[num] = ( ry == true ) ? 1 : 0;
    rotz[num] = ( rz == true ) ? 1 : 0;
    r = eval(rotr[num]) + eval(rr) ;

    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('rotation').x      = rotx[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('rotation').y      = roty[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('rotation').z      = rotz[num];
    parent.frame1.Cortona.Engine.Nodes('tra'+num).Fields('rotation').angle  = r;

    rotr[num] = r;

    GetField(num);
    
  }


  function OpenTex(){

   var win1 = window.open('./Texture.html','texwin','');
    
  }

  function OpenObj(list){

   if ( list == "Field" ){ var win1 = window.open('./cgi-bin/Field_sl.cgi','texwin2',''); }
   else if ( list == "Build" ){ var win1 = window.open('./cgi-bin/Build_sl.cgi','texwin2',''); }
   else if ( list == "Garden" ){ var win1 = window.open('./cgi-bin/Garden_sl.cgi','texwin2',''); }
   else if ( list == "Interier" ){ var win1 = window.open('./cgi-bin/Interier_sl.cgi','texwin2',''); }
   else if ( list == "Light" ){ var win1 = window.open('./cgi-bin/Light_sl.cgi','texwin2',''); }
   else if ( list == "Tree" ){ var win1 = window.open('./cgi-bin/Tree_sl.cgi','texwin2',''); }
   else if ( list == "Chara" ){ var win1 = window.open('./cgi-bin/Chara_sl.cgi','texwin2',''); }
   else if ( list == "Other" ){ var win1 = window.open('./cgi-bin/Other_sl.cgi','texwin2',''); }
   else { alert("想定外のエラー"); }
    
  }

  function OpenPrt(){

   var win1 = window.open('./Prtform.html','texwin3','');
    
  }
