//-( LiteboxImage )-------------------------------------------------------------
 
/* class */ function LiteGallery( ) /* extends Litebox */ {
	Litebox.apply( this, [] );
	
	this.setCanvas(
		document.createElement( 'div' )
		);
		
	this.getCanvas( ).id = 'galleryBox';
	this.getCanvas( ).className = 'liteboxCore';

	this.setIgnoreCanvasClick( true );
	
	}

extend( LiteGallery, {
 	_cache					:	[]
,	getCache				:	function( k ) {
		return LiteGallery._cache[ k ] || null;
		}
,	setCache				:	function( k, v ) {
		LiteGallery._cache[ k ] = v;
		return LiteGallery;
		}

,	_pipeline				:	[]
,	inPipeline				:	function( k ) {
		return LiteGallery._pipeline[ k ] || null;
		}
,	addToPipeline			:	function( k ) {
		LiteGallery._pipeline[ k ] = 1;
		return LiteGallery;
		}
,	clearFromPipeline		:	function( k ) {
		LiteGallery._pipeline[ k ] = 0;
	}
} );

extend( LiteGallery.prototype, Litebox.prototype );
extend( LiteGallery.prototype, {

	_template					:	null
,	_bridge						:	null

// Has litebox assembled at least once? False for first assemble( ), true for subsequents
,	_has_assembled				:	false
,	hasAssembled				:	function( ) {
		return this._is_assembled;
	}
,	setHasAssembled				:	function( v ) {
		this._is_assembled = v;
		return this;
	}

,	getTemplate					:	function( ) {
		return this._template;
		}
,	setTemplate					:	function( v ) {
		this._template = v;
		return this;
		}

,	_galleryUri					:	null
,	getGalleryUri				:	function( ) {
		return this._galleryUri;
		}
,	setGalleryUri				:	function( uri ) {
		this._galleryUri = uri;
		
		var cache = LiteGallery.getCache( uri );
		if( cache ) {
			this.assemble( uri, cache );
			}
		else
		if( LiteGallery.inPipeline( uri ) ) {
			this._bridge.setResultCallback( bind( this, 'assemble', uri ) );
		}
		else {
			LiteGallery.addToPipeline( uri );
			this._bridge = LiteBridge.span(
				 uri
				,bind( this, 'assemble', uri )
				);
			}
		
		return this;
		}
		
,	assemble					:	function( uri, response ) {
		
		LiteGallery.setCache( uri, response );
		LiteGallery.clearFromPipeline( uri );
		
		if( !this.hasAssembled( ) ) {
			this.cloakCanvas( );
		}
		setHTML( this.getCanvas( ), response.body );
		
	   	var frame = getObj( 'frame' );	
		var frameWidth = getObjWidth( frame );
		var frameHeight = getObjHeight( frame );
		
		if( this.getTemplate( ) == 'video'
		&&  response.qtUpshift ) {
			uvqt_attach( new Array( response.qtUpshift ) );
			
			// Get movie height explicitly because it's slow to attach
			frameHeight += qtUpshift[ 0 ][ 3 ];
			}
		
		var help = document.createElement( 'div' );
			addClass( help, 'help' );
			setText( help, 'Click outside this box to close it.' );
			frame.appendChild( help );
        	
        var next = getObj( 'gNext' );
        if( next ) {
	        next.onclick = bind( this, 'changeFrame', next );
	        this.preloadFrame( next );
	        }
	        
	   	var prev = getObj( 'gPrev' );
	   	if( prev ) {
	   		prev.onclick = bind( this, 'changeFrame', prev );
	   		}
	   	
	   	this.getCanvas( ).style.width = frameWidth + 'px';
	   	this.getCanvas( ).style.height = frameHeight + 'px';
	   	
	   	if( !this.hasAssembled( ) ) {
		   	this.updateCanvasPosition( );
	   		this.uncloakCanvas( );
		   	this.setHasAssembled( true );
		}
	   	
	   	return this;
		}
		
,	changeFrame					:	function( obj, e ) {
		this.setGalleryUri( obj.href.replace( 'gallery/', 'gallery/ajax/' ) );
		if( e = getEvent( e ) ) {
			return abortEvent( e );
			}
		return false;
		}
	
,	preloadFrame				:	function( obj ) {
		var uri = obj.href.replace( 'gallery/', 'gallery/ajax/' );
		
		if( !LiteGallery.getCache( uri )
		&&  !LiteGallery.inPipeline( uri ) ) {
			LiteGallery.addToPipeline( uri );
			this._bridge = LiteBridge.span(
				 uri
				,bind( LiteGallery, 'setCache', uri )
				);
			}
		}
	
,	show						:	function( ) {
		if( getObj( 'uvHardpoint_InteractiveMap' ) ) {
			addClass( getObj( 'uvHardpoint_InteractiveMap' ), 'backdrop' );
		}
		
		bind( this, Litebox.prototype.show )( );
		return this;
		}
		
,	dispose						:	function( ) {
		if( getObj( 'uvHardpoint_InteractiveMap' ) ) {
			removeClass( getObj( 'uvHardpoint_InteractiveMap' ), 'backdrop' );
		}
		
		bind( this, Litebox.prototype.dispose )( );
		removeNode( this.getFrame( ) );
		}

	} );

