

// Used for separate testing of this page
$(document).ready( function(){

// Create namespace if not existing
if(typeof mt === 'undefined') {
	mt = {	'controllers' : {}, 
			'models' : {}, 
			'extra' : {}
		}
	}
	
	
	// Create controller
	mt.controllers.signup = new signup();
	
	
	// Set the paths
	mt.controllers.signup.paths = {};	
	mt.controllers.signup.paths.saveUrl = mt.constants.SECURE_URL + 'mongo.php?action=update&page=signup';
	mt.controllers.signup.paths.successRedirect = 'myOverview.php?signup=true';
	
	
	// init
	mt.controllers.signup.init();


});

/***
 * Main controller class for signup
 */
function signup(){
	
	// variables

	
	// INIT the page		
	this.init = function(){
		
		// Create the signup model
		mt.models.signup = new signupModel(); 		
		// Set save URL so that the model knows where to save its data
		mt.models.signup.setSaveUrl(mt.controllers.signup.paths.saveUrl)
		
		// Create the controls
				
		// Create simple GUI controls		
		var emailAddress = new GUIControle(mt.models.signup,"emailAddress", "#emailAddress");
		var password = new GUIControle(mt.models.signup,"password", "#password2");
		$('#password').password_strength();
		var acceptLegal = new GUIControle(mt.models.signup,"acceptLegal", "#acceptLegal", "checkbox");
		var displayName = new GUIControle(mt.models.signup,"displayName", "#displayName");
				
		// Create save/signup button
		var signupButton = new guiControlSaveButton(mt.models.signup,"saveButton", "#sign-up-button", "Sign up", null, mt.controllers.signup.paths.successRedirect, true);
		

	}

}



