var LastLeftID = ""; 

function menuFix() { 
 var obj = document.getElementById("nav").getElementsByTagName("li"); 
  
 for (var i=0; i<obj.length; i++) { 
  obj[i].onmouseover=function() { 
   this.className+=(this.className.length>0? " ": "") + "sfhover"; 
  } 
  obj[i].onMouseDown=function() { 
   this.className+=(this.className.length>0? " ": "") + "sfhover"; 
  } 
  obj[i].onMouseUp=function() { 
   this.className+=(this.className.length>0? " ": "") + "sfhover"; 
  } 
  obj[i].onmouseout=function() { 
   this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), ""); 
  } 
 } 
} 

function DoMenu(emid) 
{ 
 var obj = document.getElementById(emid);  
 obj.className = (obj.className.toLowerCase() == "expanded"?"collapsed":"expanded"); 
 if((LastLeftID!="")&&(emid!=LastLeftID)) //关闭上一个Menu 
 { 
  document.getElementById(LastLeftID).className = "collapsed"; 
 } 
 LastLeftID = emid; 
} 

function GetMenuID() 
{ 

 var MenuID=""; 
 var _paramStr = new String(window.location.href); 

 var _sharpPos = _paramStr.indexOf("#"); 
  
 if (_sharpPos >= 0 && _sharpPos < _paramStr.length - 1) 
 { 
  _paramStr = _paramStr.substring(_sharpPos + 1, _paramStr.length); 
 } 
 else 
 { 
  _paramStr = ""; 
 } 
  
 if (_paramStr.length > 0) 
 { 
  var _paramArr = _paramStr.split("&"); 
  if (_paramArr.length>0) 
  { 
   var _paramKeyVal = _paramArr[0].split("="); 
   if (_paramKeyVal.length>0) 
   { 
    MenuID = _paramKeyVal[1]; 
   } 
  } 
  /* 
  if (_paramArr.length>0) 
  { 
   var _arr = new Array(_paramArr.length); 
  } 
   
  //取所有#后面的，菜单只需用到Menu 
  //for (var i = 0; i < _paramArr.length; i++) 
  { 
   var _paramKeyVal = _paramArr[i].split('='); 
    
   if (_paramKeyVal.length>0) 
   { 
    _arr[_paramKeyVal[0]] = _paramKeyVal[1]; 
   }   
  } 
  */ 
 } 
  
 if(MenuID!="") 
 { 
  DoMenu(MenuID) 
 } 
} 

function flashWrite( id, flashUri, vWidth, vHeight, winMode ) {
	var _obj_ = "";
	_obj_ = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + vWidth + '" height="' + vHeight + '" id="' + id + '" align="middle">';
	_obj_ += '<param name="movie" value="' + flashUri + '" />';
	_obj_ += '<param name="quality" value="high" />';
	_obj_ += '<param name="wmode" value="' + winMode + '" />';
	_obj_ += '<param name="bgcolor" value="#ffffff" />';
	_obj_ += '<embed src="' + flashUri + '" quality="high" wmode="' + winMode + '" bgcolor="#ffffff" width="' + vWidth +'" height="' + vHeight + '" id="' + id + '" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>    ';
	_obj_ += '</object>';
	document.write( _obj_ );
}

function DrawImage(ImgD,FitWidth,FitHeight){
     var image=new Image();
     image.src=ImgD.src;
     if(image.width>0 && image.height>0){
         if(image.width/image.height>= FitWidth/FitHeight){
             if(image.width>FitWidth){
                 ImgD.width=FitWidth;
                 ImgD.height=(image.height*FitWidth)/image.width;
             }else{
                 ImgD.width=image.width; 
                ImgD.height=image.height;
             }
         } else{
             if(image.height>FitHeight){
                 ImgD.height=FitHeight;
                 ImgD.width=(image.width*FitHeight)/image.height;
             }else{
                 ImgD.width=image.width; 
                ImgD.height=image.height;
             } 
        }
     }
 }