
// James-Newton-Howard.com Album Scroller - Emile Brinkman - © 2005


albumNames = new Array( "Nanny McPhee & The Big Bang (2010)",
						"Duplicity (2009)", "Confessions of a Shopaholic (2009)", "Defiance (2008)", "The Dark Knight (2 CD Special Edition, 2008)", 
                        "The Dark Knight (2008)", "The Happening (2008)", "The Great Debaters (2007)", "I Am Legend (2007)", "Charlie Wilson's War (2007)", 
                        "The Water Horse: Legend of the Deep (2007)", "Michael Clayton (2007)", "The Lookout (2007)", "Blood Diamond (2006)", 
                        "Blood Diamond (Academy Promo, 2006)", "Lady in the Water (2006)", "Freedomland (2006)", "King Kong (2005)", 
                        "Batman Begins (co-composer, 2005)", "The Interpreter (2005)",
                        "Collateral (co-composer, 2004)", "The Village (2004)", "Hidalgo (2004)", "Peter Pan (2003)",
                        "Peter Pan (Academy promo, 2003)", "Dreamcatcher (2003)", "Treasure Planet (2002)",
                        "The Emperor's Club (2002)", "Signs (2002)", "America's Sweethearts (2001)",
                        "Atlantis: The Lost Empire (2001)", "Atlantis: The Lost Empire (Academy promo, 2001)",
                        "Vertical Limit (2000)", "Unbreakable (2000)", "Dinosaur (2000)",
                        "Snow Falling on Cedars (1999)", "Mumford (1999)", "The Sixth Sense (1999)",
                        "The Sixth Sense (bootleg, 1999)", "Stir of Echoes (1999)", "A Perfect Murder (1998)",
                        "The Postman (1997)", "Devil's Advocate (1997)", "My Best Friend's Wedding (songs, 1997)",
                        "My Best Friend's Wedding (Academy promo, 1997)", "My Best Friend's Wedding (bootleg, 1997)",
                        "Liar Liar (theme, 1997)", "Dante's Peak (co-composer, 1997)", "The Sentinel (theme TV-series, 1997)",
                        "One Fine Day (songs, 1996)", "One Fine Day (bootleg, 1996)", "Space Jam (score, 1996)",
                        "Space Jam (songs, 1996)", "The Trigger Effect (bootleg, 1996)", "Primal Fear (1996)",
                        "Restoration (1995)", "Waterworld (1995)", "French Kiss (songs, 1995)", "French Kiss (bootleg, 1995)",
                        "Outbreak (1995)", "Just Cause (1995)", "Junior (1994)", "Junior (CD single, 1994)",
                        "Theme from ER (promo, 1994)", "ER (theme TV-series, 1994)", "Wyatt Earp (1994)",
                        "Intersection (1994)", "The Saint of Fort Washington (1993)", "The Fugitive (2-CD set, 1993)", "The Fugitive (1993)",
                        "Dave (1993)", "Falling Down (bootleg, 1993)", "Alive (1993)",
                        "Night and the City (songs, 1992)", "Glengarry Glen Ross (1992)", "Diggstown (1992)",
                        "Grand Canyon (1991)", "The Prince of Tides (1991)", "My Girl (songs, 1991)",
                        "The Man in the Moon (1991)", "Dying Young (1991)", "Guilty by Suspicion (1991)",
                        "King Ralph (bootleg, 1991)", "Three Men and a Little Lady (1990)",
                        "Marked for Death (songs, 1990)", "Flatliners (bootleg, 1990)", "The Package (1989)",
                        "Major League (songs, 1989)", "Tap (songs, 1989)", "Everybody's All-American (songs, 1988)", 
                        "Off Limits (1988)", "Promised Land (1987)", "Russkies (1987)", "Russkies (LP, 1987)", "Five Corners (1987)",
                        "Wildcats (LP songs, 1986)", "The Film Music of James Newton Howard (compilation promo, 2001)",
                        "Suites and Themes (compilation bootleg, 1998)",
                        "The Sheffield Drum & Track Disc (instrumental pop album - XRCD, 2004)",
                        "James Newton Howard & Friends (instrumental pop album - XRCD, 2004)",
                        "James Newton Howard & Friends (instrumental pop album - Golden edition, 1995)",
                        "The Sheffield Drum & Track Record (instrumental pop album, 1990)",
                        "James Newton Howard & Friends (instrumental pop album, 1984)",
                        "China (pop songs LP, 1977)", "James Newton Howard (bootleg solo LP, 1976)",
                        "James Newton Howard (solo LP, 1974)" );

