 /*************************************************************************
  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!
*************************************************************************/
var glideLyrs = new Array();

function initGlideLayers() {
  var i, el;
  
  // Set up your layers here
  // arguments: id, amount to be visible (left), top, width, height
  // duration of glide onscroll, accel (-1 to 1, -1 decelerates)
	glideLyrs[0] = new Glider('glideDivEditionPageTop', getWinWidth()-1, 40, 29, 21, 0, -1); // Top-Corner
	glideLyrs[1] = new Glider('glideDivAdministration', getWinWidth(), 320, 29, 225, 0, -1); // Bottom
	glideLyrs[2] = new Glider('glideDivEditionPage', getWinWidth(), 61, 29, 260, 0, -1); // Top
	glideLyrs[3] = new Glider('glideDivAdministrationTop', getWinWidth()-1, 545, 29, 21, 0, -1); // Bottom-Corner

	for (i=0; glideLyrs[i]; i++) {
		glideLyrs[i].x = glideLyrs[i].x-29 ;
		glideLyrs[i].xOff =  glideLyrs[i].x ;
    }
    
  initGlideLayersFinal(glideLyrs);
 }
 
 
 function initGlideLayersFinal(glideLyrs)
 { 
  for (i=0; glideLyrs[i]; i++) {
		// hold amount to be left visible 
		glideLyrs[i].xOff = getWinWidth() - glideLyrs[i].w;
		if ( !glideLyrs[i].y ) // position based on previous glideLyrs height and position
			if ( glideLyrs[i-1] ) 
				glideLyrs[i].y = glideLyrs[i-1].y + glideLyrs[i-1].h + 2;	
				glideLyrs[i].shiftTo( glideLyrs[i].xOff, glideLyrs[i].y );
				glideLyrs[i].show();
    el = dynObj.getElemRef( glideLyrs[i].id );	
    if (el) {      
      el.onclick = slideIntoView;      
      if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("MSIE 7") != -1) {        
        el.ondblclick = slideIntoView;
      }
    }
  }  
}


function slideIntoView() {
  var glideLyr = dynObj.getInstance(this.id);  
  var el = dynObj.getElemRef(glideLyr.id);
	if (glideLyr.id == "glideDivAdministration") {	 
	  if (glideLyr.w == 29) {
		  el.style.width = 103;
		  glideLyr.w = 103;
		  glideLyr.slideTo(getWinWidth()-glideLyr.w, null, 250, -.9,null);
		  el.style.overflow = "visible";
	  } else { 
  		  glideLyr.w = 29;
		  glideLyr.slideTo(getWinWidth()-glideLyr.w, null, 300, -.9,null);
		  el.style.width = 29;
		  el.style.overflow = "hidden";
	  }	
	} else if (glideLyr.id == "glideDivEditionPage") {
	  if (glideLyr.w == 29) {
		  el.style.width = 103;
 		  glideLyr.w = 103;
		  glideLyr.slideTo(getWinWidth()-glideLyr.w, null, 250, -.9,null);
		   el.style.overflow = "visible";
	  } else {		  
   		  glideLyr.w = 29;
		  glideLyr.slideTo( getWinWidth()-glideLyr.w, null, 300, -.9,null);
		  el.style.width = 29;
		  el.style.overflow = "hidden";
	  }
	} else {
		glideLyr.slideTo(getWinWidth()-glideLyr.w, null, 250, -.9,null);
	}

}

function slideOutOfView(e) {
  var glideLyr = dynObj.getInstance(this.id);
	e = e? e: window.event;
  var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
  if ( toEl != glideLyr.el && !contained(toEl, glideLyr.el) )	  
	glideLyr.slideTo( -(glideLyr.w - glideLyr.xOff), null, 300, -.9);
}
  
// returns true if oNode is contained by oCont (container)
function contained(oNode, oCont) {
  if (!oNode) return; // in case alt-tab away while hovering (prevent error)
  while ( oNode = oNode.parentNode ) if ( oNode == oCont ) return true;
  return false;
}