/* class */ function LiteMapGallery( ) /* extends LiteMap */ {
	LiteGallery.apply( this, [] );
	}

extend( LiteMapGallery.prototype, LiteGallery.prototype );
extend( LiteMapGallery.prototype, {
	show						:	function( ) {
		addClass( getObj( 'mapShell' ), 'backdrop' );
		
		bind( this, LiteGallery.prototype.show )( );
		return this;
		}
		
,	dispose						:	function( ) {
		removeClass( getObj( 'mapShell' ), 'backdrop' );
		bind( this, LiteGallery.prototype.dispose )( );
		}
	
	} );
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
/* class */ function RichMediaVideo( ) /* extends Litebox */ {
	Litebox.apply( this, [] );
	
	this.setCanvas(
		document.createElement( 'div' )
		);
		
	this.getCanvas( ).id = 'galleryBox';
	this.getCanvas( ).className = 'richVideo';
	//this.getCanvas( ).className = 'liteboxCore';

	this.setIgnoreCanvasClick( true );
	
	
	
	}
	
extend( RichMediaVideo.prototype, Litebox.prototype );
extend( RichMediaVideo.prototype, {

	embedVideo					:	function( video_id ) {

		this.cloakCanvas( );
		setHTML(
			this.getCanvas( ),
			'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+
			'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"'+
			'id="player" width="450" height="392"><param name="movie"'+
			'value="http://content.fliqz.com/components/5b61da2cb99a43efa8e93e77592d2d7e.swf" />'+
			'<param name="allowFullScreen" value="true" />'+
			'<param name="wmode" value="transparent" />'+
			'<param name="AllowScriptAccess" value="always" />'+
			'<param name="flashvars" value="file='+video_id+'&" />'+
			'<embed name="player" src="http://content.fliqz.com/components/5b61da2cb99a43efa8e93e77592d2d7e.swf"'+
			'width="450" height="392" allowFullScreen="true" wmode="transparent"'+
			'AllowScriptAccess="always" flashvars="file='+video_id+'&"'+
			'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" >'+
			'</embed></object>'+
			'<div class="closeLite">'+
				'<a href="#" onclick="bind( LiteboxController.getFrontLitebox( ), LiteGallery.prototype.dispose )( ); return false;">close [ x ]</a>'+
			'</div><div style="clear:right;"></div>'
		);

	   	this.getCanvas( ).style.width = '460px';
	   	this.getCanvas( ).style.height = '425px';

	   	this.updateCanvasPosition( );
	   	this.uncloakCanvas( );
	   	
	   	return this;
	}
});
	
	
	













































/* class */ function AroostookLiteMap( ) /* extends Litebox */ {
	Litebox.apply( this, [] );
	
	this.setCanvas(
		document.createElement( 'div' )
		);
		
	this.getCanvas( ).id = 'galleryBox';
	this.getCanvas( ).className = 'liteboxCore';

	this.setIgnoreCanvasClick( true );
	
	
	
	}
	
extend( AroostookLiteMap.prototype, Litebox.prototype );
extend( AroostookLiteMap.prototype, {

	prepareMap					:	function( ) {

		this.cloakCanvas( );
		setHTML(
			this.getCanvas( ),
			'<img src="'+full_auri( 'resource/aroostook/image/main_map_lg.jpg' )+'" alt="Click on a Region to View" usemap="#AroostookMapLarge" />'+
			'<div class="closeLite" style="font-size: 10px; float: right;">'+
				'<a style="color: #666666;" href="#" onclick="bind( LiteboxController.getFrontLitebox( ), LiteGallery.prototype.dispose )( ); return false;">close [ x ]</a>'+
			'</div><div style="clear:right;"></div>'
		);

	   	this.getCanvas( ).style.backgroundColor = 'white';
	   	this.getCanvas( ).style.padding = '10px 10px 20px 10px';
	   	this.getCanvas( ).style.width = '570px';
	   	this.getCanvas( ).style.height = '594px';

		

	   	this.updateCanvasPosition( );
	   	
//	   	this.getCanvas( ).style.top = '0px !important';
//	   	this.getCanvas( ).style.left = '0px !important';
	   	
	   	
	   	this.uncloakCanvas( );
	   	
	   	return this;
	}
});









