Page.mod_videos.flash = {

	vid : '',
	name : '',
	movieLoc : '',
	width : -1,
	height : -1,
	bgcolor : 000000,
	flashVars : '',
	wmode : 'transparent',
	buffer : '',
	destination : '',
	playad : false,
	
	flashObj : {},
	
	setBuffer : function() {
		if(this.vid != ''){
			this.flashVars= "vid="+this.vid+"&id="+this.id+"&play_ad="+this.playad;
		}
		
		if (this.name == "false"){
			//this.name = "swf"+mediaList.length;
		}
		var buffer = "";
		buffer +=("<" + "OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" id=\"" + this.name + "\" ");
		buffer +=(" CODEBASE=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" "); 
		buffer +=(" WIDTH=" + this.width + " HEIGHT=" + this.height);
		buffer +=(" > ");	
		buffer +=(" <"+"PARAM NAME=MOVIE VALUE='" + this.movieLoc + "'> ");
		buffer +=(" <"+"PARAM NAME=PLAY VALUE='true'> ");
		buffer +=(" <"+"PARAM NAME=LOOP VALUE='true'> ");
		buffer +=(" <"+"PARAM NAME=bgcolor VALUE=#" + this.bgcolor + "> ");
		buffer +=(" <"+"PARAM NAME=QUALITY VALUE=high> ");
		// Flash Vars 
		buffer +=(" <"+"PARAM NAME=FlashVars VALUE='"+this.flashVars+"'> ");
		buffer +=(" <"+"PARAM NAME=MENU VALUE='" + this.menu + "'> ");
		// set tranparency
		buffer +=(" <"+"PARAM NAME=WMODE VALUE='" + this.wmode + "'>");
		buffer +=("<EMB"+"ED NAME=\"" + this.name + "\" SRC='" + this.movieLoc + "' ");
		buffer +=("FlashVars='" + this.flashVars + "' ");
		buffer +=(" WIDTH='" + this.width + "' HEIGHT='" + this.height + "' play=true ");
		buffer +=(" loop=true QUALITY=best ALIGN=TOP ");
		buffer +=(" BGCOLOR=#" + this.bgcolor + " ");
		buffer +=(" TYPE=application/x-shockwave-flash ");
		buffer +=(" wmode=" + this.wmode );
		buffer +=(" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">");
		buffer +=("</EMBED>");
		buffer +=("</OBJECT>");
		
		this.buffer = buffer;
	
	}, // end set
	
	flashwrite : function(){
		
		this.setBuffer();
	
		if(this.destination != ''){
			System.out.println('flashwrite destination='+this.destination);
			document.getElementById(this.destination).innerHTML = this.buffer;
		}
		else
		document.getElementById('mod_videos.vidholder').innerHTML = this.buffer;
		
	},
	
	loadVideo : function(strVid,strId,playad){
		
		if(playad){
			this.playad = true;
		}	
		
		Page.mod_videos.flash.vid = strVid;
		Page.mod_videos.flash.id = strId;
		this.movieLoc = '/home/modules/videos/swf/player.swf';
		this.width = 226;
		this.height = 171;
		this.name = 'video_module';
		this.destination = 'mod_videos.vidholder';
		
		this.flashwrite();
		
		
		Page.mod_videos.flash.flashwrite();
	},
	
	loadflash : function(what,where,name,width,height,vars){
		System.out.println('what='+what);
		this.vid = '';
		this.movieLoc = what;
		this.width = width;
		this.height = height;
		this.name = name;
		this.destination = where;
		if(vars)
			this.flashVars = vars;
		
		this.flashwrite();

	}
}




		
