var browsername = navigator.appName;
var opera = (navigator.userAgent.search("Opera")>=0) ? 1:0;
var nsadv = ((document.layers) && parseInt(navigator.appVersion)>=4) ? 1:0;
var ieadv = ((document.all) && parseInt(navigator.appVersion)>=4) ? 1:0;

function ShowLoc(index, e) {
  var thetext='<font color=blue>';
  switch (index) {
    case 0: thetext += 'Genesis 11'; break;
    case 1: thetext += 'Genesis 12'; break;
    case 2: thetext += 'Genesis 16'; break;
    case 3: thetext += 'Genesis 13'; break;
    case 4: thetext += 'Genesis 14-15'; break;
    case 5: thetext += 'Genesis 18-21'; break;
    case 6: thetext += 'Genesis 23'; break;
    case 7: thetext += 'Genesis 24'; break;
    case 8: thetext += 'Genesis 25'; break;
    case 9: thetext += 'Genesis 22'; break;
    case 10:thetext += 'Genesis 26'; break;
    case 11:thetext += 'Genesis 27-28'; break;
    case 12:thetext += 'Genesis 35'; break;
    case 13:thetext += 'Genesis 16,21'; break;
    case 14:thetext += 'Genesis 28'; break;
    case 15:thetext += 'Genesis 37,42'; break;
    case 16:thetext += 'Genesis 46-50'; break;
  }
  thetext += '</font>' 
  if (ieadv) {
    commenttext.innerHTML = thetext;
	commentbubble.style.left = e.x - 25 + document.body.scrollLeft;
	commentbubble.style.top = e.y - 140 + document.body.scrollTop;
	commenttext.style.left = e.x + document.body.scrollLeft;
	commenttext.style.top = e.y - 110 + document.body.scrollTop;
	commentbubble.style.visibility = 'visible';
	commenttext.style.visibility = 'visible';
  }
  if (nsadv) {
    vbub=document.commentbubble;
	vbub.document.write('<img src=images/comment.gif>');
	vbub.document.close();
	vbub.moveTo(e.x+250,e.y-80);
    vtext=document.commenttext;
	vtext.document.write('<font color=#006600>' + thetext + '</font>');
	vtext.document.close();
	vtext.y = e.y - 45;
	vtext.x = e.x+275;
	vbub.visibility = "visible";
	vtext.visibility = "visible";
  }
}

function HideLoc() {
  if (ieadv) {
	commenttext.style.visibility = 'hidden';
	commentbubble.style.visibility = 'hidden';
    commenttext.innerHTML = '';
  }
  if (nsadv) {
	vbub=document.layers['commentbubble'];
    vtext=document.layers['commenttext'];
	vtext.visibility = "hidden";
	vbub.visibility = "hidden";
	vtext.document.write('');
	vtext.document.close();
  }
}

