// JScript source code
var STP=new Array();   //static show picture time spam
var FTP=new Array();   //fading out time spam
var Tstep=new Array();   //every step time spam
var TotalStep=new Array();  //total steps for one picture
var Trans=new Array();  

var opacityValues = new Array();  //intial the first step, more than 100, igore the transparent 
var maxLinks =new Array();
var startValue = 1;
var cdiv=new Array();
var maxHeight=new Array();
var maxWidth=new Array();
var slide_height=265;

//test feild
//testval=document.getElementById("txtS");  
//testC=document.getElementById("txtC");
isIE = false; 
navVer = navigator.appVersion; 
ver = parseFloat(navVer); 
IEPos = navVer.indexOf('MSIE'); 
	    if (IEPos !=-1) { 
  	        isIE = true; 
  	        ver = parseFloat(navVer.substring(IEPos+5,navVer.indexOf(';',IEPos))); 
	    }
isIE5up = (isIE && ver >= 5);

function jjump(location,numc)
{
    //alert(TotalStep[location]);
    clearTimeout(Trans[location]);
    if(numc>1){
        cdiv[location]=numc-1;   
    }
    else
    {
        cdiv[location]=maxLinks[location];
    }
    
    for (i=1;i<=maxLinks[location];i++){
          document.getElementById('link' + location +'_'+ i ).style.zIndex = 200-i;
          document.getElementById('bt'+location +'_'+ i).style.backgroundImage="url(/images/core/no_bg.gif)";
           if(i==numc){
           document.getElementById('bt'+location +'_'+ i).style.backgroundImage="url(/images/core/no_bg_highlight.gif)";
          }
          if(i>cdiv[location])
          {
           setTransparent(i,100,location);
          }
         else
         {
             setTransparent(i, 0, location);
             document.getElementById('link' + location + '_' + i).style.zIndex = 100 - i;
         } 
          	                 
    }
    opacityValues[location] = 1 ;
    Trans[location]= setTimeout("nextImage("+cdiv[location] + "," + location +")",Tstep[location]);
} 

function setTransparent(adiv,tVal,location)  //set the transparent of a div
    {
     if(document.getElementById('link'+ location + '_'+adiv)!=null)
     {
     if(isIE5up ){
            document.getElementById('link'+ location + '_'+adiv).filters[0].opacity = tVal;                   
        }else{
            document.getElementById('link'+ location + '_'+adiv).style.MozOpacity = tVal/100;         		   
		    document.getElementById('link'+ location + '_'+adiv).style.opacity  = tVal/100;
		    document.getElementById('link'+ location + '_'+adiv).style.KhtmlOpacity = tVal/100;
        }
        }
    }
    
function setTransparent1(adiv,tVal,location)  //set the transparent of a div
    {
     if(document.getElementById(adiv)!=null)
     {
     if(isIE5up){
            document.getElementById(adiv).filters[0].opacity = tVal;                   
        }else{
            document.getElementById(adiv).style.MozOpacity = tVal/100;         		   
		    document.getElementById(adiv).style.opacity  = tVal/100;
		    document.getElementById(adiv).style.KhtmlOpacity = tVal/100;
        }
    }
    }
    
function isPause(location){
    if(document.getElementById("img" +location + "_pause").src.indexOf("pause_on.gif")>0)
    {
        return true;
    }else
    {
        return false;
    }
}
function jpause(location){
    if(maxLinks[location]==null){return false;}
     clearTimeout(Trans[location]);
    if(isPause(location))
    {
        document.getElementById("img" +location + "_pause").src="images/core/pause.gif"; 
        Trans[location]= setTimeout("nextImage("+cdiv[location] + "," + location +")",Tstep[location]);      
    }
    else
    {       
        document.getElementById("img" +location + "_pause").src="images/core/pause_on.gif";       
    }
}

function jcontinue(location){
        if(maxLinks[location]==null){return false;}
        clearTimeout(Trans[location]);    
        document.getElementById("img" +location + "_pause").src="images/core/pause.gif";         
        Trans[location]= setTimeout("nextImage("+cdiv[location] + "," + location +")",Tstep[location]);
}


	

