function movieSet(vid, num) {
  var host = "http://pb1.m-telebee.jp";
  var width = 320;
  var height= 240;
  var html;

  var s1 = new SWFObject(host + '/loadplayer/player.swf','mpl', width, height,'7', '#000000');
  s1.addParam('allowfullscreen','true');
  s1.addParam('allowscriptaccess','always');
  s1.addVariable('file','http://pb1.m-telebee.jp/loadplayer/readdir_playlist.php?vid=' + vid);
  s1.addVariable('backcolor','0xFFFFFF');
  s1.addVariable('frontcolor','0x000000');
  s1.addVariable('largecontrols','false');
  s1.addVariable('showdigits','true');
  s1.addVariable('displayheight',height);
  s1.addVariable('width',width);
  s1.addVariable('height',height);
  s1.addVariable('vmode','1');
  s1.addVariable('inti_volume','50');
  s1.addVariable('p_mode','auto');
  s1.addVariable('quality','high');
  s1.addVariable('bgcolor','0x000000');
  s1.addVariable('bg_color','aaaaaa');
  s1.write('movieArea');

  mainBodySet(num);
  mainBodyTitleSet(num);
}

function mainBodySet(num) {
  var txt = eval("mainBodyText" + num);

  var obj = document.getElementById('mainBody');
  obj.innerHTML = txt;
}

function mainBodyTitleSet(num) {
  var ttl = eval("mainBodyTitle" + num);

  var obj = document.getElementById('mainBodyTitle');
  obj.innerHTML = ttl;
}

function URLencode(str){
// Unicode to URL encoded UTF-8
var i, encoded_str, char_code, padded_str;
encoded_str = "";
for (i = 0; i < str.length; i++){
  char_code = str.charCodeAt(i);
  if(char_code == 0x20){
    // space -> "+"
    encoded_str += "+";
  } else { // else 1
    if(((0x30 <= char_code) && (char_code <= 0x39)) || ((0x41 <= char_code) && (char_code <= 0x5a)) 
      || ((0x61 <= char_code) && (char_code <= 0x7a))){
      // [0-9a-z-A-Z]
      // no escape
      encoded_str += str.charAt(i);
    } else if((char_code == 0x2a) || (char_code == 0x2e) || (char_code == 0x2d) || (char_code == 0x5f)) {
      // [.-_]
      // no escape
      encoded_str += str.charAt(i);
    } else { // else 2
      // for internal unicode to UTF-8
      if( char_code > 0xffff ) {
        encoded_str += "%" + ((char_code >> 18) | 0xf0).toString(16).toUpperCase();
        encoded_str += "%" + (((char_code >> 12) & 0x3f) | 0x80).toString(16).toUpperCase();
        encoded_str += "%" + (((char_code >> 6) & 0x3f) | 0x80).toString(16).toUpperCase();
        encoded_str += "%" + ((char_code & 0x3f) | 0x80).toString(16).toUpperCase();
      } else if( char_code > 0x7ff ) {
        encoded_str += "%" + ((char_code >> 12) | 0xe0).toString(16).toUpperCase();
        encoded_str += "%" + (((char_code >> 6) & 0x3f) | 0x80).toString(16).toUpperCase();
        encoded_str += "%" + ((char_code & 0x3f) | 0x80).toString(16).toUpperCase();
      } else if( char_code > 0x7f ) {
        encoded_str += "%" + (((char_code >> 6) & 0x1f) | 0xc0).toString(16).toUpperCase();
        encoded_str += "%" + ((char_code & 0x3f) | 0x80).toString(16).toUpperCase();
      } else {
        // for ascii
        padded_str = "0" + char_code.toString(16).toUpperCase();
        encoded_str += "%" + padded_str.substr(padded_str.length - 2, 2);
      }
    } // else 2
  } // else 1
} // for
return encoded_str;
}

