/*
*	Flash类 V1.0.0
*	2007-7-16
*	laoqiming@gmail.com
*/
function Flash(id,url,width,height){
	this.id=!id?"FreeSiteFlash_" + Number(Math.random()*100).toFixed(0):id;
	this.url=!url?"":url;
	this.width=!width?200:width;
	this.height=!height?50:height;
	this.attributes=[];
	this.attributes["quality"]="high";
	this.attributes["wmode"]="transparent";
	this.attributes["swliveconnect"]=true;
	this.toString=function(){
		var html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + this.width + '" height="' + this.height + '">\
            <param name="movie" value="' + this.url + '" id="' + this.id + '">';
		for(var i in this.attributes){
			html += '<param name="' + i.toString() + '" value="' + this.attributes[i] + '">';
		}
        html += '<embed name="' + this.id + '" id="' + this.id + '" src="' + this.url + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + this.width + '" height="' + this.height + '"';
		for(var i in this.attributes){
			html += ' ' + i.toString() + '="' + this.attributes[i] + '"';
		}
		html += '></embed>\
          </object>';
		return html;
	}
	this.addAttribute=function(name,value){
		this.attributes[name]=value;
	}
	this.getAttribute=function(name){
		return this.attributes[name];
	}
	this.render=function(target){
		if(!target){
			document.write(this.toString());
		}else if(typeof target == "string"){
			if(document.getElementById(target)){
				document.getElementById(target).innerHTML=this.toString();
			}
		}else if(typeof target == "object"){
			if(target.innerHTML){
				target.innerHTML=this.toString();
			}
		}
	}
}



