window.addEvent('domready', function(){									 
	$('execute').addEvent('click', function(event){									 
		var req = new Request({
			url: "users.xml",
			method: "get",
			onSuccess: function(objTXT,objXML){
				var xml = objXML;
				var user = xml.getElementsByTagName('movie');
				for (i = 0; i < user.length; i++) {
					var userXML = user[i].getAttribute('id');
					var passXML = user[i].getAttribute('pass');
					if ($('user').get('value') == userXML && $('pass').get('value') == passXML) {
						showError("#fff");
						var theTop = (screen.height / 2) - (600 / 2);
						var theLeft = (screen.width / 2) - (700 / 2);
						//window.open('../showroom/index.html', 'mywindow', 'width=800,height=600, resizable=0, top=' + theTop + ', left=' + theLeft + '');
						window.location = 'http://www.avventa.com/showroom/index.html';
					} else {
						showError("#000");
					}
				}
			}
		});
		req.send();
	});
});

function showError(color) {
	var m = document.getElementById("logIncorrect")
	var p = m.getElementsByTagName("span");
	for (i = 0; i < p.length; i++) {
		p[i].style.color = color;
	}
}
