/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2002-4 by Sharon Paine 
  See Terms of Use at 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!
*************************************************************************/

// 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

function initGlideLayers() {
	var glideLyrs = new Array();
  
	// Set up your layers here
	// arguments: id, left=0 (offset calculated based on width), top
	glideLyrs[0] = new dynObj('glideDiv0', 60, 0);
	glideLyrs[1] = new dynObj('glideDiv1', 162, 0);
	glideLyrs[2] = new dynObj('glideDiv2', 264, 0);
	glideLyrs[3] = new dynObj('glideDiv3', 366, 0);
 
	for (var i=0; glideLyrs[i]; i++) {
		// hold original left position 
		glideLyrs[i].yOff = -(0);
		glideLyrs[i].shiftTo( glideLyrs[i].xOff, glideLyrs[i].y );
		glideLyrs[i].show();
	}
	//slideEm('glideDiv0'); // Slide first one into view 
}

var curGlideLyr;
function slideEm(id) {
	var oldLyr, newLyr;
	// if link for current layer clicked, slide it out of view 
	if (curGlideLyr == id) { 
		oldLyr = dynObj.getInstance(curGlideLyr);
		oldLyr.slideTo( null, oldLyr.yOff, slide_out_speed, -1);
		curGlideLyr = ""; return; 
	}
	// if layer currently in view, set up to slide new one into view
	// after current one slides away
	if (curGlideLyr) {
    oldLyr = dynObj.getInstance(curGlideLyr);
		oldLyr.onSlideEnd = function() { 
			dynObj.holder[curGlideLyr].slideTo( null, 215, slide_in_speed, -1); 
			this.onSlideEnd = function() { if (this.el) this.el = null } 
		}
		// slide current layer out of view
		oldLyr.slideTo(null, oldLyr.yOff, slide_out_speed, -1);
	}
	else { 
		// if no layer currently in view
	    newLyr = dynObj.getInstance(id);
	    newLyr.slideTo(null, 260, slide_in_speed, -1);
	}
	curGlideLyr = id;
}