/*********** function that handle flash on page **********/
function fnPrintFlash(sFileURL, nWidth, nHeight,id) {
    try { document.write(fnGetFlash(sFileURL, nWidth, nHeight,id)); }
    catch (e) { alert('Error loading script:\n'+e.message); }
}  
function fnGetFlash(sFileURL, nWidth, nHeight,id)
{
  var RetValue = "";
  if (window.ActiveXObject)
	  RetValue += '<object type="application/x-shockwave-flash"' + ((id && id!='')?' id="'+id+'"' : '') + ' width="' + nWidth + '" height="'+ nHeight + '">';
  else
	  RetValue += '<object' + ((id && id!='')?' id="'+id+'"' : '') + ' width="' + nWidth + '" height="'+ nHeight + '" data="' + sFileURL + '">';
  RetValue += '<param name="movie" value="' + sFileURL + '">';
  //document.write('<param name="quality" value="high">');
  if (id && id!='')
      RetValue += '<param name="scale" value="exactfit">';
  RetValue += '<param name="wmode" value="transparent">';
  RetValue += '<embed type="application/x-shockwave-flash" wmode="transparent" ';
  RetValue += 'width="'+nWidth+'" height="'+nHeight+'" src="'+sFileURL+'"/>';
  RetValue += '</object>';
  return RetValue;
}

function fnPrintFlashAdv(sFileURL, nWidth, nHeight, id, sFVars) {    
    var fvars = new String(sFVars);    
    var fileName = new String(fvars.substring(fvars.lastIndexOf("/")+1));
    var fullFileName = new String(fvars.substring(fvars.indexOf("sMaskSWF=")+9));
    
    sFVars = fvars.replace(/%26/ig,"&");
    
    if(!isCustomFlash(fileName) || sFVars.indexOf("nMaskAlpha=100&nMaskColor=0xFFFFFF") != -1)
    {
        fnPrintFlash(fullFileName, "100%", "100%", "flash");
    }
    else
    {
        if (window.ActiveXObject)
	        document.write("<object type=\"application/x-shockwave-flash\" id=\"" + id + "\" width=\"" + nWidth + "\" height=\""+ nHeight + "\">");
        else
	        document.write("<object FlashVars=\"" + sFVars + "\" type=\"application/x-shockwave-flash\" id=\"" + id + "\" width=\"" + nWidth + "\" height=\""+ nHeight + "\" data=\"" + sFileURL + "\">");
        document.write("<param name=\"movie\" value=\"" + sFileURL + "\">");
        document.write("<param name=\"quality\" value=\"high\">");
        document.write("<param name=\"wmode\" value=\"transparent\">");
        document.write("<param name=\"FlashVars\" value=\"" + sFVars + "\">");
        document.write("</object>");
    }
}

function isCustomFlash(fileName)
{
    return fileName.indexOf(".") == fileName.lastIndexOf(".");
}

/*********** end ******************************************/
