/*

DHTML SCROLLER v4.0 RC (c) 2001-2006 Angus Turnbull, http://www.twinhelix.com
Altering this notice or redistributing this file is prohibited.

*/



// *** SCROLLER OBJECT SETUP AND LOADING CONTENT ***
var content = new DHTMLScroller('content', 'products_list.html');

// *** SCROLLER LAYOUT AND CUSTOMISATION ***

// Once we have created a scroller object, we tell it the names of the relevant divs in the page
// we want it to use. This is accomplished by adding 'ScrDiv()' objects to an array:
//
// divs[n] = new ScrDiv('ID-of-div', 'Left', 'Top', 'Width', 'Height', Visibility, 'Parent');
//
// As you can see, the second through to fourth parameters are the positions and dimensions of
// the divs. They can be strings containing JavaScript expressions, using functions/variables to
// calculate special positions, e.g. centring or sizing with the window. All left/top positions
// are measured in pixels from the top-left corner of the document, and the div will hover over
// that area of the page. An empty string '' will not set that position/dimension.
//   The visibility parameter should be 0, 1 or 2. If 0, the div visibility will never be set
// by the script. If 1, the div will be shown, but only when the scroller content is larger than
// the scroller area. If 2, the div will always be visible.
//   The 'parent' parameter is optional and can be ignored. Only use it if you're nesting the
// scroller divs within other divs, by passing a string that when evaluated returns a reference to
// the nesting div, e.g. 'getRef("containerDivID")'

// This example uses my 'page' object, included with this script. It provides some functions,
// page.winW() and page.winH(), which return the current width and height of the window.
// These allow you to construct mathematical expressions to size or position the scroller based on
// the window dimensions, e.g. centre it, or hover it over a given point in the page somewhere.

with (content)
{
 // The first three divs you add are special! The first is the scroller area itself into which
 // files are loaded. The second is the scrollbar area, and he third is the scrollbar thumb (the
 // draggable bit). Anything after that is positioned and sized by the scroller engine on window
 // resize but does not have any special properties.

 // CONTENT: This div has an ID of 'contentOuter', is positioned at (x=50, y=50), and is
 // most of the window wide and high. If you want to centre the div, try something like:
 //divs[0] = new ScrDiv('contentOuter', 'page.winW()/2 - 300', 'page.winH()/2 - 200', '600', '400');
 divs[0] = new ScrDiv('contentOuter', '50', '50', '555', '360', 2);

 // SCROLLBAR: Positioned near the right edge of the window by setting its 'Left' position.
 divs[1] = new ScrDiv('contentBar', '589', '70', '1', '340', 2);

 // DRAGGABLE THUMB: Don't pass 'Y' or 'Height' settings, these are set automatically.
 // Visibility=1, so this will hide when scroller content is smaller than the scroller area.
 divs[2] = new ScrDiv('contentThumb', '580', '', '20', '', 1);

 // And after that, you can put in the IDs of any other divs you want to position/size.
 // These are the up and down arrow divs, positioned on resize accordingly...
 divs[3] = new ScrDiv('contentUpArrows', '580', '55', '20', '15', 2);
 divs[4] = new ScrDiv('contentDownArrows', '580', '410', '20', '15', 2);

 onload = function() { 
 var lm = getSty('loadMessage'); if (lm) lm.visibility = 'hidden'; }
}



// *** SCROLLING BY MOUSEWHEEL HANDLER - delete if you want to restore normal mousewheeling ***
var mwHandler = function(evt)
{
 evt=evt?evt:window.event;
 // You have to manually specify a scroller name in here (like 'content').
 if (evt.wheelDelta) content.scrollBy(evt.wheelDelta / (window.opera ? 3 : -3));
 else if (evt.detail) content.scrollBy(evt.detail * 12);
 return false;
};
if (window.addEventListener && !window.opera)
 window.addEventListener('DOMMouseScroll', mwHandler, false);
else window.onmousewheel = document.onmousewheel = mwHandler;



// *** SCROLLING BY KEYPRESS HANDLER - delete this too if you want ***

// This will capture keypresses and scroll up/down depending on the key code.
// You must manually specify a scroller name here ('content'), as only one can respond to keys.
/*
function scrKeyDown(evt) { with (content)
{
 if (!loaded) return;

 // Find the correct event object and property.
 var evt = evt?evt:window.event;
 var key = evt.keyCode?evt.keyCode:(evt.charCode?evt.charCode:evt.which);

 //alert(key);
 // Depending on key press (capital || lowercase || function key), scroll div.
 // Uncomment the above 'alert(key)' line to figure out your own keycodes.
 if (key==84 || key==116 || key==36) scrollTo(0);         // 'T', 't' or 'Home'
 if (key==83 || key==115 || key==33) scrollBy(0-cHeight); // 'S', 's' or 'PgUp'
 if (key==65 || key==97  || key==38) scrollBy(-10);       // 'A', 'a' or 'Up'
 if (key==90 || key==122 || key==40) scrollBy(10);        // 'Z', 'z' or 'Down'
 if (key==88 || key==120 || key==34) scrollBy(cHeight);   // 'X', 'x' or 'PgDn'
 if (key==66 || key==98  || key==35) scrollTo(divHeight); // 'B', 'b' or 'End'
}};

// Capture key presses.
if (isIE && !isOp) document.onkeydown = scrKeyDown;
else
{
 if (isNS4) document.captureEvents(Event.KEYPRESS);
 document.onkeypress = scrKeyDown;
}
*/