/*按比例生成缩略图*/
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=""; 
    } 
  }
}
function DrawImages(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; 
			}
		}
	}
}
// 引用方法 <img onload="javascript:DrawImage(this,500,400)" >
function getbak()
{
	window.location.href=document.referrer;
	return false;
	}
	
function open_mem(id)
{
	var tabe=document.getElementById(id);
	var img=document.getElementById(id+"_pic")
	if (tabe.style.display=="none")
		{
			tabe.style.display="";	
			img.src="images/Sort_Folder_Open.gif";
		}
	else
	{
		tabe.style.display="none";
		img.src="images/Sort_Folder_Close.gif";
	}
	return false;
}

function Div_scroll()
{
	var div=document.getElementById("scroll");
	div.style.top=150;
	document.body.onscroll =div_scroll2;
	
}
div_scroll2=function(){
	var div1
	try{
		div1=document.getElementById("scroll");
		div1.style.top=150+document.documentElement.scrollTop;
		}catch(e){}
}

function scroll_img()
{
	document.body.onscroll =img_scroll;
}
img_scroll=function(){
		
	var img=document.getElementById("img");
	img.style.top=document.documentElement.scrollTop;
}

//创建xmlhttp对像
	function createxmlhttp()
	{
		var xmlHttp;
		if(window.ActiveXObject)
		{
			try{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				} catch(e)
					{
						xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
		}
		else if(window.XMLHttpRequest)
		{
			xmlHttp=new XMLHttpRequest();
			if(xmlHttp.overrideMimeType)
			{
				xmlHttp.overrideMimeType("text/xml");	
			}
		}
		if(!xmlHttp)
		{
			alert("无法创建xmlHttp对象.");	
			return null;
		}
		return xmlHttp;
	}

//新闻中心菜单
function New_OpenMem(Objects)
{
	var Mem=document.getElementById(Objects);
	if(Mem.style.display=="none")
	{
		Mem.style.display="";
	}
	else
	{
		Mem.style.display="none";	
	}
	return false;
}

function ChangBack(Objects)
{
	Objects.style.cursor="pointer";
	Objects.style.background="#ffffff";	
	Objects.style.border="#ffffff 1px solid";
}

function ChangGetBack(Objects)
{
	Objects.style.background="url(Images/memback.jpg)";	
	Objects.style.border="#DBDBDB 1px solid";
}

function Open_Mem(ID,ImgStr1,ImgStr2)
{
	var Td=document.getElementById(ID);
	var Img=document.getElementById("Img_"+ID);
	if(Td.style.display=="none")
	{
		Td.style.display="";
		Img.innerHTML=ImgStr1;
	}
	else
	{
		Td.style.display="none";
		Img.innerHTML=ImgStr2;
	}
}


function Mem_Start(Str)
{
	var mem=Str.split(",");
	var object,Img;
	for(var i=0;i<mem.length;i++)
	{
		try{
		object=document.getElementById(mem[i]);
		object.style.display="";
		Img=document.getElementById("Img_"+mem[i]);
		Img.innerHTML="<img src=Images/img_33.jpg border=0 align=absmiddle >";
		}catch(e){}
	}
	
		
}
