/*
  fe.js
*/

var X, app;
var time = 10000;
/*function window_load() {
	if (RefDiLeft.length==0) return;
	all_table.height = document.body.clientHeight;
	//alert(RefDiLeft[0][3])
	if (RefDiLeft[0][3]<=100)
		app = new xDI3(
	    "#000000", // header bg
	    "#ffffff", // col1 bg
	    "#ffffff", // col2 bg
	    "#ffffff", // footer bg
	    0,  // header height
	    0,  // footer height
	    100, // column 1 width - 116
	    0,  // vertical margin
	    0,  // horizontal margin
	    0,   // inner margin
	    10,  // divAdLeft x offset - 10
	    200-document.body.clientHeight,  // divAdLeft y offset
	    .4   // divAdLeft slide factor
		);
	else
		app = new xDI3(
	    "#000000", // header bg
	    "#ffffff", // col1 bg
	    "#ffffff", // col2 bg
	    "#ffffff", // footer bg
	    0,  // header height
	    0,  // footer height
	    100, // column 1 width - 116
	    0,  // vertical margin
	    0,  // horizontal margin
	    0,   // inner margin
	    0,  // divAdLeft x offset - 10
	    200-document.body.clientHeight,  // divAdLeft y offset
	    .4   // divAdLeft slide factor
		);
  app.paint();
  xAddEventListener(window, "resize", winResizeListener, false);
  xAddEventListener(window, "scroll", winScrollListener, false);
  if (RefDiLeft.length > 0) setTimeout("down()", time);
  if (RefDiLeft.length > 0) setTimeout("xHide('divAdLeft')", time + 1000);
  if (RefDiLeft.length > 0) setTimeout("window_load()", time*3); 
}

function down(){
	if (RefDiLeft.length==0) return;
	xSlideTo('divAdLeft', 10, xTop('divAdLeft') + 300, 1500);
}
	
window.onload = function() {
	if (RefDiLeft.length==0) return;
	window_load();
}*/

function winResizeListener() {
  if (RefDiLeft.length==0) return;
  if (document.layers) location.replace(location.href);
  else app.paint();
}
function winScrollListener() {
  if (RefDiLeft.length==0) return;
  var y = 0, st = xScrollTop();
  if (st > app.my) y = st - app.my;
  xSlideTo('divAdLeft', xLeft('divAdLeft'), y, 1500);
// menuSlide(y);
}

function xDI3(hdrBg, col1Bg, col2Bg, ftrBg, hdrHeight, ftrHeight, col1Width, vMargin, hMargin, iMargin, mXOffset, mYOffset, mSlideFactor) {
  if (RefDiLeft.length==0) return;
  // Properties
  this.hbg = hdrBg;
  this.c1bg = col1Bg;
  this.c2bg = col2Bg;
  this.fbg = ftrBg;
  this.hh = hdrHeight;
  this.fh = ftrHeight;
  this.cw = col1Width;
  this.vm = vMargin;
  this.hm = hMargin;
  this.im = iMargin;
  this.mx = mXOffset;
  this.my = mYOffset;
  this.msf = mSlideFactor;
  this.mm = false;
  this.mt = 0;
  // Methods
  this.paint = function() {
    xBackground('header', this.hbg);
    xBackground('col1', this.c1bg);
    xBackground('col2', this.c2bg);
    xBackground('footer', this.fbg);
    xBackground('bMargin', 'transparent');
    xWidth('col2', (xClientWidth()-(2*this.hm))-this.cw-this.im);
    var ch = xHeight('col2');
    var hw = xClientWidth()-(2*this.hm);
    xResizeTo('header', hw, this.hh);
    xMoveTo('header', this.hm, this.vm);
    xShow('header');
    xResizeTo('col1', this.cw, ch);
    xMoveTo('col1', this.hm, this.hh+this.vm+this.im);
    xShow('col1');
    xMoveTo('col2', xWidth('col1')+this.hm+this.im, xTop('col1'));
    xShow('col2');
    xResizeTo('footer', hw, this.fh);
    xMoveTo('footer', this.hm, xTop('col1')+ch+this.im);
    xShow('footer');
    xResizeTo('bMargin', hw, this.vm);
    xMoveTo('bMargin', this.hm, xTop('footer')+this.fh);
    xShow('bMargin');
    xWidth('divAdLeft', this.cw-(2*this.mx));
    xMoveTo('divAdLeft', this.mx, ch);
    xShow('divAdLeft');
    winScrollListener(); // initial slide of divAdLeft
  } // end paint() method
} // end class xDI3


function menuSlide(iY, iterating) {
  if (RefDiLeft.length==0) return;
  var delta, currentY;
  if (!app.mm) {app.mt = iY;}
  else if (!iterating) {
    app.mt = iY;
    return;
  }
  currentY = xTop('divAdLeft');
  app.mm = true;
  if (app.msf < 1) {
    delta = app.msf * Math.abs(Math.abs(currentY) - Math.abs(app.mt));
    if (delta < 1) delta = 1;
  }
  else {delta = app.msf;}
  if (currentY < app.mt) {
    if (currentY + delta <= app.mt) xTop('divAdLeft', currentY + delta);
    else xTop('divAdLeft', app.mt);
  }
  else if (currentY > app.mt) {
    if (currentY - delta >= app.mt) xTop('divAdLeft', currentY - delta);
    else xTop('divAdLeft', app.mt);
  }
  else {
    app.mm = false;
    return;
  }
  if (RefDiLeft.length > 0) setTimeout("menuSlide("+app.mt+","+true+")",25);
}
// end fe.js
