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=8,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>');
	
	 }

