var isOpera=function(){
var sUserAgent=navigator.userAgent;
return(sUserAgent.indexOf("Opera")>-1);
};
var isIE=function(){
var sUserAgent=navigator.userAgent;
return((sUserAgent.indexOf("compatible")>-1)&&(sUserAgent.indexOf("MSIE")>-1)&&(!isOpera()));
};
var isFirefox=function(){
var sUserAgent=navigator.userAgent;
return(sUserAgent.indexOf("Firefox")>-1);
};
var isSafari=function(){
var sUserAgent=navigator.userAgent;
return(sUserAgent.indexOf("Safari")>-1);
};
if(isFirefox()){
HTMLElement.prototype.__defineGetter__("innerText",function(){
return this.textContent;
});
HTMLElement.prototype.__defineSetter__("innerText",function(sText){
this.textContent=sText;
});
};
function getOffsetLeft(obj){
var iLeft=0;
var tagObj=documentBody();
if(arguments.length>1)tagObj=arguments[1];
while(obj.offsetParent!=null){
iLeft+=obj.offsetLeft+obj.clientLeft;
if(obj.offsetParent==tagObj)break;
obj=obj.offsetParent;
};
return iLeft;
};
function getOffsetTop(obj){
var iTop=0;
var tagObj=documentBody();
if(arguments.length>1)tagObj=arguments[1];
while(obj.offsetParent!=null){
iTop+=obj.offsetTop+obj.clientTop;
if(obj.offsetParent==tagObj)break;
obj=obj.offsetParent;
};
return iTop;
};
function setTransparency(obj,opacity){
if(opacity<0)opacity=0;
try{
if(isIE()){
obj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+opacity+")";
}else if(isFirefox()){
if(opacity>=100)opacity=99;
obj.style.MozOpacity=opacity/100;
}else if(isSafari()){
obj.style.opacity=opacity/100;
}else{
if(opacity>=50)obj.style.visibility="visible";
else obj.style.visibility="hidden";
}}catch(ex){
}};
function linkTo(url,target){
if((url=="")||(target==""))return;
if(target=="_blank"){
var cmd="left=100,top=100,width=800,height=400,resizable=yes,";
cmd+="scrollable=yes,toolbar=no,status=yes,location=yes";
window.open(url,"",cmd);
}else if(target=="_self"){
window.location=url;
}else if(target=="_parent"){
window.parent.location=url;
}else if(target=="_top"){
window.top.location=url;
}else{
var targetWin=window.frames[target];
if(targetWin!=null)targetWin.location=url;
else{
var parentWin=window.parent;
targetWin=parentWin.frames[target];
if(targetWin!=null)targetWin.location=url;
}}};
function EventUtil(){
};
EventUtil.addEventHandler=function(oTarget,sEventType,fnHandler){
if(oTarget.addEventListener){
oTarget.addEventListener(sEventType,fnHandler,false);
}else if(oTarget.attachEvent){
oTarget.attachEvent("on"+sEventType,fnHandler);
}else{
oTarget["on"+sEventType]=fnHandler;
}};
EventUtil.removeEventHandler=function(oTarget,sEventType,fnHandler){
if(oTarget.removeEventListener){
oTarget.removeEventListener(sEventType,fnHandler,false);
}else if(oTarget.detachEvent){
oTarget.detachEvent("on"+sEventType,fnHandler);
}else{
oTarget["on"+sEventType]=null;
}};
EventUtil.formatEvent=function(oEvent){
oEvent.charCode=(oEvent.type=="keypress")?oEvent.keyCode:0;
if(isIE()){
oEvent.eventPhase=2;
oEvent.pageX=oEvent.clientX+document.body.scrollLeft;
oEvent.pageY=oEvent.clientY+document.body.scrollTop;
if(oEvent.type=="mouseout"){
oEvent.relatedTarget=oEvent.toElement;
}else if(oEvent.type=="mouseover"){
oEvent.relatedTarget=oEvent.fromElement;
}};
oEvent.isChar=(oEvent.charCode>0);
oEvent.preventDefault=function(){
this.returnValue=false;
};
oEvent.stopPropagation=function(){
this.cancelBubble=true;
};
if(oEvent.target==null||oEvent.target==undefined){
oEvent.target=oEvent.srcElement;
};
oEvent.time=(new Date()).getTime();
return oEvent;
};
EventUtil.getEvent=function(){
if(window.event){
return this.formatEvent(window.event);
}else{
return EventUtil.getEvent.caller.arguments[0];
}};


