﻿// SlideShow 共用JS 文件




//-------------声明变量------------
//-------------end-----------------
var changeImg="two";
var cc=navigator.appName;
var mptwo = document.getElementById("MPtwo");
var matwo = document.getElementById("MAtwo");
var mpone = document.getElementById("MPone");
var maone = document.getElementById("MAone");
var demo = document.getElementById("demo");
var demo1 = document.getElementById("demo1");
var demo2 = document.getElementById("demo2");
var timeError =null;//图片下载的最大时间触发的定时器
var showTime=null;
var imgOk=false;//图片下载成功的标识
var timeOk=false;//在等待时间内onload事件不能启用布局
var timeWorkslistOver=null;//鼠标移出worklist的定时器
var timeWorkslistOut=null;//鼠标移出worklist的定时器
var WLstrTemp=null;
var speed=20;
var MyMar;
var gonow=1;
var pStateTemp=null;
var browseTime=null;
var timeIntervalFlashOut=null;
var artWorkIdTemp=null;
var errorList=new Array(); 
var showZoomIn=0;
var flashOrJs=null;
var workListBtn=false;
var browseBtn=false;
var sequenceOnLoad=null;
/////////////
new Init().InitJS();

//初始化类
function Init(){
    if(document.getElementById("Frame").style.height!=""){
        document.getElementById("js").style.position="static";
        if (mode == 0)
        {
            document.getElementById("js").style.overflow="hidden";
            document.getElementById("js").style.height = "407px";
        }
        else
        {
            document.getElementById("js").style.overflow="hidden";
            document.getElementById("js").style.height = "257px";
        }
    }else
    {
        if(mode==1){
            document.getElementById("js").style.overflow="hidden";
            document.getElementById("js").style.height = "400px";
        }
    }
    //初始化JS  
   this.InitJS = function(){
        document.getElementById("flashZoomIn").style.width="340px";
        if(mode==1){
            document.getElementById("ImgZZ").style.height="310px";
            document.getElementById("flashZoomIn").style.height="240px";
            document.getElementById("one").style.height="220px";
            document.getElementById("two").style.height="220px";
            document.getElementById("js").style.position="static"
        }
        new ControlStyle().InitBtn();
        new ControlStyle().ControlView(groupId);
        new ControlStyle().ControlIconStyle();
        //判断IE版本的代码
        if(cc=="Microsoft Internet Explorer"){
        var b_v = navigator.appVersion; 
        var IE6 = b_v.search(/MSIE 6/i) != -1; 
        var IE7 = b_v.search(/MSIE 7/i) != -1; 
        var IE8 = b_v.search(/MSIE 8/i) != -1; 
        if(IE6)
        {
            cc="IE6";
        }
        if(IE7)
        {
            cc="IE7";
        }
        if(IE8)
        {
            cc="IE8";
        }
    }
    //控制IE8的WLZZ的高度(worklist的遮罩层)2009-4-3 liulei
     if(cc=="IE8"){
        if(mode==0){
            document.getElementById("WLZZ").style.top="698px";
        }/*else{
            document.getElementById("WLZZ").style.top="509px";
        }*/
    }
    if(cc=="Netscape"){
        document.getElementById("createBlack").style.top="256px";
        if(mode==0){
            document.getElementById("WLZZ").style.top="692px";
        }else{
            document.getElementById("one").style.marginTop="256px";
            document.getElementById("two").style.marginTop="256px";
            document.getElementById("WLZZ").style.top="565px";
            document.getElementById("createBlack").style.top="256px";
        }
    }
     //----End----
     //Flash判断代码-------------------------------
     if(cc=="Netscape")
     {
        var i_flash;
        var v_flash;
        if (navigator.plugins) {
            for (var i=0; i < navigator.plugins.length; i++) {
                if (navigator.plugins[i].name.toLowerCase().indexOf("shockwave flash") >= 0) {
                    i_flash = true;
                    v_flash = navigator.plugins[i].description.substring(navigator.plugins[i].description.toLowerCase().lastIndexOf("flash ") + 6, navigator.plugins[i].description.length);
                }
            }
        }
        if(i_flash){  
            document.getElementById("flashZoomIn").style.display="block";
            flashOrJs="flash";
      
        }else{
            document.getElementById("flashZoomIn").style.display="none";
            flashOrJs="JS";
        }
     }else{
     
        try{
        var  swf  =  new  ActiveXObject('ShockwaveFlash.ShockwaveFlash');
        var a=(swf) ? 1 : 0 ;
            if(a){
                flashOrJs="flash";
                document.getElementById("flashZoomIn").style.display="block";
                var fileref=document.createElement('script')//创建标签 
                fileref.setAttribute("type","text/javascript")//定义属性type的值为text/javascript 
                fileref.setAttribute("src", "/JSSlideShow/JS/FlashZoomIn.js")//文件的地址 
                document.getElementsByTagName("head")[0].appendChild(fileref);
              //  var WandH = SampleMG.getAsize(CacheGroupID).value; 
                /*window.document.FZoomIn.SetVariable("toFlash", WandH);*/
            }
        }catch(e){  
            flashOrJs="JS";
            document.getElementById("flashZoomIn").style.display="none";
            var fileref=document.createElement('script')//创建标签 
            fileref.setAttribute("type","text/javascript")//定义属性type的值为text/javascript 
            fileref.setAttribute("src", "/JSSlideShow/JS/JSZoomIn.js")//文件的地址
            document.getElementsByTagName("head")[0].appendChild(fileref);           
        }
     } 
     //----------播放或停止 
       new ControlPlay().PlayOrStop();
       document.getElementById("initDiv").style.display="none";
       document.getElementById("Pagess").value=currentSequence;   
   }
}
//控制样式类
function ControlStyle(){
    this.InitBtn=function(){
        this.ControlButton("ZoomIn","ZoomInOut");
        this.ControlButton("Create","createOut");
        if(sampleCount>1){
            browseBtn=true;
            this.ControlButton("next","nextOut");
            this.ControlButton("pre","prevOut");
            this.ControlButton("play","Out");
        
        }else{
            //按钮变灰 2009-4-3 liulei
            this.ControlButton("next","nextUnable");
            this.ControlButton("pre","prevUnable");
            this.ControlButton("play","Unable");
            //---END---
            browseBtn=false;
            pState=false;
        }
        if(sampleCount>6){
            workListBtn=true;
            this.ControlButton("WLPre","wlPrevOut");
            this.ControlButton("WLNext","wlNextOut");
        }else{
            //按钮变灰 2009-4-3 liulei
            this.ControlButton("WLPre","wlPrevUnable");
            this.ControlButton("WLNext","wlNextUnable");
            //---END---
            workListBtn=false;
        }
    }
    
    //控制遮罩
    this.ControlMask= function(obj,type){
        document.getElementById(obj).style.display=type;
    }
    //所有按钮变灰 2009-4-3 liulei
    this.huiBtn=function(){
        this.ControlButton("ZoomIn","ZoomInUnable");
        this.ControlButton("Create","createUnable");
        this.ControlButton("next","nextUnable");
        this.ControlButton("pre","prevUnable");
        this.ControlButton("play","Unable");
        this.ControlButton("WLPre","wlPrevUnable");
        this.ControlButton("WLNext","wlNextUnable");
    }
    //---END---
    //控制按钮
    this.ControlButton=function(Object,BtnName){
        //09-04-03mouseover按钮样式 xht
        if(sampleCount<=6&&Object!="ZoomIn"&&Object!="Create"){
            if(sampleCount==1&&(Object=="play"||Object=="next"||Object=="pre")){
                if(Object=="play"){
                    BtnName="Unable";
                }
                else{
                    var tempName=BtnName.substr(BtnName.length-3,BtnName.length);
                    if(tempName=="ver" || tempName=="own"){
                        BtnName=BtnName.substr(0,BtnName.length-4)+"Unable";
                    }
                    if(tempName=="Out"){
                        BtnName=BtnName.substr(0,BtnName.length-3)+"Unable";
                    }
                }
            }else{
                if(sampleCount>1&&Object!="play"&&Object!="next"&&Object!="pre"){
                    var tempName=BtnName.substr(BtnName.length-3,BtnName.length);
                    if(tempName=="ver" || tempName=="own"){
                        BtnName=BtnName.substr(0,BtnName.length-4)+"Unable";
                    }
                    if(tempName=="Out"){
                        BtnName=BtnName.substr(0,BtnName.length-3)+"Unable";
                    }
                }
            }
        }
        if(Object=="play"){
            if(pState){
                document.getElementById(Object).src="/Images/JSSlideShow/stop"+BtnName+".gif";
            }else{
                document.getElementById(Object).src="/Images/JSSlideShow/play"+BtnName+".gif";
            }
         }else{
            document.getElementById(Object).src="/Images/JSSlideShow/"+BtnName+".gif";
         }

         //end
    }
    //控制全部按钮的可用性
    this.ControlAllButton=function(){
        
    }
    
    //控制样片图标边框
    this.ControlIconStyle=function(){
         var n=currentSequence;
         var om = document.getElementById("caseimg"+n);
         if(sampleCount>6)
         {
             for(var i=workListsNum-6;i<=workListsNum-1;i++){
                 if(i<=sampleCount && i>=1)
                {
                    document.getElementById("caseimg"+i).style.border="solid 2px White ";
                }
             } 
             if(n>=workListsNum-6&&n<=workListsNum-1)
             {
                 om.style.border="solid 2px #00C0FF ";
             }
         }
         else
         {
            for(var i=1;i<=6;i++){
                 if(i<=sampleCount && i>=1)
                {
                    document.getElementById("caseimg"+i).style.border="solid 2px White ";
                }
             } 
             if(n>=1&&n<=sampleCount)
             {
                 om.style.border="solid 2px #00C0FF ";
             }
         }
    }
    //渐变效果
    this.SlowChange=function(sequence){
         //---------------------测试可用开始----------------------      
        
        if(cc=="IE7"||cc=="IE6"||cc=="IE8"){
             //IE渐变---------------------------------
             new ControlStyle().ControlMask("initDiv","block");
             var num1 = document.getElementById(changeImg).filters.alpha.opacity;
             //var num2 = document.getElementById("bb").filters.alpha.opacity
             //消失
             if(num1>0){
                num1=num1-10;
                document.getElementById(changeImg).style.filter="alpha(opacity="+num1+")";
                setTimeout("new ControlStyle().SlowChange("+sequence+")",100);
             }else{
                document.getElementById(changeImg).style.display="none";
                
                document.getElementById(changeImg).style.zIndex=0;
                if(changeImg=="two"){
                     document.getElementById("one").style.zIndex=10;
                }else{
                     document.getElementById("two").style.zIndex=10;
                } 
                new ImgHandling().ShowEnd();
             }
//             //显示
//             if(num2<100){
//                num2=num2+5;
//                document.getElementById("bb").style.filter="alpha(opacity="+num2+")";
//                setTimeout("new ControlStyle().SlowChange()",100);
//             }
//             }
           
        }else if(cc=="Netscape"){                     
            //FF和Safair渐变
            var num1 = document.getElementById(changeImg).style.opacity;
            //消失
            if(num1>0){
                num1=num1-0.1;
                document.getElementById(changeImg).style.opacity = num1;
                setTimeout("new ControlStyle().SlowChange()",100);
             }else{
                document.getElementById(changeImg).style.display="none";
                document.getElementById(changeImg).style.zIndex=0;
                if(changeImg=="two"){
                     document.getElementById("one").style.zIndex=10;
                }else{
                     document.getElementById("two").style.zIndex=10;
                } 
                new ImgHandling().ShowEnd();
             }
//            //显示
//              if(num2<1){
//                  num2= parseFloat(num2)+0.05;
//                  document.getElementById("aa").style.opacity = num2;
//                  setTimeout("new ControlStyle().SlowChange()",100);
//              }
          }
          //-------------------测试可用结束---------------------------    
    }
    //控制View的样式
    this.ControlView=function(ViewGroupID){
        if(groupList!="")
        {
            var View=groupList.split('|');
            if(View.length>1){
                for(var i=0;i<View.length;i++){
                    var v=View[i].split(',');
                    document.getElementById(v[0]).style.textDecoration="underline";
                    document.getElementById(v[0]).style.fontFamily="Verdana";
                    document.getElementById(v[0]).style.fontWeight="normal";
                    document.getElementById(v[0]).style.color="#1B434A";
                }
                document.getElementById(ViewGroupID).style.textDecoration="none";
                document.getElementById(ViewGroupID).style.fontFamily="Verdana";
                document.getElementById(ViewGroupID).style.fontWeight="bold";
                document.getElementById(ViewGroupID).style.color="#000000";
                document.getElementById(ViewGroupID).style.cursor="default";
                document.getElementById(ViewGroupID).blur();
            }
        }
    }
    this.ControlViewOut=function(ViewGroupID){
        if(groupList!=""){
            if(ViewGroupID==groupId){
                document.getElementById(ViewGroupID).style.textDecoration="none";
                document.getElementById(ViewGroupID).style.fontFamily="Verdana";
                document.getElementById(ViewGroupID).style.fontWeight="bold";
                document.getElementById(ViewGroupID).style.color="#000000";
                document.getElementById(ViewGroupID).style.cursor="default";
            }else{
                document.getElementById(ViewGroupID).style.textDecoration="underline";
                document.getElementById(ViewGroupID).style.fontFamily="Verdana";
                document.getElementById(ViewGroupID).style.fontWeight="normal";
                document.getElementById(ViewGroupID).style.color="#1B434A";
            }
        }
    }
    this.ControlViewOver=function(ViewGroupID){
        if(groupList!=""){
            if(ViewGroupID!=groupId){
            document.getElementById(ViewGroupID).style.textDecoration="underline";
            document.getElementById(ViewGroupID).style.color="blue";
            document.getElementById(ViewGroupID).style.cursor="pointer";
            }
        }
    }
}
//////////////////////////////////////////////////////////////////////////////////
//图片加载
    var errorLoad=true;
