// rollover: D1A103
// default: FBF8D9
// current: E5C55B

// navsides: 57c2d9
// 5289A9


var itsa = null;
var currentsubfeaturediv = null;
var lastclicked = null;
var lastfeature = null;
var ieopacity = null;

var bodytextstyle = null;
var myWidth = 0, myHeight = 0;
var fadeintimer = null;
fadeouttimer = new Array();

tutorialfiles = new Array();
tutorialtitles = new Array();
tutorialpageid = new Array();
thenextpage = 1;


// browser detect

if (typeof(window.innerWidth) == 'number')
  {
  itsa = "notie";
  }
else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
  {
  itsa = "ie6";
  }
else if (document.body && (document.body.clientWidth || document.body.clientHeight))
  {
  itsa = "oldie";
  }
else
  {
  itsa = "whatever";
  }
    
// set list style separately for IE and Mozilla

browser_version = parseInt(navigator.appVersion);
browser_type = navigator.appName;
if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4))
  {
  document.write('<link REL="stylesheet" HREF="/_styles/lists_ie.css" TYPE="text/css">');
  }

else if (browser_type == "Netscape" && (browser_version >= 4))
  {
  document.write('<link REL="stylesheet" HREF="/_styles/lists.css" TYPE="text/css">');
  }
//










    
// page layout and style
   
function repositionfooter()
  {
  // browser check

  // alert(window.innerWidth);
  document.getElementById("footertext").style.width = 300;
  document.getElementById("footertext").style.textAlign = "center";

 // determine either homepage or not homepage
  if (document.getElementById("bodytext_homepage"))
    {
    thebodyobject = document.getElementById("bodytext_homepage");
    }
  else
    {
    // alert("not homepage");
    thebodyobject = document.getElementById("bodytext");
    }
    
  // alert ("The Body Object's ID is " + thebodyobject.id);

  if (itsa == 'notie')
    {
    // alert ("Non IE!");//Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
    non_ie_reposition();
    }
  else if (itsa == "ie6")
    {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
    ie_reposition();
    }
  else if (itsa == "oldie")
    {
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
    ie_reposition();
    }
  else
    {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
    ie_reposition();
//    alert("IE 7 is disturbingly incompatible");
    }
  // window.alert( 'Width = ' + myWidth );
  // window.alert( 'Height = ' + myHeight );
  
  // determine what style object is supported in the browser

  // alert(bodytextstyle.height);
  // alert(bodytextstyle.top);

  // alert ("Bodytext Height = " + bodytextheight);
  
  // alert ("The Page Height = " + thepageheight);
  }
  
  function non_ie_reposition()
    {
    // alert("Non IE style object");
    bodytextstyle = window.getComputedStyle(thebodyobject,"");
    bodytextheight = parseInt(bodytextstyle.height);
    bodytextwidth = parseInt(bodytextstyle.width);
    bodytexttop = parseInt(bodytextstyle.top);
    bodytextleft = parseInt(bodytextstyle.left);
    footertextwidth = parseInt(document.getElementById("footertext").style.width);
    
    // alert(bodytexttop);
    // alert(bodytextleft + " " + (parseInt(bodytextwidth)) + " " + (parseInt(document.getElementById("footertext").style.width) / 2));
    // document.getElementById("featuredetails").style.left = bodytextleft + parseInt(bodytextwidth);
    // alert(document.getElementById("featuredetails").style.left);
    thepageheight = myHeight;
    thepagewidth = myWidth;
    document.getElementById("footertext").style.left = bodytextleft + (bodytextwidth / 2) - (footertextwidth / 2);

    if (parseInt(bodytextheight + bodytexttop) < thepageheight)
      {
      document.getElementById("footertext").style.top = thepageheight - 50;
      }
    else
      {
      // document.getElementById("footertext").style.position = "relative";
      document.getElementById("footertext").style.top = bodytexttop + bodytextheight + 50;
      }
    }

  function ie_reposition()
    {
    // alert("IE style object");
    bodytextstyle = thebodyobject.currentStyle;
    bodytextheight = thebodyobject.offsetHeight;
    bodytextwidth = thebodyobject.offsetWidth;
    bodytextleft = thebodyobject.offsetLeft;
    bodytexttop = thebodyobject.offsetTop;
    thepageheight = myHeight;
    thepagewidth = myWidth;
    
    // alert(bodytextleft + " " + (parseInt(bodytextwidth)) + " " + (parseInt(document.getElementById("footertext").style.width) / 2));
    // alert((bodytextleft + (bodytextwidth / 2) - (parseInt(document.getElementById("footertext").style.width) / 2)));
    document.getElementById("footertext").style.left = (bodytextleft + (bodytextwidth / 2) - (parseInt(document.getElementById("footertext").style.width) / 2));

    if (bodytextheight + bodytexttop < thepageheight)
      {
      document.getElementById("footertext").style.top = thepageheight - 30;
      }
    else
      {
      document.getElementById("footertext").style.top = bodytextheight + bodytexttop + 50;
      }
    }