function Button(){
if(arguments.length==0)return;
this.oParent=arguments[0];
this.sBtnId=arguments[1];
this.sValue=arguments[2];
this.sPicture=arguments[3];
this.iBtnWidth=arguments.length<6?"20px":parseInt(arguments[4])+"px";
this.iBtnHeight=arguments.length<5?"20px":parseInt(arguments[5])+"px";
this.initPictures();
this.create();
};
Button.prototype.create=function(){
this.body=document.createElement("IMG");
this.body.id=this.sBtnId;
this.body.style.width=this.iBtnWidth;
this.body.style.Height=this.iBtnHeight;
this.body.title=this.sValue;
this.body.src=this.sPictureUp;
this.body.style.cursor="pointer";
this.initEvents();
this.oParent.appendChild(this.body);
};
Button.prototype.initEvents=function(){
var self=this;
var eventFunc=function(){
Button.prototype.event_btnEvents.apply(self,arguments);
};
EventUtil.addEventHandler(this.body,"mousedown",eventFunc);
EventUtil.addEventHandler(this.body,"mouseup",eventFunc);
EventUtil.addEventHandler(this.body,"mouseenter",eventFunc);
EventUtil.addEventHandler(this.body,"mouseleave",eventFunc);
};
Button.prototype.initPictures=function(){
var idx=this.sPicture.lastIndexOf(".");
var sImgName=this.sPicture.substr(0,idx);
var sImgExtend=this.sPicture.substring(idx);
this.sPictureUp=sImgName+"_up"+sImgExtend;
this.sPictureDown=sImgName+"_down"+sImgExtend;
this.sPictureOn=sImgName+"_on"+sImgExtend;
};
Button.prototype.event_btnEvents=function(){
var oEvent=EventUtil.getEvent();
var eventType=oEvent.type;
if(eventType=="mouseenter"||eventType=="mouseup"){
this.body.src=this.sPictureOn;
};
if(eventType=="mouseleave"){
this.body.src=this.sPictureUp;
};
if(eventType=="mousedown"){
this.body.src=this.sPictureDown;
}};
Button.prototype.getButton=function(){
return this.body;
};
Button.prototype.changeImage=function(newImage){
if(ImageName!=""){
this.sPicture=newImage;
this.initPictures();
this.body.src=this.sPictureUp;
}};
Button.prototype.bindClick=function(bindFunc){
EventUtil.addEventHandler(this.body,"click",bindFunc);
};
Button.prototype.Enabled=function(enabled){
this.getButton().disabled=!enabled;
if(isIE()){
if(enabled){
this.body.style.filter="";
}else{
this.body.style.filter="gray";
}}};
Button.prototype.Visible=function(visiblity){
if(visiblity){
this.body.style.display="block";
}else{
this.body.style.display="none";
}};
Button.prototype.Transparency=function(opacity){
if(opacity<0)opacity=0;
try{
if(isIE()){
this.body.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+opacity+")";
}else if(isFirefox()){
if(opacity>=100)opacity=99;
this.body.style.MozOpacity=opacity/100;
}else if(isSafari()){
this.body.style.opacity=opacity/100;
}else{
if(opacity>=50)this.Visible(true);
else this.Visible(false);
}}catch(ex){
}};
Button.prototype.setTitle=function(title){
this.sValue=title;
this.body.title=title;
};
Button.prototype.getTitle=function(){
return this.sValue;
};
function StateButton(){
Button.apply(this,arguments);
this.bClicking=false;
this.OnClick=null;
};
StateButton.prototype=new Button();
StateButton.prototype.initEvents=function(){
var self=this;
var eventFunc=function(){
StateButton.prototype.event_btnEvents.apply(self,arguments);
};
EventUtil.addEventHandler(this.body,"click",eventFunc);
EventUtil.addEventHandler(this.body,"mouseenter",eventFunc);
EventUtil.addEventHandler(this.body,"mouseleave",eventFunc);
};
StateButton.prototype.initPictures=function(){
var idx=this.sPicture.lastIndexOf(".");
var sImgName=this.sPicture.substr(0,idx);
var sImgExtend=this.sPicture.substring(idx);
this.sPictureUp=sImgName+"_up"+sImgExtend;
this.sPictureDown=sImgName+"_down"+sImgExtend;
this.sPictureUpOn=sImgName+"_up_on"+sImgExtend;
this.sPictureDownOn=sImgName+"_down_on"+sImgExtend;
};
StateButton.prototype.event_btnEvents=function(){
var oEvent=EventUtil.getEvent();
var eventType=oEvent.type;
var bkImage=this.body.src;
if(bkImage==undefined)return;
if(eventType=="click"){
if(bkImage.indexOf("_down")>-1){
this.body.src=this.sPictureUpOn;
};
if(bkImage.indexOf("_up")>-1){
this.body.src=this.sPictureDownOn;
};
if(this.OnClick!=null){
this.OnClick(this);
}};
if(eventType=="mouseleave"){
if(bkImage.indexOf(this.sPictureDownOn)>-1)this.body.src=this.sPictureDown;
if(bkImage.indexOf(this.sPictureUpOn)>-1)this.body.src=this.sPictureUp;
};
if(eventType=="mouseenter"){
if(bkImage.indexOf(this.sPictureDown)>-1)this.body.src=this.sPictureDownOn;
if(bkImage.indexOf(this.sPictureUp)>-1)this.body.src=this.sPictureUpOn;
}};
StateButton.prototype.bindClick=function(bindFunc){
this.OnClick=bindFunc;
};
StateButton.prototype.isDown=function(){
var sImageName=this.body.src;
if(sImageName.indexOf("_down")>0)return true;
else return false;
};
StateButton.prototype.Down=function(){
if(this.isDown())return;
var bkImage=this.body.src;
if(bkImage.indexOf(this.sPictureUpOn)>-1)this.body.src=this.sPictureDownOn;
if(bkImage.indexOf(this.sPictureUp)>-1)this.body.src=this.sPictureDown;
};
StateButton.prototype.Up=function(){
if(!this.isDown())return;
var bkImage=this.body.src;
if(bkImage.indexOf(this.sPictureDownOn)>-1)this.body.src=this.sPictureUpOn;
if(bkImage.indexOf(this.sPictureDown)>-1)this.body.src=this.sPictureUp;
};



