//*************************************************************************************************
function validateContact(){
  var ErrorMessage='';
  var FirstError='';
  if (GetE('cu_firstname').value==''){
    ErrorMessage+="\n - First Name";
    if (FirstError=='') FirstError='cu_firstname';
  }
  if (GetE('cu_surname').value==''){
    ErrorMessage+="\n - Surname";
    if (FirstError=='') FirstError='cu_surname';
  }

  if (GetE('cu_tel').value==''){
    ErrorMessage+="\n - Tel";
    if (FirstError=='') FirstError='cu_tel';
  }

  if (GetE('cu_email').value==''){
    ErrorMessage+="\n - Email";
    if (FirstError=='') FirstError='cu_email';
  }

  if (GetE('cu_locations').value==0){
    ErrorMessage+="\n - Location";
  }
  if (GetE('cu_comment').value==''){
    ErrorMessage+="\n - Comment";
    if (FirstError=='') FirstError='cu_comment';
  }

  if (ErrorMessage==''){
    document.forms.mainform.action.value='SubmitContactRequest';
    document.forms.mainform.submit();
  }else{
    alert('You are required to complete the following fields: '+ErrorMessage);
    if (FirstError!='') document.forms.mainform[FirstError].focus();
  }
}

//*************************************************************************************************
function validateEventRegister(){
  var ErrorMessage='';
  var FirstError='';
  if (GetE('cu_firstname').value==''){
    ErrorMessage+="\n - First Name";
    if (FirstError=='') FirstError='cu_firstname';
  }
  if (GetE('cu_surname').value==''){
    ErrorMessage+="\n - Surname";
    if (FirstError=='') FirstError='cu_surname';
  }

  if (GetE('cu_email').value=='' && GetE('cu_tel').value==''){
    ErrorMessage+="\n - Tel or Email";
    if (FirstError=='') FirstError='cu_tel';
  }

  if (GetE('cu_comment').value==''){
    ErrorMessage+="\n - Comment";
    if (FirstError=='') FirstError='cu_comment';
  }

  if (ErrorMessage==''){
    document.forms.mainform.action.value='Send';
    document.forms.mainform.submit();
  }else{
    alert('You are required to complete the following fields: '+ErrorMessage);
    if (FirstError!='') document.forms.mainform[FirstError].focus();
  }
}

//**********************************************************************************************************************
function Search(pageID){
  if (GetE('keyword').value.length<3){
    alert('Please enter a keyword (min 3 characters)');
    GetE('keyword').focus();
  }else{
    document.location='/'+pageID+'/'+GetE('keyword').value;
    return false;
  }
}


//******************************************************************************************************************************
function validate_My_login(){
  if (document.forms.mainform.My_login.value.length<1){
    alert('Please enter your Username');
    document.forms.mainform.My_login.focus();
  }else{
    document.forms.mainform.submit(); 
  }
}

//******************************************************************************************************************************
function FPSM(){
  if (GetE('remember_password').value==''){
    alert('Please enter your email address.');
    GetE('remember_password').focus();
  }else{  
    document.forms.mainform.EnterLoginData.value=0;
    document.forms.mainform.rememberpassword.value=1;
    document.forms.mainform.submit(); 
  }
}


//***********************************************************************************************************************
//***********************************************************************************************************************
//***********************************************************************************************************************
//***********************************************************************************************************************

//**********************************************************************************************************************
function CP(page,action,actionid,conf){
  if (conf!=1 || confirm('Are you sure?')) {
    if (action!='') document.forms.mainform.action.value=action;
    if (actionid!='') document.forms.mainform.actionid.value=actionid;
    document.forms.mainform.submit();
  }
}
