var mar;
var mar1;
var mar2;
var speed = 50;//the speed of scrolling 
var step = 1;
var MyMar1;
var MyMar2;
var leftHit = 0;//left click or not
var rightHit = 0;//right click or not
function bodyload(){
	mar = document.getElementById('scrollbody');
	mar1 = document.getElementById('scroll1');
	mar2 = document.getElementById('scroll2');
	mar2.innerHTML = mar1.innerHTML;
	toLeft();
	addCount();
	setTimeout("noneAds()",8000);
}
function toLeft(){
	clearLeft();
	clearRight();
	if(speed > 10){
		speed -= 10;
		step += 1;
		if (step >= 2) step = 2;
	}else{ 
		speed = 10;
	}
	if(leftHit != 0){
		if(MyMar1)
			MyMar1 = setInterval(MarqueeLeft,speed);
	}
	MarqueeLeft();
}
function toRight(){
	clearLeft();
	clearRight();
	if(speed > 10){
		speed -= 10;
		step += 1;
		if (step >= 2) step = 2;
	}else{ 
		speed = 10;
	}
	if(rightHit != 0){
		if(!MyMar2)
			MyMar2 = setInterval(MarqueeRight,speed);
	}
	MarqueeRight();
}
function MarqueeLeft(){
	if(mar2.offsetWidth-mar.scrollLeft <= 0){
		mar.scrollLeft -= mar1.offsetWidth;
	}else{
		mar.scrollLeft += step;
	}
	if(leftHit == 0){
		speed = 50;
		step = 1;
		if(!MyMar1)
			MyMar1 = setInterval(MarqueeLeft,speed);
		leftHit = 1;
		rightHit = 0;
	 }
	mar.onmouseover = function() {
		clearLeft();
		clearRight();
	}
	mar.onmouseout = function() {
		if(!MyMar1)
			MyMar1=setInterval(MarqueeLeft,speed);
	}
}
function MarqueeRight(){
	if(mar.scrollLeft <= 0){
		mar.scrollLeft = mar2.offsetWidth;
	}else{
		mar.scrollLeft -= step;
	}
	if(rightHit == 0){
		speed = 50;
		step = 1;
		if(!MyMar2)
			MyMar2=setInterval(MarqueeRight,speed);
		leftHit = 0;
		rightHit = 1;
	}
	mar.onmouseover = function() {
		clearLeft();
		clearRight();
	}
	mar.onmouseout = function() {
		if(!MyMar2)
			MyMar2 = setInterval(MarqueeRight,speed);
	}
}
function clearLeft(){
   clearInterval(MyMar1);
   MyMar1 = null;
}
function clearRight(){
   clearInterval(MyMar2);
   MyMar2 = null;
}

/*Í¼Æ¬ÇÐ»»*/

var n=0;
var showNum = document.getElementById("num");
function Mea(value){
 n=value;
 //setBg(value);
 plays(value);
 cons(value);
 }

function plays(value){
 try
 {
  with (fc)
  {
   filters[0].Apply();
   for(i=0;i<3;i++)i==value?children[i].style.display="block":children[i].style.display="none"; 
   filters[0].play(); 
  }
 }
 catch(e)
 {
  var divlist = document.getElementById("fc").getElementsByTagName("div");
  for(i=0;i<3;i++)
  {
   i==value?divlist[i].style.display="block":divlist[i].style.display="none";
  }
 } 
}
function cons(value){
 try
 {
  with (con)
  {
    for(i=0;i<3;i++)i==value?children[i].style.display="block":children[i].style.display="none";   
  }
 }
 catch(e)
 {
  var divlist = document.getElementById("con").getElementsByTagName("div");
  for(i=0;i<3;i++)
  {
   i==value?divlist[i].style.display="block":divlist[i].style.display="none";
  }  
 }
}
function clearAuto(){clearInterval(autoStart)}
function setAuto(){autoStart=setInterval("auto(n)", 5000)}
function auto(){
 n++;
 if(n>6)n=0;
 Mea(n);
} 
function sub(){
 n--;
 if(n<0)n=6;
 Mea(n);
} 
setAuto(); 
 
/*--------------------------------------------------------------------*/
function menuFix() {
    var sfEls = document.getElementById("nav").getElementsByTagName("li");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
        this.className+=(this.className.length>0? " ": "") + "sfhover";
        }
        sfEls[i].onMouseDown=function() {
        this.className+=(this.className.length>0? " ": "") + "sfhover";
        }
        sfEls[i].onMouseUp=function() {
        this.className+=(this.className.length>0? " ": "") + "sfhover";
        }
        sfEls[i].onmouseout=function() {
        this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");
        }
    }
}
window.onload=menuFix;

/*--------------------------------------------------------¶þ¼¶»ÃµÆÆ¬*/

