var movie_loaded = false;
var shaking = false;

function Notice(id) {
	if (id == "nouser1") {
		// alert(shaking);
		if (shaking == false)
		{
			$('notice').innerHTML = "je moet eerst inloggen";
			$('notice').show();
			new Effect.Shake('login_container', {duration: 0.4});			
			shaking = true;
			setTimeout("shaking = false", 450);
		}
	}
	else {
		$('notice').hide();
	}
}

function ImHere() {
	movie_loaded = true;
	$('labels').reset();
	CheckInitialLabel();
	// alert('loaded');
	// SayYo();
	// SayLabels();
}

function SayLabels() {
	var labels = $('labels').getInputs('checkbox').findAll(function(item){ return item.checked }).pluck('value')
	// alert(labels);
	if (movie_loaded)
		thisMovie('kubiverse').CheckLabels(labels);
	// var checked = Form.getInputs(element.form, "checkbox", element.name).findAll(function(item) 
	// { return item.checked; }).pluck("value");
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    } else {
        return document[movieName];
    }
}
 
function SayYo() {
	HideSpinner();
	Notice();
	if (movie_loaded)
    	thisMovie('kubiverse').Yo();
}

function SetDimensions() {
	// var x,y;
	// if (self.innerHeight) { // all except Explorer 
	// 	x = self.innerWidth;
	// 	y = self.innerHeight;
	// }
	// else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
	// 	x = document.documentElement.clientWidth;
	// 	y = document.documentElement.clientHeight;
	// }
	// else if (document.body) { // other Explorers
	// 	x = document.body.clientWidth;
	// 	y = document.body.clientHeight;
	// }
	// $('kubiverse').setStyle({
	// 	width: $('body').getWidth() - $('login_container').getWidth()
	// });
	// alert($('kubiverse').getWidth());
	// $('login_container').setStyle({
	// 	height: $('body').getHeight()
	// });
}

function ShowError(usernumber) {
	// Effect.Appear('errors'+usernumber, {duration: 0.2});
	// Effect.BlindDown('errors'+usernumber, {duration: 0.2});
	$('errors'+usernumber).show();
	$('boxuser_container'+usernumber).className = 'boxuser_container boxuser_container_error'
}
function HideError(usernumber) {
	// Effect.Fade('errors'+usernumber, {duration: 0.2});
	// Effect.BlindUp('errors'+usernumber, {duration: 0.2});
	$('errors'+usernumber).hide();
	$('boxuser_container'+usernumber).className = 'boxuser_container'
}