function OnloadImg(sequenceO){
    onloadS=onloadS+1;
    var maload=false;
    var mpload=false;
    var a=sequenceO;
    if(!beingMP){
         mpload=true
    }
    errorLoad=true;
    //错误图片停止onload
    for(var i=0;i<errorList.length;i++){
        if(errorList[i]==sequenceO){
            errorLoad=false;
        }
    }
    eval("ma"+changeImg).onload= function(){  
        if(onloadS<=1){
            if(errorLoad){
                maload=true;
                if(mpload)
                { 
                    maload=false;
                    if(beingMP){
                         mpload=false;
                    }
                    clearTimeout(timeError);
                    imgOk=true;
                    if(timeOk){
                        LayOut(sequenceO);
                    }
                }    
            } 
        }else{
            onloadS--;
        }      
    } 
    if(beingMP){  
        eval("mp"+changeImg).onload= function(){ 
            if(onloadS<=1){
                if(errorLoad){
                    mpload=true;
                    if(maload)
                    {
                        maload=false;
                        mpload=false;
                        clearTimeout(timeError);
                        imgOk=true;
                        if(timeOk){
                            LayOut(sequenceO);
                        }
                    }   
                }
            }else{
                onloadS--;
            }
        }
    }     
}
function OnloadType(sequenceT){
    if(imgOk==true){
        LayOut(sequenceT);
        imgOk=false;   
    }else{
        timeOk=true;
        document.getElementById("ImgZZ").style.display="block";
    } 
    
}
function ImgError(sequenceE){
    errorList.push(sequenceE);
   // imgOk=false;
 
    new ControlStyle().ControlMask("initDiv","none");
    /*if(pState){
        sequenceE=sequenceE+1;
        sequenceE = new DataHandling().ControlSequence(sequenceE,"next");
        new ImgHandling().ReadyImg(sequenceE); 
        document.getElementById("ImgZZ").style.display="none";
    }*/

    
}
function LayOut(sequence)
{
    if(sequenceOnLoad == sequence)
    {
        if(mode==0){
            var sampleArray = eval(sampleList+"["+sequence+"]").split("|"); 
            var a = sampleArray[1].split("-");
            var aw=a[0].split(",")[0];
            var ah=a[0].split(",")[1];
            var pw=a[1].split(",")[0];
            var ph=a[1].split(",")[1]; 
            document.getElementById("MA"+changeImg).style.marginLeft=(340-aw)/2+"px";
            document.getElementById("MP"+changeImg).style.marginLeft=(340-aw)/2+"px";
            document.getElementById("MP"+changeImg).style.marginTop=(360-ph)+"px";
        }
        else
        {
            var sampleArray = eval(sampleList+"["+sequence+"]").split("|"); 
            var a = sampleArray[1].split("-");
            var aw=a[0].split(",")[0];
            var ah=a[0].split(",")[1];
            var pw=a[1].split(",")[0];
            var ph=a[1].split(",")[1]; 
            document.getElementById("MA"+changeImg).style.marginRight=(340-aw-pw-5)/2+"px";
            document.getElementById("MP"+changeImg).style.marginLeft=(340-aw-pw-5)/2+"px";
        }
        new ImgHandling().ShowImg(sequence);
    }
}

