/**********************************************************************************************/
/* Javascript-Bibliothek von 4foto                                                            */
/*                                                                                            */
/* (C) 4foto GmbH                                                                             */
/* www.4foto.com                                                                              */
/*                                                                                            */
/* Fotobuch, Fotoleinwand, Foto-Poster, Foto-Abzüge                                           */
/*                                                                                            */
/* Alle Rechte vorbehalten.                                                                   */
/*                                                                                            */
/* Autor: Christoph Peters                                                                    */
/**********************************************************************************************/

/**********************************************************************************************/
/* MAIN                                                                                       */
/**********************************************************************************************/

function preis_number_format(number, laenge, sep, th_sep ) {
  number = Math.round( number * Math.pow(10, laenge) ) / Math.pow(10, laenge);
  str_number = number+"";
  arr_int = str_number.split(".");
  if(!arr_int[0]) arr_int[0] = "0";
  if(!arr_int[1]) arr_int[1] = "";
  if(arr_int[1].length < laenge){
    nachkomma = arr_int[1];
    for(i=arr_int[1].length+1; i <= laenge; i++){  nachkomma += "0";  }
    arr_int[1] = nachkomma;
  }
  if(th_sep != "" && arr_int[0].length > 3){
    Begriff = arr_int[0];
    arr_int[0] = "";
    for(j = 3; j < Begriff.length ; j+=3){
      Extrakt = Begriff.slice(Begriff.length - j, Begriff.length - j + 3);
      arr_int[0] = th_sep + Extrakt +  arr_int[0] + "";
    }
    str_first = Begriff.substr(0, (Begriff.length % 3 == 0)?3:(Begriff.length % 3));
    arr_int[0] = str_first + arr_int[0];
  }
  return arr_int[0]+sep+arr_int[1];
}

/**********************************************************************************************/
/* DARK POPUPS                                                                                */
/**********************************************************************************************/
function getPageSize(){
// Code from Lokesh Dhakar - http://www.huddletogether.com
  var xScroll, yScroll;
  if (window.innerHeight && window.scrollMaxY) {  
    xScroll = document.body.scrollWidth;
    yScroll = window.innerHeight + window.scrollMaxY;
  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
    xScroll = document.body.scrollWidth;
    yScroll = document.body.scrollHeight;
  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
    xScroll = document.body.offsetWidth;
    yScroll = document.body.offsetHeight;
  }
  var windowWidth, windowHeight;
  if (self.innerHeight) {  // all except Explorer
    windowWidth = self.innerWidth;
    windowHeight = self.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
  } else if (document.body) { // other Explorers
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
  }  
  // for small pages with total height less then height of the viewport
  if(yScroll < windowHeight){
    pageHeight = windowHeight;
  } else { 
    pageHeight = yScroll;
  }
  // for small pages with total width less then width of the viewport
  if(xScroll < windowWidth){  
    pageWidth = windowWidth;
  } else {
    pageWidth = xScroll;
  }
  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
  return arrayPageSize;
}
function getPageScroll() {
// Code from Lokesh Dhakar - http://www.huddletogether.com
  var yScroll;
  if (self.pageYOffset) {
    yScroll = self.pageYOffset;
  } else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
  yScroll = document.documentElement.scrollTop;
  } else if (document.body) {// all other Explorers
    yScroll = document.body.scrollTop;
  }
  arrayPageScroll = new Array('',yScroll) 
  return arrayPageScroll;
}

