$(document).ready(function(){
  $("#LBPo a").mouseover(function(){
    $(this).css("border-color","#FDAF6A");
    $(this).css("background","#FFF9F3");
  });
  $("#LBPo a").mouseout(function(){
    $(this).css("border-color","#E4E4E4");
    $(this).css("background","#F9F8F8");
  });
  $("#LBArLi").click(function(){
    $("#LBArBo").toggle("slow");
  });
});
//slideshow start
window.onload = function() {
   slideshow();
};

function $1(id) {
   return document.getElementById(id);
}
function $2(tName, id) {
   return document.getElementById(id).getElementsByTagName(tName);
}
function $3(tName) {
   return document.getElementsByTagName(tName);
}

//slidshow
var myLi, myNumDiv, myNumUl, myNumLi, curElement, nextElement, slideShow, opcval, opcval2, ff;
opcval = 1;
opcval2 = 0;
function slideshow() {
   myLi = $2('li', 'fade-banner');
   myNumDiv = $1('numeric');
   myNumUl = document.createElement('ul');
   myNumDiv.appendChild(myNumUl);
   for (i = 0; i < myLi.length; i++) {
       myNumUl.innerHTML += "<li>" + (i + 1) + "</li>";
   }
   myNumLi = $2('li', 'numeric');
   myNumLi[0].className = "current";
  for (i = 0; i < myNumLi.length; i++) {
       myNumLi[i].onclick = new Function("decision('" + i + "')");
   }
   curElement = Number(myLi.length - 1);
   nextElement = Number(myLi.length - 2);
   for (i = 0; i < myLi.length - 1; i++) {
       opac(myLi[i], 0);
       myLi[i].style.zIndex = "1";
   }
   opac(myLi[myLi.length - 1], 1);
   myLi[myLi.length - 1].style.zIndex = "2";
   slideShow = setInterval('fade()', 5000);
}
function fade() {
   myNumLi[((myLi.length - 1) - curElement)].className = "";
   myNumLi[((myLi.length - 1) - nextElement)].className = "current";
   var c = setInterval(function() {
       gonextimage();
       if (opcval <= 0) {
           fixedposition();
           clearInterval(c);
           if (curElement == 0) { curElement = myLi.length - 1; } else { curElement = curElement - 1; }
           if (nextElement == 0) { nextElement = myLi.length - 1; } else { nextElement = nextElement - 1; }
       }
   }, 20);
}
function decision(i) {
   if (opcval == 1 && ((myLi.length - 1) - i) != curElement) {
       clearInterval(slideShow);
       nextElement = (myLi.length - 1) - i;
       myNumLi[((myLi.length - 1) - curElement)].className = "";
       myNumLi[i].className = "current";
       ff = setInterval(function() {
           gonextimage();
           if (opcval <= 0) {
               fixedposition();
               clearInterval(ff);
               curElement = nextElement;
           }
       }, 20);
   }
}
function gonextimage() {
   opac(myLi[curElement], opcval);
   opac(myLi[nextElement], opcval2);
   opcval = opcval - 0.05;
   opcval2 = opcval2 + 0.05;
}
function fixedposition() {
   opac(myLi[curElement], 0);
   myLi[curElement].style.zIndex = "1";
   opac(myLi[nextElement], 1);
   myLi[nextElement].style.zIndex = "2";
   opcval = 1;
   opcval2 = 0;
}
function opac(obj, value) {
   obj.style.opacity = value;
   obj.style.MozOpacity = value;
   obj.style.KhtmlOpacity = value;
   obj.style.filter = "alpha(opacity=" + (value * 100) + ")";
}
//slideshow end
