//|
//| Copyright (C) Architecte du Logiciel
//| All rights reserved. Duplication and distribution prohibited.
//| http://www.architectedulogiciel.fr
//|

//ADL
function flash_obj(divid,swfid,swfmovie,swfwidth,swfheight,
  swfvars,swfcolor,swftransp,flashversion)
{
  var params = {};
  params.quality="high";
  params.bgcolor=swfcolor;
  params.allowscriptaccess="sameDomain";
  params.allowfullscreen="true";
  params.wmode=swftransp;
  var attributes = {};
  attributes.id=swfid;
  attributes.name=swfid;
  attributes.align="middle";
  swfobject.embedSWF(swfmovie,divid,swfwidth,swfheight,flashversion,
    "../swf/adobe_flash.swf",swfvars,params,attributes);
  // display the flashContent div in case it is not replaced with a swf object
  swfobject.createCSS("#"+divid, "display:block;text-align:left;");
}

//ADL
function resize_flash_obj(idname,width,height)
{
  document.getElementById(idname).width=""+width+"px";
  document.getElementById(idname).height=""+height+"px";
  document.getElementById(idname+"_embed").width=""+width+"px";
  document.getElementById(idname+"_embed").height=""+height+"px";
}

//ADL
// Return a string, dot-separated, with charCode for each characters of str_to_encode.
// last char is . (to have at least one dot in string)
function charcode_encode(str_to_encode)
{
  var str=new String();
  for (idx=0;idx<str_to_encode.length;idx++)
  {
    str+=str_to_encode.charCodeAt(idx)+".";
  }
  return str;
}

//ADL
// Return a string decoded from a dot-separated, with charCode for each characters of str_to_encode.
function charcode_decode(charcodelist_string)
{
  var str_arr = charcodelist_string.split(".");
  var fstring = new String();
  for (idx=0; idx<str_arr.length; idx++)
  {
    if (str_arr[idx].length>0)
      fstring += String.fromCharCode(str_arr[idx]);
  }
  delete str_arr;
  return fstring;
}

//ADL
function get_flashobject(flashid)
{
  if (window.document[flashid])
  {
    return window.document[flashid];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[flashid])
      return document.embeds[flashid];
    //else
      //alert("no flash object found");
  }
  else
  {
    return document.getElementById(flashid);
  }
}

