var appNavNameIE = "";
var appNavNameNetsacpe = "";
function getBrowserType()
{
	var objGetNavigatorType = new claGetNavigatorType();
	appNavNameIE = objGetNavigatorType.appNameIE;
	appNavNameNetsacpe = objGetNavigatorType.appNameNetsacpe;
	return objGetNavigatorType.getNavigatorName();
}

function chooseBrowserFunction(functionIE,functionNetscape)
{
	var objGetNavigatorType = new claGetNavigatorType();
	var tempNavType = objGetNavigatorType.getNavigatorName();
	switch(tempNavType)
	{
		case objGetNavigatorType.appNameIE:
			if (functionIE.length >= 1)
			{
				eval(functionIE);
			}
			break;
		case objGetNavigatorType.appNameNetsacpe:
			if (functionNetscape.length >= 1)
			{
				eval(functionNetscape);
			}
			break;
		default:break;
	
	}
}

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 getTagColection(objTagName)
{
	return document.getElementsByTagName(objTagName.toUpperCase());
}

