var getObj = function (id) {
	return "string" == typeof id ? document.getElementById(id) : id;
};

var two,twos=1;
function showtwo(id)
{
for(var i=1; i<3; i++)
{
document.getElementById("twocont"+i).style.display = "none"
document.getElementById("twonav"+i).className = ""
}
document.getElementById("twocont"+id).style.display = "block"
document.getElementById("twonav"+id).className = "on"
twos=id;
}
function adtwo()
{
stopadtwo();
showtwo(twos);
twos+=1;
if(twos==3)
{
	twos=1;
}
	two=setTimeout("adtwo()",3000);
}
function stopadtwo()
{
	clearTimeout(two);
}
function staradtwo()
{
	two=setTimeout("adtwo()",3000);
}

var adt,adf=1;
function showban(id)
{
for(var i=1; i<3; i++)
{
document.getElementById("adban"+i).style.display = "none"
}
document.getElementById("adban"+id).style.display = "block"
adf=id;
}
function adbanc()
{
stopadbanc();
showban(adf);
adf+=1;
if (adf==3)
{
	adf=1;
}
	adt=setTimeout("adbanc()",3000);
}
function stopadbanc()
{
	clearTimeout(adt);
}
function staradbanc()
{
	adt=setTimeout("adbanc()",3000);
}
			
var chartF=0;
var chartT,chartNum;
function chartOn(n){
	chartNum = getObj("chartbox").getElementsByTagName("li")
	for (i=0; i<chartNum.length; i++)
	{
		getObj("chart"+i).style.display="none";
		getObj("chartnav"+i).className="";
	}
	getObj("chart"+n).style.display="block";
	getObj("chartnav"+n).className="on";
	chartF=n;
	}
	
function chart(){
	chartNum = getObj("chartbox").getElementsByTagName("li")
	stopchartF();
	chartOn(chartF);
	chartF+=1;
	if (chartF==chartNum.length)
	{
		chartF=0;
	}
	chartT=setTimeout("chart()",3000);
	}
function stopchartF(){
	clearTimeout(chartT);
	}
function starchartF(){
	chartT=setTimeout("chart()",3000);
	}


var scrollEcCt=1;
var timerEc;
function ecNavOn(n){
	for (i=1; i<5; i++)
	{
		getObj("ecBox"+i).style.display="none";
		getObj("ecNav"+i).className="";
	}
	getObj("ecBox"+n).style.display="block";
	getObj("ecNav"+n).className="";
	scrollEcCt=n;
	}
	
function fecScroll(){
	stopEcScroll();
	ecNavOn(scrollEcCt);
	scrollEcCt+=1;
	if (scrollEcCt==5)
	{
		scrollEcCt=1;
	}
	timerEc=setTimeout("fecScroll()",3000);
	}
function stopEcScroll(){
	clearTimeout(timerEc);
	}
function starEcScroll(){
	timerEc=setTimeout("fecScroll()",3000);
	}
	
var autotime=1;
var autoplay;
function autoOn(n){
	for (i=1; i<4; i++)
	{
		getObj("autoBox"+i).style.display="none";
		getObj("autoNav"+i).className="";
	}
	getObj("autoBox"+n).style.display="block";
	getObj("autoNav"+n).className="on";
	autotime=n;
	}
	
function auto(){
	stopauto();
	autoOn(autotime);
	autotime+=1;
	if (autotime==4)
	{
		autotime=1;
	}
	autoplay=setTimeout("auto()",3000);
	}
function stopauto(){
	clearTimeout(autoplay);
	}
function starauto(){
	autoplay=setTimeout("auto()",3000);
	}

var autotimes=1;
var autoplays;
function autoOns(n){
	for (i=1; i<4; i++)
	{
		getObj("autoBoxs"+i).style.display="none";
		getObj("autoNavs"+i).className="";
	}
	getObj("autoBoxs"+n).style.display="block";
	getObj("autoNavs"+n).className="on";
	autotimes=n;
	}
	
