﻿// JavaScript Document
var flag=false; 
function DrawImage(ImgD,iwidth,iheight){ 
    //参数(图片,允许的宽度,允许的高度) 
    var image=new Image(); 
    image.src=ImgD.src; 
    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; 
        } 
    } 
}  
//按比例绽放图片的大小
//网页中应用示例<img src="图片地址" onload="DrawImage(this,80,80)" alr="" />
function display(n,w){ //点击图片显示与隐藏
if(window.document.body.clientHeight<window.document.documentElement.clientHeight){
	window.document.body.style.height=window.document.documentElement.clientHeight+"px";
	}

if(n == 0){
document.body.style.height=document.getElementById("as_body").style.height=window.document.body.clientHeight + 10 +"px";
document.getElementById("as_body").style.display=document.getElementById(w).style.display="block";
document.getElementById(w).style.marginLeft=(window.document.documentElement.clientWidth - document.getElementById(w).scrollWidth )/2+"px";
document.getElementById(w).style.marginTop=(window.document.documentElement.clientHeight - document.getElementById(w).scrollHeight )/2+"px";
}
else
{
	document.getElementById("as_body").style.display=document.getElementById(w).style.display="none";
}
}
function Nav(ID, TAG) {
    var tags = document.getElementById(ID).getElementsByTagName(TAG);
    for (i = 0; i < tags.length-1; i++) {
        tags[i].onmouseover = function() {
            this.className = "at";
        }
        tags[i].onmouseout = function() {
            this.className = "";
        }
     }
 }
