     var i=0;
     var height=0;
     var width=0;
     var menu="<li><a href='index.htm'>Homepage</a></li>"+
     	      "<li><a href='product.htm'>Products</a></li>"+
			  "<li><a href='project.htm'>Projects</a></li>"+
              "<li><a href='job.jsp'>Job Vacancies</a></li>"+
			  "<li><a href='contact.htm'>Contact Us</a></li>"+
              "<li><a href='chi/index.htm'>中文</a></li>"
     
     var cmenu=	"<li><a href='index.htm'>主頁</a></li>"+
			    "<li><a href='product.htm'>產品</a></li>"+
			    "<li><a href='project.htm'>工程項目</a></li>"+
                "<li><a href='job.jsp'>職位招聘</a></li>"+			
			    "<li><a href='contact.htm'>聯絡我們</a></li>"+
                "<li><a href='../index.htm'>ENG</a></li>"	           
     
     function nextphoto(){
                   i++;
                   if(i>imagearray.length-1){
                        i=0;
                      }
                  document["pic"].src =imagearray[i]
                  document.getElementById("desc").innerHTML = descarray[i];
                  document.getElementById("picno").innerHTML = "Image No "+(i+1)+" of "+imagearray.length;
                  }
    
        function periousphotot(){
                  i--;
                  if(i<0){
                       i=imagearray.length-1;
                     }
                  document["pic"].src = imagearray[i];
                  document.getElementById("desc").innerHTML = descarray[i];
                  document.getElementById("picno").innerHTML = "Image No "+(i+1)+" of "+imagearray.length;                      
             }	
	
function firstimage(){
    document["pic"].src =imagearray[0];
    //desc.innerHTML=descarray[0];
    //picno.innerHTML="Image No "+1+" of "+imagearray.length;
    document.getElementById("desc").innerHTML = descarray[0];
    document.getElementById("picno").innerHTML = "Image No "+1+" of "+imagearray.length;
    }

function showpic(x){
      window.open("image.jsp?id="+imagearray[x]);
    }

function getImgSize(imgSrc){
    var newImg = new Image();
    newImg.src = "imagefile/"+imgSrc;
    height = (newImg.height)*0.3;
    width = (newImg.width)*0.3;
}

function adjustRatio(img){
    var winheight = (document.body.clientHeight === undefined)?window.innerHeight:document.body.clientHeight;
    var winwidth = (document.body.clientWidth === undefined)?window.innerWidth:document.body.clientWidth;
    winratio = winheight / winwidth;

   if(winratio < imageratio){
      img.style.height = '100%';
      img.style.width = 'auto';
      }else{
        img.style.width = '100%';
        img.style.height = 'auto';
        }
 
/* if( winheight > img.height && winwidth > img.width){
           img.style.width='auto';
           img.style.height='auto';
        }
  
   if(winheight < img.height){
        img.style.height = '100%';
        img.style.width = 'auto';
      }else if(winwidth< img.width){
        img.style.width = '100%';
        img.style.height = 'auto';
        }*/
        
   }

function currentYear(){
    year=new Date() 
    thisDay=year.getFullYear()
    document.write(thisDay)	
}   

function menucall(){
    document.write(menu)	
}   

function cmenucall(){
    document.write(cmenu)	
}   