<!--
/*
CreatePerson:					paul
CreateDate:						2005-11-15
*/

var expires = new Date();
expires.setTime(expires.getTime()+(365*24*60*60*1000));

function createCookie(name,value) {
  var argv = createCookie.arguments;
  var argc = createCookie.arguments.length;
  var path = (argc > 3) ? argv[3] : "/";
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;

  var exp = new Date();
  exp.setTime (exp.getTime() - 1);

  document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + exp.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");

  document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
    
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length));
  }
  return null;
}

function setWinLoad(sObjFunction)
{
	if (window.onload)
	{
		var sWinLoad = window.onload.toString();
		sWinLoad = sWinLoad.replace(/^\s*fUNction\s*anonymous\s*\([^\)]*\)\s*\{/gi,"");
		sWinLoad = sWinLoad.replace(/^\s*fUNction\s*onload\s*\([^\)]*\)\s*\{/gi,"");
		sWinLoad = sWinLoad.replace(/^\s*fUNction\s*\([^\)]*\)\s*\{/gi,"");
		sWinLoad = sWinLoad.replace(/^\s*fUNction\s*[^\(]*\s*\([^\)]*\)\s*\{/gi,"");
		
		sWinLoad = sWinLoad.replace(/\}\s*$/gi,"");
		
		sWinLoad += "\n" + sObjFunction;
		window.onload = new Function(sWinLoad);
	}
	else
	{
		window.onload = new Function(sObjFunction);
	}
}

function claGetNavigatorType()
{
	this.appNameIE = 1;this.appNameNetsacpe = 2;
	var constAppIE = "Microsoft Internet Explorer";
	var constAppNetscape = "Netscape";
	
	var navAppName = navigator.appName;
	var navAppVersion = navigator.userAgent;
	
	constAppIE = constAppIE.toUpperCase();
	constAppNetscape = constAppNetscape.toUpperCase();
	
	navAppName = navAppName.toUpperCase();
	navAppVersion = navAppVersion.toUpperCase();
	
	this.getNavigatorName = function ()
	{
		if (document.all)
		{
			return this.appNameIE;
		}
		else
		{
			return this.appNameNetsacpe;
		}
		
		/*
		switch(navAppName)
		{
			case constAppIE: return this.appNameIE; break;
			case constAppNetscape: return this.appNameNetsacpe; break;
			default: return this.appNameIE;break;	
		}
		*/
	}
	
	this.appVersionIE4_0 = "MSIE 4.0";
	this.appVersionIE5_0 = "MSIE 5.0";
	this.appVersionIE5_5 = "MSIE 5.5";
	this.appVersionIE6_0 = "MSIE 6.0";
	
	this.appVersionNetscape4_0 = "Netscape/4.0";
	this.appVersionNetscape5_0 = "Netscape/5.0";
	this.appVersionNetscape6_0 = "Netscape/6.0";
	this.appVersionNetscape7_0 = "Netscape/7.0";
	this.appVersionNetscape7_2 = "Netscape/7.2";


	this.appVersionIE4_0 = this.appVersionIE4_0.toUpperCase();
	this.appVersionIE5_0 = this.appVersionIE5_0.toUpperCase();
	this.appVersionIE5_5 = this.appVersionIE5_5.toUpperCase();
	this.appVersionIE6_0 = this.appVersionIE6_0.toUpperCase();
	
	this.appVersionNetscape4_0 = this.appVersionNetscape4_0.toUpperCase();
	this.appVersionNetscape5_0 = this.appVersionNetscape5_0.toUpperCase();
	this.appVersionNetscape6_0 = this.appVersionNetscape6_0.toUpperCase();
	this.appVersionNetscape7_0 = this.appVersionNetscape7_0.toUpperCase();
	this.appVersionNetscape7_2 = this.appVersionNetscape7_2.toUpperCase();
	
	this.getNavigatorVersion = function ()
	{
		var tempVersion = "";
		
		//IE
		if (navAppVersion.indexOf("MSIE") >= 0)
		{
			var tempIndex = navAppVersion.indexOf("MSIE");
			tempVersion = navAppVersion.substring(tempIndex,tempIndex + 8);
		
		
		}//Netscape
		else if (navAppVersion.indexOf("NETSCAPE") >= 0)
		{
			var tempIndex = navAppVersion.indexOf("NETSCAPE");
			tempVersion = navAppVersion.substring(tempIndex,tempIndex + 12);
		}
		
		switch(tempVersion)
		{
			case this.appVersionIE4_0:return this.appVersionIE4_0;break;
			case this.appVersionIE5_0:return this.appVersionIE5_0;break;
			case this.appVersionIE5_5:return this.appVersionIE5_5;break;
			case this.appVersionIE6_0:return this.appVersionIE6_0;break;

			case this.appVersionNetscape4_0:return this.appVersionNetscape4_0;break;
			case this.appVersionNetscape5_0:return this.appVersionNetscape5_0;break;
			case this.appVersionNetscape6_0:return this.appVersionNetscape6_0;break;
			case this.appVersionNetscape7_0:return this.appVersionNetscape7_0;break;
			case this.appVersionNetscape7_2:return this.appVersionNetscape7_2;break;
			
			default:return this.appVersionIE5_0;break;
		}

	}
}

