// NOTE: Dependent on Overlib.js for some root functions

var canDo = (ns4 || ns6 || ie4 || ie5);

var lyr = new Array();
var movingLyr = new Array(0,0,0); // gets a higher number while moving in progress

function testPage(){
//  alert(document.images[0].name);
alert(document.lyr.left);

}

function init(){
  for (var i=0;i<3;i++){
    var divName = 'movDiv'+i;
    if (ns4) lyr[i] = document[divName];
    if (ie4) lyr[i] = self[divName].style
    if (ns6) lyr[i] = document.getElementById(divName).style;
  }//endfor
}//init();

var show = "visible";
var hide = "hidden";
if (ns4){
 show = "show";
 hide = "hide";
}
function moveAcross(L,x,y,steps,mode){//mode:0=straight,1=sin(x/20),2=sin(x/300)
  if (! canDo) return;
  var again=false;
  if (steps > 0){
    var dx = (x - parseInt(lyr[L].left)) / steps;
    lyr[L].left = parseInt(lyr[L].left) + dx;

    var dy = (y - parseInt(lyr[L].top)) / steps;
    var offsetY = 0;
    if (mode == 1) offsetY = Math.sin(parseInt(lyr[L].left)/20) * 30;//Art, sine1
    if (mode == 2) offsetY = dy - (Math.sin(parseInt(lyr[L].left)/200+.7) * 30);//Van, sine2

    lyr[L].top = parseInt(lyr[L].top) + dy + offsetY;
  }//endif steps>0

  if (steps > 1) {
    setTimeout("moveAcross(" + L + "," + x + "," + y + "," + (steps-1) + "," + mode + ")",60);
  } else {
    lyr[L].visibility = hide;
    lyr[L].left = 0;
    lyr[L].top = 0;
    movingLyr[L] = 0;// clear flag
  }

}//bigUntil


function writeMov(txt) {
  if (! canDo) return false;
  if (! lyr) init();// moving layers need to be post-initialized

  txt += "\n";

  if (ns4) {
     lyr.document.write(txt)
     lyr.document.close()
  } else if (ie4) {
    document.all["movDiv"].innerHTML = txt
  } else if (ns6) {
    range = document.createRange();
    var ly = document.getElementById("movDiv");
    range.setStartBefore(ly);
    domfrag = range.createContextualFragment(txt);
    while (ly.hasChildNodes()) {
      ly.removeChild(ly.lastChild);
    }
    ly.appendChild(domfrag);
  }
  return true;
}//writeMov

function sweepArt(){
  document.spArt.src = "images/spArt1.gif";
  overlib('See <b><font face="serif" size="3"><font color="#808000">T</font><font color="#800080">i</font><font color="#0000ff">t</font><font color="#808ff">a</font><font color="#f0f060">n</font><font color="#f0f0ff">i</font><font color="#a000b0">u</font><font color="00a0c0">m</font></font></b> jewelry, Art Clocks, earrings, pendants, pins, and more. Read about the Artist. <br /><b>Buy </b> online.', WIDTH,200,LEFT,OFFSETY,-20,OFFSETX,100);


  if (movingLyr[0] != 1){ // don't interrupt if already moving
    if (! canDo) return false;
    if (! lyr[0]) init();// moving layers need to be post-initialized

    lyr[0].left = 700;//somwhere leftish
    lyr[0].top = "-100";//above the top
    lyr[0].visibility = show;
    movingLyr[0] = 1;
    moveAcross(0,0,400,70,1);//to x,y,steps,mode1=sine1
  }
  return true;
}
function clrArt(){
  document.spArt.src = "images/spArt0.gif";
  nd(); // clears Overlib
}


function sweepTech(){
  document.spTech.src = "images/spTech1.gif";
  overlib('Need a computer problem solved? Database designed? Website developed? See other web design samples, and peruse my many and varied technical qualifications.',WIDTH,200,CAPTION,'<center>Computer Development Resum&eacute;</center>',RIGHT,OFFSETY,-50,OFFSETX,100,DELAY,200);


  if (movingLyr[1] != 1){ // don't interrupt if already moving
    if (! canDo) return;
    if (! lyr[1]) init();// moving layer needs to be post-initialized

    lyr[1].left = 800; //somwhere leftish
    lyr[1].top = 350; //Centerish
    lyr[1].visibility = show;
    movingLyr[1] = 1;
    moveAcross(1,-100,150,35,0);//to x,y,steps,mode0=straight
  }
}
function clrTech(){
  document.spTech.src = "images/spTech0.gif";
  nd(); // clears Overlib
}

function sweepVan(){
  document.spVan.src = "images/spVan1.gif";
  overlib('Pictures, travelogues, garden, dancing, and so endless forth',WIDTH,200,CAPTION,'Dan and Karen\'s personal page',ABOVE,OFFSETY,-100,OFFSETX,-100,DELAY,200);

  if (movingLyr[2] != 1){ // don't interrupt if already moving
    if (! canDo) return;
    if (! lyr[2]) init();// moving layers need to be post-initialized

    lyr[2].left = -100;//Off right
    lyr[2].top = "400";//start low
    lyr[2].visibility = show;
    movingLyr[2] = 1;
    moveAcross(2,800,400,50,2);//to: x,y,steps,mode2=sine2
  }
}
function clrVan(){
  document.spVan.src = "images/spVan0.gif";
  nd(); // clears Overlib
}

