

function logincheck()
{  
  //alert("in");

   var isError = false;
   var firstErrorField = false;
   var errorBackgroundColor = "#FEE0C6";
   var errorTextColor ="#DD2200";
   
   var noerrorBackgroundColor = "";
   var noerrorTextColor = "black";
   
   document.loginform.emailid.style.backgroundColor = noerrorBackgroundColor;
   document.loginform.pwd.style.backgroundColor = noerrorBackgroundColor;


   var errorMessage="<ul>" ;
 
      
   
   
 if(document.loginform.emailid.value=='')
     {   
        // alert('line 1');
         errorMessage =  errorMessage + "<li>*Fill the email ID field</li>";

         document.loginform.emailid.focus();
         document.loginform.emailid.style.backgroundColor = errorBackgroundColor;
         firstErrorField = true;          
         isError = true;         
     }

  else
  {
    if( echeck(document.loginform.emailid.value) == false)
      { //alert('line 2');
         errorMessage=errorMessage + "<li>*EmailId format is wrong</li>";
         document.loginform.emailid.focus();


         document.loginform.emailid.style.backgroundColor = errorBackgroundColor;
         firstErrorField = true;              

	  isError = true;

       }
    else
       {//alert("truef");
        }  
   }          
  

   if(document.loginform.pwd.value=='')
   {  // alert('line 3');
        errorMessage=errorMessage+"<li>*Fill the password field</li>";

        if (firstErrorField == false)
		{
			document.loginform.pwd.focus();
	                firstErrorField = true;			
		}
		document.loginform.pwd.style.backgroundColor = errorBackgroundColor;          

	  isError =true; 

   }  


  errorMessage=errorMessage+"</ul>";

  if (isError == true)
	{ 
       // alert('There is an error..'+ errorMessage);

	document.getElementById("loginerror").style.display="block"  ;
        document.getElementById("loginerror").style.color=errorTextColor  ;
        document.getElementById("loginspan").innerHTML=errorMessage;

        //alert("false");
	        
        return false;
		
	}
    else
	{
	 // alert("Data saving");
	   document.getElementById("loginerror").style.display="none"  ;
           document.getElementById("loginspan").innerHTML="";

         // alert("true");
          return true;


        }    
     
}





