var __videoPath = null;

addedPlayer();
function addedPlayer() {
  lightwindow.prototype._setupActions = (function (orig) {
    return function() {
      orig.bind(lightwindow.prototype);
      if($('related_video')){
      __videoPath = $('related_video').className;
     }
      if($('flash_player') && __videoPath != null) {
        window.setTimeout(function() {
          swfobject.embedSWF(assetsPath + "flashplayer/player.swf?r=1", "lightwindow_loading", "540", "350", "9.0.0","expressInstall.swf", {"videoURL":__videoPath + "", "skinURL":assetsPath + "flashplayer/ClearOverAll.swf"}, {"wmode":"transparent", allowScriptAccess:"always"}, {});
        }, 200);
      }
    }
  })(lightwindow.prototype._setupActions);
}


lightwindow.prototype._defaultAnimationHandler = (function(originalConstructor) { 
  return function() {
    
    (originalConstructor.bind(lightwindow.prototype))();
    
    $('lightwindow_title_bar_inner').setStyle({
			height: '0px',
			margin: '0px'
		});
    
    this.dimensions.dataEffects.push(
			new Effect.Morph('lightwindow_title_bar_inner', {sync: true, style: {height: '0px', marginTop: '0px'}}),
		 	new Effect.Appear('lightwindow_title_bar_inner', {sync: true, from: 1.0, to: 1.0})
		);		

    this.dimensions.dataEffects.push(
			new Effect.Morph('lightwindow_title_bar_inner', {sync: true, style: {height: '0px', marginTop: '0px'}}),
		 	new Effect.Fade('lightwindow_title_bar_inner', {sync: true, from: 1.0, to: 1.0})
		);

  }
})(lightwindow.prototype._defaultAnimationHandler);


lightwindow.prototype.initialize = (function(originalConstructor) { 
  return function(opts) {
    var opts2 = Object.extend({
      overlay : {
				opacity : 0.9,
				image : '' + imagesPath + 'black-70.png',
				presetImage : '' + imagesPath + 'black-70.png'
			},
      fileTypes : {
      page : ['asp', 'aspx', 'cgi', 'htm', 'html', 'pl', 'php4', 'php3', 'php', 'php5', 'phtml', 'rhtml', 'shtml', 'txt', 'vbs', 'rb', 'jspx', ''],
      media : ['aif', 'aiff', 'asf', 'avi', 'divx', 'm1v', 'm2a', 'm2v', 'm3u', 'mid', 'midi', 'mov', 'moov', 'movie', 'mp2', 'mp3', 'mpa', 'mpa', 'mpe', 'mpeg', 'mpg', 'mpg', 'mpga', 'pps', 'qt', 'rm', 'ram', 'swf', 'viv', 'vivo', 'wav'],
      image : ['bmp', 'gif', 'jpg', 'png', 'tiff']
      },
      skin : 	{
				main : 	'<div id="lightwindow_container" >'+
							
							'<div id="lightwindow_stage" >'+
								'<div id="lightwindow_contents" >'+
								'</div>'+
                '<div id="video_player" >'+
								'</div>'+
								'<div id="lightwindow_navigation" >'+
									'<a href="#" id="lightwindow_previous" >'+
										'<span id="lightwindow_previous_title"></span>'+
									'</a>'+
									'<a href="#" id="lightwindow_next" >'+
										'<span id="lightwindow_next_title"></span>'+
									'</a>'+
									'<iframe name="lightwindow_navigation_shim" id="lightwindow_navigation_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe>'+
								'</div>'+								
								'<div id="lightwindow_galleries">'+
									'<div id="lightwindow_galleries_tab_container" >'+
										'<a href="#" id="lightwindow_galleries_tab" >'+
											'<span id="lightwindow_galleries_tab_span" class="up" >Galleries</span>'+
										'</a>'+
									'</div>'+
									'<div id="lightwindow_galleries_list" >'+
									'</div>'+
								'</div>'+
								'<a id="lightwindow_title_bar_close_link" >&nbsp;</a>'+
							'</div>'+
              '<div id="lightwindow_title_bar" >'+
								'<div id="lightwindow_title_bar_inner" >'+
									'<span id="lightwindow_title_bar_title"></span>'+
								'</div>'+
							'</div>'+
							'<div id="lightwindow_data_slide" style="display: none;" >'+
								'<div id="lightwindow_data_slide_inner" >'+
									'<div id="lightwindow_data_details" >'+
										'<div id="lightwindow_data_gallery_container" >'+
											'<span id="lightwindow_data_gallery_current"></span>'+
											''+
											'<span id="lightwindow_data_gallery_total"></span>'+
										'</div>'+
										'<div id="lightwindow_data_author_container" >'+
											'by <span id="lightwindow_data_author"></span>'+
										'</div>'+
									'</div>'+
									'<div id="lightwindow_data_caption" >'+
									'</div>'+
								'</div>'+
							'</div>'+
						'</div>',	
				loading : 	'<div id="lightwindow_loading" >'+
								'<span>Loading or <a href="javascript: myLightWindow.deactivate();">Cancel</a></span>'+
								'<iframe name="lightwindow_loading_shim" id="lightwindow_loading_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe>'+
							'</div>',
				iframe : 	'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'+
							'<html xmlns="http://www.w3.org/1999/xhtml">'+
								'<body>'+
									'{body_replace}'+
								'</body>'+
							'</html>',
				gallery : {
					top :		'<div class="lightwindow_galleries_list">'+
									'<h1>{gallery_title_replace}</h1>'+
									'<ul>',
					middle : 			'<li>'+
											'{gallery_link_replace}'+
										'</li>',
					bottom : 		'</ul>'+
								'</div>'
				}
			},
      hideGalleryTab : true,
      galleryAnimationHandler : false,
      showGalleryCount : false
    }, opts);
    
    (originalConstructor.bind(lightwindow.prototype))(opts2);

  }
})(lightwindow.prototype.initialize);

