// JavaScript Document
/***********************************************************************
*
* Function to write flash item directly to the page using javascript
* rather than the standard embedding directly into html.
* 
* This provides a solution to having the page validated as html 4.01
* by W3C and not showing the "there is no attribute SRC" error within
* the embed section of the flash code.
*
* The script is copyright 2005 "Web 4 Now". www.web4now.co.uk It can however
* be used by others for either commercial or private use as long as this
* header remains in place.
*
* This script has been tested and we have not found any errors however,
* we can not guarantee that it is error free and that it will work as intended
* on all web platforms. It is made available on the strict understanding that:
* 
* "Web 4 now" will not be liable for any damages or other consequences
* relating to your use of the script. The script is supplied "as is" with no
* warranties whatsoever.
* 
* USE OF THIS SCRIPT IS AT YOUR OWN RISK.
************************************************************************/

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}


	 function writeflash(MM_w,MM_h,MM_source,MM_pname,MM_title,MM_mode){
		var MM_temp = MM_source;
        var MM_nasource = replace(MM_temp,' ','~');
		
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
	document.write(' ID="'+MM_pname+'" WIDTH="'+MM_w+'" HEIGHT="'+MM_h+'" title="'+MM_title+'">');
	document.write(' <PARAM NAME="movie" VALUE="'+MM_source+'"> <PARAM NAME="menu" VALUE="false"> <PARAM NAME="wmode" VALUE="'+MM_mode+'"> <PARAM NAME="quality" VALUE="high">  ');
	document.write(' <embed src="'+MM_nasource+'" menu=false wmode='+MM_mode+' quality=high ');
	document.write(' WIDTH="'+MM_w+'" HEIGHT="'+MM_h+'" NAME="'+MM_pname+'"');
	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	document.write(' </embed>');
	document.write(' </object>');
	
	 }