///////////////////////////////////////////////////////////////////////
//图片处理类
  var onloadS=0;
function ImgHandling(){
    //图片准备
    this.ReadyImg=function(sequenceI){ 
     
       var cacheImgId = new DataHandling().ReadSamplList(sequenceI);
        
       // var sjTemp=parseInt(Math.random()*1000);
        var sampleArray = eval(sampleList+"["+sequenceI+"]").split("|"); 
        var a = sampleArray[1].split("-");
        var aw=a[0].split(",")[0];
        var ah=a[0].split(",")[1];
        var pw=a[1].split(",")[0];
        var ph=a[1].split(",")[1]; 
        
        if(pw!="0"){
            eval("mp"+changeImg).src="/x/"+cacheImgId+"/MP"
            if(mode==0){
                if(changeImg=="one"){
                    eval("mpone").style.display="block";
                }else{
                    eval("mptwo").style.display="block";
                }
            }
        }else{
            if(mode==0){
                if(changeImg=="one"){
                    eval("mpone").style.display="none";
                }else{
                    eval("mptwo").style.display="none";
                }
            }
        }
        eval("ma"+changeImg).src="/x/"+cacheImgId+"/MA"
        //timeOk=false;
        //onloadS=0;
        sequenceOnLoad=sequenceI;
        //OnloadImg(sequenceI);
        showTime = setTimeout("LayOut("+sequenceI+")",browseTime);
        //timeError=setTimeout("ImgError("+sequenceI+")",10000);
    }
    //图片加载
   // this.OnloadImg=function(){
        
   // }
    //图片显示
    this.ShowImg=function(sequence){
       
        document.getElementById(changeImg).style.display="block";
        document.getElementById(changeImg).style.filter="alpha(opacity=100)";
        document.getElementById(changeImg).style.opacity = "1";
        if(changeImg=="two"){
            changeImg="one";
        }else{
            changeImg="two";
        } 
        try{
            var sampleArray = eval(sampleList+"["+sequence+"]").split("|");  
            cacheImgId=sampleArray[0];
            var a = sampleArray[1].split("-");
            var wh=a[0]+"-"+a[1]+"-"+sampleArray[0];
            if(cc=="Netscape"){
                document.embeds["firFlash"].SetVariable("toFlash", wh);
            }else{
                window.document.FZoomIn.SetVariable("toFlash", wh);
            }
        }
        catch(e)
        {
        }
        currentSequence=sequence;
            var temp=sequence;
            
            if(temp%6>0)
            {
                temp=parseInt(temp/6)*6+1;
            }
            else
            {
                temp=(parseInt(temp/6)-1)*6+1;
            }
            
            if(temp!=workListsNum-6)
            {
                workListsNum=temp;
                if(sampleCount>6)
                {   
                    new ImgBrowse().IconPush('Left');
                }
            }
            new ControlStyle().ControlIconStyle();
          new ControlStyle().SlowChange(sequence);
          document.getElementById("Pagess").value=currentSequence;
    }
    //
    this.ShowEnd=function(){
       document.getElementById("Pagess").style.border="solid 1px #ADADAD";
       new ControlStyle().ControlMask("initDiv","none");
       
       
       document.getElementById("ImgZZ").style.display="none";
       document.getElementById("WLZZ").style.display="none";
     
       document.getElementById("ofPagess").style.display ="block";
       document.getElementById("GoBtn").style.display="none";
       new ControlStyle().ControlMask("createBlack","none");
       new ControlStyle().ControlMask("zoominBlack1","none");
       showZoomIn=0;
       new ControlStyle().InitBtn();
       new Reference().ControlReferenceStyle("Out");
       new ControlPlay().PlayOrStop();
    }
}
var ppp = new Array(130);
//数据处理类
function DataHandling(){
    //读取数据
    this.ReadSamplList=function(sequenceD,sTe){ 
    //eval(sampleList).push(要添加的内容);
        //alert(SlideSampleImg.getAsize("1001").value);
    //eval(sampleList).splice(要删除的索引，要删除的个数，要更新的内容一，要更新的内容二)
        var cacheImgId = null;
        if(eval(sampleList+"["+sequenceD+"]")!=undefined &&eval(sampleList+"["+sequenceD+"]")!=0){
          
            var sampleArray =eval(sampleList+"["+sequenceD+"]").split("|");            
            cacheImgId=sampleArray[0];
            return cacheImgId;
           
        }else{
            var sequenceTemp=sequenceD;
            if(designSequence==0){
                sequenceD=sequenceD-1;
            }else if(designSequence>1){
                if(sequenceD<=designSequence){
                    sequenceD=sequenceD-1;
                }
            }
            if(sequenceD>0 && sequenceD<10){
                sequenceD="00"+sequenceD;      
            }else if(sequenceD>=10 && sequenceD<100){
                sequenceD="0"+sequenceD;                
            }else{
                sequenceD=sequenceD;      
            }
            cacheImgId=groupId+""+sequenceD;
            
          
            //alert(eval(sampleList+"[1]"));
            if(sTe != "strTemp")
            {
                eval(sampleList).splice(sequenceTemp,1,cacheImgId+"|"+SlideSampleImg.getAsize(cacheImgId).value);  
            }
            return cacheImgId;
        //----------------------查数据-----------------
            
           // eval(sampleList).splice(sequenceTemp,0,);//添加数据
           // return eval(sampleList+"["+sequence+"]"); 
        }
    }
    //控制序号循环播放
    this.ControlSequence=function(sequence,Location){
        //Location为pre或next;
       if(Location=="pre"&&sequence<1){sequence=sampleCount;}
       else if(Location=="next"&&sequence>sampleCount){sequence=1;}
       return  sequence;
    }
    //错误处理
    this.ErrorHandling=function(){   
    }
    //验证输入框
    this.InputBox=function(){
        n=document.getElementById("Pagess").value;
        var sequence;
        if(isNaN(n)||sampleCount==1) {            
            document.getElementById("Pagess").value=currentSequence;  
            document.getElementById("GoBtn").style.display="none";
            document.getElementById("ofPagess").style.display ="block";
            document.getElementById("Pagess").style.border="solid 1px #ADADAD";
        }else{
            n=parseInt(n,10);
            if(n==currentSequence){
               document.getElementById("Pagess").value=currentSequence;  
               document.getElementById("GoBtn").style.display="none";
               document.getElementById("ofPagess").style.display ="block";
               document.getElementById("Pagess").style.border="solid 1px #ADADAD";
            }
            else{
                document.getElementById("ImgZZ").style.display="block";
                if(n<=0){
                    sequence=1;
                }else if(n>0&&n<sampleCount){ 
                    sequence=n;
                }else{
                    
                    sequence=sampleCount;
                }
                browseTime=1000;
                new ImgHandling().ReadyImg(sequence);
            }
        } 
    }
}

