function cover(initialImg,coverImg){
initialImg.style.display='none';
coverImg.style.display='';
}

function uncover(initialImg,coverImg){
initialImg.style.display=''; 
coverImg.style.display='none';
}


function sizeImg(Imgsrc,ObjId){
//Imgsrc  图片路径；
//ObjId  图片id
var imgWidth;
var imgHeight;
var  styObj = document.getElementById(ObjId);
var imgObj = new Image(); //生成一个img对象；
imgObj.src= Imgsrc;//通过路径指定图片；
imgWidth = imgObj.width;//通过img对象得到图片原始宽度；
imgHeight = imgObj.height;//通过img对象得到图片原始高度；
if(imgWidth>imgHeight){//如果宽度大于高度；
styObj.style.width = 90;//通过img的style属性定义图片的宽度，高度不定义会等比例缩放；
}
else if(imgWidth<90 && imgHeight<90){//如果图片宽度和高度都小于90则使用原始尺寸；
	styObj.style.width = imgWidth;
	styObj.style.height = imgHeight;
	}
else{//如果高度大于宽度，则对联高度进行限制，宽度会等比例缩放；
styObj.style.height = 90;
}
}

function sizeImgBig(Imgsrc,ObjId,W,H){
//Imgsrc  图片路径；
//ObjId  图片id
var imgWidth;
var imgHeight;
var  styObj = document.getElementById(ObjId);
var imgObj = new Image(); //生成一个img对象；
imgObj.src= Imgsrc;//通过路径指定图片；
imgWidth = imgObj.width;//通过img对象得到图片原始宽度；
imgHeight = imgObj.height;//通过img对象得到图片原始高度；
if(imgWidth>imgHeight){//如果宽度大于高度；
styObj.style.width = W;//通过img的style属性定义图片的宽度，高度不定义会等比例缩放；
styObj.style.height = H;
}
else if(imgWidth<W && imgHeight<H){//如果图片宽度和高度都小于90则使用原始尺寸；
	styObj.style.width = imgWidth;
	styObj.style.height = imgHeight;
	}
else{//如果高度大于宽度，则对联高度进行限制，宽度会等比例缩放；
styObj.style.height = H;
}
alert(imgObj.height);
}


var flag=false; 
function DrawImage(ImgD,ImgSrc,W,H){ 
 var image=new Image(); 
 var iwidth = W;  //定义允许图片宽度 
 var iheight = H;  //定义允许图片高度 
 image.src=ImgSrc;
 ImgD = document.getElementById(ImgD);
 if(image.width>0 && image.height>0){ 
 flag=true; 
 if(image.width/image.height>= iwidth/iheight){ 
  if(image.width>iwidth){   
  ImgD.width=iwidth; 
  ImgD.height=(image.height*iwidth)/image.width; 
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  ImgD.alt=image.width+"×"+image.height; 
  } 
 else{ 
  if(image.height>iheight){   
  ImgD.height=iheight; 
  ImgD.width=(image.width*iheight)/image.height;   
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  ImgD.alt=image.width+"×"+image.height; 
  } 
 } 
}  



// menu
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0;i<(args.length-2);i+=3){
  if ((obj=MM_findObj(args[i]))!=null) {
      v=args[i+2];
      if (obj.style) {
       obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v;
      }
    	obj.visibility=v;
    }
    }
}
function MM_findObj(n, d) { //v4.01
  var p,i,x; 
  if(!d) d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; 
    n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++)
    x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
   x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);
   return x;
}


//png图片处理
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var j=0; j<document.images.length; j++)
      {
         var img = document.images[j]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            j = j-1
         }
      }
   }    
}
