
function checkForm(clientId)
{
	var strTemp;
		
	//Username
	strTemp = checkTextArea(document.getElementById(clientId + '_txtUser'), 'user name', '', true, 4, 16, 'password');
	if(strTemp != '') {alert(strTemp);return false;}
	
	//Password
	strTemp = checkTextArea(document.getElementById(clientId + '_txtPass'), 'password', '', true, 4, 16, 'password');
	if(strTemp != '') {alert(strTemp);return false;}
	
	//Check if passwords the same
	strTemp = checkTextAreaValuesEqual(document.getElementById(clientId + '_txtPass'), document.getElementById(clientId + '_txtPass2'), 'Confirm password field is different than the password field');
	if(strTemp == false) {return false;}
	
	//Email
	strTemp = checkTextArea(document.getElementById(clientId + '_txtEmail'), 'email address', 'email', true, 10, 100, 'email');
	if(strTemp != '') {alert(strTemp);return false;}
	
	//Title
	strTemp = checkTextArea(document.getElementById(clientId + '_txtTitle'), 'introduction title', 'text', true, 10, 100, 'en');
	if(strTemp != '') {alert(strTemp);return false;}
	
	//Gender
	strTemp = document.getElementById(clientId + '_ddlGender').selectedIndex;
	if(strTemp == 0)
	{
		alert('Please choose your gender');
		return false;
	}
	
	//Country
	strTemp = document.getElementById('countrySelect').selectedIndex;
	if(strTemp == 0)
	{
		alert('Please choose your country');
		return false;
	}
	
	//Year of birth
	strTemp = document.getElementById(clientId + '_ddlYear').selectedIndex;
	if(strTemp == 0)
	{
		alert('Please choose your year of birth');
		return false;
	}
	
	
	
	//check images for uploads
	strTemp = checkFileToUpload(document.getElementById(clientId + '_FileUpload1'), false, 'Please upload images only!');
	if(strTemp != '') {alert(strTemp);return false;}
	strTemp = checkFileToUpload(document.getElementById(clientId + '_FileUpload2'), false, 'Please upload images only!');
	if(strTemp != '') {alert(strTemp);return false;}
	strTemp = checkFileToUpload(document.getElementById(clientId + '_FileUpload3'), false, 'Please upload images only!');
	if(strTemp != '') {alert(strTemp);return false;}
	strTemp = checkFileToUpload(document.getElementById(clientId + '_FileUpload4'), false, 'Please upload images only!');
	if(strTemp != '') {alert(strTemp);return false;}
	strTemp = checkFileToUpload(document.getElementById(clientId + '_FileUpload5'), false, 'Please upload images only!');
	if(strTemp != '') {alert(strTemp);return false;}
	
	
	//Self description
	strTemp = checkTextArea(document.getElementById(clientId + '_txtDescription'), 'self description', 'text', false, 0, 1000, 'en');
	if(strTemp != '') {alert(strTemp);return false;}
	
	//Partner description
	strTemp = checkTextArea(document.getElementById(clientId + '_txtPartnerDescription'), 'partner description', 'text', false, 0, 1000, 'en');
	if(strTemp != '') {alert(strTemp);return false;}	
	
	//Confirm terms
	if(document.getElementById(clientId + '_chb1').checked == false)
	{
		alert('Please read and confirm that you agree to the terms and conditions by checking the checkbox at the bottom of this form');
		return false;
	}
	
	return true;
}

//---------------------------------CHECK UPDATE DETAILS FORM---------------------------------
function checkUpdateDetailsForm(clientId)
{
	var strTemp;
		
		
	//Email
	strTemp = checkTextArea(document.getElementById(clientId + '_txtEmail'), 'email address', 'email', true, 10, 100, 'email');
	if(strTemp != '') {alert(strTemp);return false;}
	
	//Title
	strTemp = checkTextArea(document.getElementById(clientId + '_txtTitle'), 'introduction title', 'text', true, 10, 100, 'en');
	if(strTemp != '') {alert(strTemp);return false;}
	
	//Gender
	strTemp = document.getElementById(clientId + '_ddlGender').selectedIndex;
	if(strTemp == 0)
	{
		alert('Please choose your gender');
		return false;
	}
	
	//Country
	strTemp = document.getElementById('countrySelect').selectedIndex;
	if(strTemp == 0)
	{
		alert('Please choose your country');
		return false;
	}
	
	//Year of birth
	strTemp = document.getElementById(clientId + '_ddlYear').selectedIndex;
	if(strTemp == 0)
	{
		alert('Please choose your year of birth');
		return false;
	}
	
	//Self description
	strTemp = checkTextArea(document.getElementById(clientId + '_txtDescription'), 'self description', 'text', false, 0, 1000, 'en');
	if(strTemp != '') {alert(strTemp);return false;}
	
	//Partner description
	strTemp = checkTextArea(document.getElementById(clientId + '_txtPartnerDescription'), 'partner description', 'text', false, 0, 1000, 'en');
	if(strTemp != '') {alert(strTemp);return false;}	
		
	return true;
}

function showMsg(strLblName, strMsg)
{
	var objElement = document.getElementById(strLblName);
	objElement.innerHTML = strMsg;
}  


//---------------------------------CHECK IF USERNAME OR EMAIL EXIST BY AJAX--------------------
var m_strMsg;
var m_strLblName;
function checkValueExists(objTextBox, strLblName, strAction, strMsg)
{
	m_strMsg = strMsg;
	m_strLblName = strLblName;
	if(objTextBox.value == "" || strAction == "" || strMsg == "")
	{
		return;
	}	
	
	var strAspxUrl = 'ajaxHandler.aspx?action=' + strAction + '&param1=' + objTextBox.value
	getServerResponse(strAspxUrl, response_alertUserExists);
}
function response_alertUserExists()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if (xmlHttp.status==200)
		{
			if(xmlHttp.responseText != '')
			{
				//alert(m_strMsg);
				var objElement = document.getElementById(m_strLblName);
				objElement.innerHTML = m_strMsg;			
			}
			else
			{
				var objElement = document.getElementById(m_strLblName);
				objElement.innerHTML = "";
			}
		}		
	} 
}
//------------------------------END FUNCTION THAT RETURNS TEXT BY AJAX--------------------