function openxzsp(theURL)
{
	var a ; 
	a = RndNum(3);
	window.open(theURL,'newwindow' + a ,'scrollbars=yes,width=600,height=500,left=150,top=95');
}

function RndNum(n){
var rnd="";
for(var i=0;i<n;i++)
rnd+=Math.floor(Math.random()*10);
return rnd;
}


//触发服务器事件
function AjaxServer()
{

}

//创建XMLhttp对象
AjaxServer.CreateHttpObj=function(){
	var objhttp;
	try
	{
		//IE浏览器
		try
		{
			objhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			objhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	catch(e)
	{
		//不是IE浏览器
		try
		{
			objhttp = new XMLHttpRequest();
		}
		catch(e)
		{
			objhttp = null;
		}
	}
	return objhttp
}

AjaxServer.ShowMenu = function(sort)
{
	var xmlhttp = AjaxServer.CreateHttpObj();
	if(xmlhttp)
	{
		xmlhttp.open("GET","/www/js/server.asp?flag=showmenu&sort="+sort+"&num="+Math.random(),false);
		xmlhttp.send();
		if(xmlhttp.status==200)
		{
			document.getElementById("classmenu").innerHTML = xmlhttp.responseText;
		}
	}
}

//图片等比例缩放函数
function ResizePic(ImgTag,FitWidth,FitHeight)
{
	var image = new Image();
	image.src = ImgTag.src;
	if(image.width>0 && image.height>0)
	{
		if(image.width/image.height >= FitWidth/FitHeight)
		{
			if(image.width > FitWidth)
			{
				ImgTag.width = FitWidth;
				ImgTag.height = (image.height*FitWidth)/image.width;
			}
			else
			{ 
				ImgTag.width = image.width;
				ImgTag.height = image.height;
			}
		}
		else
		{
			if(image.height > FitHeight)
			{
				ImgTag.height = FitHeight;
				ImgTag.width = (image.width*FitHeight)/image.height;
			}
			else
			{
				ImgTag.width = image.width; 
				ImgTag.height = image.height;
			}
		}
	}
}

