  //**********************************************************************************************************
  // www.xoooox.it
  // My javascript file
  //**********************************************************************************************************

  function VerifyData()
  {
    if( document.getElementById('author')!=null )
    {
  	  if( trim(document.post_data_form.author.value)=="" )
	  {
	    document.post_data_form.author.value="";
	    document.post_data_form.author.focus();
	    return false;
	  }
	}
	
	if( trim(document.post_data_form.posts.value)=="" )
	{
	  document.post_data_form.posts.value="";
	  document.post_data_form.posts.focus();
	  return false;
	}

    if( document.getElementById('author')!=null )
    {
	  if( trim(document.post_data_form.email.value)!="" &&
	           (
			     (document.post_data_form.email.value.indexOf('@')==-1 || document.post_data_form.email.value.indexOf('.')==-1) ||
			     (document.post_data_form.email.value.indexOf('@')>document.post_data_form.email.value.indexOf('.')) ||
				 (document.post_data_form.email.value.length==(document.post_data_form.email.value.indexOf('.')+1)) 
			   ) )
	  {
	    alert("Invalid E-mail");
	    document.post_data_form.email.focus();
	    return false;
	  }
    }
    else
    {
	  if( trim(document.post_data_form.email.value)=="" ||
	           (
			     (document.post_data_form.email.value.indexOf('@')==-1 || document.post_data_form.email.value.indexOf('.')==-1) ||
			     (document.post_data_form.email.value.indexOf('@')>document.post_data_form.email.value.indexOf('.')) ||
				 (document.post_data_form.email.value.length==(document.post_data_form.email.value.indexOf('.')+1)) 
			   ) )
	  {
	    alert("Invalid E-mail");
	    document.post_data_form.email.focus();
	    return false;
	  }
    }

    return true;
  }

  function trim(stringa) 
  {
    while (stringa.substring(0,1) == ' ')
    {
      stringa = stringa.substring(1, stringa.length);
    }
    
	while (stringa.substring(stringa.length-1, stringa.length) == ' ')
    {
      stringa = stringa.substring(0,stringa.length-1);
    }
    return stringa;
  }

  function righttrim(stringa) 
  {
	while (stringa.substring(stringa.length-1, stringa.length) == ' ')
    {
      stringa = stringa.substring(0,stringa.length-1);
    }
	return stringa;
  }

