// JavaScript Document

/*按比例生成缩略图==================================================================*/
function DrawImage(ImgD,W,H){ 
  var flag=false; 
  var image=new Image(); 
  image.src=ImgD.src; 
  if(image.width>0 && image.height>0){ 
    flag=true; 
    if(image.width/image.height>= W/H){ 
      if(image.width>W){
        ImgD.width=W; 
        ImgD.height=(image.height*H)/image.width; 
      }
	  else{ 
        ImgD.width=image.width;
        ImgD.height=image.height; 
      } 
      ImgD.alt= ""; 
    } 
    else{ 
      if(image.height>H){
        ImgD.height=H; 
        ImgD.width=(image.width*W)/image.height; 
      }
	  else{ 
        ImgD.width=image.width;
        ImgD.height=image.height; 
      } 
      ImgD.alt=""; 
    } 
  }
}
/*按比例生成缩略图结束==================================================================*/


//menu display start========================================================================
function closewin() {
   if (opener!=null && !opener.closed) {
      opener.window.newwin=null;
      opener.openbutton.disabled=false;
      opener.closebutton.disabled=true;
   }
}

var count=0;//做计数器
var limit=new Array();//用于记录当前显示的哪几个菜单
var countlimit=1;//同时打开菜单数目，可自定义

function expandIt(el) {
   obj = eval("sub" + el);
   if (obj.style.display == "none") {
      obj.style.display = "block";//显示子菜单
      if (count<countlimit) {//限制2个
         limit[count]=el;//录入数组
         count++;
      }
      else {
         eval("sub" + limit[0]).style.display = "none";
         for (i=0;i<limit.length-1;i++) {limit[i]=limit[i+1];}//数组去掉头一位，后面的往前挪一位
         limit[limit.length-1]=el;
      }
   }
   else {
      obj.style.display = "none";
      var j;
      for (i=0;i<limit.length;i++) {if (limit[i]==el) j=i;}//获取当前点击的菜单在limit数组中的位置
      for (i=j;i<limit.length-1;i++) {limit[i]=limit[i+1];}//j以后的数组全部往前挪一位
      limit[limit.length-1]=null;//删除数组最后一位
      count--;
   }
}
//menu display end=============================================================================================

//Start Menu Support_IE6
<!--//--><![CDATA[//><!--
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("menu");
var allli = navRoot.getElementsByTagName("li")
for (i=0; i<allli.length; i++) {
node = allli[i];
node.onmouseover=function() {
this.className+=" current";
}
node.onmouseout=function() {
this.className=this.className.replace(" current", "");
}
}
}
}
window.onload=function(){ startList()}
//--><!]]>
//End Menu Support_IE6



//var xmlHttp;
//function S_xmlhttprequest(){
//    if(window.ActiveXObject)
//    {
//        xmlHttp = new ActiveXObject('microsoft.XMLHTTP');
//    }
//    else if(window.XMLHttpRequest)
//    {
//        xmlHttp = new XMLHttpRequrest();
//    }
//}
//
//function myfun(url){
//    S_xmlhttprequest();
//    xmlHttp.open("GET","test1.asp?Pro_Number"+url,true); ///#發送#/
//    xmlHttp.onreadystatechange = byphp;
//    xmlHttp.send(null);
//}
//
//function byphp(){
//    if (xmlHttp.readyState == 4)
//    {
//    var byphp100 = xmlHttp.responseText;
//    document.getElementById('show').innerHTML = byphp100 ; //将调回的值返回这个div里面
//    }
//}

//ajax========================================================================================
var xmlHttp;
function S_xmlhttprequest(){
    if(window.ActiveXObject)
    {
        xmlHttp = new ActiveXObject('microsoft.XMLHTTP');
    }
    else if(window.XMLHttpRequest)
    {
        xmlHttp = new XMLHttpRequrest();
    }
}

function byphp(){
    if (xmlHttp.readyState == 4)
    {
	var byphp100 = xmlHttp.responseText;
    //document.getElementById('show1').innerHTML = byphp100; //将调回的值返回这个div里面
    }
}

function myfun(url,divname,inputname){
	//if(url!="")
	//{
    S_xmlhttprequest();
    xmlHttp.open("GET","test1.asp?Pro_Number="+url,true); ///#發送#/
	//xmlHttp.onreadystatechange = byphp;
    xmlHttp.send(null);
	//alert(xmlHttp.readyState);
	 if (xmlHttp.readyState == 4)
    {
	document.getElementById(divname).innerHTML = xmlHttp.responseText;
	document.getElementById(inputname).value  = xmlHttp.responseText;
	}
	//}
}
 

//end ajax========================================================================================


