// Write activity to comboadlogs by calling log-write.html lasso format file //
// 
// 	[Var: 'UserID'	 		= (Action_Param: 'u')]
// 	[Var: 'ClientIP' 		= (Action_Param: 'ip')]
// 	[Var: 'ClientTime'		= (Action_Param: 't')]
// 	[Var: 'ClientType' 		= (Action_Param: 'y')]
// 	[Var: 'ClientURL' 		= (Action_Param: 'l')]
// 	[Var: 'ServerName' 		= (Action_Param: 's')]
// 	[Var: 'Page' 			= (Action_Param: 'p')]
// 	[Var: 'Description' 	= (Action_Param: 'd')]
// 	[Var: 'Action' 			= (Action_Param: 'a')]
// 	[Var: 'Result'			= (Action_Param: 'r')]
// 	[Var: 'ProcessingTime'	= (Action_Param: 'pt')]
// 	[Var: 'Referrer' 		= (Action_Param: 'ref')]
// 	[Var: 'Params' 			= (Action_Param: 'q')]
// 	[Var: 'MachineID' 		= (Action_Param: 'm')]
// 
// 	<!-- Log Session Data -->
// 	[Var: 'SessionID' 		= (Action_Param: 'sid')]

function logWrite(u,ip,y,s,p,d,a,r,ref,q,m,sid) {

	// Set variables
	var t;
	var date = new Date();
	t = date.getFullYear() + '-' + pad(date.getMonth()+1) + '-' + pad(date.getDate()) + ' ';
	t += pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds()) + ' ';
	t += tzos(date.getTimezoneOffset());
	var l = escape(document.location.href);
	var pt = '';
	
	if(document.getElementById('PLT')) {
		pt = document.getElementById('PLT').value;
	}
	var url = 'log-write.html?u='+u+'&l='+l+'&ip='+ip+'&t='+t+'&y='+y+'&s='+s+'&p='+p+'&d='+d+'&a='+a+'&r='+r+'&ref='+ref+'&q='+q+'&m='+m+'&pt='+pt+'&sid='+sid;

	var myAjax = new Ajax.Request(url,{
		method: 'post',
		onComplete:handleLogWrite
	});
}
function handleLogWrite(ap_http) {
	if(ap_http.readyState == 4) {
		var n = ap_http.responseText;
	}
}
function pad(num){
	var str = num+'';
	if (str.length == 1) {
		str = '0'+str;
	}
	
	return(str);
}
function tzos(tzo) {
	var h = pad(tzo/60);
	var m = tzo%60;
	var mi = pad(m*60);
	
	return ('GMT-'+h+mi);
}