
function Invalid_Value(str) {

 if ( str.indexOf("'") != -1 || str.indexOf("%") != -1 || str.indexOf("`") != -1 )  {
  window.alert("Invalid Information found....\n"+
                           "{ \' , % and ` }character's not allowed");
  return true;
 }else
 return false;
}

  

function Correct_Email ( email ) {

	var indexvalue1 = email.indexOf("@");
	var indexvalue2 = email.indexOf(".");
	
		if ( indexvalue1 <= 0 ) {
			window.alert("Invalid Email Value");
			return false;
		}else if ( email.indexOf("'") != -1 || email.indexOf("%") != -1 ) {
			window.alert("Email value should not contain ( \')  or ( \") character's");
			return false;
 		}
   		      return true;
}


function Correct_DomainName( DomainName ) {

  var ch;

      DomainName = DomainName.toLowerCase();

	  
    if ( DomainName.length == 0 ) {
	     window.alert("Domain Name Should Not Be Empty\n");
             return false;
     }		
    
         for (var i = 0 ; i < DomainName.length ; i++ ) {
	      ch = DomainName.substring(i,i+1)

		  if ( ! (( ch >= "a" && ch <="z" ) || ( ch >="0" && ch <="9" ))) {
  		     if( ! (ch === "-" || ch === "_" || ch === "." )) {
			      window.alert("Invalid Domain name, Should contain 0-9,A-Z,-,_ char. only\n");
                              return false;
			 }
		   } 
	 }// end for

  return true;
 		
}

function Correct_DomainType( DomainType ) {

 DomainType = DomainType.toLowerCase();

         if ( DomainType.length == 0 ) {
              window.alert("Domain Extension Should not Be Empty\n");
              return false;
         } 


          for ( var i = 0 ; i < DomainType.length ;i++ ) {
                ch = DomainType.substring(i,i+1)  

 		  if ( ch === "." && i == 0 ) {
                         window.alert("Invalid Domain Extension, \".\" Character Should not be a first Character\n");
                         return false;
                  }else if( !(ch >= "a" && ch <="z") && ch != "." ) {
                          window.alert("Invalid Domain Extension, Should contain A-Z char's only\n");
                          return false;
                        }
                  
	   }// end for
  return true;
}

function Correct_Password( DomainName, Password ) {
     

	DomainName = DomainName.toLowerCase();
	Password = Password.toLowerCase();



	if ( Password.length < 5 || Password.length > 14 ) {
                window.alert("Invalide Password, should contain 5 to 14 digits \n");
		return false;

        }
        if ( Password.indexOf(" ") != -1 ) {
		window.alert("Password Field should not contain space's");
	        return false;
        }

        if ( Password === DomainName ) {
                window.alert("Password Should Not Be Same as Domain Name\n");
                return false;
         }
  return true;

}
