//  1/26/2001 - T. E. Harris  Captures desired events in a database.  This process remotely
//			runs WebEventMethodDB in the Events.asp file passing a 'form name', event, userid, 
//			and event status.  Remove comments on the myCallBack(callObj) line to debug call 
//			results.
//  6/07/2001 - T. E. Harris - Add host determination for call from other web servers (FileNET, storelocator, etc.)
//  8/14/2001 - PSK - Changed Ecom Store Locator port from 8095 to 80.

var Host = window.location.host;
var x;
function AddEvents(pForm,pEvent,pStat,pAlias,pUserID,pVariable,pMaterial,pShop)
{
	//alert('In CaptureEventsJS.js');
	var useragent = navigator.userAgent;
	var bName = (useragent.indexOf('Opera') > -1) ? 'Opera' : navigator.appName;
	var pos = useragent.indexOf('MSIE');
	
	if (pos > -1) {
	bVer = useragent.substring(pos + 5);
	var pos = bVer.indexOf(';');
	var bVer = bVer.substring(0,pos);
	}
	var pos = useragent.indexOf('Opera');
	if (pos > -1)	{
	bVer = useragent.substring(pos + 6);
	var pos = bVer.indexOf(' ');
	var bVer = bVer.substring(0, pos);
	}
	if (bName == "Netscape") {
	var bVer = useragent.substring(8);
	var pos = bVer.indexOf(' ');
	var bVer = bVer.substring(0, pos);
	}
	if (bName == "Netscape" && parseInt(navigator.appVersion) >= 5) {
	var pos = useragent.lastIndexOf('/');
	var bVer = useragent.substring(pos + 1);
	}
	//alert(bName + " - " + bVer);
	if (Host == 'dafnwebqa.mysylvania.com')
	{
		Host = 'eqas.mysylvania.com';
	}

	if ( (Host == 'dafnwebdv.sylvania.com') || (Host == 'daecmpd.mysylvania.com') || (Host == 'daecmpd') || (Host == 'daglbswebdev.mysylvania.com') || (Host == 'edev.mysylvania.com:8095'))
	{
		Host = 'edev.mysylvania.com';
	}

	if ( (Host == 'dafnwebpd.mysylvania.com')  || (Host == 'ecomstorelocator.mysylvania.com') || (Host == 'daglbswebpd.mysylvania.com') )
	{
		Host = 'ecom.mysylvania.com';
	}
	//alert(Host + ' \nProtocol '+location.protocol );
	var parms = pForm+'|'+pEvent+'|'+pStat+'|'+pAlias+'|'+pUserID+'|'+pVariable+'|'+pMaterial+'|'+bName+'|'+bVer+'|'+pShop;
	//alert('calling jsrsExecute');
	x = jsrsExecute(location.protocol +'//' + Host + '/remote/scripting/JSAddEvents.asp',temp,'AddEvent', parms, false);
}

function temp(){
	// alert(x);
}