/*
		dw_glider.js - requires dw_lib.js
		glide to maintain window location on scroll
		version date: September 2003 

		This code is from Dynamic Web Coding at www.dyn-web.com
    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.	
    
    Resources: ypChaser by Aaron Boodman (www.youngpup.net)
    DHTML chaser tutorial at DHTML Lab - www.webreference.com/dhtml		
*/

Glider.holder = [];
function Glider(id,x,y,w,h,d,ac) {
	
	this.glideDur = d || 1000; this.origX = x; this.origY = y; this.ac = -ac || 0;
	this.baseObj = dynObj;
	this.baseObj(id,x,y,w,h);
  Glider.holder[Glider.holder.length] = this;
  if (!Glider.winHt) Glider.winHt = getWinHeight();
}
Glider.prototype = new dynObj;
Glider.prototype.onGlideInit = function () {}

Glider.prototype.checkGlider = function() {
	var destY = getScrollY() + this.origY;
	if (destY != this.y) {
		if (destY != this.dy) {
			this.dy = destY;
			this.glideInit();
      this.onGlideInit();
		} 
		this.glide();
	}
}

Glider.prototype.glideInit = function() {
	this.gt = new Date().getTime();
	var distY = this.dy - this.y;
	if ( Math.abs(distY) > Glider.winHt ) {	// distance greater than window height?
		this.gsy = (distY > 0)? this.dy - Glider.winHt: this.dy + Glider.winHt;
	} else this.gsy = this.y;
  this.g_yc1 = this.gsy + ( (1+this.ac) * (this.dy - this.gsy)/3 );
	this.g_yc2 = this.gsy + ( (2+this.ac) * (this.dy - this.gsy)/3 );
}

Glider.prototype.glide = function() {
	var elapsed = new Date().getTime() - this.gt;
  if (elapsed < this.glideDur) {
    var y = dw_Bezier.getValue( elapsed/this.glideDur, this.gsy, this.dy, this.g_yc1, this.g_yc2 );
    this.shiftTo(null,y);
  } else this.shiftTo(null,this.dy);
}

Glider.control = function() {
  for (var i=0; Glider.holder[i]; i++) {
    var curObj = Glider.holder[i];
    if (curObj) curObj.checkGlider();
  }
}
//Glider.timer = setInterval("Glider.control()",20);
dw_Animation.add(Glider.control);

// returns height of window
function getWinHeight() {
	var winHt = 0;
	if (window.innerHeight) winHt = window.innerHeight-18;
	else if (document.documentElement && document.documentElement.clientHeight) 
		winHt = document.documentElement.clientHeight;
	else if (document.body && document.body.clientHeight) 
		winHt = document.body.clientHeight;
	return winHt;
}	

function getWinWidth() {
	var winWt = 0;
	if (window.innerWidth) winWt = window.innerWidth-18;
	else if (document.documentElement && document.documentElement.clientWidth) 
		winWt = document.documentElement.clientWidth;
	else if (document.body && document.body.clientWidth) 
		winWt = document.body.clientWidth;
	return winWt;
}

// returns amount of vertical scroll
function getScrollY() {
	var sy = 0;
	if (document.documentElement && document.documentElement.scrollTop)
		sy = document.documentElement.scrollTop;
	else if (document.body && document.body.scrollTop) 
		sy = document.body.scrollTop; 
	else if (window.pageYOffset)
		sy = window.pageYOffset;
	else if (window.scrollY)
		sy = window.scrollY;	
	return sy;	
}

// onresize, get window height
if (window.addEventListener) {
  window.addEventListener("resize", function(){ initGlideLayersFinal(glideLyrs); }, "false");
  
} else if (window.attachEvent) {
  window.attachEvent("onresize", function(){ initGlideLayersFinal(glideLyrs); } );
}