function editUser()
{
	var result = true;
	if($('cfname').value == ''){alert('First name incorrect');result = false;}
	if($('clname').value == '' && result){alert('Last name incorrect');result = false;}
	if($('cgender').selectedIndex == -1 && result){alert('Gender incorrect');result = false;}
	if($('ccountry').value!='' && $('ccountry_id').value != $('ccountry').value){alert('Please, choose a valid country from the list');return false;}
	//if($('cdateofbirth').value == ''){result = false;}
	if(!_IsDate($('cdateofbirth').value, 'mmddyyyy', '-') && result){alert('Date of birth incorrect');result = false;}
	if(!_IsEmail($('cemail').value) && result){alert('Email incorrect');result = false;}
	if(($('cpassword').value).length < 6 && result){
		alert('Password length incorrect');result = false;
		}
	if(!_TextNumberOnly($('cpassword').value) && result){
		alert('Password incorrect');result = false;
		}
	if($('turing').value == '' && result){alert('Incorrect Code');reloadCaptcha();result = false;}
	return result;
}

function addUser()
{
	var result = true;
	if($('cuname').value == '' && result){alert('Username must contain 6-12 characters');result = false;$('cuname').focus();}
	if($('cfname').value == '' && result){alert('Enter your first name please');result = false;$('cfname').focus();}
	if($('clname').value == '' && result){alert('Enter your last name please');result = false;$('clname').focus();}
	if($('cgender').options[$('cgender').selectedIndex].value == -1 && result){alert('Choose your gender please');result = false;$('cgender').focus();}
	if($('ccountry').options[$('ccountry').selectedIndex].value == -1 && result){alert('Choose your country please');result = false;$('ccountry').focus();}
//	if($('ccountry').value=='' && result){alert('Please, enter your country');result = false;$('ccountry').focus();}
//	if($('ccountry').value!='' && $('ccountry_id').value != $('ccountry').value){alert('Please, choose a valid country from the list');result = false;$('ccountry').focus();}
	if(!_IsDate($('cdateofbirth').value, 'mmddyyyy', '-') && result){alert('Enter your birthdate please');result = false;$('cdateofbirth').focus();}
	if(!_IsEmail($('cemail').value) && result){alert('Enter your Email address please');result = false;$('cemail').focus();}
	if(($('cemail').value)!=$('cemail2').value && result){
		alert('E-Mail addresses do not match');result = false;$('cemail').focus();
		}
	if(($('cpassword').value).length < 6 && result){
		alert('Password must contain 6 or more characters');result = false;$('cpassword').focus();
		}
	if(!_TextNumberOnly($('cpassword').value) && result){
		alert('Password must contain alphanumeric characters only');result = false;$('cpassword').focus();
		}
	if(($('cpassword').value)!=$('cpassword2').value && result){
		alert('Passwords do not match');result = false;$('cpassword').focus();
		}
	if(($('agree').checked == false) && result){
		alert('You must agree to the Terms and Conditions and Privacy');result = false;$('agree').focus();
		}
	if($('turing').value == '' && result){alert('Incorrect Code');reloadCaptcha();result = false;$('turing').focus();}
	return result;
}

function addFriend(_me, _friend)
{
	var url = '/modules/user/add_del_friend.php?me='+_me+'&friend='+_friend;
	new Ajax.Updater('capa_add_friend', url, {evalScripts: true});
}

function delFriend(_me, _friend)
{
	var url = '/modules/user/add_del_friend.php?action=del&me='+_me+'&friend='+_friend;
	new Ajax.Updater('capa_add_friend', url, {evalScripts: true});
}