function GetRelativeAddressPath(sFilePath)
{
	var sURL = document.URL;
	return GetRelativeServerPageAddressPath(sURL,sFilePath);
}

function GetRelativeServerPageAddressPath(sURL,sFilePath)
{
	sURL = sURL.toLowerCase();
	sFilePath = sFilePath.toLowerCase();
	
	sURL = sURL.replace(/\\/g,"\/");
	//sURL = sURL.replace(/\/\/\s*/gi,"");
	sFilePath = sFilePath.replace(/(^\/\s*)/g,"");

	if (sFilePath.indexOf("/") <= -1)
	{
		return sFilePath;
	}
	
	var sTopFolder = sFilePath.substring(0,sFilePath.indexOf("/"));
	
	if (sURL.indexOf(sTopFolder) <= -1)
	{
		return sFilePath;
	}
	
	var sIndex = "";
	while (sURL.substring(sURL.lastIndexOf("/") + 1) != sTopFolder)
	{
		sURL = sURL.substring(0,sURL.lastIndexOf("/"));
		
		if (sURL.substring(sURL.lastIndexOf("/") + 1) != sTopFolder)
		{
			sIndex += "../";
		}
	}
	
	return sIndex + sFilePath.replace(sTopFolder+"/","");

}

function GetAbsoluteAddressPath(sFilePath)
{
	var sURL = document.URL;
	sURL = sURL.toLowerCase();
	sFilePath = sFilePath.toLowerCase();
	
	sURL = sURL.replace(/\\/g,"\/");
	//sURL = sURL.replace(/\/\/\s*/gi,"");
	
	var rPatternFile = /(\.\.\/\s*)/gi;
//	var sMatches = rPatternFile.exec(sFilePath);
	if (!rPatternFile.test(sFilePath))
	{
		if (sFilePath.indexOf("http") == 0)
		{
			return sFilePath;
		}
		else
		{
			return sURL.substring(0,sURL.lastIndexOf("/")) + "/" + sFilePath;
		}
	}
	
	var sMatches = sFilePath.split("../");
	sMatches.pop();
	
	sFilePath = sFilePath.replace(rPatternFile,"");
	var sMatchesLength = sMatches.length;
	for(var i = 0;i<= sMatchesLength;i++)
	{
		if (sURL.lastIndexOf("/") >= 8)
		{
			sURL = sURL.substring(0,sURL.lastIndexOf("/"));
		}
		else
		{
			break;
		}
	}
	
	return sURL +"/" + sFilePath;
}

//Ñ¡ÔñIE»¹ÊÇNetscape//
function chooseBrowserFunction(functionIE,functionNetscape)
{
	var objGetNavigatorType = new claGetNavigatorType();
	var tempNavType = objGetNavigatorType.getNavigatorName();
	
	switch(tempNavType)
	{
		case objGetNavigatorType.appNameIE:
			if (functionIE.length >= 1)
			{
				return eval(functionIE);
			}
			break;
		case objGetNavigatorType.appNameNetsacpe:
			if (functionNetscape.length >= 1)
			{
				return eval(functionNetscape);
			}
			break;
		default:break;
	
	}
}

chooseBrowserFunction(
	'document.write(\'<script language=\"javascript\" src=\"'+GetRelativeAddressPath("/OtherProject/js/IECommon.js")+'\"></script>\');',
	'document.write(\'<script language=\"javascript\" src=\"'+GetRelativeAddressPath("/OtherProject/js/NetscapeCommon.js")+'\"></script>\');'
);

document.write('<script language="javascript" src="'+GetRelativeAddressPath("/OtherProject/js/constInform.js")+'"></script>');

//-->