albumFiles = new Array( "nannymcphee",
						"duplicity", "confessionsofashopaholic", "defiance", "darkknight_2cd", "darkknight", "happening", 
                        "greatdebaters", "iamlegend", "charliewilsonswar", "waterhorse", "michaelclayton", "lookout", 
                        "blooddiamond", "blooddiamondpromo", "ladyinthewater", "freedomland", "kingkong", "batmanbegins", "interpreter", 
                        "collateral", "village", "hidalgo", "peterpan", "peterpanpromo", "dreamcatcher",
                        "treasureplanet", "emperorsclub", "signs", "americassweethearts", "atlantis",
                        "atlantispromo", "verticallimit", "unbreakable", "dinosaur", "snowfallingoncedars",
                        "mumford", "sixthsense", "sixthsenseboot", "stirofechoes", "perfectmurder", "postman",
                        "devilsadvocate", "mybestfriendswedding", "mybestfriendsweddingpromo", "mybestfriendsweddingboot",
                        "liarliar", "dantespeak", "sentinel", "onefineday", "onefinedayboot", "spacejam",
                        "spacejam_songs", "triggereffectboot", "primalfear", "restoration", "waterworld",
                        "frenchkiss", "frenchkissboot", "outbreak", "justcause", "junior", "junior_single",
                        "erpromo", "er", "wyattearp", "intersection", "saintoffortwashington", "fugitive_2cd", "fugitive",
                        "dave", "fallingdownboot", "alive", "nightandthecity", "glengarryglenross", "diggstown",
                        "grandcanyon", "princeoftides", "mygirl", "maninthemoon", "dyingyoung", "guiltybysuspicion",
                        "kingralphboot", "threemenandalittlelady", "markedfordeath", "flatlinersboot", "package", 
                        "majorleague", "tap", "everybodysallamerican", "offlimits", "promisedland", "russkies", "russkies_lp",
                        "fivecorners", "wildcats_lp", "filmmusicofjnh", "suitesandthemes", "drumtrackdisc",
                        "jnhandfriends_xrcd", "jnhandfriendsgold", "drumtrackrecord", "jnhandfriends", "china_lp",
                        "jnh1976_lp", "jnh1974_lp" );

function writeAScode()
{
  var HTMLcode = "";
  HTMLcode += "<div id='motioncontainer' style=\"position: relative; width: 580px; height: 140px; left: 0; " +
              "overflow: hidden; background-color: #000; background-image: url('images/smallcovers/bb_background2.jpg'); " +
              "border: 1px solid #333\">" +
              "  <div id='motiongallery' style='position:absolute;left:0;top:20;white-space: nowrap;'>" +
              "  <nobr>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

  for (i = 0; i < albumFiles.length; i++)
  {
    HTMLcode += "  <a href='" + albumFiles[i] + ".html' onmouseover=\"document.all." + albumFiles[i] + ".style.display='inline';hover(1);return true\" " +
                "  onmouseout=\"document.all." + albumFiles[i] + ".style.display='none';hover(0);return true\" onclick=\"hover(0)\">" +
                "  <img src='images/smallcovers/" + albumFiles[i] + ".jpg' style='margin-right:75px' width='100' height='100'></a>";
  }

  HTMLcode += "  </div>" +
              "</div>" +
              "<div id='textframe' style='position: relative; width: 580px; height: 34px; background-color: #262020; text-align: center; font-weight: bold; padding-top: 6px'>" +
              "  <span id='loading' style='display: block; font-weight:normal'>Loading images... in a moment you can scroll and click the booklets with your mouse</span>";

  for (i = 0; i < albumNames.length; i++)
  {
    HTMLcode += "  <span id='" + albumFiles[i] + "' style='display: none;'>" + albumNames[i] + "</span>";
  }

  HTMLcode += "</div>";

  document.write(HTMLcode);

  // Firefox bug correction
  if (navigator.userAgent.indexOf('Firefox') != -1)
    document.getElementById('textframe').style.height = 28;
}

