// 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 mlocation=1;
var precon="ctl00_mainContent_";
var prelink="ctl00_mainContent_slideshow_ctl";
var prebt="ctl00_mainContent_nav_ctl";

//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(numc)
{    
    //alert(numc);
    clearTimeout(Trans[mlocation]);
    if(numc>1){
        cdiv[mlocation]=numc-1;   
    }
    else
    {
        cdiv[mlocation]=maxLinks[mlocation];
    }
    
    for (i=1;i<=maxLinks[mlocation];i++){
         num_txt="";
          if(i<10){ num_txt="0" + String(i-1); num_txt1="0"+i;}
            else{num_txt=String(i-1);num_txt1=i;}
          document.getElementById(prelink + num_txt + '_link').style.zIndex = 200-i;
          document.getElementById(prebt + num_txt1 +'_bt_num').style.backgroundImage="url(resources/images/upper_nav_bg.jpg)";
           if(i==numc){
            //alert(prebt + num_txt1 +'_bt_num');
            document.getElementById(prebt + num_txt1 +'_bt_num').style.backgroundImage="url(resources/images/numbg.gif)";
          }
          if(i>cdiv[mlocation])
          {
           setTransparent(i,TotalStep[mlocation],mlocation);
          }
         else
         {
            setTransparent(i,0,mlocation);
         } 
          	                 
    }
    opacityValues[mlocation] = 1 ;
    Trans[mlocation]= setTimeout("nextImage("+cdiv[mlocation] + "," + mlocation +")",Tstep[mlocation]);
} 

function setTransparent(adiv,tVal)  //set the transparent of a div
    {
    if(adiv<=10){adiv_txt="0"+String(adiv-1);}
    else{adiv_txt=String(adiv-1);}
     if(isIE5up){
            document.getElementById(prelink + adiv_txt + '_link').filters[0].opacity = tVal;                   
        }else{
            document.getElementById(prelink + adiv_txt + '_link').style.MozOpacity = tVal/100;         		   
		    document.getElementById(prelink + adiv_txt + '_link').style.opacity  = tVal/100;
		    document.getElementById(prelink + adiv_txt + '_link').style.KhtmlOpacity = tVal/100;
        }
    
    }
function isPause(){
    if(document.getElementById("img" +mlocation + "_pause").src.indexOf("pause_on.gif")>0)
    {
        return true;
    }else
    {
        return false;
    }
}
function jpause(){
    if(maxLinks[mlocation]==null){return false;}
     clearTimeout(Trans[mlocation]);
    if(isPause())
    {
        document.getElementById("img" +mlocation + "_pause").src="/resources/images/pause.gif"; 
        Trans[mlocation]= setTimeout("nextImage("+cdiv[mlocation] + "," + mlocation +")",Tstep[mlocation]);      
    }
    else
    {       
        document.getElementById("img" +mlocation + "_pause").src="/resources/images/pause_on.gif";       
    }
}

function jcontinue(){
        if(maxLinks[mlocation]==null){return false;}
        clearTimeout(Trans[mlocation]);    
        document.getElementById("img" +mlocation + "_pause").src="/resources/images/pause.gif";         
        Trans[mlocation]= setTimeout("nextImage("+cdiv[mlocation] + "," + mlocation +")",Tstep[mlocation]);
}


	

function jback(mlocation){
    clearTimeout(Trans[mlocation]); 
     if(cdiv[mlocation]<10){ value_txt="0" + String(cdiv[mlocation]-1);num_txt1="0"+ cdiv[mlocation];}
            else{value_txt=String(cdiv[mlocation]-1);num_txt1=cdiv[mlocation];}  
    
    document.getElementById(prelink + value_txt + '_link').style.zIndex=200-cdiv[mlocation];
    setTransparent(cdiv[mlocation],100,mlocation);
    document.getElementById(prebt + num_txt1 +'_bt_num').style.backgroundImage="url(resources/images/upper_nav_bg.jpg)";
    if(cdiv[mlocation]>1){
        cdiv[mlocation]=cdiv[mlocation]-1;
             if(cdiv[mlocation]<10){ value_txt="0" + String(cdiv[mlocation]-1);}
            else{value_txt=String(cdiv[mlocation]-1);}  
    
        document.getElementById(prelink + value_txt + '_link').style.zIndex=200-cdiv[mlocation];
        setTransparent(cdiv[mlocation],100,mlocation);

         opacityValues[mlocation] =TotalStep[mlocation];
    }
    else{      
        cdiv[mlocation]=maxLinks[mlocation]-1;
        opacityValues[mlocation] =1;
    }
    document.getElementById(prebt + num_txt1 +'_bt_num').style.backgroundImage="url(resources/images/numbg.gif)";
    //testC.value=opacityValue + "," + cdiv;   
    Trans[mlocation]= setTimeout("nextImage("+cdiv[mlocation]+ "," + mlocation +")",Tstep[mlocation]);
    
}

