	
	// the submit function, per defualt cookie set hint
	var submitFunction = function(form){
			org.resoa.showMessage ("Resoa Security is based on cookies, please <strong>enable Cookie setting</strong> for this site, " + 
				"otherwise access will not be possible!", "Cookies not enabled!", "OK");
	};
	if (!JSUTIL.testCookieAccept()){
		org.resoa.showMessage ("Resoa Security is based on cookies, please <strong>enable Cookie setting</strong> for this site, " +
			"otherwise access will not be possible!", "Cookies not enabled!", "OK");
	} else{
		// we declare submit function for entering
		submitFunction = function(form) {
			var ajaxOptions = org.resoa.getAJAXOptions(function(xmlReq, textStatus){
				// we check for response
				if (org.resoa.website.AuthRequest.prototype.instanceOf(xmlReq.responseText)){
					// success
					// we check for cookie information (IE!)
					org.resoa.checkCookieSet(xmlReq);
					$.historyLoad(org.resoa.DOWNLOAD);
				} else if (org.resoa.topology.Error.prototype.instanceOf(xmlReq.responseText)){
					var err = new Error(xmlReq.responseText);
					org.resoa.showMessage(err.message, "Error", "OK");
				} else
					org.resoa.showMessage("Sorry, download section is currently not available, please try again in a few minutes.", "Error", "OK");
				
			}, function(xmlReq, textStatus) {
				alert ("reached error");
			 	org.resoa.showMessage("Sorry, download section is currently not available, please try again in a few minutes.", "Error", "OK");	
			 });
			var req = new org.resoa.website.AuthRequest();
			req.agreed = true;
			ajaxOptions.data = req.toJson("authorize");
			$.ajax(ajaxOptions);
   		}
	}
	
	$("#enterdownload").validate({
		rules : {
			agree : "required"
		},
		messages : {
			agree : "Please agree first! "
		},
		submitHandler: submitFunction 
	});