function autos(){
	stopautos();
	autoOns(autotimes);
	autotimes+=1;
	if (autotimes==4)
	{
		autotimes=1;
	}
	autoplays=setTimeout("autos()",3000);
	}
function stopautos(){
	clearTimeout(autoplays);
	}
function starautos(){
	autoplays=setTimeout("autos()",3000);
	}


var autotimet=1;
var autoplayt;
function autoOnt(n){
	for (i=1; i<4; i++)
	{
		getObj("autoBoxt"+i).style.display="none";
		getObj("autoNavt"+i).className="";
	}
	getObj("autoBoxt"+n).style.display="block";
	getObj("autoNavt"+n).className="on";
	autotimet=n;
	}
	
function autot(){
	stopautot();
	autoOnt(autotimet);
	autotimet+=1;
	if (autotimet==4)
	{
		autotimet=1;
	}
	autoplayt=setTimeout("autot()",3000);
	}
function stopautot(){
	clearTimeout(autoplayt);
	}
function starautot(){
	autoplayt=setTimeout("autot()",3000);
	}

var autotimef=1;
var autoplayf;
function autoOnf(n){
	for (i=1; i<4; i++)
	{
		getObj("autoBoxf"+i).style.display="none";
		getObj("autoNavf"+i).className="";
	}
	getObj("autoBoxf"+n).style.display="block";
	getObj("autoNavf"+n).className="on";
	autotimef=n;
	}
	
function autof(){
	stopautof();
	autoOnf(autotimef);
	autotimef+=1;
	if (autotimef==4)
	{
		autotimef=1;
	}
	autoplayf=setTimeout("autof()",3000);
	}
function stopautof(){
	clearTimeout(autoplayf);
	}
function starautof(){
	autoplayf=setTimeout("autof()",3000);
	}


var autotimei=1;
var autoplayi;
function autoOni(n){
	for (i=1; i<4; i++)
	{
		getObj("autoBoxi"+i).style.display="none";
		getObj("autoNavi"+i).className="";
	}
	getObj("autoBoxi"+n).style.display="block";
	getObj("autoNavi"+n).className="on";
	autotimei=n;
	}
	
function autoi(){
	stopautoi();
	autoOni(autotimei);
	autotimei+=1;
	if (autotimei==4)
	{
		autotimei=1;
	}
	autoplayi=setTimeout("autoi()",3000);
	}
function stopautoi(){
	clearTimeout(autoplayi);
	}
function starautoi(){
	autoplayi=setTimeout("autoi()",3000);
	}



var autotimej=1;
var autoplayj;
function autoOnj(n){
	for (i=1; i<4; i++)
	{
		getObj("autoBoxj"+i).style.display="none";
		getObj("autoNavj"+i).className="";
	}
	getObj("autoBoxj"+n).style.display="block";
	getObj("autoNavj"+n).className="on";
	autotimej=n;
	}
	
function autoj(){
	stopautoj();
	autoOnj(autotimej);
	autotimej+=1;
	if (autotimej==4)
	{
		autotimej=1;
	}
	autoplayj=setTimeout("autoj()",3000);
	}
function stopautoj(){
	clearTimeout(autoplayj);
	}
function starautoj(){
	autoplayj=setTimeout("autoj()",3000);
	}
	
	
	
var autotimeh=1;
var autoplayh;
function autoOnh(n){
	for (i=1; i<5; i++)
	{
		getObj("autoBoxh"+i).style.display="none";
		getObj("autoNavh"+i).className="";
	}
	getObj("autoBoxh"+n).style.display="block";
	getObj("autoNavh"+n).className="on";
	autotimeh=n;
	}
	
function autoh(){
	stopautoh();
	autoOnh(autotimeh);
	autotimeh+=1;
	if (autotimeh==5)
	{
		autotimeh=1;
	}
	autoplayh=setTimeout("autoh()",3000);
	}
function stopautoh(){
	clearTimeout(autoplayh);
	}
