

function FlashObject(params){
	
	this.available_version=0;
	this.max_version=params.max_version?params.max_version:6;
	this.required_version=params.required_version?params.required_version:6;
	this.file=params.file;
	this.noflash=params.noflash;
	this.width=params.width;
	this.height=params.height;
	this.id=params.id;
	this.name=params.name?params.name:this.id;
	this.params=params.param;
	this.getVariable=params.get?params.get:'';
	this.classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
	
}

{
	var Fla=FlashObject.prototype;
	
	Fla.detect=function(){
		// netscape plugin architecture	
    if(typeof(navigator.plugins["Shockwave Flash"]) == "object"){
    	var description = navigator.plugins["Shockwave Flash"].description;
      this.available_version = description.substr(16, (description.indexOf(".", 16) - 16));
    }
    // IE
    else if(typeof(ActiveXObject) == "function"){
     for(var i = 2; i < (this.max_version + 1); i ++){
      try{
       if(typeof(new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i)) == "object"){
         this.available_version= i;
       }
      }
      catch(error){}
     }
    }
    return this.available_version >= this.required_version ;
  }
  
  
  Fla.render=function(id){
  	
  	var code='';
  	if(!this.detect()){
  		code='<img src="'+this.noflash+'" border="0" />';
  		
  	}
  	else{
  	var params = this.params; // Object parameter
  	var flashvars = this.getVariable;	// Flash Variables
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { 
			// netscape plugin architecture			
			code = '<embed type="application/x-shockwave-flash" src="'+ this.file +'" width="'+ this.width +'" height="'+ this.height +'"  ';
			code += ' id="'+ this.id +'" name="'+ this.name +'" ';
			
			 for(var key in params){ 
			 	code += [key] +'="'+ params[key] +'" '; 
			 }
			
			if (flashvars.length > 0){ 
			 	code += 'flashvars="'+ flashvars +'"'; 
			}
			code += '/>';
		} 
		else { // IE			
			code = '<object id="'+ this.id +'" classid="'+this.classid+'" width="'+ this.width +'" height="'+ this.height +'">';
			code += '<param name="movie" value="'+ this.file +'" />';
			
			for(var key in params) {
			 code += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
				
			if(flashvars.length > 0) {
				code += '<param name="flashvars" value="'+ flashvars +'" />';
			}
			code += "</object>";
		}  		
  		
  	}
  	d=this.findObject(id);
  	
  	if(d!=null && typeof(d) == "object"){
  		d.innerHTML=code;
  	}
  	
  }	
  /**
   @name findObjetc 
   @return DOM Object 
  
  */
 	Fla.findObject=function (id){
 			return(document.getElementById==null) ?
   (document.all==null ? null : document.all[id]) : document.getElementById(id);
 		
 	}
	
}
