function LoopInfo(){this.Image=null;this.ImageWidth=null;this.ImageHeight=null;this.Title=null;this.Link=null;this.Content=null;this.Navigator=null;this.NavigatorChildrenCssClass=null;this.NavMouseOverShow=true;this.Interval=6000;this.TransTime=1;this.TransType="";this.TransParam=null;this.ShowIndex=false;this.ShowIndexTitle=false;this.MouseOverStop=true;this.ImageTransEffect=true;this.TitleTransEffect=true;this.ContentTransEffect=true;this.Restore=false;this.RestoreAfter=500;this.NavigatorNormalClass="";this.NavigatorHighlightClass="";this.NavigatorSelectedClass="";this.IndexWidth="20px";this.IndexHeight="15px";this.IndexColor="#fff";this.IndexBackgroundColor="#000";this.IndexHightlightColor="#fff";this.IndexHighlightBackgroundColor="#FF840C";this.IndexSeparator="1px #fff solid";this.IndexFont="bold 11px sans-serif";this.IndexOpacity=50;this.infoCount=0;this.lastIndex=null;this.loopTimer=null;this.restoreTimer=null;this.ie=document.all?true:false;this.images=new Array();this.titles=new Array();this.links=new Array();this.contents=new Array();this.navNormalClasses=new Array();this.navHighlightClasses=new Array();this.navSelectedClasses=new Array();this.cacheImages=null;this.iniIndex=null};LoopInfo.prototype.AddEvent=function(obj,evt,func){if(obj.attachEvent)obj.attachEvent("on"+evt,func);else obj.addEventListener(evt,func,false)};LoopInfo.prototype.Add=function(imgSrc,titleHtml,href,contentHtml,navNormalClass,navHighlightClass,navSelectedClass){if(typeof imgSrc=="undefined")var imgSrc="";if(typeof titleHtml=="undefined")var titleHtml="";if(typeof href=="undefined")var href="";if(typeof contentHtml=="undefined")var contentHtml="";if(typeof navNormalClass=="undefined")var navNormalClass="";if(typeof navHighlightClass=="undefined")var navHighlightClass="";if(typeof navSelectedClass=="undefined")var navSelectedClass=navHighlightClass;with(this){images[infoCount]=imgSrc;titles[infoCount]=titleHtml;links[infoCount]=href;contents[infoCount]=contentHtml;navNormalClasses[infoCount]=navNormalClass;navHighlightClasses[infoCount]=navHighlightClass;navSelectedClasses[infoCount]=navSelectedClass;infoCount++}};LoopInfo.prototype._Random=function(v1,v2){var ok=true;if(arguments.length==1)if(typeof(v1)!="number"||v1<0)ok=false;else if(arguments.length==2)if(typeof(v1)!="number"||v1<0||typeof(v2)!="number"||v2<0)ok=false;else ok=false;if(!ok){alert("_Random 函数需要一个或两个正整数参数");return false}if(arguments.length==1){var v2=v1;v1=0}else{var temp=Math.max(v1,v2);v1=Math.min(v1,v2);v2=temp}return Math.floor(Math.random()*(Math.floor(v2-v1)+1))+v1};LoopInfo.prototype._PreLoadImages=function(){this.cacheImages=new Array();for(i=0;i<this.infoCount;i++){this.cacheImages[i]=new Image();this.cacheImages[i].src=this.images[i]}};LoopInfo.prototype._StopShow=function(){clearTimeout(this.loopTimer)};LoopInfo.prototype._ShowNext=function(index){if(this.Interval>0){var _self=this;this.loopTimer=setTimeout(function(){_self._Show(index+1)},this.Interval)}};LoopInfo.prototype._RestoreIni=function(){if(this.Restore){if(this.RestoreAfter>0){var _self=this;this.restoreTimer=setTimeout(function(){_self._BeginRestoreIni()},this.RestoreAfter)}else this._BeginRestoreIni()}};LoopInfo.prototype._BeginRestoreIni=function(){with(this){if(iniIndex>=0){_Show(iniIndex);return}else{var eImage=document.getElementById(Image);var eTitle=document.getElementById(Title);var eContent=document.getElementById(Content);var eLink=document.getElementsByName(Link);if(!eLink)eLink[0]=document.getElementById(Link);if(eImage&&ShowIndex)var eIndex=eImage.nextSibling;var eNavsParent=document.getElementById(Navigator);if(eNavsParent){var eChildNodes=eNavsParent.childNodes;var eNavs=new Array();for(var i=0,ilen=eChildNodes.length;i<ilen;i++){if(eChildNodes[i].nodeType==1&&(NavigatorChildrenCssClass==null||eChildNodes[i].className.indexOf(NavigatorChildrenCssClass)>-1))eNavs[eNavs.length]=eChildNodes[i]}if(eNavs.length==0)eNavs=null}if(eImage)eImage.src=eImage.getAttribute("LoopInfoIni");if(eTitle)eTitle.innerHTML=eTitle.getAttribute("LoopInfoIni");if(eContent)eContent.innerHTML=eContent.getAttribute("LoopInfoIni");if(eLink){for(var i=0;i<eLink.length;i++)eLink[i].href=eLink[i].getAttribute("LoopInfoIni")}if(eNavs){var lastNav=eNavs[lastIndex];lastNav.className=navNormalClasses[lastIndex];lastNav.setAttribute("LoopInfoIsCurrent","")}}}};LoopInfo.prototype._StopRestoreIni=function(){if(this.Restore)clearTimeout(this.restoreTimer)};LoopInfo.prototype.Show=function(index){var _self=this;with(this){if(typeof index=="undefined"||index>=infoCount)var index=0;if(Image){var eImage=document.getElementById(Image);eImage.setAttribute("LoopInfoIni",eImage.src);if(eImage){_PreLoadImages();if(MouseOverStop){AddEvent(eImage,"mouseover",function(){_self._StopRestoreIni();_self._StopShow()});AddEvent(eImage,"mouseout",function(){_self._RestoreIni();_self._ShowNext(_self.lastIndex)})}if(ShowIndex){var eImageParent=eImage.parentNode;var width=eImage.style.width;var height=eImage.style.height;if(width==""||height==""){alert("要显示索引按钮, 必须用 style 指定 图象 的宽度和高度.");return false}var eContainer=document.createElement("span");eContainer.style.width=width;eContainer.style.height=height;eContainer.style.overflow="hidden";var eIndex=document.createElement("span");eIndex.style.styleFloat="right";eIndex.style.position="relative";eIndex.style.height=IndexHeight;eIndex.style.top="-"+IndexHeight;var IndexMouseOver=function(e){return function(){e.setAttribute("indexIsMouseOver","1");if(!e.getAttribute("LoopInfoIsCurrent")){e.style.color=IndexHightlightColor;e.style.backgroundColor=IndexHighlightBackgroundColor}}};var IndexMouseOut=function(e){return function(){e.setAttribute("indexIsMouseOver","");if(!e.getAttribute("LoopInfoIsCurrent")){e.style.color=IndexColor;e.style.backgroundColor=IndexBackgroundColor}}};var IndexClick=function(i){return function(){_self._Show(i)}};for(var i=infoCount-1;i>=0;i--){var eSpan=document.createElement("span");eSpan.style.styleFloat="right";eSpan.style.height=IndexHeight;eSpan.style.width=IndexWidth;eSpan.style.textAlign="center";eSpan.style.font=IndexFont;eSpan.style.color=IndexColor;eSpan.style.backgroundColor=IndexBackgroundColor;eSpan.style.borderLeft=IndexSeparator;eSpan.style.overflow="hidden";eSpan.style.cursor="pointer";eSpan.style.filter="alpha(opacity="+IndexOpacity+")";AddEvent(eSpan,"mouseover",IndexMouseOver(eSpan));AddEvent(eSpan,"mouseout",IndexMouseOut(eSpan));AddEvent(eSpan,"click",IndexClick(i));eSpan.innerHTML=i+1;if(titles[i])eSpan.setAttribute("title",titles[i]);eIndex.appendChild(eSpan)}eImage=eImageParent.removeChild(eImage);eImageParent.appendChild(eContainer);eContainer.appendChild(eImage);eContainer.appendChild(eIndex)}}}if(Navigator){var eNavsParent=document.getElementById(Navigator);if(eNavsParent){var eChildNodes=eNavsParent.childNodes;var eNavs=new Array();for(var i=0,ilen=eChildNodes.length;i<ilen;i++){if(eChildNodes[i].nodeType==1&&(NavigatorChildrenCssClass==null||eChildNodes[i].className.indexOf(NavigatorChildrenCssClass)>-1))eNavs[eNavs.length]=eChildNodes[i]}if(eNavs.length==0)eNavs=null}if(eNavs){var NavMouseOver=function(i){return function(){_StopRestoreIni();var e=eNavs[i];var cssClass=navHighlightClasses[i];e.setAttribute("navIsMouseOver","1");if(!e.getAttribute("LoopInfoIsCurrent")){e.className=cssClass;if(_self.NavMouseOverShow)_self._Show(i)}}};var NavMouseOut=function(i){return function(){var e=eNavs[i];var cssClass=navNormalClasses[i];_self._RestoreIni();e.setAttribute("navIsMouseOver","");if(!e.getAttribute("LoopInfoIsCurrent"))e.className=cssClass}};var NavClick=function(i){return function(){_self._Show(i)}};for(var i=0,ilen=eNavs.length;i<ilen;i++){if(!navNormalClasses[i])navNormalClasses[i]=NavigatorNormalClass;if(!navHighlightClasses[i])navHighlightClasses[i]=NavigatorHighlightClass;if(!navSelectedClasses[i])navSelectedClasses[i]=navHighlightClasses[i];if(NavigatorChildrenCssClass){navNormalClasses[i]+=" "+NavigatorChildrenCssClass;navHighlightClasses[i]+=" "+NavigatorChildrenCssClass;navSelectedClasses[i]+=" "+NavigatorChildrenCssClass}AddEvent(eNavs[i],"mouseover",NavMouseOver(i));AddEvent(eNavs[i],"mouseout",NavMouseOut(i));if(!NavMouseOverShow)AddEvent(eNavs[i],"click",NavClick(i))}}}if(Title){var eTitle=document.getElementById(Title);if(eTitle){eTitle.setAttribute("LoopInfoIni",eTitle.innerHTML);if(MouseOverStop){AddEvent(eTitle,"mouseover",function(){_self._StopRestoreIni();_self._StopShow()});AddEvent(eTitle,"mouseout",function(){_self._RestoreIni();_self._ShowNext(_self.lastIndex)})}}}if(Content){var eContent=document.getElementById(Content);if(eContent){eContent.setAttribute("LoopInfoIni",eContent.innerHTML);if(MouseOverStop){AddEvent(eContent,"mouseover",function(){_self._StopRestoreIni();_self._StopShow()});AddEvent(eContent,"mouseout",function(){_self._RestoreIni();_self._ShowNext(_self.lastIndex)})}}}var eLink=document.getElementsByName(Link);if(!eLink)eLink[0]=document.getElementById(Link);if(eLink){for(var i=0;i<eLink.length;i++)eLink[i].setAttribute("LoopInfoIni",eLink[i].href)}iniIndex=index;lastIndex=index;if(index>=0)_Show(index);else lastIndex=0}};LoopInfo.prototype._Show=function(index){with(this){clearTimeout(loopTimer);var eNavsParent=document.getElementById(Navigator);if(eNavsParent){var eChildNodes=eNavsParent.childNodes;var eNavs=new Array();for(var i=0,ilen=eChildNodes.length;i<ilen;i++){if(eChildNodes[i].nodeType==1&&(NavigatorChildrenCssClass==null||eChildNodes[i].className.indexOf(NavigatorChildrenCssClass)>-1))eNavs[eNavs.length]=eChildNodes[i]}if(eNavs.length==0)eNavs=null}var eImage=document.getElementById(Image);var eTitle=document.getElementById(Title);var eContent=document.getElementById(Content);var eLink=document.getElementsByName(Link);if(!eLink)eLink[0]=document.getElementById(Link);if(eImage&&ShowIndex)var eIndex=eImage.nextSibling;if(typeof index=="undefined"||index>=infoCount)var index=0;if(ie&&TransType!=null){var type=TransType;var params=TransParam;var filterStr="Barn|BlendTrans|Blinds|CheckerBoard|Fade|GradientWipe|Inset|Iris|"+"Pixelate|RadialWipe|RandomBars|RandomDissolve|RevealTrans|"+"Slide|Spiral|Stretch|Strips|Wheel|Zigzag";if(type==""||filterStr.indexOf(type)==-1){var filters=filterStr.split("|");type=new Array();for(var i=0;i<filters.length;i++)type.push(filters[i]);type=type[_Random(type.length-1)]}else{if(typeof(TransParam)=="string"){params={};var temp=TransParam.split(",");for(var i=0;i<temp.length;i++){var tmp=temp[i].split("=");if(tmp.length!=2){alert("转换滤镜的参数不正确");return false}params[tmp[0].substr(0,1).toUpperCase()+tmp[0].substr(1).toLowerCase()]=isNaN(parseInt(tmp[1]))?tmp[1]:parseInt(tmp[1])}}TransParam=params}var enabled=type!="Pixelate"?"true":"false";var typeName=type!="BlendTrans"&&type!="RevealTrans"?"DXImageTransform.Microsoft."+type:type;if(params==null){params={};switch(type){case"Barn":params.Motion=_Random(1)==0?"in":"out";params.Orientation=_Random(1)==0?"vertical":"horizontal";break;case"Blinds":params.Bands=_Random(1,20);var direction=["down","up","right","left"];params.Direction=direction[_Random(direction.length-1)];break;case"CheckerBoard":params.SquaresX=_Random(2,24);params.SquaresY=_Random(2,20);var direction=["down","up","right","left"];params.Direction=direction[_Random(direction.length-1)];break;case"Fade":params.Overlap=_Random(10)/10;break;case"GradientWipe":params.GradientSize=_Random(10)/10;params.Motion=_Random(1)?"forward":"reverse";params.WipeStyle=_Random(1);break;case"Iris":var style=["PLUS","DIAMOND","CIRCLE","CROSS","SQUARE","STAR"];params.IrisStyle=style[_Random(style.length-1)];params.Motion=_Random(1)==0?"in":"out";break;case"Pixelate":params.MaxSquare=_Random(2,50);break;case"RadialWipe":var style=["CLOCK","WEDGE","RADIAL"];params.WipeStyle=style[_Random(style.length-1)];break;case"_RandomBars":params.Orientation=_Random(1)==0?"vertical":"horizontal";break;case"RevealTrans":params.Transition=23;break;case"Slide":params.Bands=_Random(1,100);var style=["HIDE","PUSH","SWAP"];params.SlideStyle=style[_Random(style.length-1)];break;case"Spiral":params.GridSizeX=_Random(1,32);params.GridSizeY=_Random(1,32);break;case"Stretch":var style=["SPIN","HIDE","PUSH"];params.StretchStyle=style[_Random(style.length-1)];break;case"Strips":var motion=["leftdown","leftup","rightdown","rightup"];params.Motion=motion[_Random(motion.length-1)];break;case"Wheel":params.Spokes=_Random(2,20);break;case"Zigzag":params.GridSizeX=_Random(1,32);params.GridSizeY=_Random(1,32);break}}}if(eImage){if(ImageWidth!=null)eImage.style.width=ImageWidth;if(ImageHeight!=null)eImage.style.height=ImageHeight;if(ImageTransEffect&&TransType!=null&&ie){if(!eImage.filters[typeName])eImage.style.filter+=(type!="BlendTrans"&&type!="RevealTrans"?" progid:":" ")+typeName+"(enabled="+enabled+")";eImage.filters[typeName].duration=TransTime;for(param in params)eval("eImage.filters[typeName]."+param+" = params[param];");eImage.filters[typeName].apply()}eImage.src=images[index]}if(eTitle){if(TitleTransEffect&&TransType!=null&&ie){if(!eTitle.filters[typeName])eTitle.style.filter+=(type!="BlendTrans"&&type!="RevealTrans"?" progid:":" ")+typeName+"(enabled="+enabled+")";eTitle.filters[typeName].duration=TransTime;for(param in params)eval("eTitle.filters[typeName]."+param+" = params[param];");eTitle.filters[typeName].apply()}eTitle.innerHTML=titles[index]}if(eLink){for(var i=0;i<eLink.length;i++){if(links[index]){eLink[i].onclick=function(){};eLink[i].href=links[index]}else{eLink[i].onclick=function(){return false};eLink[i].href="#"}}}if(eContent){if(ContentTransEffect&&TransType!=null&&ie){if(!eContent.filters[typeName])eContent.style.filter+=(type!="BlendTrans"&&type!="RevealTrans"?" progid:":" ")+typeName+"(enabled="+enabled+")";eContent.filters[typeName].duration=TransTime;for(param in params)eval("eContent.filters[typeName]."+param+" = params[param];");eContent.filters[typeName].apply()}eContent.innerHTML=contents[index]}if(eNavs){var curNav=eNavs[index];var lastNav=eNavs[lastIndex];if(lastNav.getAttribute("navIsMouseOver"))lastNav.className=navHighlightClasses[lastIndex];else lastNav.className=navNormalClasses[lastIndex];curNav.className=navSelectedClasses[index];lastNav.setAttribute("LoopInfoIsCurrent","");curNav.setAttribute("LoopInfoIsCurrent","1")}if(ie){if(eIndex){var indexButtons=eIndex.childNodes;var lastIndexButton=indexButtons[infoCount-1-lastIndex];var curIndexButton=indexButtons[infoCount-1-index];if(!lastIndexButton.getAttribute("indexIsMouseOver")){lastIndexButton.style.color=IndexColor;lastIndexButton.style.backgroundColor=IndexBackgroundColor}curIndexButton.style.color=IndexHightlightColor;curIndexButton.style.backgroundColor=IndexHighlightBackgroundColor;lastIndexButton.setAttribute("LoopInfoIsCurrent","");curIndexButton.setAttribute("LoopInfoIsCurrent","1")}if(eImage&&ImageTransEffect&&TransType!=null)eImage.filters[typeName].play();if(eTitle&&TitleTransEffect&&TransType!=null)eTitle.filters[typeName].play();if(eContent&&ContentTransEffect&&TransType!=null)eContent.filters[typeName].play()}lastIndex=index;_ShowNext(index)}};