function SlideType(){
};
SlideType.SLIDE_NONE=0;
SlideType.SLIDE_FADE=1;
SlideType.SLIDE_SLIDE=2;
SlideType.SLIDE_SCROLLUP=3;
SlideType.SLIDE_BLINDX=4;
SlideType.SLIDE_BLINDY=5;
function BorderStyle(){
};
BorderStyle.bsSolid=0;
BorderStyle.bsDashed=1;
BorderStyle.bsDotted=2;
function SlideScale(){
};
SlideScale.SCALE_TO_IMAGESIZE=0;
SlideScale.SCALE_TO_SLIDESIZE=1;
SlideScale.SCALE_TO_SPECIALSIZE=2;
function PositionType(){
};
PositionType.posLeftTop=0;
PositionType.posLeft=1;
PositionType.posLeftBottom=2;
PositionType.posBottom=3;
PositionType.posRightBottom=4;
PositionType.posRight=5;
PositionType.posRightTop=6;
PositionType.posTop=7;
PositionType.posCenter=8;
function RepeatAction(){
};
RepeatAction.REPEAT_NONE=0;
RepeatAction.REPEAT_X=1;
RepeatAction.REPEAT_Y=2;
RepeatAction.REPEAT=3;
function LastImageAction(){
};
LastImageAction.DO_NOTHING=0;
LastImageAction.GOTO_URL=1;