function hover(action)
{
  if (action == 1)
    window.status = 'click to go to the album page';
  else
    window.status = '';
}


var restarea = 10;
var maxspeed = 10;

var iedom = document.all || document.getElementById;
var scrollspeed = 0;
var movestate = "";

if (iedom)
  document.write('<span id="temp" style="visibility: hidden; position: absolute; top: -100; left: -30000"></span>');

var actualwidth = "";
var cross_scroll, ns_scroll;
var loadedyes = 0;

function ietruebody()
{
  return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}

function getposOffset(what, offsettype)
{
  var totaloffset = (offsettype=="left") ? what.offsetLeft : what.offsetTop;
  var parentEl = what.offsetParent;
  while (parentEl != null)
  {
    totaloffset = (offsettype=="left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
    parentEl = parentEl.offsetParent;
  }
  return totaloffset;
}


function moveleft()
{
  if (loadedyes)
  {
    movestate = "left";
    if (iedom && parseInt(cross_scroll.style.left) > (menuwidth-actualwidth))
      cross_scroll.style.left = parseInt(cross_scroll.style.left) - scrollspeed + "px";
  }
  lefttime = setTimeout("moveleft()", 10)
}

function moveright()
{
  if (loadedyes)
  {
    movestate = "right";
    if (iedom && parseInt(cross_scroll.style.left) < 0)
      cross_scroll.style.left = parseInt(cross_scroll.style.left) + scrollspeed + "px";
  }
  righttime = setTimeout("moveright()", 10);
}

function motionengine(e)
{
  var dsocx = (window.pageXOffset) ? pageXOffset : ietruebody().scrollLeft;
  var dsocy = (window.pageYOffset) ? pageYOffset : ietruebody().scrollTop;
  var curposy = window.event ? event.clientX : e.clientX ? e.clientX : "";
  curposy -= mainobjoffset - dsocx;
  var leftbound = (menuwidth - restarea)/2;
  var rightbound = (menuwidth + restarea)/2;
  if (curposy > rightbound)
  {
    scrollspeed = (curposy-rightbound)/((menuwidth-restarea)/2) * maxspeed;
    if (window.righttime)
      clearTimeout(righttime);
    if (movestate != "left")
      moveleft();
  }
  else if (curposy < leftbound)
  {
    scrollspeed = (leftbound-curposy)/((menuwidth-restarea)/2) * maxspeed;
    if (window.lefttime)
      clearTimeout(lefttime);
    if (movestate != "right")
      moveright();
  }
  else
    scrollspeed = 0;
}

function contains_ns6(a, b)
{
  while (b.parentNode)
    if ((b = b.parentNode) == a)
      return true;
    return false;
}

function stopmotion(e)
{
  if ((window.event&&!crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget)))
  {
    if (window.lefttime)
      clearTimeout(lefttime);
    if (window.righttime)
      clearTimeout(righttime);

    movestate = "";
  }
}

function fillup()
{
  if (iedom)
  {
    crossmain = document.getElementById ? document.getElementById("motioncontainer") : document.all.motioncontainer;
    menuwidth = parseInt(crossmain.style.width);
    mainobjoffset = getposOffset(crossmain, "left");
    cross_scroll = document.getElementById ? document.getElementById("motiongallery") : document.all.motiongallery;
    document.getElementById("temp").innerHTML = cross_scroll.innerHTML;
    actualwidth = document.all ? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth;

    if (!window.opera)
      document.getElementById("temp").style.display = "none";

    crossmain.onmousemove = function(e)
    {
      motionengine(e);
    }

    crossmain.onmouseout = function(e)
    {
      stopmotion(e);
    }
   }
   loadedyes = 1;

   cross_scroll.style.left = parent.pos;
   if (document.all)
     document.all.loading.style.display = "none";
   else
     document.getElementById("loading").style.display = "none";

}

function cachePos()
{
  parent.pos = cross_scroll.style.left;
}

window.onload = fillup;
window.onunload = cachePos;