function DoExplain(trigger) 
{
  theText='';
  switch (trigger)
  {
    case 0: theText="Terah travels from Ur to Haran with Abram, Lot and Sarai.";break;
    case 1: theText="Abram travels at age 75 with Lot and Sarai from Haran to Canaan. They settle in the Negev after brief stops at Shechem and Bethel.";break;
    case 2: theText="Ishmael is born of Hagar to Abraham aged 86. After this, Abraham continues to live at Mamre.";break;
    case 3: theText="After avoiding famine by residing in Egypt, Abram and Lot separate. Lot lives in Sodom, still a thriving settlement.";break;
    case 4: theText="The battle of 9 armies and Yahweh's covenant with Abram. His name is changed to Abraham.";break;
    case 5: theText="The destruction of Sodom and Gomorrah, Abraham negotiates with Abimelech, Isaac is born.";break;
    case 6: theText="Sarah dies aged 127, Abraham negotiates with Hittites to purchase land to bury her.";break;
    case 7: theText="Isaac is sent back to Haran to find a wife and returns with Rebekah.";break;
    case 8: theText="Abraham marries Keturah and has other children but appoints Isaac his heir. The last part of his life is spent uneventfully at Mamre.";break;
    case 9: theText="Abram is born and grows up in Ur. His brother Haran dies there.";break;
    case 10:theText="Abram lives in Haran with other family members. After a time, Abram's father Terah dies there.";break;
    case 11:theText="Abram lives at Beersheba.";break;
    case 12:theText="Isaac lives and grows up with his family at Mamre.";break;
    case 13:theText="Isaac goes back to Haran at 40 years of age to find a wife, and returns with Rebekah to Mamre.";break;
    case 14:theText="Isaac lives at Mamre. At age 60 Rebekah gives birth to Esau and Jacob.";break;
    case 15:theText="Because of famine, Isaac and Rebekah move to Gerar and deal with Abimelech.";break;
    case 16:theText="Isaac and Rebekah return to Beersheba. At some point Rebekah dies during these years.";break;
    case 17:theText="Isaac continues to live at Beersheba until his death, when he is buried by his sons.";break;
    case 18:theText="Ishmael is born to Hagar when Sarah apparently cannot have children. He lives with Abraham until after Isaac is weaned, at which point he and his mother are sent away.";break;
    case 19:theText="At age 40, Esau marries two Hittite women, Judith and Basemath. This becomes a source of grief for Isaac and Rebekah.";break;
    case 20:theText="Jacob is sent to Haran to find a wife. He ends up working for Laban for 20 years, 7 each in order to marry Rachel and Leah and 6 for ownership of flocks.";break;
    case 21:theText="Jacob returns to Canaan and is reconciled to Esau. The two brothers bury Isaac together. Rachel dies in childbirth. He believes Joseph has been killed.";break;
    case 22:theText="Jacob remains in Canaan. At the end of this time, famine forces him to send his other sons to Egypt where they discover Joseph alive and are reconciled to him..";break;
    case 23:theText="Jacob moves with his family to Egypt and lives the remainder of his life in Goshen.";break;
    case 24:theText="Joseph grows up in Haran first and then Canaan (from age 6). In his teens he starts to have prophetic dreams that offend his brothers.";break;
  }
  if (ieadv)
  {
    theText="<h3>Key events</h3>"+theText;
    expl.innerHTML=theText;
  }
  if (nsadv)
  { 
    exp=document.expl;
    theText="<table cellpadding=5 width=240 height=475 border=1><tr><td valign=top><font color='#006600'><h3>Key events</h3>"+theText+"</font></td></tr></table>";
    exp.document.write(theText);
    exp.document.close();
    exp.left=10;
    exp.top=75;
  } 
}

function ClearExplain()
{
  if (ieadv)
  {
    expl.innerHTML="<h3>Key events</h3>";
  }
  if (nsadv)
  { 
    document.expl.document.write("<font color='#006600'><h3>Key events</h3></font>");
    document.expl.document.close();
  } 
}

function DoPosition() {
  if (ieadv)
  {
    ap = abrahampic.style;
    ae = abrahamexpl.style;
    ip = isaacpic.style;
    ie = isaacexpl.style;
    isp = ishmaelpic.style;
    ise = ishmaelexpl.style;
    jp = jacobpic.style;
    je = jacobexpl.style;
    ep = esaupic.style;
    ee = esauexpl.style;
    jop = josephpic.style;
    joe = josephexpl.style;
    exp = expl.style;
    leg = legend.style;
    nts = notes.style;
  }
  if (nsadv)
  { 
    exp=document.expl;
    ap=document.abrahampic;
    ae=document.abrahamexpl;
    ip=document.isaacpic;
    ie=document.isaacexpl;
    isp=document.ishmaelpic;
    ise=document.ishmaelexpl;
    jp=document.jacobpic;
    je=document.jacobexpl;
    ep=document.esaupic;
    ee=document.esauexpl;
    jop=document.josephpic;
    joe=document.josephexpl;
    leg = document.legend;
    nts = document.notes;
  }
  if (ieadv||nsadv)
  {
    exp.left=10;
    exp.top=225;
    exp.width=240; 
    exp.height=475;
    exp.visibility="visible";
    leg.left=600;
    leg.top=225;
    leg.width=200; 
    leg.height=400;
    leg.visibility="visible";
    nts.top = 750;
    nts.left = 10;
    nts.visibility = "visible";
    ap.left = 250;
    ap.top = 225;
    ap.visibility = "visible";
    ae.left = 250;
    ae.top = 225;
    ae.visibility = "visible";
    ip.left = 300;
    ip.top = 225;
    ip.visibility = "visible";
    ie.left = 325;
    ie.top = 245;
    ie.visibility = "visible";
    isp.left = 350;
    isp.top = 225;
    isp.visibility = "visible";
    ise.left = 370;
    ise.top = 225;
    ise.visibility = "visible";
    jp.left = 400;
    jp.top = 225;
    jp.visibility = "visible";
    je.left = 425;
    je.top = 245;
    je.visibility = "visible";
    ep.left = 450;
    ep.top = 225;
    ep.visibility = "visible";
    ee.left = 480;
    ee.top = 225;
    ee.visibility = "visible";
    jop.left = 500;
    jop.top = 225;
    jop.visibility = "visible";
    joe.left = 525;
    joe.top = 245;
    joe.visibility = "visible";
  }
}