function starautoh(){
	autoplayh=setTimeout("autoh()",3000);
	}

function nav_cont(subbox,con_list,list,tab,cont,cur,state)
{
	var navs = getObj(subbox).getElementsByTagName(tab);
	var conts = getObj(subbox).getElementsByTagName(cont);
	for(var i=0; i<conts.length; i++)
	{
		conts[i].id = con_list+i;
		conts[i].setAttribute("id",con_list+i);
		conts[i].style.display = "none";
		navs[i].id = list+i;
		navs[i].setAttribute("id",list+i);
		navs[i].onmouseover = function()
		{
			for(var i=0; i<conts.length; i++)
			{
				getObj(con_list+i).style.display = "none";
				getObj(list+i).className = state;
			}
			getObj("cont_"+this.id).style.display = "block";
			getObj(this.id).className = cur;
		}
	}
	conts[0].style.display = "block";
	navs[0].className = cur;
}
if(getObj('alist'))
{
	var cur = 'm01';
	var nav = getObj('alist').getElementsByTagName('li');
	var nal = nav.length;
	for(var i=0;i<nal;i++)
	{
		if(nav[i].id == cur)nav[i].className = 'on';
		nav[i].onmouseover = function()
		{
			getObj(cur).className = '';
			this.className = 'on';
		}
		nav[i].onclick = function()
		{
			cur = this.id;
		}
		nav[i].onmouseout = function()
		{
			this.className = '';
			getObj(cur).className = 'on';
		}
	}
}
if(getObj('alistzt'))
{
	var cur = 'a01';
	var nav = getObj('alistzt').getElementsByTagName('span');
	var nal = nav.length;
	for(var i=0;i<nal;i++)
	{
		if(nav[i].id == cur)nav[i].className = 'on';
		nav[i].onmouseover = function()
		{
			getObj(cur).className = '';
			this.className = 'on';
		}
		nav[i].onclick = function()
		{
			cur = this.id;
		}
		nav[i].onmouseout = function()
		{
			this.className = '';
			getObj(cur).className = 'on';
		}
	}
}

function ImgAuto(i)
{
	var MaxW=500;
	var MaxH;
	var o=new Image();
	o.src=i.src;
	var w=o.width;
	var h=o.height;
	var t;
	if (w>MaxW)
	{
		t=MaxW;
	}
	else
	{
		t=w;
	}
	if ((h*t/w)>MaxH)
	{
		i.height=MaxH;i.width=MaxH/h*w;
	}
	else
	{
		i.width=t;i.height=t/w*h;
	}
}


