function writeObjEmb(fileExt,width,height,tagObj){
	//check to see if we can handle this type of file
	switch ( fileExt ){
	case "wmv" :
		classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95";
		codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0";
		type="video/x-ms-asf-plugin";
		titleTag = "Video";
		break;
	case "swf" :
		if(canPlayFlash==true){
			classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
			codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0";
			titleTag = "Flash";
			tagObj.allowScriptAccess = "sameDomain";
			tagObj.movie = "introChicago_Sheraton2.swf";
			tagObj.src = "introChicago_Sheraton2.swf";
			tagObj.menu = "false";
			tagObj.quality = "high";
			tagObj.bgcolor = "#ffffff";
			tagObj.type = "application/x-shockwave-flash";
			tagObj.pluginspage = "http://www.macromedia.com/go/getflashplayer";
		} else {
			fileExt = "msg";
			classid = "messagebox";
			titleTag = "Error";
			errorMessage = "<a href='http://www.macromedia.com/go/getshockwaveplayer/' target='_blank'><img src='http://www.macromedia.com/images/get_flashplayer.gif' border='0'></a>";
		}
		break;
	case "mov" :
		classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
		codebase="http://www.apple.com/qtactivex/qtplugin.cab";
		type="video/quicktime";
		titleTag = "Video";
		break;
	case "asf" :
		classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95";
		codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0";
		type="application/x-mplayer2";
		titleTag = "Video";
		break;
	case "msg" :
		classid = "messagebox";
		titleTag = "Error";
		break;
	default :
		classid = null;
	}	
	if(!classid){
			msg=window.open("","","height=" + height + ",width=" + width + ",left='50',top='50'");
			msg.document.write("<html>");
			msg.document.write("<head><title>Flash test</title></head>");
			msg.document.write("<body onblur='self.close()' marginheight='0' topmargin='0' marginwidth='0' leftmargin='0'><center>");		
			msg.document.write("There was an error attempting to play this file. Please try again at another time.");
			msg.document.write("</body></html>");
			return msg;
		} else {		
			msg=window.open("","","height=" + height + ",width=" + width + ",left='50',top='50'");
			msg.document.write("<html>");
			msg.document.write("<head><title>" + titleTag + "</title></head>");
			msg.document.write("<body onblur='self.close()' marginheight='0' topmargin='0' marginwidth='0' leftmargin='0'><center>");		
			if(fileExt!="msg"){
				writeTag = new Object();
				msg.document.write('<object classid="'+ classid +'" codebase="'+ codebase+'" ');
				msg.document.write('width="'+width+'" id="'+tagObj.id+'" align="'+tagObj.align+'" height="'+height+'">');
				//write the object tag first
				for (var prop in tagObj) {			
					writeTag.value = prop;
					writeTag.attribute = tagObj[prop];
					msg.document.write( '<param name="' + writeTag.value + '" value="' + writeTag.attribute + '">' );
					}
				//write the embed tag
				msg.document.write('<embed ');
				msg.document.write('width="'+width+'" height="'+height+'" ');
				for (var prop in tagObj) {			
					writeTag.value = prop;
					writeTag.attribute = tagObj[prop];
					msg.document.write( writeTag.value + '="' + writeTag.attribute + '" ' );
					}
					
				msg.document.write('></embed></object>');
			} else {
				msg.document.write("<table align='center' width='100%' height='100%' cellspacing='0' cellpadding='0' border='0'><tr><td align='center'><table align='center' width='100%' height='100%' cellspacing='0' cellpadding='0' border='0'><tr><td align='center'>");
				msg.document.write(errorMessage);
				msg.document.write("</td></tr></table></td></tr></table>");
			}
		msg.document.write("</body></html>");
		return msg;
		}	
}

