function MM_reloadPage(init){ //reloads the window if Nav4 resized
    if (init == true) {
        with (navigator) {
            if ((appName == "Netscape") && (parseInt(appVersion) == 4)) {
                document.MM_pgW = innerWidth;
                document.MM_pgH = innerHeight;
                onresize = MM_reloadPage;
            }
        }
    }
    else {
        if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH) {
            location.reload();
        }
    }
}

MM_reloadPage(true);

function dump(o){
    var a = '';
    for (var k in o) {
        a += k + ': ' + o[k] + '; ';
    }
    return a;
}

function trim(string) {
	return string.replace (/^\s+/, '').replace (/\s+$/, '');
}

function submitHandler(strLang){
    var message = '';
    $$('input[type=text]').each(function(objElement){
		objElement.value = trim(objElement.value);
        if (objElement.name.substr(0, 8) == 'register' && objElement.value.length < 3) {
			if((text = $$('label[for=' + objElement.id + ']')[0].get('text'))) {
				if(strLang == 'en' && objElement.id != 'phone') {
		            message += 'The ' + trim(text).replace('*', '') + ' is invalid \n';
				}
				else if(strLang == 'de' && objElement.id != 'phone') {
		            message += 'Die Angabe ' + trim(text).replace('*', '') + ' ist unzureichend \n';
				}
			}
        }
    });
	if(!$('agb').checked) {
		if (strLang == 'en') {
			message += 'You must accept the game conditions\n';
		}
		else {
			message += 'Sie müssen die Spielbedingungen akzeptieren\n';
		}
	}
	if(!$('mails').checked) {
		if (strLang == 'en') {
			message += 'You must accept that you\'ll receive mails\n';
		}
		else {
			message += 'Sie müssen die Zusendung von E-Mails akzeptieren\n';
		}
	}
	if(message.length > 0) {
		alert(message);
	}
    return message.length == 0;
};

window.addEvent('load', function(){

});
