var Laster={};

Laster.fadeHeader=function(){
	if($i("headerSShow")){
		if (!this.headSShow) {
			this.headSShow = $t1L("li",$i("headerSShow"));
			this.headSShowIndex = 0;
		};
		if(this.headSShowIndex==this.headSShow.length){
			CEDjs.Timer.appear(this.headSShow[this.headSShowIndex-1],-1,100,0);
			this.headSShowIndex = -1;
		}else if(this.headSShowIndex != -1){
			var oLcl = this.headSShow[this.headSShowIndex-1];
			CEDjs.Timer.appear(this.headSShow[this.headSShowIndex],1,0,100,function(){
				if(oLcl){
					CEDjs.Timer.appear(oLcl,1,100,0);
				};
			});
		};
		this.headSShowIndex++;
		setTimeout(Laster.fadeHeader,10000);
	};
};

Laster.initBoxApp=function(){
	var bA=$i("boxApplications");
	if(bA){
		bA.className="boxApplications";
		this.bAli = [];
		var LIlcl = $t1L("li",$t1L("ul",bA)[0]);
		for(var i=0;i<LIlcl.length;i++){
			this.bAli.push({
				"lnk":$t1L("span",LIlcl[i])[0],
				"txt":$t1L("span",LIlcl[i])[1],
				"img":$t1L("img",LIlcl[i])[0]
			});
		};
		for(var i=0; i<this.bAli.length; i++) {
			var L = this.bAli[i];
			L.lnk.bAli = this.bAli;
			L.lnk.parent=L;
			L.lnk.onclick=function(){
				if(!this.parent.isActive){
					for (var j = 0; j < this.bAli.length; j++) {
						if(this.bAli[j].lnk!=this && this.bAli[j].isActive){
							this.bAli[j].lnk.style.backgroundColor="";
							this.bAli[j].lnk.style.color="#FFFFFF";
							CEDjs.Timer.displace(this.bAli[j].txt,"top",0,-10,-150);
							CEDjs.Timer.appear(this.bAli[j].img,-10,100,0);
							this.bAli[j].isActive=false;
						};
					};
					this.style.backgroundColor="#FFFFFF";
					this.style.color="#666666";
					CEDjs.Timer.displace(this.parent.txt,"top",-150,10,0);
					CEDjs.Timer.appear(this.parent.img,10,0,100);
					this.parent.isActive=true;
				};
			};
			L.lnk.className="boxAppLink";
			L.txt.className="boxAppText";
			var bg=$dc("div");
			bg.style.backgroundColor="#FFFFFF";
			bg.style.width="451px";
			bg.style.height="200px";
			bg.style.position="absolute";
			bg.style.bottom="-1px";
			bg.style.left="0px";
			bg.style.zIndex=-1;
			CEDjs.Timer.appear(bg,1,69,69);
			L.txt.appendChild(bg);
		};
		this.bAli[0].lnk.onclick();
		bA.style.visibility="visible";
	};
};


Laster.initSlideshow = function(){
	var sShow = $c("ul","slideShow");
	for(var i=0;i<sShow.length;i++){
		var oLcl = {};
		oLcl.delay = parseInt(sShow[i].getAttribute("delay"));
		oLcl.speed = parseInt(sShow[i].getAttribute("speed"));
		oLcl.ref = 0;
		oLcl.li = $t1L("li",sShow[i]);
		oLcl.runSshow = function(){
			oLcl.ref++;
			if (oLcl.ref >= oLcl.li.length) {
				for(var j=1;j<oLcl.li.length-1;j++){
					oLcl.li[j].style.display="none";
				}
				CEDjs.Timer.appear(oLcl.li[oLcl.ref-1],-oLcl.speed,100,0);
				oLcl.ref = 0;
			}else{
				CEDjs.Timer.appear(oLcl.li[oLcl.ref],oLcl.speed,0,100);
			};
			setTimeout(oLcl.runSshow,oLcl.delay);
		};
		setTimeout(oLcl.runSshow,oLcl.delay);
	};
};


