
function switchInput(id)
{
  redborder.style.visibility="hidden";
  nw.hide();
  se.hide();

}

function tailLRSwitch(_7)
{

}

function showLeft(_8)
{
}

function showRight(_b)
{
}

function switchTail(_e,id)
{
  var _10=imgtexts[_e-1].height;
  if(id<3)
  {
    if(_12.y<_11.y+37)
    {
      _12.moveTo(_12.x,_12.y+(69+_10));
      setMetrics(_e);
    }
  }
  else
  {
    if(_12.y>_11.y+37)
    {
      _12.moveTo(_12.x,_12.y-(69+_10));
      setMetrics(_e);
    }
  }
  switch(_e)
  {
    case 1:mtrcs.tailtype1.value=id;break;
    case 2:mtrcs.tailtype2.value=id;break;
    case 3:mtrcs.tailtype3.value=id;break;
    case 4:mtrcs.tailtype4.value=id;break;
  }
}
function textCounter(msg)
{
  var _18=100;
  if(msg.value.length>_18)
  {
    msg.value=msg.value.substring(0,_18);
    msg.parentNode.getElementsByTagName("span")[0].getElementsByTagName("span")[0].innerHTML=100-msg.value.length;
  }
  else
  {
    msg.parentNode.getElementsByTagName("span")[0].getElementsByTagName("span")[0].innerHTML=100-msg.value.length;
  }
}


function setMetrics(_1d)
{

}



var photo=dd.elements.photo;
var xxx=document.Show.xxx;
var yyy=document.Show.yyy;
var www=document.Show.www;
var hhh=document.Show.hhh;
var nw=dd.elements.nw;
var se=dd.elements.se;
var grips=[nw,se];
var redborder=document.getElementById("redborder");
var ratio;
init();
resetBorder();

