document.writeln("<script>");
document.writeln("if(typeof PicFocusManager == \"undefined\")");
document.writeln("	{");
document.writeln("		PicFocusManager =[];");
document.writeln("	}");
document.writeln("	function PicFocus(imageContainerID,textContainerID,buttonContainerID,intervarTime){");
document.writeln("		this.$ = function (id){return document.getElementById(id)}");
document.writeln("		this.index = PicFocusManager.length;");
document.writeln("		PicFocusManager[PicFocusManager.length] = this;");
document.writeln("		this.imageContainer = this.$(imageContainerID);");
document.writeln("		this.textContainer = this.$(textContainerID);");
document.writeln("		this.buttonContainer = this.$(buttonContainerID);");
document.writeln("		this.firstShow = 0; \/\/默认显示项");
document.writeln("		this.interval = (isNaN(intervarTime)?0:intervarTime) || 5000;");
document.writeln("		 \/\/切换时间");
document.writeln("		this.canAutoPlay = true; \/\/是否可以自动切换");
document.writeln("		this.currentPosition = this.firstShow;");
document.writeln("		this.timer;");
document.writeln("		this.images = [];");
document.writeln("		this.texts = [];");
document.writeln("		this.buttons = [];");
document.writeln("		this.callback=function(){};");
document.writeln("		this.bindEvent = function(){");
document.writeln("			var _self = this;");
document.writeln("			for(var i=0;i<this.images.length;i++){");
document.writeln("				this.images[i].onmouseover = function(){");
document.writeln("					_self.stop();");
document.writeln("				}");
document.writeln("				this.images[i].onmouseout = function(){");
document.writeln("					_self.timer = setTimeout(\'PicFocusManager[\' + _self.index + \'].play()\' , _self.interval )");
document.writeln("				}");
document.writeln("			}");
document.writeln("			for(var i=0;i<this.buttons.length;i++){");
document.writeln("				this.buttons[i].onclick = function(){");
document.writeln("					_self.focus(this);");
document.writeln("				}");
document.writeln("			}");
document.writeln("		}");
document.writeln("		this.play = function(){");
document.writeln("			this.stop();");
document.writeln("			if(this.canAutoPlay){");
document.writeln("				this.setFocus(this.currentPosition ++ )");
document.writeln("				if(this.currentPosition >= this.images.length)this.currentPosition =0 ;");
document.writeln("			}");
document.writeln("			this.timer = setTimeout(\'PicFocusManager[\' + this.index + \'].play()\' , this.interval )");
document.writeln("		}");
document.writeln("		this.stop = function(){");
document.writeln("			clearTimeout( this.timer );");
document.writeln("		}");
document.writeln("		this.focus = function(button){");
document.writeln("			for(var i=0;i<this.buttons.length;i++){");
document.writeln("				if(this.buttons[i] == button){");
document.writeln("					this.currentPosition = i;");
document.writeln("					this.setFocus(this.currentPosition);");
document.writeln("					break;");
document.writeln("				}");
document.writeln("			}");
document.writeln("		}");
document.writeln("		this.setFocus = function(i){");
document.writeln("			if(\/Microsoft\/.test(navigator.appName)){");
document.writeln("				this.imageContainer.filters[0].apply();");
document.writeln("				this.imageContainer.filters[0].play();");
document.writeln("			}");
document.writeln("			for(var j=0;j<this.images.length;j++){");
document.writeln("				this.images[j].style.display = (i==j)?\"\":\"none\";");
document.writeln("			}");
document.writeln("			for(var j=0;j<this.texts.length;j++){");
document.writeln("				this.texts[j].style.display = (i==j)?\"\":\"none\";");
document.writeln("			}");
document.writeln("			for(var j=0;j<this.buttons.length;j++){");
document.writeln("				this.buttons[j].className = (i==j)? this.buttons[j].getAttribute(\"focusClass\") :this.buttons[j].getAttribute(\"normalClass\");");
document.writeln("			}");
document.writeln("			if(\/Microsoft\/.test(navigator.appName)){  \/\/滤镜版本");
document.writeln("				new ActiveXObject(\"DXImageTransform.Microsoft.Fade\");");
document.writeln("				this.imageContainer.filters[0].play();");
document.writeln("			}");
document.writeln("			this.callback(i);");
document.writeln("		}");
document.writeln("		this.init = function(){");
document.writeln("			if(this.imageContainer && this.buttonContainer){");
document.writeln("				\/\/init");
document.writeln("				this.images=this.imageContainer.getElementsByTagName(\"img\");");
document.writeln("				if(this.textContainer) this.texts=this.textContainer.getElementsByTagName(\"label\");");
document.writeln("				this.buttons=this.buttonContainer.getElementsByTagName(\"a\");");
document.writeln("				this.bindEvent();");
document.writeln("				for(var i=0;i<this.images.length;i++){");
document.writeln("					this.images[i].style.display = \"none\";");
document.writeln("					if(i<this.texts.length) this.texts[i].style.display = \"none\";");
document.writeln("					this.buttons[i].className = this.buttons[i].getAttribute(\"normalClass\");");
document.writeln("					this.buttons[i].target=\"_self\";");
document.writeln("				}");
document.writeln("				this.images[this.firstShow].style.display = \"\";");
document.writeln("				if(this.firstShow<this.texts.length) this.texts[this.firstShow].style.display = \"\";");
document.writeln("				this.buttons[this.firstShow].className = this.buttons[this.firstShow].getAttribute(\"focusClass\");");
document.writeln("			}else{");
document.writeln("				alert(\"未提供正确的参数\")");
document.writeln("			}");
document.writeln("		}");
document.writeln("	}");
document.writeln("<\/script>");
document.writeln("")
