function checkForm(theForm)
{
  
  var radioSelected = false;
  for (i = 0;  i < theForm.sex.length;  i++)
  {
    if (theForm.sex[i].checked)
        radioSelected = true;
  }
  if (!radioSelected)
  {
    alert("Please select one of the \"gender\" options.");
    return (false);
  }

  if (theForm.Nickname.value == "")
  {
    alert("Please enter a value for the \"Nickname\" field.");
    theForm.Nickname.focus();
    return (false);
  }

  if (theForm.Nickname.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Nickname\" field.");
    theForm.Nickname.focus();
    return (false);
  }

  if (theForm.Nickname.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"Nickname\" field.");
    theForm.Nickname.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-\\.,;:<>_ç°§*|!\"£$%&/()=?^[]@#~-+ìéèòàùüéâàåçëèïîìÄÅÉæÆôöòûùÿÖÜáíóúÜÑªº¿¡«» \t\r\n\f";
  var checkStr = theForm.Nickname.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter, digit, whitespace and \"\\.,;:<>_ç°§*|!\"£$%&/()=?^[]@#~-+ìéèòàùüéâàåçëèïîìÄÅÉæÆôöòûùÿÖÜáíóúÜÑªº¿¡«»\" characters in the \"Nickname\" field.");
    theForm.Nickname.focus();
    return (false);
  }

  if (theForm.Username.value == "")
  {
    alert("Please enter a value for the \"Username\" field.");
    theForm.Username.focus();
    return (false);
  }

  if (theForm.Username.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Username\" field.");
    theForm.Username.focus();
    return (false);
  }

  if (theForm.Username.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"Username\" field.");
    theForm.Username.focus();
    return (false);
  }

  if (theForm.Password.value == "")
  {
    alert("Please enter a value for the \"Password\" field.");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Password.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Password\" field.");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Password.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"Password\" field.");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Email.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Email\" field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"Email\" field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Agree.checked == false)
  {
    alert("Please you have to check the Agree before to continue.");
    return (false);
  }
  
  // check email
  
  var strEmail=theForm.Email.value;
  var errMsg='YAHOO or AOL account have some problem for receive the confirmation email.\n\nPlease type a different email account!\n\nHOTMAIL or GMAIL are good and fast.'
  
  if (strEmail.search(/yahoo/i)>0)
  {
    alert(errMsg);
    return (false);
  }

  if (strEmail.search(/aol.com/i)>0)
  {
    alert(errMsg);
    return (false);
  }
  
  if (strEmail.search(/netscape/i)>0)
  {
    alert(errMsg);
    return (false);
  }

	var answer = confirm (theForm.Email.value + '\n\n\Is important that your email is correct to receive the confirmation.\n\nIs your email correct ?');
	if (answer)
		return (true);
	else
		return (false);

}

function checkPopUp()
{
 var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
 var popUpsBlocked;
 if(mine)
 	{
    popUpsBlocked = false;
   	mine.close()
   	}
 else
 	{
    popUpsBlocked = true;
 	}
 
if(popUpsBlocked)
  alert('POPUP BLOCKER ACTIVE\n\nWe have detected that you are using popup blocking software.\n\nThis website needs to open a window to show you members profiles, messages and chat...\n\nPlease disable your popup blocker.');
}

