if (!window.tokyoace4) {
    tokyoace4 = {}
   
}
if (!window.tokyoace4.VideoPlayer) {

    /** VideoPlayer class definition. */
    tokyoace4.VideoPlayer = function(width, height, videoSrc) {
		
        if (width !== undefined && width != null) {
            this.swfWidth = width;
        } else {
            this.swfWidth = 450;
        }
        
        if (height !== undefined && height != null) {
            this.swfHeight = height;
        } else {
            this.swfHeight = 338;
        }
        
        if (videoSrc !== undefined && videoSrc != null) {
            this.videoSrc = videoSrc;
        } else {
            this.videoSrc = "";
        }
        
        this.objectID = "id"+Math.random()*10000;
        this.styleID = "sid"+Math.random()*10000;
        
        this.display();
       
    };

    /* Class variables */
    tokyoace4.VideoPlayer.swfWidth = 450;
    tokyoace4.VideoPlayer.swfHeight = 338;
    tokyoace4.VideoPlayer.videoSrc = "";
    tokyoace4.VideoPlayer.objectID = "";
    tokyoace4.VideoPlayer.styleID = "";
    tokyoace4.VideoPlayer.swfPath = "http://blog.tokyoace4.com/js/videoPlayer_blog.swf";

    tokyoace4.VideoPlayer.prototype = {
		getFlashVars : function() {
            var ret = 'videoWidth=' + this.swfWidth;
            ret += '&videoHeight=' + this.swfHeight;
            ret += '&srcUrl=' + this.videoSrc;
            return ret;
        },
        display : function() {
           
            var objectId = this.objectId;
            var flashVars = this.getFlashVars();
            var html = '<div id="' + this.styleID + '">';
            html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + this.swfWidth + '" height="'+ this.swfHeight+'" id="' + this.objectId + '">';
            html += '<param name="movie" value="' +  tokyoace4.VideoPlayer.swfPath + '" />';
            html += '<param name="quality" value="high" />';
            html += '<param name="FlashVars" value="' + flashVars + '" />';
            html += '<param name="allowScriptAccess" value="always" />';
            html += '<param name="wmode" value="Window" />';
            html += '<embed src="' +  tokyoace4.VideoPlayer.swfPath + '" width="' + this.swfWidth + '" height="' + this.swfHeight + '" quality="high" bgcolor="#000000" id="' + this.objectId +'" name="' + this.objectId + '" type="application/x-shockwave-flash" allowScriptAccess="always" FlashVars="' + flashVars + '" wmode="transparent" />';
            html += '</object>';
            html += '</div>';
            document.writeln(html);
        }
	};
}

