//
// Copyright (c) 2002 Catherine Gurdulic of Cabur Consulting.  
// Permission granted to use and modify this script so long as the
// copyright above is maintained, modifications are documented, and
// credit is given.
//

  browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || 
            ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )))

  if (browser) {
    off = new MakeArray(10)
    on = new MakeArray(10)
    blurb = new MakeArray(11)
    name = "link"

    off[1].src = "/images/off_about.gif"
    off[2].src = "/images/off_sale.gif"
    off[3].src = "/images/off_buy.gif"
    off[4].src = "/images/off_sell.gif"
    off[5].src = "/images/off_jargon.gif"
    off[6].src = "/images/off_mortgage.gif"
    off[7].src = "/images/off_services.gif"
    off[8].src = "/images/off_resources.gif"
    off[9].src = "/images/off_contact.gif"

    on[1].src = "/images/on_about.gif"
    on[2].src = "/images/on_sale.gif"
    on[3].src = "/images/on_buy.gif"
    on[4].src = "/images/on_sell.gif"
    on[5].src = "/images/on_jargon.gif"
    on[6].src = "/images/on_mortgage.gif"
    on[7].src = "/images/on_services.gif"
    on[8].src = "/images/on_resources.gif"
    on[9].src = "/images/on_contact.gif"

    blurb[1] = "Colette Cooper - Judy Marsales Sales Representative"
    blurb[2] = "Properties For Sale"
    blurb[3] = "Buying Your Next Property"
    blurb[4] = "Selling Your Property"
    blurb[5] = "Realtor \'Jargon\' Explained"
    blurb[6] = "Mortgage Information"
    blurb[7] = "Accompanying Services"
    blurb[8] = "Resources"
    blurb[9] = "Contact Information"
    blurb[10] = ""
  }

  function MakeArray(n) {
    this.length = n

    for (var i = 1; i<=n; i++) {
      this[i] = new Image()
    }

    return this
  }

  function over(num) {
    if ( browser) { 
      document [name + num].src = on[num].src
      window.status = blurb[num]
    }
  }

  function out(num,current) {
    if ( browser) {
      if (num!=current) {
        document [name + num].src = off[num].src
        window.status = blurb[10]
      }
    }                   
  }

  function openWin(image_name,img_width,img_height) {
    img_width = img_width + 15;
    img_height = img_height + 15;
    var new_window = window.open(image_name,'LargeImage','height='+img_height+',width='+img_width+'');
    new_window.focus();
  }

  function setVariables() {
    if (navigator.appName == "Netscape") {
      v=".top=";h=".left=";
      dS="document.";sD="";
      y="window.pageYOffset";x="window.pageXOffset";
      iW="window.innerWidth";
      iH="window.innerHeight"
    }
    else {
      h=".pixelLeft=";v=".pixelTop=";
      dS="";sD=".style";
      y="document.body.scrollTop";x="document.body.scrollLeft";
      iW="document.body.clientWidth";iH="document.body.clientHeight"
    }

    object="tothetop";
    checkLocationA()
  }

  movex=0,movey=0,xdiff=0,ydiff=0,ystart=0,xstart=0

  function checkLocation() {
//    innerX=eval(iW)-115 // place to the right
    innerX=0 // controls the horizontal from the left side of the page
    innerY=eval(iH)-30 // place at the bottom
    // innerY=0 // controls the verticle from the top of the page

    if (document.layers) { innerY-=0;innerX-=0 }
    yy=eval(y);
    xx=eval(x);
    ydiff=ystart-yy;
    xdiff=xstart-xx;
    if ((ydiff<(-1))||(ydiff>(1))) movey=Math.round(ydiff/10),ystart-=movey
    if ((xdiff<(-1))||(xdiff>(1))) movex=Math.round(xdiff/10),xstart-=movex

    N=(document.layers)?1:0
    V=(N) ? 4:5
    if (V==4) {
      eval(dS+object+sD+v+(ystart+innerY));
      eval(dS+object+sD+h+(xstart+innerX));
      //eval(dS + objectX + sD + v + y);
    }
    else {
      object=document.getElementById('tothetop')
      object.style.top=ystart+innerY-0
      object.style.left=xstart+innerX-0
    }

    setTimeout("checkLocation()",10)
  }

  function checkLocationA() {
    ystart=eval(y);xstart=eval(x);
  }


  function floor(number) {
    return Math.floor(number*Math.pow(10,2))/Math.pow(10,2);
  }

  function dosum() {
    var mi = document.temps.IR.value / 1200;
    var base = 1;
    var mbase = 1 + mi;
    for (i=0; i<document.temps.YR.value * 12; i++) {
      base = base * mbase
    }
    document.temps.PI.value = floor(document.temps.LA.value * mi / ( 1 - (1/base)))
    document.temps.MT.value = floor(document.temps.AT.value / 12)
    document.temps.MI.value = floor(document.temps.AI.value / 12)
    var dasum = document.temps.LA.value * mi / ( 1 - (1/base)) + document.temps.AT.value / 12 + document.temps.AI.value / 12;
    document.temps.MP.value = floor(dasum);
  }

