var stadds_host = 'http://www.nur-mal-so-am-ran.de/stadds/loging/';

url = stadds_host + 'image.php?';

//url += 'charset=' 		+ encodeURIComponent(document.charset) + "&";
//url += 'defaultCharset=' + encodeURIComponent(document.defaultCharset) + "&";
//url += 'lastModified=' 	+ encodeURIComponent(document.lastModified) + "&";
url += 'title=' 		+ encodeURIComponent(document.title) + "&";
url += 'url=' 		+ encodeURIComponent(document.URL) + "&";
url += 'referrer=' 	+ encodeURIComponent(document.referrer) + "&";
url += 'history_length=' + encodeURIComponent(history.length) + "&";
url += 'userAgent=' 	+ encodeURIComponent(navigator.userAgent) + "&";
//url += 'javaEnabled=' + encodeURIComponent(navigator.javaEnabled()) + "&";
url += 'platform=' 	+ encodeURIComponent(navigator.platform) + "&";
url += 'language=' 	+ encodeURIComponent(navigator.language) + "&";
url += 'cookieEnabled=' + encodeURIComponent(navigator.cookieEnabled) + "&";
url += 'appVersion=' 	+ encodeURIComponent(navigator.appVersion) + "&";
url += 'appName=' 	+ encodeURIComponent(navigator.appName) + "&";
url += 'appCodeName=' 	+ encodeURIComponent(navigator.appCodeName) + "&";


for (i = 0; i < navigator.plugins.length; ++i)
url += 'plugins[]=' + navigator.plugins[i].name + "&";;


url += 'width_height=' 	+ encodeURIComponent(screen.width + "x" + screen.height) + "&";
//url += 'availwidth_availheight=' + encodeURIComponent(screen.availWidth + "x" + screen.availHeight) + "&";
url += 'colorDepth=' 	+ encodeURIComponent(screen.colorDepth) + "&";
//url += 'pixelDepth=' 	+ encodeURIComponent(screen.pixelDepth) + "&";

//setCookie ('stadds_counter', getCookie('stadds_counter')==null ? 1 : parseInt(getCookie('stadds_counter'),10) + 1);

if (getCookie('stadds') == null) {
	var start_time = new Date();
	setCookie ('stadds', start_time.getTime() + '.' + start_time.getMilliseconds() + '.' + Math.random(), 360);
}
else {
	setCookie ('stadds', getCookie('stadds'), 360);
}

url += 'stadds=' + encodeURIComponent(getCookie('stadds'));

// daten per image senden
image = new Image();
if (Math.random() <= 0.2) {
	url += '&check_speed=1';
	image.onload = function () {
		end_time = new Date();
		image = new Image();
		image.src = stadds_host + 'image_speed.php?time=' + encodeURIComponent(end_time.getTime() - start_time.getTime());
	}
}
image.style.width = '0px';
image.style.height = '0px';
image.style.display = 'none';
image.style.border = '0px';

document.body.insertBefore (image, document.body.firstChild)

var start_time = new Date();
image.src = url;

function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) {
		return null;
	}
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) {
		end = document.cookie.length;
	}
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
	( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
	( ( path ) ? ';path=' + path : '' ) +
	( ( domain ) ? ';domain=' + domain : '' ) +
	( ( secure ) ? ';secure' : '' );
}

function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
	( ( path ) ? ';path=' + path : '') +
	( ( domain ) ? ';domain=' + domain : '' ) +
	';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}