var do_popup_inits = false;
function init_for_dark_popups() {
  if (do_popup_inits == true) {
    var fullPageSize = getPageSize();
    document.getElementById('dark_popup_background').style.width = ""+fullPageSize[0]+"px";
    document.getElementById('dark_popup_background').style.height = ""+fullPageSize[1]+"px";
    document.getElementById('dark_popup_editor_background').style.width = ""+fullPageSize[0]+"px";
    document.getElementById('dark_popup_editor_background').style.height = ""+fullPageSize[1]+"px";
    document.getElementById('dark_popup_background_ie6hack').style.width = ""+fullPageSize[0]+"px";
    document.getElementById('dark_popup_background_ie6hack').style.height = ""+fullPageSize[1]+"px";
    var prelImage_black = new Image();
    prelImage_black.src = "../img/css/4foto-dark-popup-background-black.png";
    var prelImage_white = new Image();
    prelImage_white.src = "../img/css/4foto-dark-popup-background-white.png";
  }
}
function open_dark_popup(img_url,imgWidth,imgHeight) {
  var fullPageSize = getPageSize();
  var fullPageScroll = getPageScroll();
  var imgTop = (fullPageScroll[1] + ((fullPageSize[3] - 35 - imgHeight) / 2));
  var imgLeft = (((fullPageSize[0] - 20 - imgWidth) / 2));
  document.getElementById('dark_popup_container').style.width = (imgWidth+0)+"px";    
  document.getElementById('dark_popup_container').style.height = (imgHeight+0)+"px";    
  document.getElementById('dark_popup_container').style.top = ""+imgTop+"px";    
  document.getElementById('dark_popup_container').style.left = ""+imgLeft+"px";    
  document.getElementById('dark_popup_container').style.backgroundImage = "url("+img_url+")";
  document.getElementById('dark_popup_background_ie6hack').style.width = (imgWidth+0)+"px";    
  document.getElementById('dark_popup_background_ie6hack').style.height = (imgHeight+0)+"px";    
  document.getElementById('dark_popup_background_ie6hack').style.top = ""+imgTop+"px";    
  document.getElementById('dark_popup_background_ie6hack').style.left = ""+imgLeft+"px";    
  document.getElementById('dark_popup_background_ie6hack').style.display = "block";    
  document.getElementById('dark_popup_background').style.display = "block";    
  document.getElementById('dark_popup_container').style.display = "block";    
}
function close_dark_popup() {
  document.getElementById('dark_popup_background_ie6hack').style.display = "none";    
  document.getElementById('dark_popup_background').style.display = "none";    
  document.getElementById('dark_popup_container').style.display = "none";    
}
function open_dark_editor(url,imgWidth,imgHeight) {
  var fullPageSize = getPageSize();
  var fullPageScroll = getPageScroll();
  var imgTop = (fullPageScroll[1] + ((fullPageSize[3] - 35 - imgHeight) / 2));
  var imgLeft = (((fullPageSize[0] - 20 - imgWidth) / 2));
  document.getElementById('dark_popup_editor_container').style.width = (imgWidth+0)+"px";    
  document.getElementById('dark_popup_editor_container').style.height = (imgHeight+0)+"px";    
  document.getElementById('dark_popup_editor_container').style.top = ""+imgTop+"px";    
  document.getElementById('dark_popup_editor_container').style.left = ""+imgLeft+"px";    
  document.getElementById('dark_popup_background_ie6hack').style.width = (imgWidth+0)+"px";    
  document.getElementById('dark_popup_background_ie6hack').style.height = (imgHeight+0)+"px";    
  document.getElementById('dark_popup_background_ie6hack').style.top = ""+imgTop+"px";    
  document.getElementById('dark_popup_background_ie6hack').style.left = ""+imgLeft+"px";    
  document.getElementById('dark_popup_background_ie6hack').style.display = "block";    
  document.getElementById('dark_popup_editor_background').style.display = "block";    
  document.getElementById('dark_popup_editor_container').style.display = "block";    
  document.getElementById('editor_iframe').src = url;
  if (typeof(pageTracker) == "object") {
    var pagecode = 'unbekannt';
    if (url.indexOf('Leinwand') >= 0) {
      pagecode = 'leinwand';
    }
    else if (url.indexOf('Poster') >= 0) {
      pagecode = 'poster';
    }
    pageTracker._trackPageview('/editor-popup/'+pagecode+'/'); 
  }
  return false;    
}

/**********************************************************************************************/
/* DYNAMIC BLOCKS                                                                             */
/**********************************************************************************************/

