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() {
var avail=0;
	if (document.frmsearchInt.searchedDomainName.value == "") {
		alert("\n\n请输入您要查询的英文域名。");
		document.frmsearchInt.searchedDomainName.focus();
		return false;
	}

if (!CheckIfEnglish(document.frmsearchInt.searchedDomainName.value )) {
		alert("\n\n在查询英文域名应输入英文不能输入中文及非法字符！");
		document.frmsearchInt.searchedDomainName.focus();
		return false;
	}
for(var i=0;i<document.frmsearchInt.suffix.length;i++)
	{
	     if (document.frmsearchInt.suffix[i].checked==true){
			avail=1;
			break;
		}
  }
  if (avail==0) {
        alert("最少选择一个域名后缀!");
     	//document.fee.kind[i].focus();
	    return false;
 }
}



function openNewWindow(fileName,windowName,theWidth,theHeight)
 {
	if (windowName == "newMessageWindow") 
	{
		uniqueName = new Date();
		windowName = uniqueName.getTime();
	}
cc=window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width="+theWidth+",height="+theHeight)
cc.focus(); 

}

var watched_window, whether_close=true;
function detecting() {
if (watched_window) if (watched_window.closed) {
  if (whether_close) window.location.replace(window.location.href);
  } else {
  setTimeout('detecting();',10);
  }
}

function newpost(url) {
	watched_window =	window.open(url,'newpost','scrollbars=yes,resizable=no,width=500,height=400');
        detecting();
}


function newpost2(url,theWidth,theHeight) {
	watched_window =	window.open(url,"newpost2","scrollbars=yes,resizable=no,width="+theWidth+",height="+theHeight);
   detecting();
}


function ask(msg,url) {
	
	if( msg=='' ) {
		msg='真的要这样做吗？';
	}

	if (confirm(msg)) {
		this.location=url;
	} 
}



function searchcheck()
{
	if (document.search.productname.value == ""){
		alert("搜索内容不能为空");
		document.search.productname.focus();
		return false;
	}
	else{	return true;	}
}



function checklogin()
{

var myReg=/^[0-9a-zA-Z_\-]{3,15}$/;
 if(!myReg.test(document.login.loginname.value)){
		alert('[ 帐 号 ]不能为空,或应符合说明的条件!');
		   document.login.loginname.focus();
		return false;
	}

 else if(document.login.password.value=="")
 {
  alert('密码不能为空!');
document.login.password.focus();
		return false;
 }

  else if(document.login.password.value.length<4)
 {
  alert('密码必须大于四位!');
document.login.password.focus();
		return false;
 }
else
	{

		return true;

	}
}