function jnext(mlocation){
    clearTimeout(Trans[mlocation]);
    setTransparent(cdiv[mlocation],0);    
    opacityValues[mlocation] =1 ;     
    Trans[mlocation]= setTimeout("nextImage("+cdiv[mlocation] + "," + mlocation +")",Tstep[mlocation]);
    
}
    
function nextImage(value){
    if(value<=10){value_txt="0"+ String(value-1);num_txt1="0"+ value;}
    else{value_txt=String(value-1);num_txt1= value;}
    //alert(value_txt);
    cdiv[mlocation]=value;     
    opacityValues[mlocation] =opacityValues[mlocation] - 1;
    //document.getElementById("txtC").value=value + "," + opacityValues[1] + "," +cdiv[1]; 
    if(opacityValues[mlocation]<= 25){
        setTransparent(value,opacityValues[mlocation]*4);			
    }
    
    if (opacityValues[mlocation] == 0){   
        document.getElementById(prelink + value_txt + '_link').style.zIndex = 100-value; 
        document.getElementById(prebt + num_txt1 +'_bt_num').style.backgroundImage="url(resources/images/upper_nav_bg.jpg)";
        opacityValues[mlocation] = TotalStep[mlocation]; 
        value= value+1;
        
        if (value>maxLinks[mlocation]){
        value=1;            
        }
         if(value<=10){value_txt="0"+ String(value-1);num_txt1="0"+ value;}
    else{value_txt=String(value-1);num_txt1= value;}
         document.getElementById(prebt + num_txt1 +'_bt_num').style.backgroundImage="url(resources/images/numbg.gif)";
        cdiv[mlocation]=value;
        if (value==1){
            for (i=1;i<=maxLinks[mlocation];i++){
                num_txt="";
                if(i<10){ num_txt="0" + String(i-1);}
                else{num_txt=String(i-1);}
                 document.getElementById(prelink + num_txt+ '_link').style.zIndex = 200-i;
                 setTransparent(i,100);	
                 
            }
        }
        if (value==maxLinks[mlocation]){   
            //alert(value);         
            for (i=1;i<maxLinks[mlocation];i++){
                num_txt="";
                if(i<10){ num_txt="0" + String(i-1);}
                else{num_txt=String(i-1);}
                document.getElementById(prelink + num_txt+ '_link').style.zIndex = 100-i;
                               
             }
             setTransparent(1,100); 
        }        
		
		
	}
    if(!isPause())
    {
	    Trans[mlocation]= setTimeout("nextImage("+value+")",Tstep[mlocation]);
	}
}

   function startFad(STPvalue, FTPvalue){
        clearTimeout(Trans[mlocation]);
        maxLinks[mlocation]=document.getElementById(precon + "maxval").value;
        
        maxHeight[mlocation]=0;
        STP[mlocation]=STPvalue;
        FTP[mlocation]=FTPvalue;
        Tstep[mlocation]=FTP[mlocation]/25;  //every step time spam
        TotalStep[mlocation]=(FTP[mlocation]+STP[mlocation])/Tstep[mlocation];  //total steps for one picture
        cdiv[mlocation]=0;   
        opacityValues[mlocation] = TotalStep[mlocation];     
       
        for(i=1;i<=maxLinks[mlocation];i++){
            num_txt="";
            if(i<10){ num_txt="0" + String(i-1);}
            else{num_txt=String(i-1);}
            if(document.getElementById(prelink + num_txt+ '_link').offsetHeight>maxHeight[mlocation])
            {
            maxHeight[mlocation]=document.getElementById(prelink + num_txt+ '_link').offsetHeight;
            maxWidth[mlocation]=document.getElementById(prelink + num_txt+ '_link').offsetWidth;
            }
        }
        for(i=1;i<=maxLinks[mlocation];i++){
            num_txt="";
            if(i<10){ num_txt="0" + String(i-1);}
            else{num_txt=String(i-1);}
              document.getElementById(prelink + num_txt+ '_link').style.zIndex = 200-i;
            if(mlocation==1)
            {
            document.getElementById(prelink + num_txt+ '_link').style.height=maxHeight[mlocation]+ "px";
            }
            else
            {
            document.getElementById(prelink + num_txt+ '_link').style.height="250px";
            }
            //alert(document.getElementById('link' + mlocation +'_'+ i).style.height);
        }
       
        if(document.getElementById('num_bar')!=null)
        {
            document.getElementById('num_bar').style.width=maxLinks[mlocation]*35 + "px";
        }
          document.getElementById(prebt + '01_bt_num').style.backgroundImage="url(resources/images/numbg.gif)";
        Trans[mlocation]= setTimeout("nextImage(" +startValue  + ")",Tstep[mlocation]);
       
    }