// JavaScript Document


function $(id) { return document.getElementById(id); }
function moveElement(elementID,final_x,final_y,interval) {
  if (!document.getElementById) return false;
  if (!document.getElementById(elementID)) return false;
  var elem = document.getElementById(elementID);
  if (elem.movement) {
    clearTimeout(elem.movement);
  }
  if (!elem.style.left) {
    elem.style.left = "0px";
  }
  if (!elem.style.top) {
    elem.style.top = "0px";
  }
  var xpos = parseInt(elem.style.left);
  var ypos = parseInt(elem.style.top);
  if (xpos == final_x  &&  ypos == final_y) {
  return true;
  }
  if (xpos < final_x) {
    var dist = Math.ceil((final_x - xpos)/10);
    xpos = xpos + dist;
  }
  if (xpos > final_x) {
    var dist = Math.ceil((xpos - final_x)/10);
    xpos = xpos - dist;
  }
  if (ypos < final_y) {
    var dist = Math.ceil((final_y - ypos)/10);
    ypos = ypos + dist;
  }
  if (ypos > final_y) {
    var dist = Math.ceil((ypos - final_y)/10);
    ypos = ypos - dist;
  }
  elem.style.left = xpos + "px";
  elem.style.top = ypos + "px";
  var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";
  elem.movement = setTimeout(repeat,interval);
}
function classNormal(){
 var focusBtnList = $('focus_change_btn__1').getElementsByTagName('li');
 for(var i=0; i<focusBtnList.length; i++) {
  focusBtnList[i].className='';
 }
}
function focusChange() {
 var focusBtnList = $('focus_change_btn__1').getElementsByTagName('li');
 
   focusBtnList[0].onmouseover = function() {
   moveElement('focus_change_list__1',0,0,5);
   classNormal()
   focusBtnList[0].className='current'
  }
  focusBtnList[1].onmouseover = function() {
   moveElement('focus_change_list__1',-972,0,5);
   classNormal()
   focusBtnList[1].className='current'
  }
  focusBtnList[2].onmouseover = function() {
   moveElement('focus_change_list__1',-1944,0,5);
   classNormal()
   focusBtnList[2].className='current'
  }
  focusBtnList[3].onmouseover = function() {
   moveElement('focus_change_list__1',-2916,0,5);
   classNormal()
   focusBtnList[3].className='current'
  }
  focusBtnList[4].onmouseover = function() {
   moveElement('focus_change_list__1',-3888,0,5);
   classNormal()
   focusBtnList[4].className='current'
  }
   
}

setInterval('autoFocusChange()', 5000);

function autoFocusChange() {
 var focusBtnList = $('focus_change_btn__1').getElementsByTagName('li');
 for(var i=0; i<focusBtnList.length; i++) {
  if (focusBtnList[i].className == 'current') {
   var currentNum = i;
  }
 }
 
   if (currentNum==0 ){
  moveElement('focus_change_list__1',-972,0,5);
  classNormal()
  focusBtnList[1].className='current'
 }
 if (currentNum==1 ){
  moveElement('focus_change_list__1',-1944,0,5);
  classNormal()
  focusBtnList[2].className='current'
 }
 if (currentNum==2 ){
  moveElement('focus_change_list__1',-2916,0,5);
  classNormal()
  focusBtnList[3].className='current'
 }
 if (currentNum==3 ){
  moveElement('focus_change_list__1',-3888,0,5);
  classNormal()
  focusBtnList[4].className='current'
 } 
 if (currentNum==4 ){
  moveElement('focus_change_list__1',0,0,5);
  classNormal()
  focusBtnList[0].className='current'
 }
   
}
window.onload=function(){
 focusChange();
}


document.write("<div class='banner__1'>");
document.write("<div id='focus_change_list__1' style='top:0; left:0;'>");
document.write("<ul>");

document.write("<li><img src='images/flashimg01.jpg' alt='' border='0' width='972' height='307'/></li>");
document.write("<li><img src='images/flashimg02.jpg' alt='' border='0' /></li>");
document.write("<li><img src='images/flashimg03.jpg' alt='' border='0' /></li>");
document.write("<li><img src='images/flashimg04.jpg' alt='' border='0' /></li>");
document.write("<li><img src='images/flashimg05.jpg' alt='' border='0' /></li>");

document.write("</ul>");
document.write("</div>");
document.write("<div class='focus_change_opacity__1'></div>");
document.write("<div id='focus_change_btn__1' class='bannerimg__1_5'>");
document.write("<ul>");

document.write("<li class='current'><a href='#'><img src='images/banner01_min.gif' alt='' width='90' height='34' /></a></li>");
document.write("<li><a href='#'><img src='images/banner02_min.gif' alt='' width='90' height='34' /></a></li>");
document.write("<li><a href='#'><img src='images/banner03_min.gif' alt='' width='90' height='34' /></a></li>");
document.write("<li><a href='#'><img src='images/banner04_min.gif' alt='' width='90' height='34' /></a></li>");
document.write("<li><a href='#'><img src='images/banner05_min.gif' alt='' width='90' height='34' /></a></li>");

document.write("</ul>");
document.write("</div>");
document.write("</div>");

