function CopyClip( strName ) {

	var objTarget;
	var objPre;
	var range;

	objTarget = document.getElementById( strName );
	objPre = objTarget.getElementsByTagName( "PRE" );

	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		window.clipboardData.setData(
			 "Text", objPre[0].innerText + "\n"
		);
	}
	else {
		if ( getFlashVarsion() <= 6 ) {
			alert("Flash のバージョン7以上が必要です");
			return;
		}
		range = document.createRange();
		range.selectNode( objPre.item(0) );
		setClipboard( range.toString() );
	}

	try {
		top.window.status = strName + " をクリップボードへコピーしました";
	}
	catch( e ) {
		alert( strName + " をクリップボードへコピーしました　　　" );
	}
}

function setClipboard( strValue ) {

	var obj;

	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		obj = document.getElementById("flash1");
	}
	else {
		obj = document.getElementById("flash2");
	}

	obj.SetVariable("commandType", "setClipboard");
	obj.SetVariable("paramValue", strValue );
	obj.Play();

}

function getFlashVarsion() {

   var objFlash,i;
   var description,flashPlugin;

   if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
      for( i = 10; i >= 5; i-- ) {
         try {
            objFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i );
            break;
         }
         catch( e ) {
            if ( i == 5 ) {
               i = 0;
               break;
            }
         }
      }
   }
   else {
      i = 0;
      if ( navigator.plugins && navigator.plugins.length > 0) {
         flashPlugin = navigator.plugins['Shockwave Flash'];
         if (typeof flashPlugin == 'object') {
            description = flashPlugin.description;
            for( i = 10; i > 4; i-- ) {
               if (description.indexOf(i+'.') != -1) {
                  break;
               }
            }
            if ( i == 4 ) {
               i = 0;
            }
         }
      }
   }

   return i;

}