function documentBody(){
if(document.body){
return document.body;
}else{
return document.documentElement.lastChild;
}};
function ImageInfo(imagePath,imageWidth,imageHeight,linkedUrl,linkedTarget,descTitle,descText,thumText){
this.sImagePath=imagePath;
this.iImageWidth=imageWidth;
this.iImageHeight=imageHeight;
this.sImageLinkedUrl=linkedUrl;
this.sImageLinkedTarget=linkedTarget;
this.sImageDescTitle=descTitle;
this.sImageDescText=descText;
this.sImageThumText=thumText;
};
function SlideBackGround(bgColor,bgImage,bgImageX,bgImageY,bgImageRepeat,bgBorderWidth,bgBorderColor,bgBorderStyle){
this.cColor=bgColor;
this.sImage=bgImage;
this.iImageX=bgImageX;
this.iImageY=bgImageY;
this.oImageRepeat=bgImageRepeat;
this.iBorderWidth=bgBorderWidth;
this.cBorderColor=bgBorderColor;
this.oBorderStyle=bgBorderStyle;
};
function ImageAction(loop,actType,actUrl){
this.bLoop=loop;
this.oActionType=actType;
this.sActionUrl=actUrl;
};
function OnImageClick(){
var event=EventUtil.getEvent();
var srcImage=event.target;
var href=srcImage.getAttribute("href");
var target=srcImage.getAttribute("target");
linkTo(href,target);
};
function PictureBox(){
this.oParent=arguments[0];
this.oImageObjects=[];
};
PictureBox.prototype.SetSlideProperties=function(slidePause,slideSpeed){
this.iSlidePause=slidePause;
this.iSlideSpeed=slideSpeed;
};
PictureBox.prototype.SetGeneralProperties=function(canSelectImage,autoPlay,showThumbail,loop,actType,actUrl,borderWidth,borderColor,borderStyle){
this.oImageAction=new ImageAction(loop,actType,actUrl);
this.bCanSelectImage=canSelectImage;
this.bAutoPlay=autoPlay;
this.bShowThumbnail=showThumbail;
this.iImageBorderWidth=borderWidth;
this.cImageBorderColor=borderColor;
this.oImageBorderStyle=borderStyle;
};
PictureBox.prototype.SetShowSizeProperties=function(slideWidth,slideHeight,scaleType,scaleWidth,scaleHeight){
this.iSlideWidth=slideWidth;
this.iSlideHeight=slideHeight;
this.iThumbnailWidth=Math.round(this.iSlideWidth/5);
this.iThumbnailHeight=Math.round(this.iSlideHeight/5);
this.oScaleType=scaleType;
this.iScaleWidth=scaleWidth;
this.iScaleHeight=scaleHeight;
};
PictureBox.prototype.SetShowPosition=function(usePercent,marginLeft,marginTop,marginRight,marginBottom,positionType){
this.bUsePercent=usePercent;
this.iMarginLeft=marginLeft;
this.iMarginTop=marginTop;
this.iMarginRight=marginRight;
this.iMarginBottom=marginBottom;
this.oPositionType=positionType;
};
PictureBox.prototype.SetBackGround=function(bgColor,bgImage,bgImageX,bgImageY,bgImageRepeat,bgBorderWidth,bgBorderColor,bgBorderStyle){
this.background=new SlideBackGround(bgColor,bgImage,bgImageX,bgImageY,bgImageRepeat,bgBorderWidth,bgBorderColor,bgBorderStyle);
};
PictureBox.prototype.AddImages=function(imageList){
this.oImageList=imageList;
};
PictureBox.prototype.CreateShower=function(slideDiv,imageDiv){
this.oSlider=new SlideShow(this.oImageObjects,this.iSlideWidth,this.iSlideHeight,this.iSlidePause,this.iSlideSpeed,this.oImageAction,slideDiv,imageDiv);
};
PictureBox.prototype.StartSlideShow=function(){
this.oSlider.Start();
if(this.oPauseButton!=undefined){
if(!this.oPauseButton.isDown()){
this.oPauseButton.Down();
this.oPauseButton.setTitle("pause");
}}};
PictureBox.prototype.EndSlideShow=function(){
this.oSlider.End();
if(this.oPauseButton!=undefined){
if(this.oPauseButton.isDown()){
this.oPauseButton.Up();
this.oPauseButton.setTitle("start");
}}};
PictureBox.prototype.GotoImageByStep=function(step){
this.oSlider.slideByStep(step);
};
PictureBox.prototype.GotoImageByIndex=function(index){
this.oSilder.slideByIndex(index);
};
PictureBox.prototype.StartOrPauseSlide=function(sender){
if(sender.isDown()){
this.oSlider.Start();
sender.setTitle("pause");
}else{
this.oSlider.End();
sender.setTitle("start");
}};
PictureBox.prototype.GetWidthOfImage=function(index){
var showWidth=this.oImageList[index].iImageWidth;
var padding_left=this.iMarginLeft;
var padding_right=this.iMarginRight;
if(this.bUsePercent){
padding_left=padding_left*this.iSlideWidth/100;
padding_right=padding_right*this.iSlideWidth/100;
};
var maxWidth=this.iSlideWidth-padding_left-padding_right-2*this.iImageBorderWidth;
if(this.oScaleType==SlideScale.SCALE_TO_IMAGESIZE){
showWidth=(showWidth>=maxWidth)?maxWidth:showWidth;
};
if(this.oScaleType==SlideScale.SCALE_TO_SLIDESIZE){
showWidth=maxWidth;
};
if(this.oScaleType==SlideScale.SCALE_TO_SPECIALSIZE){
showWidth=(this.iScaleWidth>=maxWidth)?maxWidth:this.iScaleWidth;
};
return showWidth;
};
PictureBox.prototype.GetHeightOfImage=function(index){
var showHeight=this.oImageList[index].iImageHeight;
var padding_top=this.iMarginTop;
var padding_bottom=this.iMarginBottom;
if(this.bUsePercent){
padding_top=padding_top*this.iSlideHeight/100;
padding_bottom=padding_bottom*this.iSlideHeight/100;
};
var maxHeight=this.iSlideHeight-padding_top-padding_bottom-2*this.iImageBorderWidth;
if(this.oScaleType==SlideScale.SCALE_TO_IMAGESIZE){
showHeight=(showHeight>=maxHeight)?maxHeight:showHeight;
};
if(this.oScaleType==SlideScale.SCALE_TO_SLIDESIZE){
showHeight=maxHeight;
};
if(this.oScaleType==SlideScale.SCALE_TO_SPECIALSIZE){
showHeight=(this.iScaleHeight>=maxHeight)?maxHeight:this.iScaleHeight;
};
return showHeight;
};
PictureBox.prototype.SetPositionOfBackground=function(paddingLeft,paddingTop){
var padding_left=this.iMarginLeft;
var padding_top=this.iMarginTop;
var padding_right=this.iMarginRight;
var padding_bottom=this.iMarginBottom;
if(this.bUsePercent){
padding_left=padding_left*this.iSlideWidth/100;
padding_top=padding_top*this.iSlideHeight/100;
padding_right=padding_right*this.iSlideWidth/100;
padding_bottom=padding_bottom*this.iSlideHeight/100;
};
var maxWidth=this.iSlideWidth-padding_left-padding_right-2*this.iImageBorderWidth;
var maxHeight=this.iSlideHeight-padding_top-padding_bottom-2*this.iImageBorderWidth;
if(this.oScaleType==SlideScale.SCALE_TO_SPECIALSIZE){
if(this.iScaleWidth<maxWidth){
var minus=maxWidth-this.iScaleWidth;
switch(this.oPositionType){
case PositionType.posLeftTop:case PositionType.posLeft:case PositionType.posLeftBottom:{
padding_right+=minus;
break;
};
case PositionType.posTop:case PositionType.posBottom:case PositionType.posCenter:{
padding_left+=minus/2;
padding_right+=minus/2;
break;
};
case PositionType.posRightTop:case PositionType.posRight:case PositionType.posRightBottom:{
padding_left+=minus;
break;
}}};
if(this.iScaleHeight<maxHeight){
var minus=maxHeight-this.iScaleHeight;
switch(this.oPositionType){
case PositionType.posLeftTop:case PositionType.posTop:case PositionType.posRightTop:{
padding_bottom+=minus;
break;
};
case PositionType.posLeft:case PositionType.posRight:case PositionType.posCenter:{
padding_top+=minus/2;
padding_bottom+=minus/2;
break;
};
case PositionType.posLeftBottom:case PositionType.posBottom:case PositionType.posRightBottom:{
padding_top+=minus;
break;
}}}};
padding_left+=paddingLeft;
padding_top+=paddingTop;
var allParam=[];
allParam["padding-left"]=padding_left;
allParam["padding-top"]=padding_top;
allParam["padding-right"]=padding_right;
allParam["padding-bottom"]=padding_bottom;
return allParam;
};
PictureBox.prototype.AddSelImageButtons=function(content){
var addedHeight=(content.clientHeight-60)/2;
var addedWidth=(content.clientWidth-60)/2;
var offsetLeft=getOffsetLeft(content);
var offsetTop=getOffsetTop(content);
var self=this;
var goBackDiv;
if(isIE()){
goBackDiv=document.createElement("<div style='width:60;height:60'></div>");
}else{
goBackDiv=document.createElement("DIV");
goBackDiv.style.width=60;
goBackDiv.style.height=60;
};
goBackDiv.style.position="absolute";
goBackDiv.style.left=offsetLeft+10;
goBackDiv.style.top=offsetTop+addedHeight;
this.oBackButton=new Button(goBackDiv,"back","back","images/back.jpg",60,60);
this.oBackButton.bindClick(function(){
PictureBox.prototype.GotoImageByStep.call(self,-1);
});
this.oBackButton.Transparency(10);
documentBody().appendChild(goBackDiv);
var goAheadDiv;
if(isIE()){
goAheadDiv=document.createElement("<div style='width:60;height:60'></div>");
}else{
goAheadDiv=document.createElement("DIV");
goAheadDiv.style.width=60;
goAheadDiv.style.height=60;
};
goAheadDiv.style.position="absolute";
goAheadDiv.style.left=offsetLeft+content.clientWidth-70;
goAheadDiv.style.top=offsetTop+addedHeight;
this.oForwardButton=new Button(goAheadDiv,"forward","forward","images/forward.jpg",60,60);
this.oForwardButton.bindClick(function(){
PictureBox.prototype.GotoImageByStep.call(self,1);
});
this.oForwardButton.Transparency(10);
documentBody().appendChild(goAheadDiv);
var pauseDiv;
if(isIE()){
pauseDiv=document.createElement("<div style='width:60;height:60'></div>");
}else{
pauseDiv=document.createElement("DIV");
pauseDiv.style.width=60;
pauseDiv.style.height=60;
};
pauseDiv.style.position="absolute";
pauseDiv.style.left=offsetLeft+addedWidth;
pauseDiv.style.top=offsetTop+addedHeight;
this.oPauseButton=new StateButton(pauseDiv,"pause","start","images/pause.jpg",60,60);
var pauseFunc=function(sender){
PictureBox.prototype.StartOrPauseSlide.call(self,sender);
};
this.oPauseButton.bindClick(pauseFunc);
this.oPauseButton.Transparency(10);
documentBody().appendChild(pauseDiv);
var mouseEvent=function(){
PictureBox.prototype.OnMouseEnterOrLeave.apply(self,arguments);
};
EventUtil.addEventHandler(content,"mouseover",mouseEvent);
EventUtil.addEventHandler(content,"mouseout",mouseEvent);
};
PictureBox.prototype.OnMouseEnterOrLeave=function(){
var oEvent=EventUtil.getEvent();
if((oEvent.relatedTarget==this.oBackButton.getButton())||(oEvent.relatedTarget==this.oForwardButton.getButton())||(oEvent.relatedTarget==this.oPauseButton.getButton())){
return;
};
if(oEvent.type=="mouseout"){
this.oBackButton.Transparency(10);
this.oForwardButton.Transparency(10);
this.oPauseButton.Transparency(10);
};
if(oEvent.type=="mouseover"){
this.oBackButton.Transparency(70);
this.oForwardButton.Transparency(70);
this.oPauseButton.Transparency(70);
}};
PictureBox.prototype.AddThumbnails=function(content){
this.oThumbnail=new Thumbnail(this.oImageList,content,this.iThumbnailWidth);
this.oSlider.setThumbnailObject(this.oThumbnail);
this.oThumbnail.setSlider(this.oSlider);
};
PictureBox.prototype.CreateTitle=function(imageList,content){
this.oTitle=new SlideTitle(imageList,content);
this.oSlider.setSlideTitleObject(this.oTitle);
};