function showError(errType)
{
	if (errType>0)
		{
			var msgError;
			
	        switch (errType)
		        {
		            case 1: msgError='NICKNAME NOT CORRECT\n\nThe nickname must be unique in the community and this nickname already exist.\n\nPlease select a new Nickname.';break;
		            case 2: msgError='USERNAME NOT CORRECT\n\nThe username must be unique in the community and this username already exist.\n\nPlease select a new username.';break;
		            case 3: msgError='EMAIL NOT CORRECT\n\nThe email must be unique in the community and this email already exist.\n\nPlease select a new email.';break;
		            case 4: msgError='IP ADDRESS NOT VALID\n\nYou IP address is banned from this site.\n\nYou cannot continue.';break;
		            case 5: msgError='EMAIL NOT CORRECT\n\nThe email must be unique in the community and this email already exist.\n\nPlease select a new email.';break;
		            case 6: msgError='INVALID NICKNAME\n\nYour nickname is contains with the wrong characters.\n\nPlease type a valid Nickname.';break;
		            case 7: msgError='USERNAME NOT CORRECT\n\nThe username must be unique in the community and this username already exist.\n\nPlease select a new username.';break;
		            case 8: msgError='NICKNAME NOT CORRECT\n\nThe nickname must be unique in the community and this nickname already exist.\n\nPlease select a new Nickname.';break;
		            case 9: msgError='EMAIL NOT VALID\n\nPlease make sure that your email is a valid email or please make your sure that is spell correctly.';break;
		        }

		    alert(msgError);

		}
}
function ControllaForm(myform)
{

	if(myform.qm.value == "") 
		{
		alert ('Please select your FILE to upload');
		return false
		}
	else
		{
			var msg='BEFORE TO UPLOAD\n\nMake sure that your photo:\n\n';
			msg=msg + '- SHOW your face fully visible\n\n';
			msg=msg + '- Is your real photo\n\n';
			msg=msg + '- Follow the rules show in the photo example and on your right in the yellow box\n\n\n--------------------\n';
			msg=msg + 'Remind if your photo are not appropriate will be rejected by our moderators\n\n';
			msg=msg + 'Are sure to upload this photo ?';
			
			var answer = confirm (msg);
			if (answer)
				{			
				document.getElementById('progress').style.display = 'block';
				myform.Send.disabled=true;
				myform.back.disabled=true; 			
				return true;			
				}
			else
				return false;
		
		}
	
}
function showErrorUpload(errType)
{
	if (errType>0)
		{
			var msgError;
			
	        switch (errType)
		        {
		            case 1: msgError='PHOTO TOO BIG\n\nThe size of your photo is too big.\n\nMax file size is 1 Mb (1024 Kb).\n\nPlease select another photo to upload';break;
		            case 2: msgError='PHOTO NOT VALID\n\nYour photo is not valid.\n\nOnly JPEG or GIF or BMP format are allowed.\n\nPlease select another photo to upload.';break;
		            case 3: msgError='PHOTO NOT VALID\n\nYour photo can not be processed for some errors!\n\nPlease select another photo to upload.';break;
		        }

		    alert(msgError);

		}
}
function sendPreview(myDest)
{

	var msg='BEFORE TO SUBMIT\n\nMake sure that your photo:\n\n';
	msg=msg + '- SHOW your face fully visible\n\n';
	msg=msg + '- Is your real photo\n\n';
	msg=msg + '- Follow the bestqm rules\n\n\n--------------------\n';
	msg=msg + 'Remind if your photo are not appropriate will be rejected by our moderators\n\n';
	msg=msg + 'Are sure to submit this photo for approval ?';
	
	var answer = confirm (msg);
	if (answer)
		{
			if (myDest==1) document.location='Profile.asp';
			if (myDest==2) document.location='ProfileChange.asp';			
			return true;			
		}
	else
		return false;

}

function CheckLen() {
	document.getElementById("lenAnnounce").innerHTML=document.forms[0].announce.value.length;
}

function showErrorAnnounce(errType)
{
	if (errType>0)
		{
			var msgError;
			
	        switch (errType)
		        {
		            case 1: msgError='AANOUNCE NOT VALID\n\nYour announce contains no valid text. Please type your announce';break;
		        }

		    alert(msgError);

		}
}

function checkContest()
{
var el_collection=eval('document.forms.frmContest');
var radioChecked=false;
for (c=0;c<el_collection.length;c++)
	{
		if(el_collection[c].type=='radio' && el_collection[c].checked==true)
			{
			radioChecked=true;
			break;
			}
	}

	if (radioChecked==true)
			return true;
	else
		{
			alert ('Please select a contest for your profile');
			return false;
		}

}

function submitProfile()
{

	var msg='BEFORE TO SUBMIT YOUR PROFILE\n\nMake sure of:\n\n';
	msg=msg + '- Your photo show your face fully visible\n\n';
	msg=msg + '- Is your real photo\n\n';
	msg=msg + '- Your data are real\n\n\n--------------------\n';
	msg=msg + 'Remind if your profile and photo are not appropriate will be rejected by our moderators\n\n';
	msg=msg + 'Are sure to submit this profile ?';
	
	var answer = confirm (msg);
	if (answer)
		return true;			
	else
		return false;
}

function startGS()
	{
		var w=640;
		var h=460;
		
		var url='gs.asp';
		var name='gs';
		
		l=(screen.width-w)/2
		t=(screen.height-h)/2

		 var win = window.open(url,name, 'width=' + w + ', height=' + h + ',status=no,location=no,menubar=no,copyhistory=no,scrollbars=no,status=no,toolbar=no,resizable=no,top='+t+',left='+l,true);
		 win.focus();
	}