function LoginClicked() {

	var JSON_Object;
	sMail = document.getElementById("tEmail").value;
	sPsw = document.getElementById("tPassword").value;
	
	if (sMail.length == 0) {
		alert("please enter the registered email address");
		return false;
	}
	
	if (sPsw.length == 0) {
		alert("please enter the registered password");
		return false;
	}

	sJSONText = "{'processor':'login','useremail':'" + sMail + "','userpass':'" + sPsw + "','userarea':'prodata'}";	
	JSON_Object = eval('(' + sJSONText + ')'); //evaluate it to a json object.
					
	//pass data to the ajax_getdata function. All data needs to be passed as json
	ajax_GetData('',JSON_Object);

}



function handleResponse() {

	//Deal with response
	if (response.error != 'none') {
		alert('Sorry, there has been an error.\n' + response.error);
	} 
	else {
		if (response.message != 'none') {	   
		   switch (response.caller) {		   
				case "login":
					ReturnFromLogin(response.message);
					break;
			}
		}
	}
}

function ReturnFromLogin(sText) {

	if (sText == "FAILURE") {
		alert("Invalid Details Entered - Please Retry");
		return true;
	}
	else {
		window.location="index.php?calling=technical&sub=prodata&sub1=menu";	
		return true;
	}
}



