/**********************************************************************

  処理開始

**********************************************************************/

//ポップアップ用 flg 0:HTML 1:ビデオ 2:画像
var sw; var str; var Astr;
function pop(url, w, h, flg){
sw = 0; wi = 640; hi = 480;
if(!!window.screen){
ScreenWIDTH = screen.width;
} else {
ScreenWIDTH = 0;
}
if(!!window.screen){
ScreenHEIGHT = screen.height;
} else {
ScreenHEIGHT = 0;
}
if(w <= ScreenWIDTH){
Pwscr = (ScreenWIDTH - w) / 2;
} else {
sw = 1; w = wi;
}
if(h <= ScreenHEIGHT){
Phscr = (ScreenHEIGHT - h) / 2;
} else {
sw = 1; h = hi;
}
if(sw){
str = ",left=0,top=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes";
} else {
str = ",left=" + Pwscr + ",top=" + Phscr + ",screenX=0,screenY=0,scrollbars=no,resizable=no";
}
Astr = "width=" + w + ",height=" + h + str;
if (flg == 0) {
//HTML
subwin = window.open(url,'window1',Astr);
if(sw){ subwin.window.scrollTo(0, 0); }
} else if (flg == 1) {
//ビデオ
subwin = window.open('','',Astr);
subwin.document.open();
subwin.document.write( "<ht" + "ml><he" + "ad>\n");
subwin.document.write( "<title></title>\n");
subwin.document.write( "<style type='text/css'>\n");
subwin.document.write( "<!--\n");
subwin.document.write( "body { margin: 0px }\n");
subwin.document.write( "-->\n");
subwin.document.write( "</style>\n");
//「X」キーを押下時、ウィンドウをクローズ
subwin.document.write( "<script type='text/javascript'>\n");
subwin.document.write( "<!--\n");
subwin.document.write( "listenKey()\n");
subwin.document.write( "function getKey(e) {\n");
subwin.document.write( " if (e == null) { keycode = event.keyCode }\n");
subwin.document.write( " else { keycode = e.which }\n");
subwin.document.write( " key = String.fromCharCode(keycode).toLowerCase()\n");
subwin.document.write( " if (key == 'x') { window.close() }\n");
subwin.document.write( "}\n");
subwin.document.write( "function listenKey() {\n");
subwin.document.write( " document.onkeypress = getKey\n");
subwin.document.write( "}\n");
subwin.document.write( "//-->\n");
subwin.document.write( "</script>\n");
subwin.document.write( "</he" + "ad>\n");
subwin.document.write( "<body bgcolor='#000000' oncontextmenu='return false'>\n");
subwin.document.write( "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'>\n");
subwin.document.write( "<tr><td align='center'>\n");
//ビデオサイズ
subwin.document.write( "<object id='player' width='" + w + "' height='" + h + "' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'>\n");
//ビデオファイル
subwin.document.write( "<param name='URL' value='" + url + "'>\n");
//オートスタート
subwin.document.write( "<param name='autoStart' value='true'>\n");
//再生回数
subwin.document.write( "<param name='PlayCount' value='1'>\n");
//プレイメニュー表示
subwin.document.write( "<param name='enableContextMenu' value='false'>\n");
subwin.document.write( "<param name='uiMode' value='full'>\n");
subwin.document.write( "<param name='stretchToFit' value='false'>\n");
subwin.document.write( "<param name='windowlessvideo' value='false'>\n");
subwin.document.write( "</object>\n");
subwin.document.write( "</td></tr>\n");
subwin.document.write( "</table>\n");
subwin.document.write( "");
subwin.document.write( "</bo" + "dy></ht" + "ml>");
subwin.document.close();
} else {
//画像
subwin = window.open('','',Astr);
subwin.document.open();
subwin.document.write( "<ht" + "ml><he" + "ad>\n");
subwin.document.write( "<meta http-equiv='imagetoolbar' content='no'>\n");
subwin.document.write( "<title></title>\n");
subwin.document.write( "<style type='text/css'>\n");
subwin.document.write( "<!--\n");
subwin.document.write( "body { margin: 0px }\n");
subwin.document.write( "-->\n");
subwin.document.write( "</style>\n");
//「X」キーを押下時、ウィンドウをクローズ
subwin.document.write( "<script type='text/javascript'>\n");
subwin.document.write( "<!--\n");
subwin.document.write( "listenKey()\n");
subwin.document.write( "function getKey(e) {\n");
subwin.document.write( " if (e == null) { keycode = event.keyCode }\n");
subwin.document.write( " else { keycode = e.which }\n");
subwin.document.write( " key = String.fromCharCode(keycode).toLowerCase()\n");
subwin.document.write( " if (key == 'x') { window.close() }\n");
subwin.document.write( "}\n");
subwin.document.write( "function listenKey() {\n");
subwin.document.write( " document.onkeypress = getKey\n");
subwin.document.write( "}\n");
subwin.document.write( "//-->\n");
subwin.document.write( "</script>\n");
subwin.document.write( "</he" + "ad>\n");
subwin.document.write( "<body bgcolor='#000000' oncontextmenu='return false'>\n");
subwin.document.write( "<center>\n");
subwin.document.write( "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'>\n");
subwin.document.write( "<tr>\n");
subwin.document.write( "<td align='center'><img src='" + url + "' width='" + w + "' height='" + h + "' border='0' onClick='window.close()' alt='クリックすると閉じます'></td>\n");
subwin.document.write( "</tr>\n");
subwin.document.write( "</table>\n");
subwin.document.write( "</center>\n");
subwin.document.write( "");
subwin.document.write( "</bo" + "dy></ht" + "ml>");
subwin.document.close();
}
}

//編集補助（ビデオサイズ：320x240）
function SetChar(strNum) {
var strMsg;
if (strNum == 'video') {
strNum = '\x0d<a href="JavaScript:pop(' + "'/diary/video/********.wmv','600','450','1')" + '" title="ビデオ再生">ビデオ再生</a>';
}
valMsg = document.set.text.value;
strMsg = valMsg + strNum;
document.set.text.value=strMsg;
}