function openFAQ(faq_id) {
  document.getElementById("faq_"+faq_id+"_answer").style.display = "block";
  document.getElementById("faq_"+faq_id+"_button_inaktiv").style.display = "none";
  document.getElementById("faq_"+faq_id+"_button_aktiv").style.display = "inline";
}
function closeFAQ(faq_id) {
  document.getElementById("faq_"+faq_id+"_answer").style.display = "none";
  document.getElementById("faq_"+faq_id+"_button_inaktiv").style.display = "inline";
  document.getElementById("faq_"+faq_id+"_button_aktiv").style.display = "none";
}
function toggleFAQ(faq_id) {
  if (document.getElementById("faq_"+faq_id+"_answer").style.display == "block") {
    closeFAQ(faq_id);
  }
  else {
    openFAQ(faq_id);
  } 
}

/**********************************************************************************************/
/* MOVING MENUS                                                                               */
/**********************************************************************************************/

var menu_status = new Array();
var menu_position = new Array();
var menu_top_position = new Array();
var menu_interval = new Array();
var moving_speed = 50;
var moving_interval = 100;
var menu_setup_position = 66;

function init_menu(menu_id) {
  document.getElementById(menu_id).style.display = "block";
  var div_height = document.getElementById(menu_id).offsetHeight;
  document.getElementById(menu_id).style.display = "none";
  var top_position = menu_setup_position - div_height;
  menu_top_position[""+menu_id] = top_position;
  menu_position[""+menu_id] = top_position;
  menu_status[""+menu_id] = "in";
  menu_interval[""+menu_id] = 0;
}
function menu_slide_in(menu_id) {
  if (menu_status[""+menu_id] == undefined) {
    init_menu(menu_id);
  }
  if (menu_status[""+menu_id] == "sliding_out" || menu_status[""+menu_id] == "out") {
    start_sliding(menu_id,"in");
  }
}
function menu_slide_out(menu_id) {
  if (menu_status[""+menu_id] == undefined) {
    init_menu(menu_id);
  }
  if (menu_status[""+menu_id] == "sliding_in" || menu_status[""+menu_id] == "in") {
    start_sliding(menu_id,"out");
  }
}
function start_sliding(menu_id,direction) {
  if (menu_interval[""+menu_id] != 0) {
    clearInterval(menu_interval[""+menu_id]);
  }
  menu_status[""+menu_id] = "sliding_"+direction;
  menu_interval[""+menu_id] = setInterval("slide_menu('"+(""+menu_id)+"','"+direction+"')",moving_interval);
}
function slide_menu(menu_id,direction) {
  var position = menu_position[""+menu_id];
  if (direction == "out") {
    position = position + moving_speed;
     document.getElementById(menu_id).style.display = "block";
  }
  else {
    position = position - moving_speed;
  }
  if (position >= menu_setup_position && direction == "out") {
    clearInterval(menu_interval[""+menu_id]);
    menu_status[""+menu_id] = "out";
    position = menu_setup_position;
  }
  if (position <= menu_top_position[""+menu_id] && direction == "in") {
    clearInterval(menu_interval[""+menu_id]);
    menu_status[""+menu_id] = "in";
    position = menu_top_position[""+menu_id];
     document.getElementById(menu_id).style.display = "none";
  }
  document.getElementById(menu_id).style.top = ""+position+"px";
  menu_position[""+menu_id] = position;
}

/**********************************************************************************************/
/* SWITCHING IMAGES                                                                           */
/**********************************************************************************************/

var zoom_image = "";

