// JavaScript Document
function isBadEmail(strg) {
		email_array = strg.split('@');
		if (email_array.length != 2) return true;
		if (email_array[1].split(".").length < 2) return true;
		if (email_array[1].split(".")[1].length < 1) return true;
		if (strg.indexOf('@') < 1) return true;
		if (strg.indexOf(' ') != -1) return true;
		if (email_array[1].indexOf('.') < 1) return true;
		if (strg.length < 5) return true;
		return false;
	}
	    
        function LTrim(str)
        {
          var whitespace = new String(" \t\n\r");

          var s = new String(str);

          if (whitespace.indexOf(s.charAt(0)) != -1) {
            // We have a string with leading blank(s)...

            var j=0, i = s.length;

            // Iterate from the far left of string until we
            // don't have any more whitespace...
            while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
            j++;

            // Get the substring from the first non-whitespace
            // character to the end of the string...
            s = s.substring(j, i);
          }

          return s;
        }

   
        function RTrim(str)
        {
          // We don't want to trip JUST spaces, but also tabs,
          // line feeds, etc.  Add anything else you want to "trim" here in Whitespace
          var whitespace = new String(" \t\n\r");

          var s = new String(str);

          if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
            // We have a string with trailing blank(s)...

            var i = s.length - 1;       // Get length of string

            // Iterate from the far right of string until we
            // don't have any more whitespace...
            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
              i--;

            // Get the substring from the front of the string to
            // where the last non-whitespace character is...
            s = s.substring(0, i+1);
          }

          return s;
        }

   
        function Trim(str)
        {
          return RTrim(LTrim(str));
        }
	function showdiv()
{
 
 document.getElementById('loading').style.display = 'block'; 

}
	function Validation()
	{
	  
	 
	 if(Trim(document.myForm.companyname.value)=='')
	 { 
	 alert('Please Enter Company Name.'); 
	 document.myForm.companyname.focus();
	 return false;
	 }
	 
     if(Trim(document.myForm.email.value)=='')
	 { 
	  alert('Please Enter Email ID.');  
	 document.myForm.email.focus();
	 return false;
	 }
	 if(isBadEmail(document.myForm.email.value))
		{
			 alert('Please Enter Valid Email ID.');   
			document.myForm.email.focus();
			return false;
		}
	 if(Trim(document.myForm.subdomain.value)=='')
	 { 
	  alert('Please Enter Subdomain Name.');  
	 document.myForm.subdomain.focus();
	 return false;
	 }
	 showdiv();
	document.myForm.submit(); 
	//formObj.submit();
	}
	function verify(ver){
		
		if(ver){
			// Confirmed message, i.e. clicked on "Yes"
			alert('Message confirmed');
		}else{
			// Clicked on "No"
			alert('Message not confirmed');
		}
	}

function scondvalidate()
{
	 
	  if(Trim(document.sign_info.username.value)=='')
	 { 
	 alert('Please Enter User Name.');  
	 document.sign_info.username.focus();
	 return false;
	 }
	 if(Trim(document.sign_info.Password.value)=='')
	 { 
	 alert('Please Enter Password.');    
	 document.sign_info.Password.focus();
	 return false;
	 }
	 
	 if(Trim(document.sign_info.txtNumber.value)=='')
	 { 
	 alert('Please Enter Authentication Code.');     
	 document.sign_info.txtNumber.focus();
	 return false;
	 }
     // cc type
     if(Trim(document.sign_info.CardType.value)=='')
	 { 
	 alert('Please enter \'Credit Card Type\'');     
	 document.sign_info.CardType.focus();
	 return false;
	 }
     if(Trim(document.sign_info.ExpMon.value)=='')
	 { 
	 alert('Please enter credit card expiration month');     
	 document.sign_info.ExpMon.focus();
	 return false;
	 }
     if(Trim(document.sign_info.ExpYear.value)=='')
	 { 
	 alert('Please enter credit card expiration year');     
	 document.sign_info.ExpYear.focus();
	 return false;
	 }
	 
	return true;
}
	