function Thumbnail(imageList,content,thumWidth){
this.oImageList=imageList;
this.oContent=content;
this.bMouseIn=false;
this.iThumbnailWidth=thumWidth;
this.iMoveInterval=0;
this.iMoveSpeed=0;
this.iMin=0;
this.iMax=0;
this.iStopPoint=0;
this.iSelectedImage=0;
this.oContent.scrollLeft=0;
this.buildThumbnails();
};
Thumbnail.prototype.buildThumbnails=function(){
var imageWidth=this.iThumbnailWidth;
var imageHeight=this.oContent.clientHeight-8;
var tableWidth=imageWidth*this.oImageList.length+2*(this.oImageList.length-1);
var tableHeight=this.oContent.clientHeight;
this.iMax=tableWidth;
var thumHtml="<table style='width:"+tableWidth+";height:"+tableHeight+"'";
thumHtml+=" border=0 cellSpacing=2>";
thumHtml+="  <tr>";
for(var idx=0;
idx<this.oImageList.length;
idx++){
var imgId="thum_"+(idx+1);
var sStyle="border:1px solid gray;cursor:pointer;width:"+imageWidth+";height:"+imageHeight;
var imgSrc=this.oImageList[idx].sImagePath;
var imgTitle=this.oImageList[idx].sImageThumText;
thumHtml+="<td>";
thumHtml+="<img id='"+imgId+"' src='"+imgSrc+"' title='"+imgTitle+"' index="+idx+" style='"+sStyle+"'></img>";
thumHtml+="</td>";
};
thumHtml+="  </tr></table>";
this.oContent.innerHTML=thumHtml;
document.getElementById("thum_1").style.borderColor="red";
var self=this;
for(var idx=0;
idx<this.oImageList.length;
idx++){
var oImage=document.getElementById("thum_"+(idx+1));
EventUtil.addEventHandler(oImage,"click",function(){
Thumbnail.prototype.event_DoSelect.apply(self,arguments);
});
};
EventUtil.addEventHandler(this.oContent,"mousemove",function(){
Thumbnail.prototype.event_Select.apply(self,arguments);
});
EventUtil.addEventHandler(this.oContent,"mouseout",function(){
Thumbnail.prototype.event_MouseIn.apply(self,arguments);
});
EventUtil.addEventHandler(this.oContent,"mouseover",function(){
Thumbnail.prototype.event_MouseIn.apply(self,arguments);
});
window.setInterval(function(){
Thumbnail.prototype.Move.apply(self,arguments);
},25);
};
Thumbnail.prototype.setSlider=function(slider){
this.oSlider=slider;
};
Thumbnail.prototype.selectImage=function(index){
if(index==this.iSelectedImage)return;
var oldImage=document.getElementById("thum_"+(this.iSelectedImage+1));
var newImage=document.getElementById("thum_"+(index+1));
if(oldImage!=null)oldImage.style.borderColor="gray";
if(newImage!=null)newImage.style.borderColor="red";
this.iSelectedImage=index;
if(!this.bMouseIn)this.MoveTo(index);
};
Thumbnail.prototype.MoveTo=function(index){
var oImage=document.getElementById("thum_"+(index+1));
var scrollLeft=this.oContent.scrollLeft;
var scrollRight=scrollLeft+this.oContent.clientWidth;
var endNode=this.oContent;
if(!isIE())endNode=this.oContent.firstChild;
var iImageLeft=getOffsetLeft(oImage,endNode)-3;
var iImageRight=iImageLeft+this.iThumbnailWidth+8;
if(iImageLeft<scrollLeft){
this.iMoveSpeed=-20;
this.iStopPoint=iImageLeft;
}else if(iImageRight>scrollRight){
this.iMoveSpeed=20;
this.iStopPoint=scrollLeft+(iImageRight-scrollRight);
}else{
this.iMoveSpeed=0;
}};
Thumbnail.prototype.Move=function(){
var scrollLeft=this.oContent.scrollLeft+this.iMoveSpeed;
if(scrollLeft>this.iMax)scrollLeft=this.iMax;
if(scrollLeft<this.iMin)scrollLeft=this.iMin;
if(((this.iMoveSpeed>0)&&(scrollLeft>this.iStopPoint))||((this.iMoveSpeed<0)&&(scrollLeft<this.iStopPoint))){
scrollLeft=this.iStopPoint;
};
this.oContent.scrollLeft=scrollLeft;
};
Thumbnail.prototype.event_Select=function(){
this.iStopPoint=-1;
var oEvent=EventUtil.getEvent();
var offsetX=oEvent.clientX-this.oContent.clientLeft;
this.iMoveSpeed=0;
if(offsetX<=this.iThumbnailWidth){
this.iMoveSpeed=-Math.round((this.iThumbnailWidth-offsetX)/10);
this.iStopPoint=this.iMin;
};
if((offsetX+this.iThumbnailWidth)>this.oContent.clientWidth){
this.iMoveSpeed=Math.round((this.iThumbnailWidth+offsetX-this.oContent.clientWidth)/10);
this.iStopPoint=this.iMax;
};
this.bMouseIn=true;
};
Thumbnail.prototype.event_MouseIn=function(){
var oEvent=EventUtil.getEvent();
var sEventType=oEvent.type;
if(sEventType=="mouseover")this.bMouseIn=true;
if(sEventType=="mouseout"){
this.bMouseIn=false;
this.iMoveSpeed=0;
}};
Thumbnail.prototype.event_DoSelect=function(){
var oEvent=EventUtil.getEvent();
var oImage=oEvent.target;
var index=oImage.getAttribute("index");
if((this.oSlider!=undefined)&&(this.oSlider!=null)){
this.oSlider.slideByIndex(index);
}};