// navigation

function navhover(navdiv, tooltip)
   {
   if (navdiv.id != currentpage)
      {
      navdiv.style.backgroundColor = "#D1A103";
      document.getElementById("link" + navdiv.id).style.color = "#FFFFFF";
      }
   //return overlib(tooltip);
   }

function navout(navdiv)
   {
   if (navdiv.id != currentpage)
      {
      navdiv.style.backgroundColor = "#FBF8D9";
      document.getElementById("link" + navdiv.id).style.color = "#224e6a";
      }
   //return nd();
   }
   
function navcurrent(navdiv)
   {
   currentpage = navdiv.id;
   navdiv.style.backgroundColor = "#E5C55B";
   document.getElementById("link" + navdiv.id).style.color = "#FFFFFF";
   //alert(document.getElementById("link" + navdiv.id).style.color);
   }
   
function navclick(navdiv)
   {
   window.location = document.getElementById("link" + navdiv.id).getAttribute("href");
   }
//











// dynamic FAQ page support

  function showanswer(answerid)
    {
    for (i = 1; document.getElementById("faqanswer_" + i); i++)
      {
      // alert(i);
      document.getElementById("faqanswer_" + i).style.display = "none";
      }
    document.getElementById("faqanswer_" + answerid).style.display = "block";
    }
// window.onResize = repositionfooter();












