function CheckIfEnglish( String )
{ 
    var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";
     var i;
     var c;
      if(String.charAt( 0 )=='-')
	return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
     for( i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
	  if (Letters.indexOf( c ) < 0)
	     return false;
     }
     return true;
}
function submitchecken() {

	if (document.endomainform.endomain.value == "") {
		alert("请输入您要查询的英文域名。");
		document.endomainform.endomain.focus();
		return false;
	}

if (!CheckIfEnglish(document.endomainform.endomain.value )) {
		alert("在查询英文域名应输入英文不能输入中文及非法字符！");
		document.endomainform.endomain.focus();
		return false;
	}
}

function CheckIfChinese( String )
{ 
     var Letters = "`=~!@#$%^&*()_+[]{}\\|/?.>,<;:'\"";
     var i;
     var c;
     for( i = 0; i < String.length; i ++ )
     {
         c = String.charAt( i );
	     if (Letters.indexOf( c ) >= 0)
	       return false;
     }
     return true;
}

function CheckIfSpace(String)
{
	 var i;
     for( i = 0; i < String.length; i ++ )
     {
	 	  if(String.charAt(i) == ' ')
		   	 return true;
     }
     return false;
}

function checkwhois()
{
	if (document.whoisform.whoistext.value=="")
	{
		alert("请输入域名以便查找whois信息。");
		document.whoisform.whoistext.focus();
		return false;
	}
}
function CheckIfEnglish( String )
{ 
    var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";
     var i;
     var c;
      if(String.charAt( 0 )=='-')
	return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
     for( i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
	  if (Letters.indexOf( c ) < 0)
	     return false;
     }
     return true;
}
function submitcheckcn() 
{
	if (document.chdomainform.zndomain.value == "") 
	{
		alert("请输入您要查询的中文国际域名。");
		document.chdomainform.zndomain.focus();
		return false;
	}

	if (document.chdomainform.zndomain.value.length > 50) 
	{
		alert("中文国际域名长度不能大于50个字符。");
		document.chdomainform.zndomain.focus();
		return false;
	}

	if (! CheckIfChinese(document.chdomainform.zndomain.value)) 
	{
		alert("在查询中文国际域名应输入中文与英文不能输入非法字符！");
		document.chdomainform.zndomain.focus();
		return false;
	}

	if (CheckIfSpace(document.chdomainform.zndomain.value)) 
	{
		alert("在查询中文国际域名应输入中文与英文不能输入空格！");
		document.chdomainform.zndomain.focus();
		return false;
	}
	
	if (CheckIfEnglish(document.chdomainform.zndomain.value)) 
	{
		alert("在查询中文国际域名应输入中文与英文不能输入全为英文！");
		document.chdomainform.zndomain.focus();
		return false;
	}
}

function whoisvalue()
	{
		if (document.getElementById("yourwhois").value=="")
		{
			alert("请输入域名以便查找whois信息。");
			document.getElementById("yourwhois").focus();
			return false;
		}
		document.whoisform.whoistext.value=document.getElementById("yourwhois").value;
		document.whoisform.submit();
	}
