//名前空間の登録
Ext.namespace("buyersnet.movie");

/**
 * 画像クラス
 * 画像処理を行なうのに必要な関数を定義しています。
 */
buyersnet.movie = function(){
	
	/**
	 * ウィンドウサイズ (幅)
	 */
	var window_width  = 526;
	
	/**
	 * ウィンドウサイズ (高さ)
	 */
	var window_height = 460;
	
	/**
	 * 動画オブジェクト
	 */
	var movie;
	
	return {
		
		/**
		 * 動画を表示
		 * @param {string} src 動画パス
		 * @return 画像表示できたかどうか
		 */
		displayImage : function(src) {
			// 動画のパスが設定されていない。
			if (src == null || src == "") {
				return false;
			}
			
			if(movie == undefined) {
				//
			} else {
				movie = undefined;
			}
			
			movie = new String(src) 
			
			if (movie != null) {
				if (movie != src) {
					//
				} else {
					// 既に読み込み済み
					buyersnet.movie.createWindow();
					return true;
				}
			}
			
			// 画像ロード
			buyersnet.movie.createWindow();			
			return true;
		},
		
		/**
		 * ウィンドウの作成、HTML書き出し
		 */
		createWindow : function() {
			var pop_win = window.open("../../../common/popupMovie.html?newwindow=true", "", "width=" + window_width + ", height=" + window_height + ", scrollbars=no, resizable=no");
			pop_win.window.document.open();
			
			// HTMLを書き出す。
			var html = "";
			html += '<?xml version="1.0" encoding="UTF-8"?>';
			html += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
			html += '<html xmlns="http://www.w3.org/1999/xhtml" xmlns:te="http://www.seasar.org/teeda/extension">';
			html += '<head>';
			html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
			html += '<title>～TOCバイヤーズネット～</title>';
			html += '</head>';
			html += '<body style="margin:0;padding:0;border:0;">';
			html += '<table border="0" cellpadding="0" cellspacing="0" width="480" height="420">';
			html += '<tr valign="middle">';
			html += '<td align="center">';
			html += '<object type="application/x-shockwave-flash" data="../../../images/flash/player_flv_maxi.swf" width="526" height="460"> ';
			html += '<param name="movie" value="../../../images/flash/player_flv_maxi.swf" />';
			html += '<param name="allowFullScreen" value="true" />';
			html += '<param name="FlashVars" id="flvParam" value="' + movie + '" />';
			html += '</object>';
			html += '</td>';
			html += '</tr>';
			html += '</table>';
			html += '</body>';
			html += '</html>';
			pop_win.window.document.write(html);
			pop_win.window.document.close();
		}
	};
}();

