if ( document.images ) {
  var aImageNames = new Array( "webcam", "webcam_sm", "webcam_p", "webcam_pic" );
  var aImages = new Array();
  aImages[0] = new Image(); aImages[0].src = "images/webcam1.jpg";
  aImages[1] = new Image(); aImages[1].src = "images/webcam2.gif";
  aImages[2] = new Image(); aImages[2].src = "images/webcam_sm1.jpg";
  aImages[3] = new Image(); aImages[3].src = "images/webcam_sm2.gif";
  aImages[4] = new Image(); aImages[4].src = "images/webcam_p.jpg";
  aImages[5] = new Image(); aImages[5].src = "images/webcam_p1.gif";
  aImages[6] = new Image(); aImages[6].src = "images/webcam_pic.jpg";
  aImages[7] = new Image(); aImages[7].src = "images/webcam_pic2.gif";
 
}

function camera()
{
  window.open( "c640x480s.htm" ,"_blank", "height=480,width=640,location=no,resizable=1" );
}

function OnCamera(id) {
  switch ( parseInt( id ) ) {
    case 0: sUrl = "http://borisbord.com/c320x240v.htm"; sSize = "height=276,width=320,resizable=1,"; break;
    case 1: sUrl = "http://borisbord.com/c640x480s.htm"; sSize = "height=480,width=640,"; break;
    default: sUrl = "http://borisbord.com/camera.asp"; sSize = "height=240,width=320,"; break;
  }
  window.open( sUrl ,"_blank", sSize + "status=no,toolbar=no,menubar=no,location=no" );
}


function OnImageOver(index) {
  var iIndex = parseInt( index );
  var sName = aImageNames[iIndex];
  
if ( document.images ) {
    document.images[sName].src = aImages[iIndex * 2 + 1].src;
  }
}

function OnImageOut(index) {
  var iIndex = parseInt( index );
  var sName = aImageNames[iIndex];
  
 if ( document.images ) {
    document.images[sName].src = aImages[iIndex * 2].src;
  }
}


function OnLoad() {
  // toggle( 1 );
  // window.open( "camera.htm" ,"_blank", "height=240,width=320,status=no,toolbar=no,menubar=no,location=no" );
  
  // TODO: arrange page
  var nTop = 55;
  
  if ( document.getElementById ) {
    document.getElementById( "idShow1" ).style.visibility = "visible";
    nTop += document.getElementById("idBanner").offsetHeight;
    nTop += document.getElementById("idShow1").offsetHeight
    document.getElementById( "idMain" ).style.top = nTop;
    document.getElementById( "idMain" ).style.visibility = "visible";
    nTop += document.getElementById("idMain").offsetHeight;
    document.getElementById( "idFooter" ).style.top = nTop;
    document.getElementById( "idFooter" ).style.visibility = "visible";
  } else if ( document.layers ) {
    document.layers["idShow1"].visibility = "show";
    document.layers["idMain"].top = document.layers["idShow1"].top + document.layers["idShow1"].clip.height;
    document.layers["idFooter"].top = document.layers["idMain"].top + document.layers["idMain"].clip.height;
    document.height = document.layers["idFooter"].top + document.layers["idFooter"].clip.height;
    document.layers["idMain"].visibility = "show";
    document.layers["idFooter"].visibility = "show";
  }
}


function OnResize() 
{
  if ( document.layers ) window.location.reload();
}
  
function doCall(url) {
  window.open("imgview.asp?img=" + url, "_blank", "resizable=yes,status=no,toolbar=no,menubar=no,location=no,width=200,height=200");
}

function setStatus(s) {
  // window.status = s;
} 

var nShow = 1;

function toggle(n) {
  if ( n!= nShow )
  {
    var nTop = 55;
    // hide main part & footer.
    if ( document.layers ) {
      document.layers["idMain"].visibility = "hide";
      document.layers["idFooter"].visibility = "hide";
    } else {
      alert(document.getElementById( "idMain" ));
      document.getElementById( "idMain" ).style.visibility = "hidden";
      document.getElementById( "idFooter" ).style.visibility = "hidden";
    }
  
    
    // turn off current image
    if (document.layers)
      document.layers["idBanner"].document.images["img" + nShow].src = "/images/but0" + nShow + ".gif";
    else
      document.images["img" + nShow].src = "/images/but0" + nShow + ".gif";
  
    if ( document.layers ) {
      document.layers["idShow" + nShow].visibility = "hide";
      document.layers["idShow" + (nShow = n)].visibility = "show";
    } else {
      document.getElementById("idShow" + nShow).style.visibility = "hidden";
      document.getElementById("idShow" + (nShow = n)).style.visibility = "visible";
    }
  
    // turn on current image
    if (document.layers)
      document.layers["idBanner"].document.images["img" + n].src = "/images/but0" + n + "b.gif";
    else
      document.images["img" + n].src = "/images/but0" + n + "b.gif";

    // show main part & footer.
    if ( document.layers ) {
      document.layers["idMain"].top = document.layers["idShow" + nShow].top + document.layers["idShow" + nShow].clip.height;
      document.layers["idFooter"].top = document.layers["idMain"].top + document.layers["idMain"].clip.height;
      document.height = document.layers["idFooter"].top + document.layers["idFooter"].clip.height;
      document.layers["idMain"].visibility = "show";
      document.layers["idFooter"].visibility = "show";
    } else if ( document.all ) {
      nTop += document.getElementById("idBanner").clientHeight;
      nTop += document.getElementById("idShow" + nShow).clientHeight;
      document.getElementById( "idMain" ).style.top = nTop;
      document.getElementById( "idMain" ).style.visibility = "visible";
      nTop += document.getElementById("idMain").clientHeight;
      document.getElementById( "idFooter" ).style.top = nTop;
      document.getElementById( "idFooter" ).style.visibility = "visible";
    } else {
      nTop += document.getElementById("idBanner").offsetHeight;
      nTop += document.getElementById("idShow" + nShow).offsetHeight
      document.getElementById( "idMain" ).style.top = nTop;
      document.getElementById( "idMain" ).style.visibility = "visible";
      nTop += document.getElementById("idMain").offsetHeight;
      document.getElementById( "idFooter" ).style.top = nTop;
      document.getElementById( "idFooter" ).style.visibility = "visible";
    }
  }
}

function imgOn(n) {
  if ( n != nShow )
  {
    if (document.layers)
      document.layers["idBanner"].document.images["img" + n].src = "/images/but0" + n + "a.gif";
    else
      document.images["img" + n].src = "/images/but0" + n + "a.gif";
  }
}

function imgOff(n) {
  if ( n != nShow )
  {
    if (document.layers)
      document.layers["idBanner"].document.images["img" + n].src = "/images/but0" + n + ".jpg";
    else
      document.images["img" + n].src = "/images/but0" + n + ".jpg";
  }
}

function Purchase( ProjectName, Amount )
{
  document.frmPurchase.ProjectName.value = "Purchase " + ProjectName;
  document.frmPurchase.Amount.value = Amount;
  document.frmPurchase.submit()
}    
//-->
