// JavaScript Document
var i_index=1;	
var i_StartAutoBox=0;
var b_s=false;

function LoadBody()
{
	
	i_StartAutoBox=setInterval("StartAutoBox()",3000);
}	

function StartAutoBox()
{
	if(b_s){
	   return; }
	   else{  
	ChangeAdBox(i_index);
	i_index++;
	if(i_index==4)
	    i_index=1;	}
}

function ChangeAdBox(i_sel)
{
	var b_ie6=false
	
	if(is_ie)
	{
			var ua = navigator.userAgent.toLowerCase();
      var s = ua.match(/msie ([\d.]+)/)[1];
      if(s=="6.0")
      {
      	 b_ie6=true;
      }	

	}
	
	if(b_ie6)
	{
		
    $("bannerbg1").style.display="block";
		$("bannerbg2").style.display="block";
		$("bannerbg3").style.display="block";
    $("bannerbg11").style.display="none";
		$("bannerbg12").style.display="none";
		$("bannerbg13").style.display="none";
	  
		$("bannerbg"+i_sel).style.display="none";
		$("bannerbg1"+i_sel).style.display="block";
		
		
		
		//imgflash.filters.blendTrans.play();	
		LoadImgAd();
	  document.images.imgflash.src = eval("img"+i_sel+".src");
		//imgflash.filters.blendTrans.play();	
	}
	else
	{
		//debugger;
		var s_img= $('bannerbg'+i_sel).getAttribute("img");
			//alert(s_img);
		$('imgflash').src=s_img;//"/template/images/banner"+i_sel+".jpg";
		
		$("bannerbg1").style.backgroundImage="url('/template/images/bannerbg.png')";
		$("bannerbg2").style.backgroundImage="url('/template/images/bannerbg.png')";
		$("bannerbg3").style.backgroundImage="url('/template/images/bannerbg.png')";
		$("bannerbg"+i_sel).style.backgroundImage="url('/template/images/bannerbg"+i_sel+".png')";
			
	}
	
	if(i_sel==3)
		{
			$('divticket').style.display="";
			$('divticket2').style.display="";
			$('divticket3').style.display="";
			
		}
		else
		{
			$('divticket3').style.display="none";
			$('divticket2').style.display="none";
			$('divticket').style.display="none";
		}	
	
	$('ahrflash').href=$('bannerbg'+i_sel).getAttribute("href")
	
}
function Changemouserover(i_sel)
{
  b_s=true;
	ChangeAdBox(i_sel);
}
function Changemouseout()
{
	b_s=false;
}
function isIE() {
  if(document.all){
	     if(!window.XMLHttpRequest)
		 {
			 return false;
		 }
			 return true;
		 }
	
	return false;
} 
var img1 = new Image();
var img2 = new Image();
var img3 = new Image();
//ÇÐ»»Ê×Ò³Í¼Æ¬
function LoadImgAd()
{
		
		img1.src = $('bannerbg1').getAttribute("img");// "/template/images/banner1.jpg"; 
		
		img2.src = $('bannerbg2').getAttribute("img"); 
		
		img3.src = $('bannerbg3').getAttribute("img");
}




var imgPath='';
	Google={
		box:null,
		index:0,
		fx:function (el,to){
		var getFx=function (a,b){
		var c=Math[(a-b)>0?'floor':'ceil'];
		return function (){return [a+=c((b-a)*0.15),a-b]};
	};
	var get=getFx(el.scrollTop,to);
	clearInterval(el.timer);
	this.showPage();
	el.timer=setInterval(function(){
		var x=get();
		el.scrollTop=x[0];
		if(x[1 ]==0)clearInterval(el.timer);
		},10);
	},

	next:function (){this.nav(1)},
	prev:function (){this.nav(-1)},
	nav:function (nav){
		this.index+=nav;
		if(this.index<0)this.index=this.list.length-1;
		if(this.index==this.list.length)this.index=0;
		this.fx(this.box,this.index*60);
	},
	stop:function (){clearTimeout(this.autoTimer);},
	auto:function (){
		this.stop();
		this.autoTimer=setInterval(function(){Google.next();},2000);
	},
	showPage:function (){this.page.innerHTML=this.index+1+'/'+this.list.length},
		init:function (box,data){
			this.box=document.getElementById(box);
			//this.addElements(data);
			this.list=this.box.getElementsByTagName("dl");
			this.page=document.getElementById("page");
			this.showPage();
			this.auto();
		}
	};
	
function onmouseroverChange(id)
	{
	   if(id=="1"){
	     $("newbg1_div").style.background="url('/template/images/newbg1.gif')";
		 $("newbg2_div").style.backgroundImage="url('/template/images/newbg2.gif')";
		 $("new2").style.display="none";
		 $("new1").style.display="block";
		 Google.stop();
		 Google.init('new1',Array(10));
	   }else{
	       $("newbg1_div").style.backgroundImage="url('/template/images/newbg1over.gif')";
		 $("newbg2_div").style.backgroundImage="url('/template/images/newbg2over.gif')";
		 $("new1").style.display="none";
		 $("new2").style.display="block";
		 Google.stop();
		 Google.init('new2',Array(10));
	   }
	   
	}
function loadbox()
{
	if($('new1')==null)
		return ;
	
	if($('new1').style.diplay=="block")
	{
		Google.stop();
		Google.init('new1',Array(10));
	}else if($('new2').style.diplay=="block")
	{
		Google.stop();
		Google.init('new2',Array(10));
	}else{
		Google.stop();
		Google.init('new1',Array(10));
	}
}