function SlideTitle(imageList,content){
this.oImageList=imageList;
this.oContent=content;
this.body;
this.buildTitle();
};
SlideTitle.prototype.buildTitle=function(){
var titleWidth=this.oContent.clientWidth;
var titleLeft=getOffsetLeft(this.oContent);
var titleTop=getOffsetTop(this.oContent);
var borderWidth=parseInt(this.oContent.style.borderRightWidth.substr(0,1));
this.body=document.createElement("DIV");
this.body.style.position="absolute";
this.body.style.left=titleLeft;
this.body.style.top=titleTop;
this.body.style.width=titleWidth;
documentBody().appendChild(this.body);
var titleDiv=document.createElement("DIV");
titleDiv.style.fontFamily="Tahoma";
titleDiv.style.fontSize=15;
titleDiv.style.fontWeight="bolder";
titleDiv.style.color="white";
titleDiv.style.whiteSpace="normal";
titleDiv.style.backgroundColor="black";
titleDiv.style.paddingTop="5px";
titleDiv.style.paddingLeft="10px";
titleDiv.style.cursor="default";
titleDiv.innerText=this.oImageList[0].sImageDescTitle;
this.body.appendChild(titleDiv);
var textDiv=document.createElement("DIV");
textDiv.style.fontFamily="Tahoma";
textDiv.style.fontSize=12;
textDiv.style.fontWeight="normal";
textDiv.style.color="white";
textDiv.style.whiteSpace="normal";
textDiv.style.backgroundColor="black";
textDiv.style.paddingTop="5px";
textDiv.style.paddingLeft="10px";
textDiv.style.paddingBottom="5px";
textDiv.style.cursor="default";
textDiv.innerText=this.oImageList[0].sImageDescText;
this.body.appendChild(textDiv);
if(isFirefox()){
this.body.style.height="auto!important";
titleDiv.style.minHeight="0px";
titleDiv.style.height="auto!important";
this.body.style.minHeight="0px";
textDiv.style.height="auto!important";
textDiv.style.minHeight="0px";
};
this.Visible(true);
};
SlideTitle.prototype.changeTitle=function(index){
this.body.firstChild.innerText=this.oImageList[index].sImageDescTitle;
this.body.lastChild.innerText=this.oImageList[index].sImageDescText;
if((this.body.firstChild.innerText.trim()=="")&&(this.body.lastChild.innerText.trim()=="")){
this.Visible(false);
}else{
this.Visible(true);
}};
SlideTitle.prototype.Visible=function(visible){
if(isIE()){
if(visible)this.body.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=70)";
else this.body.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
}else if(isFirefox()){
if(visible)this.body.style.MozOpacity=0.70;
else this.body.style.MozOpacity=0;
}else if(isSafari()){
if(visible)this.body.style.opacity=0.70;
else this.body.style.opacity=0;
}else{
if(visible)this.body.style.display="block";
else this.body.style.display="none";
};
if(visible)this.setTop();
};
SlideTitle.prototype.getBody=function(){
return this.body;
};
SlideTitle.prototype.setTop=function(){
var divHeight=this.body.clientHeight;
var titleBottom=getOffsetTop(this.oContent)+this.oContent.clientHeight;
var titleTop=titleBottom-divHeight;
this.body.style.top=titleTop;
};
String.prototype.trim=function(){
return this.replace(/(^\s*)|(\s*$)/g,"");
};


