function xmlhttpTest() {
	if ( xmlhttp.readyState == 4 ) {
		if ( xmlhttp.status == 200 ) {
			location.href = '/protected/';
		} else if ( xmlhttp.status == 400 ) {
			showLoginBox();
		} else if ( xmlhttp.status == 401 ) {
			showLoginBox();
		} else if ( xmlhttp.status == 403 ) {
			showLoginBox();
		}
	}
}

function showLoginBox() {
	document.getElementById('try').style.visibility = 'hidden';
}

document.getElementById('try').style.visibility = 'visible';

var xmlhttp = createAJAX();

xmlhttp.open("GET", '/protected/?d=' + new Date() . getTime() ,true);
xmlhttp.onreadystatechange = xmlhttpTest;
xmlhttp.send(null);

// timeOut in case SAMS reports something else or -bad- nothing
setTimeout("showLoginBox()",10000);