function switch_product_image(image_element,act_zoom_image) {
  zoom_image = act_zoom_image;
  document.getElementById('product_image').src = image_element.src;
}
function zoom_switched_image() {
  open_dark_popup(zoom_image,800,400);
}
function switch_example_image(image_element) {
  document.getElementById('example_image').src = image_element.src;
}
function zoomin_image(image_nr,direction) {
  var small_image     = 'details_small_image_'+image_nr;
  var large_image     = 'details_large_image_'+image_nr;
  var image_block     = 'details_image_block_'+image_nr;
  var image_subtitle   = 'details_image_subtitle_'+image_nr;
  var zoom_lens         = 'details_zoomlens_zoom_'+image_nr;
  var unzoom_lens     = 'details_zoomlens_unzoom_'+image_nr;
  document.getElementById(image_block).style.width = "480px";
  document.getElementById(image_block).style.padding = "0px 0px 10px 0px";
  document.getElementById(image_subtitle).style.width = "445px";
  document.getElementById(small_image).style.display = "none";
  document.getElementById(large_image).style.display = "block";
  document.getElementById(zoom_lens).style.display = "none";
  document.getElementById(unzoom_lens).style.display = "block";
}
function zoomout_image(image_nr,direction) {
  var small_image     = 'details_small_image_'+image_nr;
  var large_image     = 'details_large_image_'+image_nr;
  var image_block     = 'details_image_block_'+image_nr;
  var image_subtitle   = 'details_image_subtitle_'+image_nr;
  var zoom_lens         = 'details_zoomlens_zoom_'+image_nr;
  var unzoom_lens     = 'details_zoomlens_unzoom_'+image_nr;
  document.getElementById(image_block).style.width = "240px";
  if (direction == 'left') {
    document.getElementById(image_block).style.padding = "0px 15px 10px 0px";
  }
  else {
    document.getElementById(image_block).style.padding = "0px 0px 10px 15px";
  }
  document.getElementById(image_subtitle).style.width = "205px";
  document.getElementById(small_image).style.display = "block";
  document.getElementById(large_image).style.display = "none";
  document.getElementById(zoom_lens).style.display = "block";
  document.getElementById(unzoom_lens).style.display = "none";
}
function zoomin_textblock_image(image_nr,direction) {
  var small_image     = 'textblock_small_image_'+image_nr;
  var large_image     = 'textblock_large_image_'+image_nr;
  var image_block     = 'textblock_image_block_'+image_nr;
  var image_subtitle   = 'textblock_image_subtitle_'+image_nr;
  var zoom_lens         = 'textblock_zoomlens_zoom_'+image_nr;
  var unzoom_lens     = 'textblock_zoomlens_unzoom_'+image_nr;
  document.getElementById(image_block).style.width = "728px";
  document.getElementById(image_block).style.padding = "0px 5px 10px 0px";
  document.getElementById(image_subtitle).style.width = "688px";
  document.getElementById(small_image).style.display = "none";
  document.getElementById(large_image).style.display = "block";
  document.getElementById(zoom_lens).style.display = "none";
  document.getElementById(unzoom_lens).style.display = "block";
}
function zoomout_textblock_image(image_nr,direction) {
  var small_image     = 'textblock_small_image_'+image_nr;
  var large_image     = 'textblock_large_image_'+image_nr;
  var image_block     = 'textblock_image_block_'+image_nr;
  var image_subtitle   = 'textblock_image_subtitle_'+image_nr;
  var zoom_lens         = 'textblock_zoomlens_zoom_'+image_nr;
  var unzoom_lens     = 'textblock_zoomlens_unzoom_'+image_nr;
  document.getElementById(image_block).style.width = "240px";
  if (direction == 'left') {
    document.getElementById(image_block).style.padding = "0px 15px 10px 0px";
  }
  else {
    document.getElementById(image_block).style.padding = "0px 0px 10px 15px";
  }
  document.getElementById(image_subtitle).style.width = "200px";
  document.getElementById(small_image).style.display = "block";
  document.getElementById(large_image).style.display = "none";
  document.getElementById(zoom_lens).style.display = "block";
  document.getElementById(unzoom_lens).style.display = "none";
}
function zusatztext_schliessen(id_nummer) {
  var element = 'zusatztext_id_'+id_nummer;
  document.getElementById(element).style.display = "none";
  return false;    
}
function zusatztext_oeffnen(id_nummer) {
  var element = 'zusatztext_id_'+id_nummer;
  document.getElementById(element).style.display = "block";
  return false;    
}

/**********************************************************************************************/
/* Ende der JS-Bibliothek von 4Foto                                                           */
/**********************************************************************************************/