function jback(location){
    clearTimeout(Trans[location]);   
    document.getElementById('link' + location +'_'+ cdiv[location] ).style.zIndex=200-cdiv[location];
    setTransparent(cdiv[location],100,location);
    document.getElementById('bt'+location +'_'+ cdiv[location]).style.backgroundImage="url(/images/core/no_bg.gif)";
    if(cdiv[location]>1){
        cdiv[location]=cdiv[location]-1;
        document.getElementById('link' + location +'_'+ cdiv[location]).style.zIndex=200-cdiv[location];
        setTransparent(cdiv[location],100,location);

         opacityValues[location] =TotalStep[location];
    }
    else{      
        cdiv[location]=maxLinks[location]-1;
        opacityValues[location] =1;
    }
   document.getElementById('bt'+location +'_'+ cdiv[location]).style.backgroundImage="url(/images/core/no_bg_highlight.gif)";
    //testC.value=opacityValue + "," + cdiv;   
    Trans[location]= setTimeout("nextImage("+cdiv[location]+ "," + location +")",Tstep[location]);
    
}

function jnext(location){
    clearTimeout(Trans[location]);
    setTransparent(cdiv[location],0,location);    
    opacityValues[location] =1 ;     
    Trans[location]= setTimeout("nextImage("+cdiv[location] + "," + location +")",Tstep[location]);
    
}
    
function nextImage(value,location){
    if(value<1){value=1;}
    cdiv[location]=value;     
    opacityValues[location] =opacityValues[location] - 1;
    //document.getElementById("txtC").value=value + "," + opacityValues[1] + "," +cdiv[1]; 
    if(opacityValues[location]<= 25){
        setTransparent(value,opacityValues[location]*4,location);			
    }
    
    if (opacityValues[location] == 0){   
        document.getElementById('link' + location +'_'+ value).style.zIndex = 100-value; 
        opacityValues[location] = TotalStep[location]; 
        document.getElementById('bt'+location +'_'+ value).style.backgroundImage="url(/images/core/no_bg.gif)";
        value= value+1;
        if (value>maxLinks[location]){
        value=1;            
        }
        document.getElementById('bt'+location +'_'+ value).style.backgroundImage="url(/images/core/no_bg_highlight.gif)";
   
        cdiv[location]=value;
        if (value==1){
            for (i=1;i<=maxLinks[location];i++){
                 document.getElementById('link' + location +'_'+ i ).style.zIndex = 200-i;
                
                 setTransparent(i,100,location);	
                 
            }
        }
        if (value==maxLinks[location]){   
            //alert(value);         
            for (i=1;i<maxLinks[location];i++){
                document.getElementById('link' + location +'_'+ i ).style.zIndex = 100-i;
                                
             }
             setTransparent(1,100,location); 
        }        
		
		
	}
    if(!isPause(location))
    {
	    Trans[location]= setTimeout("nextImage("+value + "," + location +")",Tstep[location]);
	}
}
   function startFad(location,STPvalue, FTPvalue){
        //if( enable_zoom==false){return false;}
        clearTimeout(Trans[location]);
        //alert(location+ "," + STPvalue + "," + FTPvalue);
        maxHeight[location]=0;
        STP[location]=STPvalue;
        FTP[location]=FTPvalue;
        Tstep[location]=FTP[location]/25;  //every step time spam
        TotalStep[location]=(FTP[location]+STP[location])/Tstep[location];  //total steps for one picture
        cdiv[location]=0;   
        opacityValues[location] = TotalStep[location];     
        maxLinks[location]=document.getElementById( "maxval_"+ location).value;
        for(i=1;i<=maxLinks[location];i++){
            if(document.getElementById('link' + location +'_'+ i).offsetHeight>maxHeight[location])
            {
            maxHeight[location]=document.getElementById('link' + location +'_'+ i).offsetHeight;
            maxWidth[location]=document.getElementById('link' + location +'_'+ i).offsetWidth;
            }
        }
        for(i=1;i<=maxLinks[location];i++){
            if(location==1)
            {
            document.getElementById('link' + location +'_'+ i).style.height= slide_height+ "px";
            }
            else
            {
            document.getElementById('link' + location +'_'+ i).style.height= slide_height+ "px";
            }
            //alert(document.getElementById('link' + location +'_'+ i).style.height);
        }
        if(document.getElementById('num' + location +'_bar')!=null)
        {
            document.getElementById('num' + location +'_bar').style.width=maxLinks[location]*28 +50 + "px";
        }
        
        if(document.getElementById('num' + location +'_cover')!=null)
        {
            document.getElementById('num' + location +'_cover').style.width=maxLinks[location]*28 +52 + "px";
        }
        document.getElementById('bt' +location +'_1').style.backgroundImage="url(/images/core/no_bg_highlight.gif)";
        setTransparent1('num' + location +'_cover',75,location);  
        Trans[location]= setTimeout("nextImage("+startValue + "," + location + ")",Tstep[location]);
       
    }