//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style;
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
	object.opacity = (opacity / 100);
} 

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			opac_timeout = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			opac_timeout = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

function loaderImage() {
	if ( typeof(window['image_timeout']) != "undefined" ) // Existiert ein 'image_timeout'-Timeout, soll dieser gelöscht werden. Nötig falls mehrmals schnell hintereinander geklickt wird.
	{ 
		window.clearTimeout(image_timeout); 
	} 
	document.getElementById("submitButton").value = "   ";
	document.getElementById("submitButton").style.backgroundImage = "url(../../../b2slogin/ajax-loader.gif)";
	image_timeout = window.setTimeout("document.getElementById('submitButton').style.backgroundImage = 'none'; document.getElementById('submitButton').value = 'Login';", 2000);
}

function wrongLoginWarning() {
	if ( typeof(window['warning_timeout']) != "undefined" ) // Existiert ein 'warning_timeout'-Timeout, soll dieser gelöscht werden. Nötig falls mehrmals schnell hintereinander geklickt wird.
	{ 
		window.clearTimeout(warning_timeout);
	} 

	opacity("loginformmessage", 0, 100, 500);
	warning_timeout = window.setTimeout("opacity('loginformmessage', 100, 0, 500);", 2000);
}

function submitLogin()
{
	xajax.$('submitButton').disabled=true;
	xajax_processLogin(xajax.getFormValues("B2Slogin"));
	return false;
}