var paramsFlash = {
   menu: "false",
   wmode: "transparent"
};
var playerVersion = swfobject.getFlashPlayerVersion();
var version = playerVersion.major+"."+playerVersion.minor+"."+playerVersion.release;
var is_ie = ((/msie/i.test(window.navigator.userAgent) && !/opera/i.test(window.navigator.userAgent)) || /Firefox/i.test(window.navigator.userAgent));
function GID(id){ return (is_ie) ? document.all[id] : document.getElementById(id);}

function toggleTopMenu(show, id, isActive)
{
  if(q = GID('menu_top_'+id))
    q.style.display = (show ? 'block' : 'none');
  if((w = GID('menu_top_td'+id)) && !isActive)
  {
    if(show)
    {
      w.style.backgroundColor = '#FF9F1A';
      w.style.backgroundImage = 'none';
    }
    else
    {
      w.style.backgroundColor = '#0377A7';
      w.style.backgroundImage = 'url(image/mt-bgr.gif)';
    }
  }
}

function toggleLeftMenu(show, id, isActive, first)
{
  if(q = GID('menu_left_'+id))
    q.style.display = (show ? 'inline' : 'none');
  if(q = GID('menu_left_td_'+id))
  {
    q.style.backgroundImage = (show ? 'url(image/m-bgr-a.gif)' : (first ? 'none' : 'url(image/m-bgr.gif)'));
    q.style.backgroundRepeat = (show ? 'repeat-x' : 'no-repeat');
  }
  //if(w = GID('menu_left_td'+id))
  //  w.style.backgroundColor = '#'+(show ? 'C0E0DD' : (isActive ? 'FFAD2B' : 'A2D4C9'));
}

function commitFlashObject(_obj, _container) {
   var _output = "";
   var _paramoutput = "";
   for (_cO in _obj) {
      if (_cO != "movie" && _cO != "FlashVars" && _cO != "wmode" && _cO != "quality") _output += _cO+"=\""+_obj[_cO]+"\" ";
      if (_cO != "data" && _cO != "width" && _cO != "height") _paramoutput += "<param name=\""+_cO+"\" value=\""+_obj[_cO]+"\" />\n";
   }
   var ihtm = "<object type=\"application/x-shockwave-flash\" "+_output+">\n";
   ihtm += _paramoutput;
   ihtm += "</object>\n";
   GID(_container).innerHTML = '&nbsp;';
   GID(_container).innerHTML = ihtm;
}
var myFlashObject = false;
function showFlash(path, width, height, div, vars, wmode) {
   if(myFlashObject != false)
    delete myFlashObject;
   myFlashObject = new Object;
   myFlashObject.movie = path;
   myFlashObject.data = path;
   myFlashObject.quality = "high";
   myFlashObject.bgcolor = "#DFE0E3";
   myFlashObject.allowFullScreen = true;
   if (width) myFlashObject.width = width;
   if (height) myFlashObject.height = height;
   if (vars != "") myFlashObject.FlashVars = vars;
   if (wmode != "") myFlashObject.wmode = wmode;
   commitFlashObject(myFlashObject, div);
}
curPhotoOD = 0;
cachedPhotoOD = new Array();
function updatePhotoOD()
{
  curPhotoOD = (curPhotoOD + 1) % photoImagesCount;
  nextImg = (curPhotoOD + 1) % photoImagesCount;
  /*if(!cachedPhotoOD[nextImg])
  {
    cachedPhotoOD[nextImg] = new Image();
    cachedPhotoOD[nextImg].src = photoImages[nextImg][1];
  }*/
  GID('photoOD_a').href = 'photo_'+photoImages[curPhotoOD][4]+'_'+photoImages[curPhotoOD][0]+'.htm';
  GID('photoOD_img').src = photoImages[curPhotoOD][1];
  GID('photoOD_url').innerHTML = '<a href="'+photoImages[curPhotoOD][2]+'" title="'+photoImages[curPhotoOD][3]+'">'+photoImages[curPhotoOD][3]+'</a>';
  setTimeout('updatePhotoOD();', photoDelay);
}

function showImage(file, info)
{
  if(!(q = GID('mmContent')))
    return;
  q.innerHTML = (file.length ? '<a href="'+file+'" target="_blank" title="'+info+'">' : '') + '<table class="tblImg"><tr><td><img src="'+file+'" /></td></tr></table>' + (file.length ? '</a>' : '');
  GID('mmComment').innerHTML = info;
}
function date2unix(val)
{
  tmp = /(\d+).(\d+).(\d+)/.exec(val);
  return date2unix3(tmp[3], tmp[2], tmp[1]);
}
function date2unix3(year, month, day)
{
  val = new Date(year, month - 1, day, 0, 0, 0);
  return Math.round(val.getTime()/1000.0);
}