/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2001-4 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

var wndo = [];
var last_td = 0;


// Necessary to avoid errors before page loaded 
function dw_startScroll(num, dir, sp) {
  if ( wndo[num] && wndo[num].startScroll ) wndo[num].startScroll(dir, sp);
}

function dw_stopScroll(num) {
  if ( wndo[num] && wndo[num].stopScroll ) wndo[num].stopScroll();
}

function dw_loadLayer(num, id, cntId) {
  if ( wndo[num] && wndo[num].loadLayer ) wndo[num].loadLayer(id, cntId);
}

// increase speed onmousedown of scroll links
function dw_doubleSpeed(num) {
  if ( wndo[num] && wndo[num].speed ) wndo[num].speed *= 2;
}

function dw_resetSpeed(num) {
  if ( wndo[num] && wndo[num].speed ) wndo[num].speed /= 2;
}

function change_back_td(butt_id)
{
  if (last_td != 0)
  {
    // resetta il colore di sfondo dell'elemento attivo 
    // riallinea il contenuto a sinistra
    butt_name = document.getElementById(last_td);
    // butt_name = eval("document.all." + last_td);
    butt_name.bgColor = '';
  }

  // setta il colore di sfondo dell'elemento nuovo
  // allinea il contenuto a destra
  butt_name = document.getElementById(butt_id);
  butt_name.bgColor = '#790000';
  last_td = butt_id;
} 

// carica il layer ly_id e cambia il fondo della cella (td) td_id
function load_ly_and_change(num, ly_id, td_id)
{
  change_back_td(td_id);
  dw_loadLayer(num, ly_id);
} 


// carica la pagina htm_name nel frame frame_name e cambia il fondo della cella (td) td_id
function load_htm_and_change(frame_name, htm_name, td_id)
{
  change_back_td(td_id);
  load_to_frame(frame_name, htm_name)
} 

function init_td_marker(td_id)
{
  last_td = 0;
  change_back_td(td_id);
} 

function initScrollLayer(ly_name, butt_name) 
{
  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
  // if horizontal scrolling, id of element containing scrolling content (table?)
  wndo[0] = new dw_scrollLayer('wn', ly_name);
  
  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
  // wndo.bSizeDragBar = false;
  
  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
  // (x/y offsets of dragBar in track)
  wndo[0].setUpScrollbar("dragBar", "track", "v", 1, 1);
  
  if (butt_name != 'void')
  {
     last_td = 0;
     change_back_td(butt_name);
  }
}

/*************************************************************************
  This code is from Dynamic Web Coding 
  at http://www.dyn-web.com/
  Copyright 2002-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  Permission granted to use this code 
  as long as this entire notice is included.
*************************************************************************/

// change speed of slide here
var slide_in_speed = 600;	// millisecond duration of slide into view
var slide_out_speed = 500;// millisecond duration of slide out of view


var curGlideLyr;
function slideEm(id, xvalue) {
  var oldLyr, newLyr;
	if (curGlideLyr == id)
        {
           slideOut(xvalue); // if same link
           return;
        }
	// if layer currently in view, set up to slide new one into view
	// after current one slides away
	// set up onGlideEnd to discard ref
	if (curGlideLyr) {
    oldLyr = dynObj.getInstance(curGlideLyr);
    newLyr = dynObj.getInstance(id);
		oldLyr.onSlideEnd = function() { 
			dynObj.holder[curGlideLyr].slideTo(xvalue, null, slide_in_speed, -1); 
			dynObj.holder[curGlideLyr].onSlideEnd = function() { dynObj.holder[curGlideLyr].el = null; } 
		}
		// slide current layer out of view
		oldLyr.slideTo(oldLyr.xOff, null, slide_out_speed, -1);
	} else { 	// if no layer currently in view
    newLyr = dynObj.getInstance(id);
    newLyr.slideTo(xvalue, null, slide_in_speed, -1);
  }
  curGlideLyr = id;
}


function slideOut(xvalue) {
  var oldLyr;
	
  if (curGlideLyr) {
    oldLyr = dynObj.getInstance(curGlideLyr);
		oldLyr.onSlideEnd = function() { 
			dynObj.holder[curGlideLyr].slideTo(xvalue, null, slide_in_speed, -1); 
			dynObj.holder[curGlideLyr].onSlideEnd = function() { dynObj.holder[curGlideLyr].el = null; } 
		}
		// slide current layer out of view
		oldLyr.slideTo(oldLyr.xOff, null, slide_out_speed, -1);
  } 
  curGlideLyr = 0;
}




