function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}


function checkform ( form )
{
   if (form.fullname.value == "") {
    alert( "Please enter your full name." );
    form.fullname.focus();
    return false ;
  }
  
     if (form.username.value == "") {
    alert( "Please enter a username." );
    form.username.focus();
    return false ;
  }
  
     if (form.password.value == "") {
    alert( "Please enter a password." );
    form.password.focus();
    return false ;
  }
  
   if (form.keyword.value == "") {
    alert( "Please enter a keyowrd. You will need one in order to reset your password." );
    form.keyword.focus();
    return false ;
  }
  
  if (form.email.value == "") {
    alert( "Please enter your email address." );
    form.email.focus();
    return false ;
  }
  
  if (echeck(form.email.value)==false){
		form.email.value=""
		form.email.focus();
		return false;
	}

  return true ;
}


function checkupload ( form )
{
   if (form.title.value == "") {
    alert( "Please enter a title." );
    form.title.focus();
    return false ;
  }
  
     if (form.large.value == "") {
    alert( "Please select a screenshot to upload!" );
    form.large.focus();
    return false ;
  }

  return true ;
}




function checkpost ( form )
{
 if (form.title.value == "") {
    alert( "Please enter a project title." );
    form.title.focus();
    return false ;
  }
  
   if (form.prize.value == "$") {
    alert( "Please enter a valid prize amount." );
    form.prize.focus();
    return false ;
  }
  
  if (form.description.value == "") {
    alert( "Please enter a full description of your project. This is important so that the designers know what to create." );
    form.description.focus();
    return false ;
  }
  
 
  return true ;
}


function checkentry ( form )
{
 if (form.title.value == "") {
    alert( "Please enter a project title." );
    form.title.focus();
    return false ;
  }
  
   if (form.image.value == "") {
    alert( "Please select an image to upload." );
    form.image.focus();
    return false ;
  }
  
  
  if (form.description.value == "") {
    alert( "Please enter a full description of your design entry." );
    form.description.focus();
    return false ;
  }
  
 
  return true ;
}



function windowopen() {
		window.open('/pm.php', 'msgwindow', config='height=400, width=660, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}


function newmsg(msg) {
var id = "/pm.php?id="+msg;
window.open(id, 'newwindow', config='height=400, width=490, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, directories=no, status=no')
}

