3
* author: Anthony Dillon
6
function MoviePlayerSystem($parent){
11
var maximised = false;
13
var movieURL = 'videos/iStock.flv';
15
this.init = function(){
19
this.setupControl = function(){
20
$('#movieplayer .control .close').click(function(){
23
$('#movieplayer .control .min').click(function(){
27
$('#movieplayer .control .max').click(function(){
30
$('#movieplayer').css('width','700px');
31
$('#movieplayer').css('height','497px');
32
$('#movieplayer').removeClass('fullsize');
33
_parent.systemSettings.decreaseFullscreen();
36
$('#movieplayer').css('width',$(document).width() - 70 + 'px');
37
$('#movieplayer').css('height',$(document).height() - 50 + 'px');
38
$('#movieplayer').addClass('fullsize');
39
_parent.systemSettings.increaseFullscreen();
43
$('#movieplayer .container .tools .controlbuttons .left .play').click(function(){
48
this.addVideo = function(){
49
var videoObject = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+$('#movieplayer .container .video').width()+'" height="'+$('#movieplayer .container .video').height()+'" id="videoPlayer"><param name="movie" value="../videoplayer.swf" /> <param name="wmode" value="transparent" /> <param name="quality" value="high" /> <param name="bgcolor" value="#000000" /> <embed wmode="transparent" src="../videoplayer.swf" quality="high" bgcolor="#000000" width="'+$('#movieplayer .container .video').width()+'" height="'+$('#movieplayer .container .video').height()+'" name="videoPlayer" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed></object>';
50
$('#movieplayer .container .video').html(videoObject);
53
this.removeVideo = function(){
54
$('#movieplayer .container .video').html('');
57
this.open = function($playvideo){
61
$('#movieplayer').show();
63
$('#movieplayer').mousedown();
64
_parent.systemMenu.openWindow('movieplayer');
66
if($('css3-container').length > 0){
67
$('#movieplayer').prev().css('top', $('#movieplayer').css('top'));
68
$('#movieplayer').prev().css('left', $('#movieplayer').css('left'));
72
this.close = function(){
73
_parent.openWindows['movieplayer'] = false;
74
if(maximised){ _parent.systemSettings.decreaseFullscreen(); }
75
$('#movieplayer ').hide();
76
_parent.systemMenu.closeWindow('movieplayer');
77
$('#movieplayer ').removeClass('fullsize');
79
minified = _isOpen = false;
84
this.min = function(){
85
if(maximised){ _parent.systemSettings.decreaseFullscreen(); }
86
$('#movieplayer ').hide();
87
_parent.systemMenu.wiggle('movieplayer');
92
this.isMaximised = function(){
96
this.resize = function(){
97
var videoWidth = $('#movieplayer').width();
98
var videoHeight = $('#movieplayer').height();
99
$('#videoPlayer embed').attr('width',videoWidth);
100
$('#videoPlayer').attr('width',videoWidth);
101
$('#videoPlayer').attr('height',videoHeight);
102
$('#videoPlayer embed').attr('height',videoHeight - 27);
105
this.center = function(){
106
var left = ($(document).width() / 2) - ($('#movieplayer').width() / 2);
107
var top = Math.max(24,($(document).height() / 2) - ($('#movieplayer').height() / 2));
108
$('#movieplayer').css('left',left);
109
$('#movieplayer').css('top',top);
113
function getFlashMovieObject(movieName){
114
if (window.document[movieName]){
115
return window.document[movieName];
117
if (navigator.appName.indexOf("Microsoft Internet")==-1){
118
if (document.embeds && document.embeds[movieName])
119
return document.embeds[movieName];
122
return document.getElementById(movieName);
126
function playClicked(){
127
var flashMovie=getFlashMovieObject("videoPlayer");
128
flashMovie.playClicked('fg');