﻿var ie_5_or_6_window_int_timer = null;

function nightVedioPlayer(mdiv, width, height, flash_file, file_img, file_url, file_title) {
	if (!flash_file) {
      //flash_file='player.swf';
      flash_file='player-licensed.swf';
      this.fixed=true;
   }
   if (!file_img) {
      file_img='/images/logo1.jpg';
   }
   if (!file_url) {
      file_url='';
   }
    if (!file_title) {
      file_title='';
   }
	this.obj = new SWFObject(flash_file, "nightangle_video_player", width, height, "9.0.98", "expressInstall.swf");
	this.div = mdiv;
	this.obj.addVariable('autostart','false');
   this.obj.addParam("wmode","transparent");
   this.obj.addParam("movie",flash_file);
	this.obj.addVariable('file', file_url);
	this.obj.addVariable('image', file_img);
	this.obj.addVariable('displaytitle','false');
	this.obj.write(this.div);
}

nightVedioPlayer.prototype.play_song = function(file_img, file_url, file_title) {
	/* minor hack - if they try to play the same song again it'll stop
	 * instead. */
	 if (!file_img) {
      file_img='nightingalemusic.jpg';
   }
	if (this.obj.getVariable('file') == file_url) {
		this.stop();
		this.obj.addVariable('image', file_img);
		this.obj.addVariable('file', '');
		this.obj.addVariable('title', file_title);
		this.obj.addVariable('displaytitle','false');
		close_video_player();
	} else {
		this.obj.addVariable('autostart','true');
		//this.obj.addVariable('autoresume','true');
		this.obj.addVariable('image', file_img);
		this.obj.addVariable('file', file_url);
		this.obj.addVariable('title', file_title);
		this.obj.addVariable('displaytitle',true);
		this.obj.write(this.div);
	}
}

nightVedioPlayer.prototype.stop = function() {
	this.obj.addVariable('autoplay','');
	this.obj.write(this.div);
}

function close_video_player() {
  nightVedioPlayer.stop();
}
