// JavaScript Document for www.schule.suedtirol.it
// ngrhldm24@schule.suedtirol.it - 20060510

// httpRequest for all sites 


function doingHttpRequests() {
	// put your common requests here
	// using ids >=100
	//sendRequest('scripts/getrequests.php?url=http://84.18.137.213/tools/utils/httpreq_useronline.php',100);
	sendRequest('/Lasis/scripts/getrequests.asp?url=http://www.blikk.it/admin/tools/utils/httpreq_useronline.php&id=useronline&ws=schule_suedtirol',100);
	//sendRequest('/www/tools/utils/httpreq_date.php?format=short',101);
	//sendRequest('scripts/getrequests.php?url=http://84.18.137.213/tools/utils/httpreq_date.php?format=short',101);
	sendRequest('/Lasis/scripts/getrequests.asp?url=http://www.blikk.it/admin/tools/utils/httpreq_date.php&format=short',101);
	// logging
	createInlineLog(logging());
	// now the page-specific-ones
	doingUserHttpRequests();
	/*
	// google tracking
	try {
		var pageTracker = _gat._getTracker("UA-12172538-2");
		pageTracker._trackPageview();
	} catch(err) {}
	*/
}

function logging() {
	url = new String(document.URL);
	a = url.split('?');
	a1 = a[0].split('/');
	fromhtm = a1[a1.length-1];
	if (fromhtm == '') {
		fromhtm = a1[a1.length-2];
	}
	return 'http://www.blikk.it/admin/logging/log.php' +
						'?workspace=' + workspace +
						'&chapter=' + chapter +
						'&event=' + scope +
						'&fromhtm=' + fromhtm +
						'&action=read';
}


function processData(id) {
	switch (id) {
		case 100: //  user-online
			document.getElementById('useronline').innerHTML = xmlHttp[id].responseText;
			break;
		case 101: // 
			document.getElementById('date').innerHTML = xmlHttp[id].responseText;
			break;
		default:	 // user specific
			processUserData(id);
			break;
	}
}

/*
// Google Tracking 07.01.2010
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
*/

// google-analytics (2011-05)
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12172538-2']);
_gaq.push(['_trackPageview']);
(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

// write log
function createInlineLog(logsrc) {
	var _d = document.createElement('div');
	_d.innerHTML = "<iframe src='"+logsrc+"' width='0' height='0' frameborder='0'></iframe>";
	document.getElementsByTagName('body')[0].appendChild(_d);
}