PictureBox.prototype.BuildPictureBox=function(){
var iW=this.iSlideWidth;
var iH=this.iSlideHeight;
var iBkW,iBkH,iImgW,iImgH;
if(isIE()){
iBkW=iW+2*this.background.iBorderWidth;
iBkH=iH+2*this.background.iBorderWidth;
iImgW=iW;
iImgH=iH;
}else{
iBkW=iW;
iBkH=iH;
iImgW=iBkW-2*this.iImageBorderWidth;
iImgH=iBkH-2*this.iImageBorderWidth;
};
var paddingParams=this.SetPositionOfBackground(0,0);
var strHtml="";
strHtml+="<div id='slide_div' style='width:"+iBkW+"!important;height:"+iBkH+"!important;overflow:hidden;";
var sBkBorderStyle="solid";
if(this.background.oBorderStyle==BorderStyle.bsDashed)sBkBorderStyle="dashed";
if(this.background.oBorderStyle==BorderStyle.bsDotted)sBkBorderStyle="dotted";
var sBkBorder=this.background.iBorderWidth+"px "+sBkBorderStyle+" "+this.background.cBorderColor;
strHtml+="border:"+sBkBorder+"'>";
var sBorderStyle="solid";
if(this.oImageBorderStyle==BorderStyle.bsDashed)sBorderStyle="dashed";
if(this.oImageBorderStyle==BorderStyle.bsDotted)sBorderStyle="dotted";
var sBorder=this.iImageBorderWidth+"px "+sBorderStyle+" "+this.cImageBorderColor;
strHtml+="  <div id='image_div' style='width:"+iImgW+"!important;height:"+iImgH+"!important;overflow:hidden;";
strHtml+="border:"+sBorder+";background-color:"+this.background.cColor+"'>";
strHtml+="<table border=0 cellPadding=0 cellSpacing=0>";
strHtml+="<tr><td colspan=3 style='height:"+paddingParams["padding-top"]+"'></td></tr>";
strHtml+="<tr>";
strHtml+="<td style='width:"+paddingParams["padding-left"]+"'></td>";
strHtml+="<td>";
for(var idx=0;
idx<this.oImageList.length;
idx++){
var a_href=this.oImageList[idx].sImageLinkedUrl;
var a_target=this.oImageList[idx].sImageLinkedTarget;
var imgId="img_"+(idx+1);
strHtml+="  <img id='"+imgId+"' href='"+a_href+"' target='"+a_target+"' onclick='OnImageClick(event)' ";strHtml+="style='width:"+this.GetWidthOfImage(idx)+";height:"+this.GetHeightOfImage(idx)+";";
strHtml+="display:none;cursor:pointer;border:0px solid white'/>";
};
strHtml+="  </td>";
strHtml+="<td style='width:"+paddingParams["padding-right"]+"'></td></tr>";
strHtml+="<tr><td colspan=3 style='height:"+paddingParams["padding-bottom"]+"'></td></tr>"
strHtml+="</table>";
strHtml+="  </div>";
strHtml+="</div>";
if(this.bCanSelectImage&&this.bShowThumbnail){
var iThumHeight=this.iThumbnailHeight;
if(!isIE()){
iThumHeight=iThumHeight-2*this.background.iBorderWidth;
};
strHtml+="<div style='width:"+iBkW+";height:10;font:0px Arial;'></div>";
strHtml+="<div style='width:"+iBkW+";height:"+iThumHeight+";border:"+sBkBorder+";overflow:hidden'";
strHtml+=" id='thumbnail_div'></div>";
};
this.oParent.innerHTML=strHtml;
for(var idx=0;
idx<this.oImageList.length;
idx++){
var img=document.getElementById("img_"+(idx+1));
img.src=this.oImageList[idx].sImagePath;
this.oImageObjects[idx]=img;
};
var slideDiv=document.getElementById("slide_div");
var imgDiv=document.getElementById("image_div");
var thumDiv=document.getElementById("thumbnail_div");
this.CreateShower(slideDiv,imgDiv);
this.CreateTitle(this.oImageList,imgDiv);
if(this.bCanSelectImage){
this.AddSelImageButtons(slideDiv);
if(this.bShowThumbnail){
this.AddThumbnails(thumDiv);
};
if(this.bAutoPlay)this.StartSlideShow();
}else{
this.StartSlideShow();
}};


