function NVIFlash(){
	
	var _host = this ;
	var _containerId ;
	
	function isset( element ){
		return typeof element != 'undefined' && element != null ;
	}
	function getUniqueId(){
		return Math.round( Math.random() * ( new Date() - new Date( 0 , 00 , 01 , 00 , 00 , 00 ) ) ) ;
	}
	function getVersion(){
		var version ;
		var flashObject ;
		var signature = 'ShockwaveFlash.ShockwaveFlash' ;
		
		try{ flashObject = new ActiveXObject( signature + '.7' ) ; }
		catch( error ){
			try{
				flashObject = new ActiveXObject( signature + '.6' ) ;
				version = 6 ;
			}catch( error ){
				try{ flashObject = new ActiveXObject( signature + '.3' ) ; }
				catch( error ){}
			}
		}
		if( !isset( version ) && isset( flashObject ) ){
			version = flashObject.GetVariable( '$version' ).match( /\d+/ ) ;
		}
		if( !isset( version ) ){
			signature = 'Shockwave Flash' ;
			try{
				flashObject = navigator.plugins[ signature ] ;
			}catch( error ){
				try{
					flashObject = navigator.plugins[ signature + ' 2.0' ] ;
				}catch( error ){}
			}
			version = isset( flashObject ) ? flashObject.description.match( /\d+/ ) : null ;
		}
	}
	this.getVersion = getVersion ;

	function create( properties , flashvars , bypass ){
		var properties = properties || null ;
		var flashvars = flashvars || {} ;
		var bypass = bypass || false ;
		var output = '' ;
		if( !isset( properties ) ) return null ;
		
		/*
		* Needed parameters
			
			properties.src
			properties.version
			properties.containerId
			properties.id
			properties.width
			properties.height 
			properties.allowScriptAccess
			properties.swLiveConnect
			properties.quality
			properties.bgColor
			properties.allowFullScreen
			properties.wMode

		*/		
		
		if( !isset( properties.src ) ) return null ;
		if( !isset( properties.id ) ) return null ;
		if( !isset( properties.width ) ) properties.width = 200 ;
		if( !isset( properties.height ) ) properties.height = 200 ;
		if( !isset( properties.version ) ) properties.version = '10' ;
		if( !isset( properties.allowScriptAccess ) ) properties.allowScriptAccess = 'always' ;
		if( !isset( properties.swLiveConnect ) ) properties.swLiveConnect = true ;
		if( !isset( properties.quality ) ) properties.quality = 'high' ;
		if( !isset( properties.bgColor ) ) properties.bgColor = '#ffffff' ;
		if( !isset( properties.allowFullScreen ) ) properties.allowFullScreen = false  ;
		if( !isset( properties.wMode ) ) properties.wMode = properties.allowFullScreen ? 'opaque' : 'transparent' ;
		
		var flashvarsOutput = '' ;
		for( var i in flashvars ) flashvarsOutput += i+"="+flashvars[i]+'&';
		flashvarsOutput += "uniqueId=" + getUniqueId() ;
		
		if( document.all ){
			output += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ properties.version +'" ' ;
			output += 'width="'+ properties.width +'" height="'+ properties.height +'" id="'+ properties.id +'" align="middle" >' ;
			output += '<param name="allowScriptAccess" value="'+ properties.allowScriptAccess +'" />' ;
			output += '<param name="swLiveConnect" value="'+ properties.swLiveConnect +'" />' ;
			output += '<param name="movie" value="'+ properties.src +'" />' ;
			output += '<param name="quality" value="'+ properties.quality +'" />' ;
			output += '<param name="menu" value="false" />' ;
			output += '<param name="bgcolor" value="'+ properties.bgColor +'" />' ;
			output += '<param name="allowFullScreen" value="'+ properties.allowFullScreen +'" />' ;
			output += '<param name="wmode" value="'+ properties.wMode +'" />' ;
			output += '<param name="FlashVars" value="'+ flashvarsOutput +'" />' ;
			output += '</object>' ;
		}else{
			output += '<embed src="'+ properties.src +'" quality="'+ properties.quality +'" FlashVars="'+ flashvarsOutput +'" bgcolor="'+ properties.bgColor +'" ';
			output += 'width="'+ properties.width +'" height="'+ properties.height +'" id="'+ properties.id +'" align="middle" allowScriptAccess="'+ properties.allowScriptAccess +'" ';
			output += 'swLiveConnect="'+ properties.swLiveConnect +'" menu="false" type="application/x-shockwave-flash" allowFullScreen="'+ properties.allowFullScreen +'" ';
			output += 'wmode="'+ properties.wMode +'" pluginspage="http://www.macromedia.com/go/getflashplayer" />';			
		}
		
		if( isset( properties.containerId ) ){
			_containerId = properties.containerId ;
			var container = document.getElementById( properties.containerId ) ;
			var containerHTML = container.innerHTML ;
			container.innerHTML = output ;
			var flashObject = document.getElementById( properties.id ) ;
			if( !bypass && document.all && isset( flashObject ) && flashObject.readyState == 0 ){
				container.innerHTML = containerHTML ;
			}
			return flashObject ;
		}else{
			return output ;
		}
	}
	this.create = create ;

	function clear(){
		try{
			document.getElementById( _containerId ).innerHTML = "" ; 
		}catch( error ){}
	}
	this.clear = clear ;
}