﻿//创建xmlHttp对象 
function XmlPost(webFileUrl)
{
 var result = "";
 var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
 xmlHttp.open("POST", webFileUrl, false);
 xmlHttp.send(null);
 result = xmlHttp.responseText;
 return(result);
}

function setabc1()
{
  var a1 = document.getElementById("abc01");
  a1.className = "h18";
}
function setabc2()
{
  var a2 = document.getElementById("abc02");
  a2.className = "h18";
}
function setabc3()
{
  var a3 = document.getElementById("abc03");
  a3.className = "Whites";
}

function click() 
{
//alert('请不要复制网页内容，谢谢合作！');
return false;
 }
function click1() {
if (event.button==2) {
//alert('右键功能已关闭~！');
return false;
}}
function CtrlKeyDown(){
if (event.ctrlKey) {//alert('不当的拷贝将损害您的系统！');
return false;
}}
document.onkeydown=CtrlKeyDown;
document.onselectstart=click;
document.onmousedown=click1;
document.oncontextmenu=click;




///////////////////////////////////////////////////////   JS按比例缩小图片   ///////////////////////////////////////////////////////
//开始_生成小图显示
    function ResizeImage(imageDest, W, H)
    {
    //显示框宽度W,高度H 
    var image = new Image();
    image.src = imageDest.src;
    if(image.width>0 && image.height>0)
    {
       //比较纵横比
       if(image.width/image.height >= W/H)//相对显示框：宽>高
       {
          if(image.width > W) //宽度大于显示框宽度W，应压缩高度
          {
               imageDest.width = W; 
               imageDest.height = (image.height*W)/image.width;   
          }
       else //宽度少于或等于显示框宽度W，图片完全显示
       {
          imageDest.width = image.width;       
          imageDest.height = image.height;   
       }
    }
    else//同理
    {
       if(image.height > H)
       {
          imageDest.height = H;
          imageDest.width = (image.width*H)/image.height;
       }
     else
     {
          imageDest.width = image.width;
          imageDest.height = image.height;
     }
   }
 }
 }
//将页面内所有指定id的图片按比例缩放
function RsizeAllImageById(id, W, H)
{
var imgs = document.getElementsByTagName("img");
for(var i=0; i<imgs.length; i++)
{
   if(imgs[i].id == id)
   {
    ResizeImage(imgs[i], W, H);
   }
}
}
function initPicWidth_Height(img,w,h)
{
RsizeAllImageById(img, w, h);
}
//结束