// dynamic feature page support

  function showfeature(clickedtitle)
    {
    featureid = document.getElementById(clickedtitle).parentNode.id;
    // alert(featureid);
    // alert(lastfeature);
    // alert(itsa);
    //document.getElementById(featureid).style.backgroundColor = "D1A103";
    //document.getElementById(featureid).style.color = "FFFFFF";
    if ((lastfeature != null) && (lastfeature != featureid))
      {
      if (itsa == "notie")
        {
        hidefeature(lastfeature);
        }
      else
        {
        document.getElementById("detail_" + lastfeature).style.display = "none";
        }
      }
    document.getElementById("detail_" + featureid).style.display = "block";
    //    document.getElementById("detail_" + featureid).style.backgroundColor = "D1A103";
    document.getElementById("detail_" + featureid).style.opacity = "0";
    fadeinrate = 0;
    if (itsa == "notie")
      {
      fadeintimer = window.setInterval(fadein,1,.04, featureid);
      }
    else
      {
      document.getElementById("detail_" + featureid).style.display = "block";
      }
    lastfeature = featureid;
    // alert(ieopacity);
    }

  function hidefeature(clickedtitle)
    {
    //document.getElementById(featureid).style.backgroundColor = "";
    //document.getElementById(featureid).style.color = "224e6a";
    document.getElementById("detail_" + clickedtitle).style.display = "block";
    fadeoutrate = 1;
    fadeouttimer[clickedtitle] = window.setInterval(fadeout,1,.04, clickedtitle);
    // alert (featureid);
    window.clearInterval(fadeintimer);
    // alert(ieopacity);
    }

  function fadein(rateoffade,thingtofade)
    {
    if ((fadeinrate + rateoffade) < 1)
      {
      fadeinrate = fadeinrate + rateoffade;
      // window.clearInterval(fadeintimer);
      }
    else
      {
      window.clearInterval(fadeintimer);
      // window.clearInterval(fadeouttimer[thingtofade]);
      fadeinrate = 1;
      }
    document.getElementById("detail_" + thingtofade).style.opacity = fadeinrate;
    ieopacity = "alpha(opacity=" + (fadeinrate * 10) + ")";
    document.getElementById("detail_" + thingtofade).style.filter = ieopacity;
    }

  function fadeout(rateoffade,thingtofade)
    {
    if (fadeoutrate >= rateoffade)
      {
      // alert(fadeoutrate + " " + rateoffade);
      fadeoutrate = fadeoutrate - rateoffade;
      // window.clearInterval(fadeintimer);
      }
    else
      {
      window.clearInterval(fadeouttimer[thingtofade]);
      document.getElementById("detail_" + thingtofade).style.display = "none";
      //      document.getElementById("detail_" + thingtofade).style.backgroundColor = "";
      fadeoutrate = 0;
      }
    
    document.getElementById("detail_" + thingtofade).style.opacity = fadeoutrate;
    // alert (fadeouttimer[thingtofade]);
    }
    
  function togglebranch(thingclicked)
    {
    // alert(thingclicked);
    treenodecontainerdiv = document.getElementById(thingclicked).parentNode;
    // alert(treenodecontainerdiv.id);
    // alert(currentsubfeaturediv);
    if ((currentsubfeaturediv != document.getElementById("sub" + treenodecontainerdiv.id).id) && (currentsubfeaturediv != null))
      {
      document.getElementById(currentsubfeaturediv).style.display = "none";
      document.getElementById(lastclicked).src = "/images/accents/collapsing.png";
      // alert(currentsubfeaturediv);
      }
    currentimage = document.getElementById(thingclicked).src;
    if (currentimage.indexOf("collapsing.png") == -1)
      {
      document.getElementById("sub" + treenodecontainerdiv.id).style.display = "none";
      document.getElementById(thingclicked).src = "/images/accents/collapsing.png";
      // alert(currentsubfeaturediv);
      }
    else
      {
      document.getElementById("sub" + treenodecontainerdiv.id).style.display = "block";
      document.getElementById(thingclicked).src = "/images/accents/expanding.gif";
      }
    lastclicked = thingclicked;
    currentsubfeaturediv = document.getElementById("sub" + treenodecontainerdiv.id).id;
    }

function showreleasefeature(clickedtitle)
  {
  // alert(clickedtitle);
  for (i = 1; document.getElementById("l_" + i); i++)
    {
    if ("l_" + i == clickedtitle)
      {
      document.getElementById("ril_" + i).style.display = "block";
      // alert ("'" + "l_" + i + "'");
      }
    else
      {
      document.getElementById("ril_" + i).style.display = "none";
      }
    }
  }
//










// OVERLIB tool tips
 function dotooltip(term)
  {
  // don't know if a space is allowed in the index.
  tooltiptype = term.className;
  thetooltiptext = tooltiptype + "[term.innerHTML]";
  // alert(thetooltiptext);
  return overlib(eval(thetooltiptext),ADAPTIVE_WIDTH);
  }
  
function dothumbnail(imagefilepath)
  {
  tooltiptype = "thumbnail";
  // don't know if a space is allowed in the index.
  thetooltiptext = '<img src="' + imagefilepath + '">';
  // alert(imagefilepath);
  // alert(thetooltiptext);
  return overlib(thetooltiptext,ADAPTIVE_WIDTH);
  }
  
function doimagearea(textstring)
  {
  tooltiptype = "whatsthishelp";
  // don't know if a space is allowed in the index.
  thetooltiptext = '<p class="firstchild">' + textstring + '</p>';
  // alert(imagefilepath);
  // alert(thetooltiptext);
  return overlib(thetooltiptext,ADAPTIVE_WIDTH);
  }
//

function iagree()
  {
  window.location = "/download/swapneatsetup.msi";
  }
  
function idonotagree()
  {
  window.location = "/";
  }







