
    function chgImage(imgObj,w,h){
    var temp_img = new Image();
    temp_img.src = imgObj.src;
  
    if(temp_img.width<=w && temp_img.height<= h){
      return;
    }
  
    factorX = 1.00;
    factorY = 1.00;
    factorX = w / temp_img.width;
    if (factorX > 1) factorX = 1;
    factorY = h / temp_img.height;
    if (factorY > 1) factorY = 1;
    if (factorX < factorY) {
      factorY = factorX;
    } else {
      factorX = factorY;
    }
    newW = Math.floor(factorX * temp_img.width);
    newH = Math.floor(factorY * temp_img.height);
    imgObj.width=parseInt(newW);
    imgObj.height=parseInt(newH);
  }
  
  function chgMediaPlayer(){
    var videoplayer = document.getElementById("VideoRecommend_001_MediaPlayer");
    var playerspan = document.getElementById("VideoRecommend_001_PlayerSpan");
        
    if(playerspan.style.display=="block"){    
      
    }else if(newWin && !newWin.closed){
    	videoplayer = newWin.document.getElementById("MediaPlayer");
    }
    
    if(videoplayer){
      if(videoplayer.playState!=3)
      	videoplayer.controls.play();
      
      if(videoplayer.playState==3)	
      	videoplayer.fullScreen="true";
    }  	
    
  }

  function VideoRecommend_001_OpenVideo(theURL,winName,features,winBgColor) {
    var videoplayer = document.getElementById("VideoRecommend_001_MediaPlayer");    
    var playerspan = document.getElementById("VideoRecommend_001_PlayerSpan");    
    var imagespan = document.getElementById("VideoRecommend_001_PlayerImg");    
    imagespan.style.display="none";
    playerspan.style.display="block";        
    
    videoplayer.URL=theURL;
    videoplayer.AutoStart="true";
    videoplayer.Enabled="true";
    videoplayer.ShowDisplay="true";
    videoplayer.DisplayMode="true";
    videoplayer.controls.play();
    
    if(newWin && !newWin.closed)
    	newWin.close();
  }  
  
  var newWin;
  function VideoRecommend_001_OpenVideoWin(theURL,winName,features,winBgColor) {
    var videoplayer = document.getElementById("VideoRecommend_001_MediaPlayer");    
    var playerspan = document.getElementById("VideoRecommend_001_PlayerSpan");    
    var imagespan = document.getElementById("VideoRecommend_001_PlayerImg");    
    imagespan.style.display="block";
    playerspan.style.display="none";        
    
    videoplayer.AutoStart="false";
    videoplayer.Enabled="false";
    videoplayer.ShowDisplay="false";
    videoplayer.DisplayMode="false";
    videoplayer.controls.stop();
    
    if(newWin)
      newWin.close();
    newWin = window.open('',winName,features);
    newWin.document.write("<html>");
    newWin.document.write("<head><META http-equiv='Content-Type' content='text/html; charset=UTF-8'></head>");
    newWin.document.write("<body bgcolor= '"+winBgColor+"'>");
    newWin.document.write("<object id='MediaPlayer' classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6' codebase='nsmp2inf.cab#Version=6,4,7,1112' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>");
    newWin.document.write("<param name='URL' value='"+theURL+"'>");
    newWin.document.write("<param name='AllowChangeDisplaySize' value='1'>");
    newWin.document.write("<param name='AutoStart' value='1'>");
    newWin.document.write("<param name='AutoSize' value='1'>");
    newWin.document.write("<param name='AnimationAtStart' value='1'>");
    newWin.document.write("<param name='ClickToPlay' value='1'>");
    newWin.document.write("<param name='EnableContextMenu' value='0'>");
    newWin.document.write("<param name='EnablePositionControls' value='1'>");
    newWin.document.write("<param name='EnableFullScreenControls' value='1'>");
    newWin.document.write("<param name='ShowControls' value='1'>");
    newWin.document.write("<param name='ShowAudioControls' value='1'>");
    newWin.document.write("<param name='ShowDisplay' value='0'>");
    newWin.document.write("<param name='ShowGotoBar' value='0'>");
    newWin.document.write("<param name='ShowPositionControls' value='1'>");
    newWin.document.write("<param name='ShowStatusBar' value='1'>");
    newWin.document.write("<param name='ShowTracker' value='1'>");
    newWin.document.write("<embed type='video/x-ms-wmv' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/' src='"+theURL+"' width='640' height='480' autoStart='1' showControls='0' AutoSize='0' AnimationAtStart='1' ClickToPlay='1' EnableContextMenu='0' EnablePositionControls='1' EnableFullScreenControls='1' ShowControls='1' ShowAudioControls='1' ShowDisplay='0' ShowGotoBar='0' ShowPositionControls='1' ShowStatusBar='1' ShowTracker='1' > </embed>");
    newWin.document.write("</object>");
    newWin.document.write("</body>");
    newWin.document.write("</html>");     
  }
  
  var newWin1;
  function VideoRecommend_001_OpenWin(theURL,winName,features) {        
    if(newWin1)
      newWin1.close();
    newWin1 = window.open(theURL,winName,features);    
  }
  
function Video(videoid,siteurl,filename,videoname,videodesc){
  this.videoid = videoid;
  this.siteurl = siteurl;
  this.filename = filename;
  this.videoname = videoname;
  this.videodesc = videodesc;  
}
  
function initDiv(divid,num){      
  var maindiv = document.getElementById(divid);  
  var mydiv;    
  var myanchor;
  var myimg;
  
  var temp;
  var x,y,z;
  
  for(var i=0;i<num*2;i++){  
  	if(i<num)
  		temp = videoarray[i];
  	else
  		temp = videoarray[i-num];
  	mydiv = document.createElement("DIV");
  	mydiv.setAttribute("id","Div"+(i+1));          
  	mydiv.style.position="absolute";
  	mydiv.style.left=(5+(115*i))+"px";
  	mydiv.style.top="0px";
  
  	myanchor = document.createElement("A");
  	myanchor.setAttribute("href","menu.jsp?imageId="+temp.videoid);
  	//myanchor.setAttribute("target","_top");  
  
  	myimg = document.createElement("IMG");  
  	myimg.src = temp.filename;
  
  	myimg.setAttribute("width","113");
    	myimg.setAttribute("height","90");    	    	
        
  	myimg.setAttribute("alt",temp.videoname+"(照片)");
  	myimg.setAttribute("border","0");  
  	//myimg.style.border = "1px #333333 solid";
  	myanchor.appendChild(myimg);          
  	mydiv.appendChild(myanchor);             
  	maindiv.appendChild(mydiv);
  }  
}//end of function initDiv

var flag;
var i_num;

function startRotate(){
  clearTimeout(flag);  
  
  //var i_num = 4;
  var i_width = 113;
  var i_height = 90;
  var i_gap = 2;
  var i_top = 0;
  var x = 0;
  var y = 1;
    
  var divTemp;
  var i=0;  
  var sTemp;
  
  sTemp = document.getElementById("Div1").style.left;
  x = eval(sTemp.substring(0,sTemp.length-2));
  x = x - y;
  if(x<=(i_width*i_num+i_gap*(i_num-1))*-1)
  	x=0;
  
  for(i=0;i<(i_num*2);i++){
  	divTemp = document.getElementById("Div"+(i+1));
  	divTemp.style.left=(x+((i_width+i_gap)*i))+"px";  
  	//alert(divTemp.style.top);
  }
    
  flag = setTimeout("startRotate()",30);
}

function stopRotate(){    
  clearTimeout(flag);      
}

  
