/**
 * Harmos Festival
 *
 * @version 1
 * @author  Rolling Mill, http://www.rolling-mill.pt
 * @created 2010-09-10
 * @updated 2010-11-30
 * @link    http://www.harmos.com
 */

	String.prototype.trim = function() {
		return this.replace(/^\s+|\s+$/g,"");
	}

	
	function registerUser(nome,email,pass,country,newsletter,lang)
	{
		
		ajaxObjectArray[ajaxObjectArray.length] = new sack();
		var ajaxIndex = ajaxObjectArray.length-1;
		ajaxObjectArray[ajaxIndex].setVar('nome', nome);
		ajaxObjectArray[ajaxIndex].setVar('email', email);
		ajaxObjectArray[ajaxIndex].setVar('pass', pass);
		ajaxObjectArray[ajaxIndex].setVar('country', country);
		ajaxObjectArray[ajaxIndex].setVar('newsletter', newsletter);
		ajaxObjectArray[ajaxIndex].setVar('lang', lang);
		ajaxObjectArray[ajaxIndex].requestFile = siteURL+'backend/users/createUser.cfm';
		ajaxObjectArray[ajaxIndex].onCompletion = function() { 
			showRegisterResponse(ajaxObjectArray[ajaxIndex].response.trim());
		};
		ajaxObjectArray[ajaxIndex].onError = function() { 
			showRegisterResponse('error');
		};
		ajaxObjectArray[ajaxIndex].onFail = function() { 
			showRegisterResponse('error');
		};
		
		ajaxObjectArray[ajaxIndex].runAJAX();
				
	}
	
	function loginUser(email,pass)
	{
		
		ajaxObjectArray[ajaxObjectArray.length] = new sack();
		var ajaxIndex = ajaxObjectArray.length-1;
		ajaxObjectArray[ajaxIndex].setVar('email', email);
		ajaxObjectArray[ajaxIndex].setVar('password', pass);
		ajaxObjectArray[ajaxIndex].requestFile = siteURL+'backend/users/loginUser.cfm';
		ajaxObjectArray[ajaxIndex].onCompletion = function() { 
			showLoginResponse(ajaxObjectArray[ajaxIndex].response.trim());
		};
		ajaxObjectArray[ajaxIndex].onError = function() { 
			showLoginResponse('error');
		};
		ajaxObjectArray[ajaxIndex].onFail = function() { 
			showLoginResponse('error');
		};
		
		ajaxObjectArray[ajaxIndex].runAJAX();
				
	}
