xInclude('/script_x_core.js', '/script_x_event.js', '/script_x_slide.js', '/script_x_debug.js');
var slideTime = 100;
var topMargin = 200;
var myVar = null;
window.onload = function() {
//  topMargin = xPageY('content1');
  winOnResize(); // set initial position
  xAddEventListener(window, 'resize', winOnResize, false);
  xAddEventListener(window, 'scroll', winOnScroll, false);
  return;
 
  test('audioPlayer');
  xWidth('audioPlayer', 120);
  test('audioPlayer');
  xHeight('audioPlayer', 200);
  test('audioPlayer');
}

function test(sId) {
  var ele = xGetElementById(sId);
  alert(
    'xClientWidth: ' + xClientWidth() + '\n' +
    'xClientHeight: ' + xClientHeight() + '\n' +
    'style.width('+sId+'): ' + ele.style.width + '\n' +
    'xWidth('+sId+'): ' + xWidth(sId) + '\n' +
    'style.height('+sId+'): ' + ele.style.height + '\n' +
    'xHeight('+sId+'): ' + xHeight(sId) + '\n' +
    'xScrollLeft: ' + xScrollLeft() + '\n' +
    'xScrollTop: ' + xScrollTop() + '\n' +
    'xPageX('+sId+'): ' + xPageX(sId) + '\n' +
    'xPageY('+sId+'): ' + xPageY(sId) + '\n' +
    'xLeft('+sId+'): ' + xLeft(sId) + '\n' +
    'xTop('+sId+'): ' + xTop(sId) + '\n' 
  );
}

function winOnResize() {
	var pw = 700;
	var mx = ((xClientWidth() - 700) / 2);
	mx = (mx < 0) ? 0 : mx;
	mx = mx + 400;
  xMoveTo('audioPlayer', mx, topMargin);
//  xMoveTo('audioPlayer', 500, topMargin);
  xShow('audioPlayer');
  winOnScroll(); // initial slide
}
function winOnScroll() {
//  xSlideTo('audioPlayer', xLeft('audioPlayer'), xScrollTop() + topMargin, slideTime);
  xSlideTo('audioPlayer', xLeft('audioPlayer'), xScrollTop() + topMargin, slideTime);
}
function setSlideTime(st) {
  st = parseInt(st);
  if (!isNaN(st)) slideTime = st;
  return false;
}
