var morph;

window.addEvent('domready', function()
{
  morph = new Fx.Morph('imgview', {duration: 500});
});

function pageLoad(isIndex)
{
  if(isIndex)
  {
    fadeIn('menu');
    fadeIn('logo');
  }
  else
  {
    fadeIn('items');
    fadeOut('items');
    zoomIn('mb',28,false);
    zoomOut('mb1',0,false);
  }
}

function fadeIn(targetElem)
{
  startFadeIn(targetElem);
}

function fadeOut(targetElem)
{
  startFadeOut(targetElem);
}

function zoomIn(targetID, maxLength, isHeight)
{
  startZoomIn(targetID, maxLength, isHeight);
}

function zoomOut(targetID, maxLength, isHeight)
{
  startZoomOut(targetID, maxLength, isHeight);
}

function ShowItem(callerObj, imgItem, imgWidth, imgHeight, imgID)
{
  var t=getObject('imgview');
  var i=getObject('imgcontainer');
  var tt=getObject('imgtext');
  var b=document.getElementsByTagName('body')[0];
  var f=getObject('fader');
  var newWidth=imgWidth;
  var newHeight=imgHeight+9;
  i.src='/_img_base/tr.gif';
  tt.style.width=imgWidth+'px';
  tt.innerHTML=getObject(imgID).innerHTML;
  f.style.width=b.clientWidth;
  f.style.height=b.clientHeight;
  f.style.display='block';
  if (b.clientWidth < newWidth) t.style.left=0+'px';
  else t.style.left=b.clientWidth/2-newWidth/2+'px';
  if (b.clientHeight < newHeight) t.style.top=b.scrollTop+'px';
  else t.style.top=b.clientHeight/2-newHeight/2+'px';
  if (imgItem == "") i.src='/_img_base/tr.gif';
  else i.src=imgItem;

  morph.start({height: newHeight+'px', width: newWidth+'px;', opacity: 1});
}

function HideImgView()
{
  getObject('fader').style.display='none';
  getObject('imgcontainer').src='/_img_base/tr.gif';
  morph.start({height: '0px', width: '0px;', opacity: 0});
}