//控制播放停止
function ControlPlay(){
    //播放
    this.Play=function(){
        pState=true;
        //09-04-03 控制一张时按钮样式XHT
        if(sampleCount>1){
            new ControlStyle().ControlButton("play","Out");
        }
        //end
        new ImgBrowse().AutomaticBrowse();
    }
    //停止
    this.Stop=function(){
        pState=false;
        clearTimeout(showTime);
        clearTimeout(timeError);
        //09-04-03 控制一张时按钮样式XHT
        if(sampleCount>1){
            new ControlStyle().ControlButton("play","Out");
        }
        //end
    }
    //恢复播放状态
    this.ResumePlay=function(){
        if(pStateTemp==true){
            pStateTemp=false;
            browseTime=2000;
            this.Play();
        }
        strTemp="Out";
        WLstrTemp="Out"
        var fid= document.getElementById("SMDiv");
        fid.style.display="none";
    }

    this.PlayOrStop=function(){
        if(pState==true){
        
           this.Play();
          
        }else{
            this.Stop();
        }
    }
    //点击按钮时触发
    this.PlayBtn=function(){
        if(browseBtn){
            if(pState!=true){
               browseTime=0;
               this.Play();
            }else{
                this.Stop();
            }
        }
    }
}


//浏览图片
function ImgBrowse(){
    //自动浏览
    this.AutomaticBrowse=function(){
        var sequence=currentSequence+1;
        browseTime=4500;
        sequence = new DataHandling().ControlSequence(sequence,"next");
        new ImgHandling().ReadyImg(sequence); 
    }
    //上下翻页浏览
    this.PreAndNextBrowse=function(num,way){ 
        if(browseBtn){
            document.getElementById("ImgZZ").style.display="block";
            browseTime=1000;
            new ControlPlay().Stop();
            var sequence=currentSequence+num;
            sequence = new DataHandling().ControlSequence(sequence,way);
            new ImgHandling().ReadyImg(sequence);
        }
    }
    //输入框浏览
    this.InputBrowse=function(obj1,obj2){
        if(browseBtn){
                new ControlPlay().Stop();
                if(obj2=="keyDown"){
                    //隐藏 ofsize层
                    document.getElementById("ofPagess").style.display ="none";
                    //显示GO层
                    document.getElementById("GoBtn").style.display="block";
                }
                if(obj2=="focus"){
                    obj1.select();
                    document.getElementById("Pagess").style.width="30px";
                    document.getElementById("Pagess").style.height="15px";
                    if(navigator.appName=="Netscape"){
                    document.getElementById("Pagess").style.width="32px";
                    document.getElementById("Pagess").style.height="17px";
                    }
                    document.getElementById("Pagess").style.border="solid 2px #99CCFF";
                    obj1.onkeypress=function(e){
                        if(window.event){
                            if(event.keyCode==13){
                                //this.InputBrowse(this,"getPage");
                                new DataHandling().InputBox();
                            }
                        }else if(e.which){
                            if(e.which==13){
                               // new ImgBrowse().InputBrowse(this,"getPage");
                                new DataHandling().InputBox();
                            }
                        }
                    }
               } 
        }
    }
    //点击样片图标浏览
    this.IconBrowse=function(sequence){
        new ControlStyle().ControlMask("initDiv","block");       
        document.getElementById("ImgZZ").style.display="block";
        pStateTemp=false;
        new ControlPlay().Stop();  
        browseTime=1000;
        new ImgHandling().ReadyImg(sequence);
    }
    //换组浏览
    this.GroupBrowse=function(groupID){
        if(groupId!=groupID){
          
            document.getElementById("ImgZZ").style.display="block";
            document.getElementById("WLZZ").style.display="block";
            pStateTemp =pState;
       
            new ControlPlay().Stop();  
              //全部按钮变灰 2009-4-3 刘磊
              new ControlStyle().huiBtn();
               //END
            groupId=groupID;
            new ControlStyle().ControlView(groupID);
            var groupArray=groupList.split("|");
            var groupTemp=null;
            for(var i=0;i<groupArray.length;i++){
                if(groupArray[i].split(",")[0]==groupId){
                    groupTemp=groupArray[i];
                    break;
                }
            }
            
            sampleList=groupTemp.split(",")[1];
            sampleCount=groupTemp.split(",")[2];
            designSequence=groupTemp.split(",")[3];
            currentSequence=0;
            workListsNum=1;
            //加了初次跳组的标示（“go”）2009-4-3 liulei
            new ImgBrowse().IconPush('Left','','go');
            //END
            var pn = document.getElementById("PagenNum");
            pn.innerText=sampleCount;
            pn.textContent=sampleCount;
            new ImgBrowse().AutomaticBrowse();
            if(sampleCount>1){
                pState=pStateTemp;
            }else{
                pState=false;
            }
        }        
    }
    //样片图标左右推动
    //左右推动的数据处理
    this.IconPush=function(way,type,comein){
        var cone_frist="";
        if(type=="stop" && sampleCount>6){
            new ControlPlay().Stop();
        }
        if(workListBtn || comein=="go"){
            var sc=0;
            if(sampleCount<=6){
                sc=0;
            }else{
                sc=1;
            }
            var tz;
            if(way=="Left"){
                demo2.innerHTML=this.ShowWorksList(workListsNum,2,1,sc); 
            }
            if(workListsNum-12>0){
                tz = workListsNum-12;	
            }else{
                if(sampleCount%6!=0)
                {
                tz = sampleCount-(sampleCount%6)+1;
                }
                else
                {
                tz = sampleCount-5;
                }
            }
            if(way=="Left"){
                if(sampleCount<=6)
                {
                tz=7; 
                }
                demo1.innerHTML=this.ShowWorksList(tz,1,0,sc);
                new ControlStyle().ControlIconStyle();
                demo.scrollLeft=0;
            }
            if(way=="Right"){ 
                workListsNum=tz;
                demo1.innerHTML=this.ShowWorksList(workListsNum,1,1,sc);
                demo2.innerHTML=this.ShowWorksList(workListsNum,2,0,sc);
                new ControlStyle().ControlIconStyle();
                demo.scrollLeft=demo1.scrollWidth;
            }
            if(way=="Right"){
                MyMar=setInterval(this.Right,speed);
            }else{
                MyMar=setInterval(this.Left,speed);
            }
        }
    }
    //左右推动的功能
    this.Left=function(){
        new ControlStyle().ControlMask("initDiv","block");
        if(demo2.offsetWidth-demo.scrollLeft<=0){
            clearInterval(MyMar);
            new ControlStyle().ControlMask("initDiv","none");
        }else{
            if(demo.scrollLeft==0){
	            demo.scrollLeft=demo.scrollLeft+295*(1/10);
	        }else{
	            demo.scrollLeft=demo.scrollLeft+demo.scrollLeft*(1/10);
	        }
        }
    }
    this.Right=function(){
        new ControlStyle().ControlMask("initDiv","block");
        if(demo.scrollLeft<=0){
            clearInterval(MyMar);
            new ControlStyle().ControlMask("initDiv","none");
        }else{
            if(demo.scrollLeft==295){
                demo.scrollLeft=demo.scrollLeft-295*(1/10);
            }else{
                demo.scrollLeft=demo.scrollLeft-demo.scrollLeft*(1/10);
            }
        }
    }
    //左右推动层的拼接
    this.ShowWorksList=function(num,id,hold,sc){
        var straa="<div id=\"ca"+id+"\"  style=\"WIDTH: 295px; HEIGHT: 48px;text-align:center;\">";
        var num_true=num;
        if(num>sampleCount)
        {
            num=1;
        }
        for(var i=1;i<=6;i++){
            if(num>sampleCount){
                if(sc==0 && hold==0){
                    straa=straa+"<img id=\"Tcaseimg"+num+"\" class=\"WLImg\" style=\"display:none;\"/>";
                }
                else{
                    straa=straa+"<img id=\"caseimg"+num+"\" class=\"WLImg\" style=\"display:none;\"/>";
                }
            }
            else{
                var str=null;
                str = new DataHandling().ReadSamplList(num,"strTemp"); 
                
                if(sc==0 && hold==0){
                    straa=straa+"<img id=\"Tcaseimg"+num+"\" style=\" background-repeat:no-repeat; background-position:center;background-image:url(/Images/JSSlideShow/loading2.gif)\" class=\"WLImg\" src=\"/x/"+str+"/ST\" onmouseover=\"new ImgZoomIn().IconZoomIn("+num+")\" onmouseout=\"new ImgZoomIn().IconZoomInClose()\" onclick=\"new ImgBrowse().IconBrowse("+num+")\"/>";
                }else{
                    straa=straa+"<img id=\"caseimg"+num+"\" style=\" background-repeat:no-repeat; background-position:center;background-image:url(/Images/JSSlideShow/loading2.gif)\" class=\"WLImg\" src=\"/x/"+str+"/ST\" onmouseover=\"new ImgZoomIn().IconZoomIn("+num+")\" onmouseout=\"new ImgZoomIn().IconZoomInClose()\" onclick=\"new ImgBrowse().IconBrowse("+num+")\"/>";
                }
            }
              num = num+1;
         } 
         if(hold==1){
            workListsNum=num;
         }
         straa=straa+"</div>";
         return straa;
    }
}
//样片放大
function ImgZoomIn(){
    //样片图标放大
    this.IconZoomIn=function(sequenceIZ,TP){
        clearTimeout(timeIntervalFlashOut);
        clearTimeout(timeWorkslistOut);
        clearTimeout(timeWorkslistOver);
        if(TP == undefined){   
            timeWorkslistOver=setTimeout("new ImgZoomIn().IconZoomIn("+sequenceIZ+",1)",400);
        }
        if(TP != undefined){
           
                if(WLstrTemp!="Over")
                {
                     if(pState==true)
                    {
                         pStateTemp =true;
                     }else{
                        pStateTemp=false;
                     }
                     
                }
                WLstrTemp="Over";
                new ControlPlay().Stop();
            document.getElementById("caseimg"+sequenceIZ).style.border="solid 2px #FF0000";
            
           // var caseimg="caseimg"+sequenceIZ;
           // caseimg= document.getElementById(caseimg);
            var fid= document.getElementById("SMDiv");
            var SM=document.getElementById("SM");
            new DataHandling().ReadSamplList(sequenceIZ); 
            var sampleArray =eval(sampleList+"["+sequenceIZ+"]").split("|"); 
            var smArtworkId=sampleArray[2];
            var SMWandH=SlideSampleImg.getSMsize(smArtworkId).value;
           
            var WH=SMWandH.split(","); 
            var imageWidth=WH[0];
            var imageHeight=WH[1];
            fid.style.width=imageWidth+"px";
            fid.style.height=imageHeight+"px";
            var size=0;
            var sjTemp=parseInt(Math.random()*1000);
            //SM.src="/Images/JSSlideShow/loading2.gif";
           
            SM.src="/images/phototoart/" + smArtworkId + "/G/SM.jpg?smTe="+sjTemp;
            if(sequenceIZ%6==1)
            fid.style.left=173-size+"px";
            else if(sequenceIZ%6==2)
            fid.style.left=221-size+"px";
            else if(sequenceIZ%6==3)
            fid.style.left=269-size+"px";
            else if(sequenceIZ%6==4)
            fid.style.left=317-size+"px";
            else if(sequenceIZ%6==5)
            fid.style.left=368-size+"px";
            else if(sequenceIZ%6==0)
            fid.style.left=416-size+"px";
            if(imageWidth>imageHeight){
                    size=10;
                    document.getElementById("jtDiv").style.marginLeft="12px";
               }else{
                     document.getElementById("jtDiv").style.marginLeft="0px";
            }
           if(cc=="Netscape")
           {
                if(mode==0){
                    fid.style.top=(681-imageHeight)+"px";
               }else{
                    fid.style.top=(556-imageHeight)+"px";
               }
           }
           else
           {
               if(mode==0){
                    fid.style.top=(691-imageHeight)+"px";
               }else{
                    fid.style.top=(566-imageHeight)+"px";
               }
           }
  
            SM.onload=function(){
               if(WLstrTemp=="Over"){
                  fid.style.display="block";
               }  
            }
         
        }
    }
    this.IconZoomInClose=function(){
        clearTimeout(timeWorkslistOver);
        if(pStateTemp==true)
        {
            pState=true;
        }
        var fid= document.getElementById("SMDiv");
        fid.style.display="none";
        timeWorkslistOut=setTimeout("new ControlPlay().ResumePlay()",400);
        for(var i=workListsNum-6;i<workListsNum;i++ ){
            document.getElementById("caseimg"+i).style.border="solid 2px White";
        }
        new ControlStyle().ControlIconStyle();
    }
    //放大
    this.ZoomIn=function(){
        pStateTemp =false;
        new ControlStyle().ControlMask("createBlack","none");
        new ControlPlay().Stop();
        var sampleArray=eval(sampleList+"["+currentSequence+"]").split("|");            
        var artWorkId=sampleArray[2];
        var cacheImgId=sampleArray[0];
        var a = sampleArray[1].split("-");
        var MA_WH=a[0].split(",");
        var MP_WH=a[1].split(",");
        if(flashOrJs=="flash"){
            if(showZoomIn==0){
                if(mode==0){
                    document.getElementById("zoominBlack1").style.width=MA_WH[0]+"px";
                    document.getElementById("zoominBlack1").style.marginLeft=((340-parseInt(MA_WH[0]))/2)+1+"px";
                    document.getElementById("zoominBlack1").style.top=(180+((parseInt(MA_WH[1])-40)/2))+"px";
                }else{
                    document.getElementById("zoominBlack1").style.width=(parseInt(MP_WH[0])+parseInt(MA_WH[0])+5)+"px";
                    document.getElementById("zoominBlack1").style.marginLeft=((340-(parseInt(MP_WH[0])+parseInt(MA_WH[0])+5))/2)+1+"px";
                    document.getElementById("zoominBlack1").style.top=(246+((parseInt(MA_WH[1])-40)/2))+"px";
                }
                showZoomIn=1;
                
                new ControlStyle().ControlMask("zoominBlack1","block");
            }else{
                showZoomIn=0;
                new ControlStyle().ControlMask("zoominBlack1","none");
            }
        }else{             
            openBigImage();
        }
       
      
    }
    this.ControlZoomInStyle=function(str){
        //鼠标停留暂停播放
        /*if(str=="Over"){
            pStateTemp=pState;
            clearTimeout(timeIntervalFlashOut);
            new ControlPlay().Stop();
        }else{
            pState=pStateTemp;
            new ControlPlay().ResumePlay();
        }*/
        document.getElementById("ZoomIn").src="/Images/JSSlideShow/zoomin"+str+".gif";
    }  
    this.ZoomInOnclick=function(){
        new ControlStyle().ControlMask("createBlack","none");
        new ControlPlay().Stop();
        var sampleArray=eval(sampleList+"["+currentSequence+"]").split("|");            
        var artWorkId=sampleArray[2];
        var a = sampleArray[1].split("-");
        var MA_WH=a[0].split(",");
        var MP_WH=a[1].split(",");
        if(showZoomIn==0){
             if(mode==0){
                document.getElementById("zoominBlack1").style.width=MA_WH[0]+"px";
                document.getElementById("zoominBlack1").style.marginLeft=((340-parseInt(MA_WH[0]))/2)+1+"px";
                document.getElementById("zoominBlack1").style.top=(180+((parseInt(MA_WH[1])-40)/2))+"px";
            }else{
                document.getElementById("zoominBlack1").style.width=(parseInt(MP_WH[0])+parseInt(MA_WH[0])+5)+"px";
                document.getElementById("zoominBlack1").style.marginLeft=((340-(parseInt(MP_WH[0])+parseInt(MA_WH[0])+5))/2)+1+"px";
                document.getElementById("zoominBlack1").style.top=(246+((parseInt(MA_WH[1])-40)/2))+"px";
            }
            showZoomIn=1;
            
            new ControlStyle().ControlMask("zoominBlack1","block");
        }else{
            showZoomIn=0;
            new ControlStyle().ControlMask("zoominBlack1","none");
        }
    }
}
//参考
function Reference(){
    this.ReferenceOnClick=function(str){
        pStateTemp =false;
        new ControlStyle().ControlMask("zoominBlack1","none");
        showZoomIn=0;
        //new ControlPlay().Stop();
        var sampleArray=eval(sampleList+"["+currentSequence+"]").split("|");            
        var artWorkId=sampleArray[2];
        if(str!="Out"){
            if(sampleArray[2]!=artWorkIdTemp){
                artWorkIdTemp=artWorkId;
                SettxtInstruction(currentSequence,artWorkId);
                document.getElementById("Create").src="/Images/JSSlideShow/undo"+str+".gif";
                var a = sampleArray[1].split("-");
                var MA_WH=a[0].split(",");
                var MP_WH=a[1].split(",");
                if(mode==0){
                    document.getElementById("createBlack").style.width=MA_WH[0]+"px";
                    document.getElementById("createBlack").style.marginLeft=((340-parseInt(MA_WH[0]))/2)+1+"px";
                }else{
                    document.getElementById("createBlack").style.width=(parseInt(MP_WH[0])+parseInt(MA_WH[0])+5)+"px";
                    document.getElementById("createBlack").style.marginLeft=((340-(parseInt(MP_WH[0])+parseInt(MA_WH[0])+5))/2)+1+"px";
                }
                new ControlStyle().ControlMask("createBlack","block");
                //document.getElementById("createBlack").style.display="block";
            }
            else
            {
                SettxtInstruction(0,artWorkId);
                artWorkIdTemp=null;
                document.getElementById("Create").src="/Images/JSSlideShow/create"+str+".gif";
                new ControlStyle().ControlMask("createBlack","none");
                //document.getElementById("createBlack").style.display="none";
            }
        }else{
            SettxtInstruction(0,artWorkId);
            artWorkIdTemp=null;
            document.getElementById("Create").src="/Images/JSSlideShow/create"+str+".gif";
            new ControlStyle().ControlMask("createBlack","none");
        }
    }
    //参考的按钮的样式
    this.ControlReferenceStyle=function(str){
        //鼠标停留暂停播放
        /*if(str=="Over"){
            pStateTemp=pState;
            clearTimeout(timeIntervalFlashOut);
            new ControlPlay().Stop();
        }else{
            pState=pStateTemp;
            new ControlPlay().ResumePlay();
        }*/
        var sampleArray=eval(sampleList+"["+currentSequence+"]").split("|");
        if(sampleArray[2]==artWorkIdTemp){
            document.getElementById("Create").src="/Images/JSSlideShow/undo"+str+".gif";
        } else{
            document.getElementById("Create").src="/Images/JSSlideShow/create"+str+".gif";
        }
    }
}




