/*
Import("LeadingMIS");
Import("LeadingMIS.Error");
Import("LeadingMIS.ValueType");
Import("LeadingMIS.ValueType.SQL");
Import("LeadingMIS.UI");
Import("LeadingMIS.UI.ButtonList");
Import("LeadingMIS.UI.Validate");
Import("LeadingMIS.WebService");
Import("LeadingMIS.WebService.Convert");
Import("LeadingMIS.Cookie");
*/
function Import(nameSpace)
{
	window.execScript(Load(getNameSpaceSource(nameSpace)),"javascript");
}

function getNameSpaceSource(nameSpace)
{
	var strPath = "";
	strPath = "/Common/BaseClassLibrary/" + nameSpace + ".js";
	return strPath;
}

function Load(nameSpaceSource, SetXml)
{
	var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHttp.open("GET",nameSpaceSource,false);
	xmlHttp.send(SetXml);
	// 如果编码类型是 ASCII,用 ASCIICoding(xmlHttp.responseBody) 进行编码
	// 如果编码类型是 Unicode,用 xmlHttp.responseText
	if(xmlHttp.status == 200 || xmlHttp.status == 0)
	{
		return ASCIICoding(xmlHttp.responseBody);
	//	return xmlHttp.responseText;
	}
	else
	{
		return null;
	}
}

function DateDiff(interval,date1,date2,firstdayofweek,firstdayofyear)
{
	if((typeof(firstdayofweek) == "undefined") && (typeof(firstdayofyear) == "undefined"))
	{
		return vbDateDiff(interval,date1,date2,1,1);
	}
	else if((typeof(firstdayofweek) == "undefined") && (typeof(firstdayofyear) != "undefined"))
	{
		return vbDateDiff(interval,date1,date2,1,firstdayofyear);
	}
	else if((typeof(firstdayofweek) != "undefined") && (typeof(firstdayofyear) == "undefined"))
	{
		return vbDateDiff(interval,date1,date2,firstdayofweek,1);
	}
	else
	{
		return vbDateDiff(interval,date1,date2,firstdayofweek,firstdayofyear);
	}
}

function FormatDateTime(expression,namedFormat)
{
	if(typeof(namedFormat) == "undefined")
	{
		return vbFormatDateTime(expression,0);
	}
	else
	{
		return vbFormatDateTime(expression,namedFormat);
	}
}

function Now()
{
	return vbNow();
}