Laster.lBox={};
Laster.lBox.close = function(){
	Laster.lBox.BG.style.display="none";
	Laster.lBox.CNT.style.display="none";
};
Laster.lightBox=function(o,top,left){
	if(!Laster.lBox.BR){
		Laster.lBox.BR = $dc("div");
		Laster.lBox.BG = $dc("div");
		Laster.lBox.CNT = $dc("div");
		Laster.lBox.BR.className = "LbBR";
		Laster.lBox.BG.className = "LbBG";
		Laster.lBox.CNT.className = "LbCNT";
		CEDjs.getBody().appendChild(Laster.lBox.BR);
		CEDjs.getBody().appendChild(Laster.lBox.BG);
		CEDjs.getBody().appendChild(Laster.lBox.CNT);
	}
	Laster.lBox.BG.style.width=(Laster.lBox.BR.offsetLeft+Laster.lBox.BR.offsetWidth)+"px";
	Laster.lBox.BG.style.height=$i("centerContent").offsetHeight+"px";
	Laster.lBox.BG.style.display="block";
	Laster.lBox.BG.onclick=Laster.lBox.close;
	
	Laster.lBox.CNT.style.display="block";
	Laster.lBox.CNT.style.top=top+"px";
	Laster.lBox.CNT.style.left=$i("centerContent").offsetLeft+left+"px";
	
	var iHTML = '';

		iHTML+= '<div class="c1"><img src="/img/LBc1.'+(CEDjs.IE6?'jpg':'png')+'"/></div>';
		iHTML+= '<div class="c2" onclick="Laster.lBox.close();"><img src="/img/LBc2.'+(CEDjs.IE6?'jpg':'png')+'"/></div>';		
		iHTML+= '<div class="c3"><img src="/img/LBc3.'+(CEDjs.IE6?'jpg':'png')+'"/></div>';
		iHTML+= '<div class="c4"><img src="/img/LBc4.'+(CEDjs.IE6?'jpg':'png')+'"/></div>';

		iHTML+= '<div class="LBt"><img src="/img/LBt.'+(CEDjs.IE6?'jpg':'png')+'"/></div>';
		iHTML+= '<div class="LBr"><img src="/img/LBr.'+(CEDjs.IE6?'jpg':'png')+'"/></div>';
		iHTML+= '<div class="LBb"><img src="/img/LBb.'+(CEDjs.IE6?'jpg':'png')+'"/></div>';
		iHTML+= '<div class="LBl"><img src="/img/LBl.'+(CEDjs.IE6?'jpg':'png')+'"/></div>';

		iHTML+= '<div class="bg">';
		iHTML+= '	<div class="bg2">';
		iHTML+= '		<div class="cnt">';
		iHTML+= $c("span","lightboxContent",o)[0].innerHTML;
		iHTML+= '		</div>';
		iHTML+= '	</div>';
		iHTML+= '</div>';
		
	Laster.lBox.CNT.innerHTML = iHTML;
	Laster.lBox.setSize();
	setTimeout(Laster.lBox.setSize,200);
	setTimeout(Laster.lBox.setSize,500);
	setTimeout(Laster.lBox.setSize,700);
	setTimeout(Laster.lBox.setSize,1000);
};
Laster.lBox.setSize=function(){
		if(!CEDjs.IE7 && !CEDjs.IE6){
			$t1L("img",$c("div","LBt",Laster.lBox.CNT)[0])[0].style.width=(Laster.lBox.CNT.offsetWidth-170)+"px";
			$t1L("img",$c("div","LBt",Laster.lBox.CNT)[0])[0].style.height="27px";
			
			$t1L("img",$c("div","LBb",Laster.lBox.CNT)[0])[0].style.width=(Laster.lBox.CNT.offsetWidth-190)+"px";
			$t1L("img",$c("div","LBb",Laster.lBox.CNT)[0])[0].style.height="37px";
			
			$t1L("img",$c("div","LBr",Laster.lBox.CNT)[0])[0].style.height=Laster.lBox.CNT.offsetHeight-177+"px";
			$t1L("img",$c("div","LBr",Laster.lBox.CNT)[0])[0].style.width="32px";
			
			$t1L("img",$c("div","LBl",Laster.lBox.CNT)[0])[0].style.height=Laster.lBox.CNT.offsetHeight-177+"px";
			$t1L("img",$c("div","LBl",Laster.lBox.CNT)[0])[0].style.width="32px";
			
		}else if(CEDjs.IE7){
			$t1L("img",$c("div","LBt",Laster.lBox.CNT)[0])[0].style.width=(Laster.lBox.CNT.offsetWidth-169)+"px";
			$t1L("img",$c("div","LBt",Laster.lBox.CNT)[0])[0].style.height="27px";
			
			$t1L("img",$c("div","LBb",Laster.lBox.CNT)[0])[0].style.width=(Laster.lBox.CNT.offsetWidth-189)+"px";
			$t1L("img",$c("div","LBb",Laster.lBox.CNT)[0])[0].style.height="37px";
			
			$t1L("img",$c("div","LBr",Laster.lBox.CNT)[0])[0].style.height=Laster.lBox.CNT.offsetHeight-176+"px";
			$t1L("img",$c("div","LBr",Laster.lBox.CNT)[0])[0].style.width="32px";
			
			$t1L("img",$c("div","LBl",Laster.lBox.CNT)[0])[0].style.height=Laster.lBox.CNT.offsetHeight-176+"px";
			$t1L("img",$c("div","LBl",Laster.lBox.CNT)[0])[0].style.width="32px";
		
		}else if(CEDjs.IE6){
			$t1L("img",$c("div","LBt",Laster.lBox.CNT)[0])[0].style.width=(Laster.lBox.CNT.offsetWidth-152)+"px";
			$t1L("img",$c("div","LBt",Laster.lBox.CNT)[0])[0].style.height="43px";
			
			$t1L("img",$c("div","LBb",Laster.lBox.CNT)[0])[0].style.width=(Laster.lBox.CNT.offsetWidth-172)+"px";
			$t1L("img",$c("div","LBb",Laster.lBox.CNT)[0])[0].style.height="56px";
			
			$t1L("img",$c("div","LBr",Laster.lBox.CNT)[0])[0].style.height=Laster.lBox.CNT.offsetHeight-176+"px";
			$t1L("img",$c("div","LBr",Laster.lBox.CNT)[0])[0].style.width="48px";
			
			$t1L("img",$c("div","LBl",Laster.lBox.CNT)[0])[0].style.height=Laster.lBox.CNT.offsetHeight-176+"px";
			$t1L("img",$c("div","LBl",Laster.lBox.CNT)[0])[0].style.width="48px";

			$c("div","LBt",Laster.lBox.CNT)[0].style.top="0px";
			$c("div","LBb",Laster.lBox.CNT)[0].style.bottom="-3px";
			$c("div","LBt",Laster.lBox.CNT)[0].style.left="68px";
			$c("div","LBb",Laster.lBox.CNT)[0].style.left="78px";
			$c("div","LBr",Laster.lBox.CNT)[0].style.right="0px";
			$c("div","LBl",Laster.lBox.CNT)[0].style.left="-17px";

			$c("div","c1",Laster.lBox.CNT)[0].style.top="0px";
			$c("div","c1",Laster.lBox.CNT)[0].style.left="-17px";
			$c("div","c3",Laster.lBox.CNT)[0].style.right="0px";
			$c("div","c3",Laster.lBox.CNT)[0].style.bottom="-3px";
			$c("div","c4",Laster.lBox.CNT)[0].style.bottom="-3px";
			$c("div","c4",Laster.lBox.CNT)[0].style.left="-17px";
		}
};

CEDjs.addOnloadEvent(function(){
	setTimeout(Laster.fadeHeader,3000);
	Laster.initBoxApp();
	Laster.initSlideshow();
	CEDjs.IE6pngFix($i("header"));
});