/**********************************************************************************************/
/*                                                                                            */
/* Javascript-Sourcen, zur Verfügung gestellt von Adobe Systems                               */
/*                                                                                            */
// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
/**********************************************************************************************/

// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
  var version;
  var axo;
  var e;

  // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

  try {
    // version will be set for 7.X or greater players
    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
    version = axo.GetVariable("$version");
  } catch (e) {
  }

  if (!version)
  {
    try {
      // version will be set for 6.X players only
      axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
      
      // installed player is some revision of 6.0
      // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
      // so we have to be careful. 
      
      // default to the first public version
      version = "WIN 6,0,21,0";

      // throws if AllowScripAccess does not exist (introduced in 6.0r47)    
      axo.AllowScriptAccess = "always";

      // safe to call for 6.0r47 or greater
      version = axo.GetVariable("$version");

    } catch (e) {
  }
  }

  if (!version)
  {
    try {
      // version will be set for 4.X or 5.X player
      axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
      version = axo.GetVariable("$version");
    } catch (e) {
    }
  }

  if (!version)
  {
    try {
      // version will be set for 3.X player
      axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
      version = "WIN 3,0,18,0";
    } catch (e) {
    }
  }

  if (!version)
  {
    try {
      // version will be set for 2.X player
      axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      version = "WIN 2,0,0,11";
    } catch (e) {
      version = -1;
    }
  }
  
  return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
  // NS/Opera version >= 3 check for Flash plugin in plugin array
  var flashVer = -1;
  
  if (navigator.plugins != null && navigator.plugins.length > 0) {
    if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
      var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
      var descArray = flashDescription.split(" ");
      var tempArrayMajor = descArray[2].split(".");      
      var versionMajor = tempArrayMajor[0];
      var versionMinor = tempArrayMajor[1];
      var versionRevision = descArray[3];
      if (versionRevision == "") {
        versionRevision = descArray[4];
      }
      if (versionRevision[0] == "d") {
        versionRevision = versionRevision.substring(1);
      } else if (versionRevision[0] == "r") {
        versionRevision = versionRevision.substring(1);
        if (versionRevision.indexOf("d") > 0) {
          versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
        }
      }
      var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
    }
  }
  // MSN/WebTV 2.6 supports Flash 4
  else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
  // WebTV 2.5 supports Flash 3
  else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
  // older WebTV supports Flash 2
  else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
  else if ( isIE && isWin && !isOpera ) {
    flashVer = ControlVersion();
  }  
  return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
  versionStr = GetSwfVer();
  if (versionStr == -1 ) {
    return false;
  } else if (versionStr != 0) {
    if(isIE && isWin && !isOpera) {
      // Given "WIN 2,0,0,11"
      tempArray         = versionStr.split(" ");   // ["WIN", "2,0,0,11"]
      tempString        = tempArray[1];      // "2,0,0,11"
      versionArray      = tempString.split(",");  // ['2', '0', '0', '11']
    } else {
      versionArray      = versionStr.split(".");
    }
    var versionMajor      = versionArray[0];
    var versionMinor      = versionArray[1];
    var versionRevision   = versionArray[2];

          // is the major.revision >= requested major.revision AND the minor version >= requested minor
    if (versionMajor > parseFloat(reqMajorVer)) {
      return true;
    } else if (versionMajor == parseFloat(reqMajorVer)) {
      if (versionMinor > parseFloat(reqMinorVer))
        return true;
      else if (versionMinor == parseFloat(reqMinorVer)) {
        if (versionRevision >= parseFloat(reqRevision))
          return true;
      }
    }
    return false;
  }
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
      str += '<object ';
      for (var i in objAttrs)
        str += i + '="' + objAttrs[i] + '" ';
      for (var i in params)
        str += '><param name="' + i + '" value="' + params[i] + '" /> ';
      str += '></object>';
    } else {
      str += '<embed ';
      for (var i in embedAttrs)
        str += i + '="' + embedAttrs[i] + '" ';
      str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){  
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":  
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