function registrationcheck()
{  
  // alert("in");

   var isError = false;
  
   var errorBackgroundColor = "#FEE0C6";
   var errorTextColor ="#DD2200";
   
   var noerrorBackgroundColor = "";
   var noerrorTextColor = "black";
   
 
   document.regform.fname.style.backgroundColor     = noerrorBackgroundColor;
   document.regform.lname.style.backgroundColor     = noerrorBackgroundColor;
   document.regform.pwd.style.backgroundColor       = noerrorBackgroundColor;
   document.regform.cpwd.style.backgroundColor      = noerrorBackgroundColor;
   document.regform.emailid.style.backgroundColor   = noerrorBackgroundColor;
   document.regform.contactid.style.backgroundColor = noerrorBackgroundColor;
 //  alert("fg");

  
   document.regform.cname.style.backgroundColor     = noerrorBackgroundColor;
   document.regform.vat.style.backgroundColor       = noerrorBackgroundColor;
   document.regform.tax.style.backgroundColor       = noerrorBackgroundColor;
   document.regform.buisness.style.backgroundColor  = noerrorBackgroundColor;
   document.regform.mobile.style.backgroundColor    = noerrorBackgroundColor;
   document.regform.fax.style.backgroundColor       = noerrorBackgroundColor;

   document.regform.address.style.backgroundColor   = noerrorBackgroundColor;
   document.regform.city.style.backgroundColor      = noerrorBackgroundColor;
   document.regform.state.style.backgroundColor      = noerrorBackgroundColor;
   document.regform.country.style.backgroundColor   = noerrorBackgroundColor;
   document.regform.zipcode.style.backgroundColor   = noerrorBackgroundColor;


  
   var errorMessage        = "*Please fill the required fields.";

   var pwderrorMessage     = "*Passwords do not match.";
   var emailIDerrorMessage = "*Email ID format is incorrect.";

   var blankerror=false;
   var matcherror=false;
   var formaterror=false;

//alert("fg");
   if(document.regform.fname.value =='')
   {  
         blankerror=true;
     
	 document.regform.fname.style.backgroundColor = errorBackgroundColor;          

	 isError =true; 

   }  

  if(document.regform.lname.value =='')
   { 
         blankerror=true;

         document.regform.lname.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  


  if(document.regform.pwd.value =='')
   { 
         blankerror=true;      
     
	document.regform.pwd.style.backgroundColor = errorBackgroundColor;          

	  isError =true; 

   }  

  if(document.regform.cpwd.value =='')
   { 
         blankerror=true;      
    
	document.regform.cpwd.style.backgroundColor = errorBackgroundColor;          

	  isError =true; 

   }  



 if((document.regform.pwd.value !='')&&(document.regform.cpwd.value !=''))
   { 

    if(document.regform.pwd.value == document.regform.cpwd.value)
     {  
     }
    else
     {
        matcherror=true;
        
	document.regform.cpwd.style.backgroundColor = errorBackgroundColor;          
	
        isError =true; 
     }
  }  


//alert("fg");

  if(document.regform.emailid.value =='')
   { 
        blankerror=true;
      
	document.regform.emailid.style.backgroundColor = errorBackgroundColor;          

        isError =true; 

   }  

  else
   {
        if( echeck(document.regform.emailid.value) ==false)
          {
             formaterror=true;
             
  	     document.regform.emailid.style.backgroundColor = errorBackgroundColor;          

   	     isError =true; 
                  
          }
   }



  if(document.regform.contactid.value =='')
   {  
         blankerror=true;      

	 document.regform.contactid.style.backgroundColor = errorBackgroundColor;

	 isError =true; 

   }  

   

  if(document.regform.cname.value =='')
   { 
         blankerror=true;

         document.regform.cname.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  


  if(document.regform.vat.value =='')
   { 
         blankerror=true;

         document.regform.vat.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  



  if(document.regform.tax.value =='')
   { 
         blankerror=true;

         document.regform.tax.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  



  if(document.regform.buisness.value =='')
   { 
         blankerror=true;

         document.regform.buisness.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  
  


//alert("fjkjg");

 if(document.regform.address.value =='')
   { 
         blankerror=true;

         document.regform.address.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 

 if(document.regform.city.value =='')
   { 
         blankerror=true;

         document.regform.city.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 
  
   if(document.regform.state.value =='')
   { 
         blankerror=true;

         document.regform.state.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 


 if(document.regform.country.value =='')
   { 
         blankerror=true;

         document.regform.country.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 
 if(document.regform.zipcode.value =='')
   { 
         blankerror=true;

         document.regform.zipcode.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 
//alert("fjkjg");
 
 if(document.regform.oroi_xrisis.checked == false)
 	{
		alert("Δεν έχετε αποδεχτεί του Όρους Χρήσης του SMS-Marketing.gr");
		return false;
	}


  if (isError == true)
	{ 
          //alert('There is an error..'+ errorMessage);

           if(blankerror==false)
               {
                   errorMessage="";
                }

           if(matcherror== true)
               {
                   errorMessage= errorMessage + pwderrorMessage;
                }

           if(formaterror==true)
               {
                   errorMessage= errorMessage + emailIDerrorMessage;
                }


       
	document.getElementById("regerror").style.display="block"  ;
        document.getElementById("regerror").style.color=errorTextColor  ;
        document.getElementById("regspan").innerHTML=errorMessage;

        //alert("false");
	        
        return false;
		
	}
    else
	{
	  //alert("Data saving");
	   document.getElementById("regerror").style.display="none"  ;
           document.getElementById("regspan").innerHTML="";

         // alert("true");
          return true;
        }    
 
}




function password()
{
 
  if(document.regform.pwd.value=='')
     {   
      
        document.regform.pwd.style.backgroundColor = "#FEE0C6";       
        document.getElementById("regerror").style.display="block"  ;
        document.getElementById("regerror").style.color="#DD2200"  ;
        document.getElementById("regspan").innerHTML="*Password can not be blank";
    
        document.regform.pwd.select();
        document.regform.pwd.focus();

     }
  else
     {
           document.getElementById("regerror").style.display="none"  ;
           document.getElementById("regspan").innerHTML="";        
      }

}



function cpassword()
{
 
  if(document.regform.cpwd.value=='')
     {   
      
        document.regform.cpwd.style.backgroundColor = "#FEE0C6";       
        document.getElementById("regerror").style.display="block"  ;
        document.getElementById("regerror").style.color="#DD2200"  ;
        document.getElementById("regspan").innerHTML="*Passwords do not match ";
    
        document.regform.cpwd.select();
        document.regform.cpwd.focus();

     }
  else
     {
        if( document.regform.pwd.value == document.regform.cpwd.value)
          { 

              document.getElementById("regerror").style.display="none"  ;
              document.getElementById("regspan").innerHTML="";
          }
         
        else
          {

            document.regform.cpwd.style.backgroundColor = "#FEE0C6";       
            document.getElementById("regerror").style.display="block"  ;
            document.getElementById("regerror").style.color="#DD2200"  ;
            document.getElementById("regspan").innerHTML="*Passwords do not match";
    
            document.regform.cpwd.select();
            document.regform.cpwd.focus();
     
           }
     }
}


function emailcheck()
{
 if(document.regform.emailid.value=='')
     {   
      
        document.regform.emailid.style.backgroundColor = "#FEE0C6";       
        document.getElementById("regerror").style.display="block"  ;
        document.getElementById("regerror").style.color="#DD2200"  ;
        document.getElementById("regspan").innerHTML="*Email ID can't be left blank";
    
  
        document.regform.getElementById("emailid").focus();

     }

 else
     {
        if( echeck(document.regform.emailid.value) ==false)
          {
            document.regform.emailid.style.backgroundColor = "#FEE0C6";       
            document.getElementById("regerror").style.display="block"  ;
            document.getElementById("regerror").style.color="#DD2200"  ;
            document.getElementById("regspan").innerHTML="*Email ID format is incorrect";
    
            document.regform.emailid.select();
            document.regform.emailid.focus();
          }
         
        else
          {
              document.getElementById("regerror").style.display="none"  ;
              document.getElementById("regspan").innerHTML="";
           }
     }

 }


function regclearall()
{
              document.getElementById("regerror").style.display="none"  ;
              document.getElementById("regspan").innerHTML="";
 
  //alert("fg");
  var noerrorBackgroundColor = "";

   document.regform.fname.style.backgroundColor = noerrorBackgroundColor;
   document.regform.lname.style.backgroundColor = noerrorBackgroundColor;
   document.regform.pwd.style.backgroundColor = noerrorBackgroundColor;
   document.regform.cpwd.style.backgroundColor = noerrorBackgroundColor;
   document.regform.emailid.style.backgroundColor = noerrorBackgroundColor;
   document.regform.contactid.style.backgroundColor = noerrorBackgroundColor;

 
   document.regform.cname.style.backgroundColor     = noerrorBackgroundColor;
   document.regform.vat.style.backgroundColor       = noerrorBackgroundColor;
   document.regform.tax.style.backgroundColor       = noerrorBackgroundColor;
   document.regform.buisness.style.backgroundColor  = noerrorBackgroundColor;
   document.regform.mobile.style.backgroundColor    = noerrorBackgroundColor;
   document.regform.fax.style.backgroundColor       = noerrorBackgroundColor;

   document.regform.address.style.backgroundColor   = noerrorBackgroundColor;
   document.regform.city.style.backgroundColor      = noerrorBackgroundColor;
   document.regform.state.style.backgroundColor     = noerrorBackgroundColor;
   document.regform.country.style.backgroundColor   = noerrorBackgroundColor;
   document.regform.zipcode.style.backgroundColor   = noerrorBackgroundColor;


}


function checknumber()
   {
          
   
   var isError = false;
   var firstErrorField = false;
   var errorBackgroundColor = "#FEE0C6";
   var errorTextColor ="#DD2200";
   
   var noerrorBackgroundColor = "";
   var noerrorTextColor = "black";
 
 
   document.contactform.contact1.style.backgroundColor = noerrorBackgroundColor;
   document.contactform.contact2.style.backgroundColor = noerrorBackgroundColor;
   document.contactform.contact3.style.backgroundColor = noerrorBackgroundColor;
   document.contactform.contact4.style.backgroundColor = noerrorBackgroundColor;
   document.contactform.contact5.style.backgroundColor = noerrorBackgroundColor;
   
 // alert("dfg");

   var errorMessage="<ul>" ;
   //1
          if((document.contactform.fname1.value=='')&&(document.contactform.contact1.value==''))  
             {//alert("1");
             }
          else
            {      //   alert("12dfg");         
                  if(document.contactform.contact1.value=='') 
                    { document.contactform.contact1.style.backgroundColor = errorBackgroundColor;
                      isError=true;
                    }                

             }

  //2 row
          if((document.contactform.fname2.value=='')&&(document.contactform.contact2.value==''))  
             {
             }
          else
            {                  
                if(document.contactform.contact2.value=='') 
                    { document.contactform.contact2.style.backgroundColor = errorBackgroundColor;
                      isError=true;
                    }                

             }

          if((document.contactform.fname3.value=='')&&(document.contactform.contact3.value==''))  
             {
             }
          else
            {                  
                  if(document.contactform.contact3.value=='') 
                    { document.contactform.contact3.style.backgroundColor = errorBackgroundColor;
                      isError=true;
                    }                

             }

          if((document.contactform.fname4.value=='')&&(document.contactform.contact4.value==''))  
             {
             }
          else
            {                  
                   if(document.contactform.contact4.value=='') 
                    { document.contactform.contact4.style.backgroundColor = errorBackgroundColor;
                      isError=true;
                    }                

             }

          if((document.contactform.fname5.value=='')&&(document.contactform.contact5.value==''))  
             {
             }
          else
            {                  
                   if(document.contactform.contact5.value=='') 
                    { document.contactform.contact5.style.backgroundColor = errorBackgroundColor;
                      isError=true;
                    }                

             }



          if(isError==true)
             {  
                //alert("error");
                document.getElementById("reterror").style.display="block"  ;
                document.getElementById("reterror").style.color="#FF0000"  ;
                document.getElementById("retspan").innerHTML = "*Please fill the required fields";
                return(false);
             } 
          else
             {     //           alert("NO error");
                document.getElementById("reterror").style.display="none"  ;
                document.getElementById("reterror").style.color="#FF0000"  ;
                document.getElementById("retspan").innerHTML = "";
                return(true);


             }
 
             
    }




function checknum()
   {
          
   //alert("checknum");
   var isError = false;
   var firstErrorField = false;
   var errorBackgroundColor = "#FEE0C6";
   var errorTextColor ="#DD2200";
   
   var noerrorBackgroundColor = "";
   var noerrorTextColor = "black";
   // alert("dfg");
   document.contactform.fname1.style.backgroundColor = noerrorBackgroundColor;
  
   document.contactform.contact1.style.backgroundColor = noerrorBackgroundColor;
 
 // alert("dfg");

   var errorMessage="<ul>" ;
   //1
         
         if(document.contactform.contact1.value=='')          
             { document.contactform.contact1.style.backgroundColor = errorBackgroundColor;
               isError=true;
             }
 
          if(isError==true)
             {  
                //alert("error");
                document.getElementById("reterror").style.display="block"  ;
                document.getElementById("reterror").style.color="#FF0000"  ;
                document.getElementById("retspan").innerHTML = "*Please fill the required fields.";
                return(false);
             } 
          else
             {     //           alert("NO error");
                document.getElementById("reterror").style.display="none"  ;
                document.getElementById("reterror").style.color="#FF0000"  ;
                document.getElementById("retspan").innerHTML = "";
                return(true);


             }
 
             
  }




function reregistrationcheck()
{  
   //alert("in");

   var isError = false;
  
   var errorBackgroundColor = "#FEE0C6";
   var errorTextColor ="#DD2200";
   
   var noerrorBackgroundColor = "";
   var noerrorTextColor = "black";
   
 
   document.regform.fname.style.backgroundColor     = noerrorBackgroundColor;
   document.regform.lname.style.backgroundColor     = noerrorBackgroundColor;
   document.regform.pwd.style.backgroundColor       = noerrorBackgroundColor;
   document.regform.cpwd.style.backgroundColor      = noerrorBackgroundColor;
   document.regform.emailid.style.backgroundColor   = noerrorBackgroundColor;
   document.regform.contactid.style.backgroundColor = noerrorBackgroundColor;
 //  alert("fg");

  
   document.regform.cname.style.backgroundColor     = noerrorBackgroundColor;
   document.regform.vat.style.backgroundColor       = noerrorBackgroundColor;
   document.regform.tax.style.backgroundColor       = noerrorBackgroundColor;
   document.regform.buisness.style.backgroundColor  = noerrorBackgroundColor;
   document.regform.mobile.style.backgroundColor    = noerrorBackgroundColor;
   document.regform.fax.style.backgroundColor       = noerrorBackgroundColor;

   document.regform.address.style.backgroundColor   = noerrorBackgroundColor;
   document.regform.city.style.backgroundColor      = noerrorBackgroundColor;
   document.regform.state.style.backgroundColor      = noerrorBackgroundColor;
   document.regform.country.style.backgroundColor   = noerrorBackgroundColor;
   document.regform.zipcode.style.backgroundColor   = noerrorBackgroundColor;


  
   var errorMessage        = "*Please fill the required fields.<br />";

   var pwderrorMessage     = "*Passwords do not match.<br />";
   var emailIDerrorMessage = "*Email ID format is incorrect.";

   var blankerror=false;
   var matcherror=false;
   var formaterror=false;

//alert("fg");
   if(document.regform.fname.value =='')
   {  
         blankerror=true;
     
	 document.regform.fname.style.backgroundColor = errorBackgroundColor;          

	 isError =true; 

   }  

  if(document.regform.lname.value =='')
   { 
         blankerror=true;

         document.regform.lname.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  



 if(document.regform.pwd.value !='')
   {
  if(document.regform.cpwd.value !='')
    { 

     if(document.regform.pwd.value == document.regform.cpwd.value)
        {  
        }
     else
       {
          matcherror=true;
        
	  document.regform.cpwd.style.backgroundColor = errorBackgroundColor;          
	
          isError =true; 
        }
     }  
     else
     {
          blankerror=true;
        
	  document.regform.cpwd.style.backgroundColor = errorBackgroundColor;          
	
          isError =true; 
     }
  }


//alert("fg");

  if(document.regform.emailid.value =='')
   { 
        blankerror=true;
      
	document.regform.emailid.style.backgroundColor = errorBackgroundColor;          

        isError =true; 

   }  

  else
   {
        if( echeck(document.regform.emailid.value) ==false)
          {
             formaterror=true;
             
  	     document.regform.emailid.style.backgroundColor = errorBackgroundColor;          

   	     isError =true; 
                  
          }
   }



  if(document.regform.contactid.value =='')
   {  
         blankerror=true;      

	 document.regform.contactid.style.backgroundColor = errorBackgroundColor;

	 isError =true; 

   }  

   

  if(document.regform.cname.value =='')
   { 
         blankerror=true;

         document.regform.cname.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  


  if(document.regform.vat.value =='')
   { 
         blankerror=true;

         document.regform.vat.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  



  if(document.regform.tax.value =='')
   { 
         blankerror=true;

         document.regform.tax.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  



  if(document.regform.buisness.value =='')
   { 
         blankerror=true;

         document.regform.buisness.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  
  


//alert("fjkjg");

 if(document.regform.address.value =='')
   { 
         blankerror=true;

         document.regform.address.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 

 if(document.regform.city.value =='')
   { 
         blankerror=true;

         document.regform.city.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 
   

 if(document.regform.state.value =='')
   { 
         blankerror=true;

         document.regform.state.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 
   

//alert("fjkjg");
 if(document.regform.country.value =='')
   { 
         blankerror=true;

         document.regform.country.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 
 if(document.regform.zipcode.value =='')
   { 
         blankerror=true;

         document.regform.zipcode.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   } 
//alert("fjkjg");



  if (isError == true)
	{ 
          //alert('There is an error..'+ errorMessage);

           if(blankerror==false)
               {
                   errorMessage="";
                }

           if(matcherror== true)
               {
                   errorMessage= errorMessage + pwderrorMessage;
                }

           if(formaterror==true)
               {
                   errorMessage= errorMessage + emailIDerrorMessage;
                }


       
	document.getElementById("regerror").style.display="block"  ;
        document.getElementById("regerror").style.color=errorTextColor  ;
        document.getElementById("regspan").innerHTML=errorMessage;

        //alert("false");
	        
        return false;
		
	}
    else
	{
	  //alert("Data saving");
	   document.getElementById("regerror").style.display="none"  ;
           document.getElementById("regspan").innerHTML="";

         // alert("true");
          return true;
        }    
 
}



function adminpass()
{  
  // alert("in");

   var isError = false;
  
   var errorBackgroundColor = "#FEE0C6";
   var errorTextColor ="#DD2200";
   
   var noerrorBackgroundColor = "";
   var noerrorTextColor = "black";
   
 
    document.regform.pwd.style.backgroundColor       = noerrorBackgroundColor;
    document.regform.cpwd.style.backgroundColor      = noerrorBackgroundColor; 
		  
   var errorMessage        = "*Please fill the required fields.<br />";

   var pwderrorMessage     = "*Passwords do not match.";
   

   var blankerror=false;
   var matcherror=false;


//alert("fg");
   if(document.regform.pwd.value =='')
   {  
         blankerror=true;
     
	 document.regform.pwd.style.backgroundColor = errorBackgroundColor;          

	 isError =true; 

   }  

  if(document.regform.cpwd.value =='')
   { 
         blankerror=true;

         document.regform.cpwd.style.backgroundColor = errorBackgroundColor;          

         isError =true; 

   }  



 if(document.regform.pwd.value !='')
   {
  if(document.regform.cpwd.value !='')
    { 

     if(document.regform.pwd.value == document.regform.cpwd.value)
        {  
        }
     else
       {
          matcherror=true;
        
	  document.regform.cpwd.style.backgroundColor = errorBackgroundColor;          
	
          isError =true; 
        }
   }  
     else
     {
          blankerror=true;
        
	  document.regform.cpwd.style.backgroundColor = errorBackgroundColor;          
	
          isError =true; 
     }
  }


  if (isError == true)
	{ 
     //   alert('There is an error..'+ errorMessage);

           if(blankerror==false)
               {
                   errorMessage="";
                }

           if(matcherror== true)
               {
                   errorMessage= errorMessage + pwderrorMessage;
                }      


       
	      document.getElementById("regerror").style.display="block"  ;
        document.getElementById("regspan").style.color=errorTextColor  ;
        document.getElementById("regspan").innerHTML=errorMessage;

        //alert("false");
	        
        return false;
		
	}
    else
	{
	//  alert("Data saving");
    	  document.getElementById("regerror").style.display="none"  ;
        document.getElementById("regspan").innerHTML="";

     return true;
  }    
}