function init()
{
  photo.setZ(photo.z+2);
  nw.setBgColor("#CCCCCC");
  se.setBgColor("#CCCCCC");
  showGrips();
  
  setTimeout("photo.setZ(photo.z-2);","1000");
}
function getPageSize()
{
  var _24,yScroll;
  if(window.innerHeight&&window.scrollMaxY)
  {
    _24=document.body.scrollWidth;
    yScroll=window.innerHeight+window.scrollMaxY;
  }
  else
  {
    if(document.body.scrollHeight>document.body.offsetHeight)
    {
      _24=document.body.scrollWidth;
      yScroll=document.body.scrollHeight;
    }
    else
    {
      _24=document.body.offsetWidth;
      yScroll=document.body.offsetHeight;
    }
  }
  var _25,windowHeight;
  if(self.innerHeight)
  {
    _25=self.innerWidth;
    windowHeight=self.innerHeight;
  }
  else
  {
    if(document.documentElement&&document.documentElement.clientHeight)
    {
      _25=document.documentElement.clientWidth;
      windowHeight=document.documentElement.clientHeight;
    }
    else
    {
      if(document.body)
      {
        _25=document.body.clientWidth;windowHeight=document.body.clientHeight;
      }
    }
  }
  if(yScroll<windowHeight)
  {
    pageHeight=windowHeight;
  }
  else
  {
    pageHeight=yScroll;
  }
  if(_24<_25)
  {pageWidth=_25;}
  else
   {pageWidth=_24;}
  arrayPageSize=new Array(pageWidth,pageHeight,_25,windowHeight);
  return arrayPageSize;
}
function adjustWhiteDivs()
{
}
function my_PickFunc()
{
  if((dd.obj.name=="nw")||(dd.obj.name=="se"))
  {
    var i=2;
    while(i--)
    {
      if(grips[i]!=dd.obj)
        {
          grips[i].hide();
        }
       else
         {grips[i].setBgColor("#8F8F8F");}
    }
  }
}
function my_DragFunc()
{
  if(dd.obj.name=="photo")
  {
    if(photo.x>=900)
    {
      photo.moveTo(900,photo.y);
    }
    else
    {
      if(photo.x+photo.w<=10)
      {
        photo.moveTo(10-photo.w,photo.y);
      }
    }
    if(photo.y>=450)
    {
      photo.moveTo(photo.x,450);
    }
    else
    {
      if(photo.y+photo.h<=32)
      {
        photo.moveTo(photo.x,32-photo.h);
      }
    }
    resetBorder();
    moveGripsToCorners();
  }
  if(dd.obj==se)
    {
      if(se.y-nw.y<50)
      {
         se.moveTo(photo.x+photo.w-se.w/2,photo.y+photo.h-se.h/2);
         resetBorder();    
         return;
      } 
      if(se.x-nw.x<50)
      {
       se.moveTo(photo.x+photo.w-se.w/2,photo.y+photo.h-se.h/2);
       resetBorder();
       return;
      }
      else
      {
        if((se.x+se.w/2<=110)||(se.y+se.w/2<=232))
        {
          se.moveTo(photo.x+photo.w-se.w/2,photo.y+photo.h-se.h/2);
        }
        else
        {
          se.moveTo(se.x,se.y);
          photo.resizeTo(se.x-nw.x,se.y-nw.y);
          resetBorder();
        }
      }
    }
    
  xxx.value = photo.x;
  yyy.value = photo.y;
  hhh.value = photo.h;
  www.value = photo.w;
}
function my_DropFunc()
{
  if((dd.obj.name=="photo")||(dd.obj.name=="nw")||(dd.obj.name=="se"))
  {
    showGrips();
    nw.setBgColor("#CCCCCC");
    se.setBgColor("#CCCCCC");
    trackPhoto();
  }
}
function moveGripsToCorners()
{
  nw.moveTo(photo.x-nw.w/2,photo.y-nw.h/2);
  se.moveTo(photo.x+photo.w-nw.w/2,photo.y+photo.h-nw.h/2);
}
function showGrips()
{
  moveGripsToCorners();
  var i=2;
  while(i--)
  {
    if(i==1)
    {
    grips[i].setZ(5);
    grips[i].show();
    }
  }
}
function hideGrips()
{
  var i=2;
  while(i--)
  {
    grips[i].hide();
  }
}
function resetBorder()
{
  redborder.style.left=photo.x+"px";
  redborder.style.top=photo.y+"px";
  redborder.style.height=photo.h+"px";
  redborder.style.width=photo.w+"px";
}
function trackPhoto()
{
  
}
function getPageSize()
{
  var _2b,yScroll;
  if(window.innerHeight&&window.scrollMaxY)
  {
    _2b=document.body.scrollWidth;
    yScroll=window.innerHeight+window.scrollMaxY;
  }
  else
  {
    if(document.body.scrollHeight>document.body.offsetHeight)
    {
      _2b=document.body.scrollWidth;
      yScroll=document.body.scrollHeight;
    }
    else
    {
      _2b=document.body.offsetWidth;
      yScroll=document.body.offsetHeight;
    }
  }
  var _2c,windowHeight;
  if(self.innerHeight)
  {
    _2c=self.innerWidth;
    windowHeight=self.innerHeight;
  }
  else
  {
    if(document.documentElement&&document.documentElement.clientHeight)
    {
      _2c=document.documentElement.clientWidth;
      windowHeight=document.documentElement.clientHeight;
    }
    else
    {
      if(document.body)
      {
        _2c=document.body.clientWidth;
        windowHeight=document.body.clientHeight;
      }
    }
  }
  if(yScroll<windowHeight)
  {
    pageHeight=windowHeight;
  }
  else
  {
    pageHeight=yScroll;
  }
  if(_2b<_2c)
  {
    pageWidth=_2c;
  }
  else
  {
    pageWidth=_2b;
  }
  arrayPageSize=new Array(pageWidth,pageHeight,_2c,windowHeight);
  return arrayPageSize;
}