function RandomSkinUrl(){
  try{
    var intSkipCount = 3;
    if( SkinList == undefined ){
      return undefined;
    }
    var ran = Math.floor(Math.random() * (SkinList.length-1) / intSkipCount-1);
    return SkinList[ran*intSkipCount+2];
  }catch(e){
    return undefined;
  }
}

function Name2SkinUrl(strSkinName){
  try{
    var intSkipCount = 3;
    if( SkinList == undefined ){
      return undefined;
    }
    intLimit = (SkinList.length-1) / intSkipCount;
    for( intLoopCount=1;intLoopCount<intLimit;intLoopCount++ ){
      if( strSkinName == SkinList[intLoopCount*intSkipCount+0] ){
        return SkinList[intLoopCount*intSkipCount+2];
      }
    }
  }catch(e){
    return undefined;
  }
}

function FlashPost(intSizeWidth,intSizeHeight,strFlashFile,strSkinName,strBgcolor){
  try{
    var strParam = "";
    var intLoopCount = 0;
    var intLimit = 0;
    var strSkinUrl="";
    /*
    try{
      if( SkinList == undefined ){
        setTimeout("FlashPost(\"" + intSizeWidth + "\",\"" + intSizeHeight + "\",\"" + strFlashFile + "\",\"" + strSkinName + "\",\"" + strBgcolor + "\")",1000);
        return;
      }else if( strSkinName == "Random" ){
        strSkinUrl=RandomSkinUrl();
      }else{
        strSkinUrl=Name2SkinUrl(strSkinName);
      }
      if( strSkinUrl == undefined ){
        setTimeout("FlashPost(\"" + intSizeWidth + "\",\"" + intSizeHeight + "\",\"" + strFlashFile + "\",\"" + strSkinName + "\",\"" + strBgcolor + "\")",1000);
        return;
      }
    }catch(e){
      setTimeout("FlashPost(\"" + intSizeWidth + "\",\"" + intSizeHeight + "\",\"" + strFlashFile + "\",\"" + strSkinName + "\",\"" + strBgcolor + "\")",1000);
      return;
    }
    */
    
    var strList = "";
    if( isNaN(intSizeWidth) ){
      strList += 'Skin Widthの指定が不正です\n';
    }else if( isNaN(intSizeHeight) ){
      strList += 'Skin Heightの指定が不正です\n';
    }else if( (intSizeWidth-0) > 200 ){
      strList += 'Skin Widthが大きすぎます\n';
    }else if( (intSizeHeight-0) > 200 ){
      strList += 'Skin Heightが大きすぎます\n';
    }else{
      /*
      if( strSkinUrl.indexOf(".xml") == -1 ){
        setTimeout("FlashPost(\"" + intSizeWidth + "\",\"" + intSizeHeight + "\",\"" + strFlashFile + "\",\"" + strSkinName + "\",\"" + strBgcolor + "\")",1000);
        return;
      }
      */
      
      var so = new SWFObject(strFlashFile, "samaple", intSizeWidth, intSizeHeight, "9,0,47,0", "#869ca7", true);
      so.addParam("allowScriptAccess", "sameDomain");
      so.addParam("wmode", "opaque");
      so.addParam("quality", "best");
      so.addParam("menu", "false");
      so.addParam('useExpressInstall', 'true');
      
      so.addVariable("SkinUrl", "http%3A%2F%2Fshk-tv.net%2FFlashSkins%2FFlash%2FSkin%2Finukko.swp");
      //so.addVariable("SkinUrl", strSkinUrl);
      if(strBgcolor!=""){
        if( strBgcolor.indexOf("0x") == -1 ){
          so.addVariable("bgColor", "0x" + strBgcolor);
        }else{
          so.addVariable("bgColor", strBgcolor);
        }
      }
      so.addVariable("Smooth", "false");
      so.addVariable("Save", "true");
      so.addVariable("SkinSave", "true");
      so.addVariable("Animation", "false");
      
      strList = so.getSWFHTML();
    }
    document.write(strList);
    
  }catch(e){
    alert(e.description);
  }
}