/***************************************************************************************************************
* Function		: LPF_writeFlash(swfsrc,swfwidth,swfheight,swfclassid,swfcodebase,swfpluginspage,imgurl,imgwidth,imgheight,imghref,imgtarget,imgalt,imgborder,otherparam)
* Description		: Generate codes for displaying Flash if appropriate plugin is installed.
*			  Otherwise it will display a graphic file with an option of hyperlink.
* Parameter Usage	: swfsrc - Specifies the location (URL) of the movie to be loaded.
*						  swfwidth - Specifies the width of the movie in either pixels or percentage of browser window.
*						  swfheight - Specifies the height of the movie in either pixels or percentage of browser window.
*						  swfclassid - Identifies the ActiveX control for the browser. OBJECT only.
*						  swfcodebase - Identifies the location of the Flash Player ActiveX control so that the browser
*						                can automatically download it if it is not already installed. OBJECT only.
*						  swfpluginspage - Identifies the location of the Flash Player plug-in so that the user can
*						                   download it if it is not already installed. EMBED only.
*						  imgurl - url of the image file to be called
*						  imgwidth - width of the image file (blank if same width as Flash)
*						  imgheight - height of the image file (blank if same height as Flash)
*						  imghref - hyperlink of the image file (no link if blank)
*						  imgtarget - target window of the hyperlink (ignore if hyperlink is blank)
*						  imgalt - alt text of image (default blank)
*						  imgborder - border of image  (default 0)
*						  otherparam - Other optional attributes and possible values. The format of the string is a
*						               set of name,value combinations separated by '|'.
*						               Please read http://www.macromedia.com/support/flash/ts/documents/tag_attributes.htm
*
***************************************************************************************************************/
function LPF_writeFlash(swfsrc,swfwidth,swfheight,swfclassid,swfcodebase,swfpluginspage,imgurl,imgwidth,imgheight,imghref,imgtarget,imgalt,imgborder,otherparam) {
   
	var i=0;
	var isOK=false;
	document.returnValue = false;
	plgIn='Shockwave Flash';

	!swfclassid? swfclassid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000":i=i;
//	!swfcodebase? swfcodebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0":i=i;
//	!swfpluginspage? swfpluginspage="http://www.macromedia.com/go/getflashplayer":i=i;

	!imgwidth? imgwidth=swfwidth:i=i;
	!imgheight? imgheight=swfheight:i=i;
	!imgalt? imgalt="":i=i;
	!imgborder? imgborder=0:i=i;

	with (navigator) if (appName.indexOf('Microsoft')!=-1 && appVersion.indexOf('Mac')==-1)
		document.write(''+'<scr'+'ipt language="VBScript">\nOn error resume next\n'+'dir = IsObject(CreateObject("SWCtl.SWCtl.1"))\n'+'flash = NOT IsNull(CreateObject("ShockwaveFlash.ShockwaveFlash"))\n</scr'+'ipt>');

	with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
		isOK=(plugins && plugins[plgIn]);
	} else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
		if (plgIn.indexOf("Flash")!=-1 && window.flash!=null)
			isOK=window.flash;
		else if (plgIn.indexOf("Director")!=-1 && window.dir!=null)
			isOK=window.dir;
		else isOK=false;
	}


	if (isOK) {
		document.write('<OBJECT classid="' + swfclassid + '" codebase="' + swfcodebase + '" WIDTH='+swfwidth+' HEIGHT='+swfheight+'>');
		document.write('<PARAM PARAM NAME="allowscriptaccess" VALUE="always" />');
		document.write('<PARAM NAME=movie VALUE="'+swfsrc+'">');

		var op = otherparam.split("|");
		var op1;
		var embedStr="";

		for(i=0;i<op.length;i++) {
			op1 = op[i].split(",");
			document.write('<PARAM NAME=' + op1[0] + ' VALUE="' + op1[1] + '">');
			embedStr = embedStr + op1[0] + '="' + op1[1] + '" ';
		}
		embedStr = embedStr + 'allowscriptaccess="always"'	 ;

		document.write('<EMBED src="'+swfsrc+'" WIDTH='+swfwidth+' HEIGHT='+swfheight+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="' + swfpluginspage + '" ');
		document.write(embedStr);
		document.write('></');
		document.write('EMBED>');
		document.write('</');
		document.write('OBJECT>');
	}
	else
	{
		if (imghref) {
			document.write('<a href="'+imghref+'"');
			if (imgtarget) {
				document.write(' target="'+imgtarget+'"');
			}
			document.write('>');
		}

		document.write('<img alt="' + imgalt + '" src="'+imgurl+'" width="'+imgwidth+'" height="'+imgheight+'" border="' + imgborder + '">');
		if (imghref) {
			document.write('</a>');
		}
	}

	op=null;
	op1=null;
}