function setTab(id,idName,tabName,tabChan,tabCur)
{
	var iNum = getObj(idName).getElementsByTagName(tabName);
	for(var i=0; i<iNum.length; i++)
	{
	if(id==0)
	{	
		getObj("cont"+i).style.display = "block";
	}
	if(id==i)
	{
		getObj("cont"+i).style.display = "block";
		for(var j=0; j<id; j++)
		{
			getObj("cont"+j).style.display = "none";
		}
	}
	getObj("tabs"+i).className = tabCur
	getObj("tabs"+id).className = tabChan
	}
}
function showLay(obj)
{
	if(obj=="lay3"){
		 var s=window.location.href;
		 var tjpy=document.getElementById("curl");
		 tjpy.value=s;
	}
	getObj(obj).style.display = "block"
}
function closeLay(obj)
{
	getObj(obj).style.display = "none"
}
function Copy_Code(oid)
{
var _txt = document.getElementById(oid); 
_txt.select();  //全选
_txt.focus();   //获取焦点
window.clipboardData.setData('text', document.getElementById(oid).value);
}
var op=0,oz=0
function f_s(id)
{
	

	var obj=getObj(id);
	if (op==1)
	{
		op=0;
		return
	}
	if(oz==1)
	{
		return
	}
	obj.style.display="block";
	if(getObj('list0').style.display!="none")
	{
		getObj('listR').style.height = getObj('list1').offsetHeight-5+"px";
		getObj('controlbtn').style.top = (getObj('list1').offsetHeight)/2+"px";
		getObj('controlbtns').style.top = (getObj('list1').offsetHeight)/2+"px";
		getObj('listB').style.width = getObj('list1').offsetWidth+"px";
	}
	if(getObj('next0').style.display!="none")
	{
		getObj('nextR').style.height = getObj('next1').offsetHeight-5+"px";
		getObj('nextB').style.width = 232+"px";
	}
}
var bw
function c_W(id)
{
	if(oz==1)
	{
		return
	}
	op=0;
	var obj=getObj(id);
	var closeDiv=function()
	{
		obj.style.display="none";
	}
	closeDiv()
}
function closeW(id){
	var obj=getObj(id);
	obj.style.display="none";
	obj.onmouseover=function(){obj.style.display="block";}
	obj.onmouseout=function(){op=1;c_W(id)}
}
function prolistcontrol()
{
	getObj('list2').scrollLeft=696
	getObj('controlbtn').style.display = "none"
	getObj('controlbtns').style.display = "block"
}
function prolistcontrols()
{
	getObj('list2').scrollLeft=0
	getObj('controlbtn').style.display = "block"
	getObj('controlbtns').style.display = "none"
}
function scrollShow(o)
{
	var f1 = o.parentNode.getElementsByTagName("ul")
	var f2 = o.parentNode.parentNode.getElementsByTagName("ul")
	for(var i=0; i<f2.length; i++)
	{
		if(f1[0].style.display == "block")
		{
			f1[0].style.display = "none"
		}
		if(f1[0].style.display == "none")
		{
			f2[i].style.display = "none"
			f1[0].style.display = "block"
		}
	}
}

function getmore(id)
{
	if(getObj(id).style.display == "none")
	{
		getObj(id).style.display = "block"
		getObj('morepic').src="http://images.lafaso.com/images/prolist_bg10.jpg"
	}
	else
	{
		getObj(id).style.display = "none"
		getObj('morepic').src="http://images.lafaso.com/images/prolist_bg9.jpg"
	}
}

var timer_5
function showTime(){
clearTimeout(timer_5);
var overtime=parseInt(getObj("timer_5").innerHTML)-1;
if(overtime==0){
$("#window").fadeOut()
return;}
getObj("timer_5").innerHTML=overtime;
timer_5=setTimeout("showTime()",1000)}

function stime()
{
	clearTimeout(timer_5);
	getObj("timer_5").innerHTML = 5;
	timer_5=setTimeout("showTime()",1000)
}
function openBg(state){
if(state == 1)
{
	clearTimeout(timer_5);
	getObj("bg").style.display = "block";
	$("#bg").fadeTo("slow", 0.66);
	getObj("brandwt").style.display = "block";
	getObj("brandwb").style.display = "none";
	var h = document.body.offsetHeight > document.documentElement.offsetHeight ? document.body.offsetHeight : document.documentElement.offsetHeight;
	getObj("bg").style.height = h + "px";
	getObj("window").style.display = "block";
	getObj("window").style.left = (getObj("bg").offsetWidth - getObj("window").offsetWidth)/2 + "px";
	getObj("window").style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight-getObj("window").offsetHeight)/2 + "px"
}
else
{
	$("#bg").fadeTo("slow",0,function(){getObj("bg").style.display = "none";});
	getObj("window").style.display = "none";
}	
}
function openwindow(state){
if(state == 1)
{
	getObj("bg2").style.display = "block";
	getObj("brandwt").style.display = "none";
	getObj("brandwb").style.display = "block";
	getObj("window").style.display = "block";
	getObj("window").style.left = (getObj("bg2").offsetWidth - getObj("window").offsetWidth)/2 + "px";
	getObj("window").style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight-getObj("window").offsetHeight)/2 + "px"
}
else
{
	getObj("window").style.display = "none";
}
}