function SlideShow(imageList,slideWidth,slideHeight,pause,speed,imageAction,slideDiv,imageDiv){
this.oImageList=imageList;
this.iWidth=slideWidth;
this.iHeight=slideHeight;
this.iPause=pause;
this.iSpeed=speed;
this.oImageAction=imageAction;
this.oSlideDiv=slideDiv;
this.oImageDiv=imageDiv;
this.bStop=false;
this.bExecute=false;
this.iSlideInterval=0;
this.iSlideSpeed=25;
this.iSlideTimer=0;
this.iSlideInterval=0;
this.iSlideIndex=0;
this.fAlpha=100;
this.fAlphaNext=0;
for(var idx=0;
idx<this.oImageList.length;
idx++){
this.setAlpha(this.oImageList[idx],0);
};
this.setAlpha(this.oImageList[0],100);
this.oImageList[0].style.display="block";
};
SlideShow.prototype.Start=function(){
this.bStop=false;
var self=this;
this.iSlideTimer=window.setTimeout(function(){
SlideShow.prototype.SlideAction.call(self,1);
},this.iPause);
};
SlideShow.prototype.End=function(){
this.bStop=true;
};
SlideShow.prototype.SlideAction=function(){
var bRealStop=true;
if(arguments.length>1)bRealStop=arguments[1];
if(this.bExecute||(this.bStop&&bRealStop))return;
var self=this;
var iStep=arguments[0];
this.iSlideInterval=window.setInterval(function(){
SlideShow.prototype.DoFade.call(self,iStep);
},this.iSlideSpeed);
};
SlideShow.prototype.DoFade=function(step){
this.bExecute=true;
var iSlide=this.iSlideIndex;
var iSlideNext=iSlide+step;
if(iSlideNext<0)iSlideNext+=this.oImageList.length;
else iSlideNext%=this.oImageList.length;
if(this.fAlpha>30){
this.fAlpha-=this.iSpeed;
this.setAlpha(this.oImageList[iSlide],this.fAlpha);
}else{
if(this.fAlphaNext==0){
this.oImageList[iSlide].style.display="none";
this.oImageList[iSlideNext].style.display="block";
};
this.fAlphaNext+=this.iSpeed;
this.setAlpha(this.oImageList[iSlideNext],this.fAlphaNext);
if(this.fAlphaNext>=99){
if(iSlideNext==this.oImageList.length-1){
if(!this.oImageAction.bLoop){
window.clearTimeout(this.iSlideTimer);
window.clearInterval(this.iSlideInterval);
if((this.oImageAction.oActionType==LastImageAction.GOTO_URL)&&(this.oImageAction.sActionUrl!="")){
window.location=this.oImageAction.sActionUrl;
};
return;
}};
if((this.oThumbnail!=undefined)&&(this.oThumbnail!=null)){
this.oThumbnail.selectImage(iSlideNext);
};
if((this.oSlideTitle!=undefined)&&(this.oSlideTitle!=null)){
this.oSlideTitle.changeTitle(iSlideNext);
};
this.iSlideIndex=iSlideNext;
this.fAlpha=100;
this.fAlphaNext=0;
this.bExecute=false;
window.clearTimeout(this.iSlideTimer);
if(!this.bStop){
var self=this;
this.iSlideTimer=window.setTimeout(function(){
SlideShow.prototype.SlideAction.call(self,1);
},this.iPause);
};
window.clearInterval(this.iSlideInterval);
}}};
SlideShow.prototype.setAlpha=function(obj,opacity){
if(opacity<0)opacity=0;
if(opacity>=100)opacity=100;
try{
if(isIE()){
obj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+opacity+")";
}else if(isFirefox()){
if(opacity==100)opacity=99;
obj.style.MozOpacity=opacity/100;
}else if(isSafari()){
obj.style.opacity=opacity/100;
}}catch(ex){
}};
SlideShow.prototype.slideByStep=function(step){
this.SlideAction(step,false);
};
SlideShow.prototype.setThumbnailObject=function(obj){
this.oThumbnail=obj;
};
SlideShow.prototype.slideByIndex=function(index){
var step=index-this.iSlideIndex;
if(step!=0)this.slideByStep(step);
};
SlideShow.prototype.setSlideTitleObject=function(obj){
this.oSlideTitle=obj;
};


var box = new PictureBox(document.getElementById("slideshow"));
box.SetSlideProperties(3000,5);
box.SetShowSizeProperties(700,400,1,400,300);
box.SetShowPosition(false,0,0,0,0,0);
box.SetGeneralProperties(false,true,false,true,0,"",0,"#000000",0);
box.SetBackGround("#FFFFFF","","","","",1,"#000000",0);
var ImageList = new Array();
ImageList[0] = new ImageInfo("images/kep_3.jpg",800,533,"","_blank","","","");
ImageList[1] = new ImageInfo("images/kep_4.jpg",800,600,"","_blank","","","");
ImageList[2] = new ImageInfo("images/kep_5.jpg",640,480,"","_blank","","","");
ImageList[3] = new ImageInfo("images/kep_7.jpg",640,480,"","_blank","","","");
ImageList[4] = new ImageInfo("images/kep_8.jpg",640,480,"","_blank","","","");
ImageList[5] = new ImageInfo("images/kep_9.jpg",640,480,"","_blank","","","");
box.AddImages(ImageList);
box.BuildPictureBox();


