//图片按比例缩放

var flag=false;

function DrawImage(ImgD, iw, ih)
{
	var image=new Image();
	//var imgtype=imgt;//定义图片横竖
	//if(imgtype==1)//横
	//{
		var iwidth = iw; //定义允许图片宽度
		var iheight = ih; //定义允许图片高度}
	/*//else//竖，交换高、宽
	{
		var iwidth = ih; //定义允许图片宽度
		var iheight = iw; //定义允许图片高度
	}*/
	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="javascript:DrawImage(this, iw, ih)">


//<!-- Begin  max number of characters allowed 控制输入字数
var maxLen; 

function checkMaxInput(form,ctrlname,maxlen) {
if (ctrlname.value.length > maxlen) // if too long.... trim it!
ctrlname.value = ctrlname.value.substring(0, maxlen);
else form.remLen.value = maxlen- ctrlname.value.length;
}
//  End -->

function showimage(imgurl)
{
 document.images.logoimg1.src="/webmodules/upload/ufile/"+imgurl.value;
 }

function openwindows(select_id) {
   var str
   if(select_id.value!="") {
  str=select_id.value;
       window.open(str);
   }
}

function left_menu(meval)
{
  var left_n=eval(meval);
  if (left_n.style.display=="none")
  { eval(meval+".style.display='';"); }
  else
  { eval(meval+".style.display='none';"); }
}

function runExe(sPath)
{
var oShell = new ActiveXObject("WScript.Shell");
try
{
oShell.Run(sPath);
}
catch(e)
{
document.write("应用程序错误");

}
}
function ClearTagArticle(name, num)
{
	for(i = 1; i <= num; i++)
	{										
		document.getElementById(name + i).style.display = "none";
	}
}
function SwitchIndustryBar(obj, num, sum)
{
	ClearTagArticle(obj, sum);
	
	document.getElementById(obj+num).style.display = "";
	
	switch(num)
	{
		case 1 : 
			document.getElementById("tag" + obj + "1").className = "tag01a";
			document.getElementById("tag" + obj + "2").className = "tag01b";
			document.getElementById("tag" + obj + "3").className = "tag01c";
			break;
		case 2 :
			document.getElementById("tag" + obj + "1").className = "b1";
			document.getElementById("tag" + obj + "2").className = "b0";
			document.getElementById("tag" + obj + "3").className = "tag01c";
		    break;
		case 3 :
			document.getElementById("tag" + obj + "1").className = "tag01b";
			document.getElementById("tag" + obj + "2").className = "b1";
			document.getElementById("tag" + obj + "3").className = "b2";
			break;
	}
}