﻿function doSubmit(theForm)
{
  document.domain="591hx.com";
  if(parent.window.document.getElementById('Articletitle').value!=null)
  {
	 var title= parent.window.document.getElementById('Articletitle').value;
	 theForm.title.value=title;
  }
  var tel = theForm.tel.value;
  if (document.all("author")!=null)
  {
	 var urlInit = document.URL;
  	 var j = urlInit.indexOf("user=");
     var author;
     if (j!=-1)
	 {
	    author=urlInit.substring(j+5 ,urlInit.length);
  	  }
  	theForm.author.value=author;
  }
  

	if(tel==null||tel=="" )
	{
	  alert("对不起，您还未输入手机号码！");
	  return false ;
	}
	 //检查手机号码长度
	if(tel.length!=11)
	{
		alert("对不起，您输入的号码位数有误，请重新输入！");
		document.getElementsByName("tel")[0].focus();
		return false;
	}
	

	//检查是否为数字
	if(isNaN (tel))
	{
		alert("对不起，您输入的手机号码有误，请重新输入！");
		document.getElementsByName("tel")[0].focus();
		return false;
	}

}
function doSubmitstock(theForm)
{
	document.domain="591hx.com";
	 if(parent.window.document.getElementById('Articletitle').value!=null)
	 {
		var title= parent.window.document.getElementById('Articletitle').value;
		theForm.title.value=title;
	 }
     var tel = theForm.tel.value;
	if (document.all("author")!=null)
	{
		 var urlInit = document.URL;
		 var j = urlInit.indexOf("user=");
		 var author;
		 if (j!=-1)
		 {
			author=urlInit.substring(j+5 ,urlInit.length);
		  }
		theForm.author.value=author;
	  }
  

	if(tel==null||tel=="" ){
	  alert("对不起，您还未输入手机号码！");
	  return false ;
	}
	if(theForm.stock.value==null||theForm.stock.value=="" ){
	  alert("请输入股票代码");
	  return false ;
	}
	if(theForm.stock.value.length!=6)
	{
		alert("对不起，您输入的股票代码位数有误，请重新输入！");
		document.getElementsByName("stock")[0].focus();
		return false;
	}
	 //检查手机号码长度
	if(tel.length!=11)
	{
		alert("对不起，您输入的号码位数有误，请重新输入！");
		document.getElementsByName("tel")[0].focus();
		return false;
	}
	

	//检查是否为数字
	if(isNaN (tel))
	{
		alert("对不起，您输入的手机号码有误，请重新输入！");
		document.getElementsByName("tel")[0].focus();
		return false;
	}
	else{
     return true;
  }

}
  
function isNaN(tempstr){
  var array1="0123456789.";
  var array2="0123456789";
  if (tempstr!=""){
      ilen=tempstr.length
      for (i=0;i<=ilen;i++) 
      {
	      temp=tempstr.charAt(i);
	      if(array1.indexOf(temp)==-1)
	      {
	    	 return true;
    	  }
      } 
	  return false;    
  }
}

var urlInit = document.URL;
var j = urlInit.indexOf("591source");

if (j!=-1){
	var value=urlInit.substring(j ,urlInit.length);
	setCookie("591hxsource",value,1,"/",".591hx.com");
}
function setCookie(name,value,expires,path,domain) 
{ 
	var today = new Date();     
	today.setTime( today.getTime() );     
	if ( expires ) 
	{         
		expires = expires * 1000 * 60 * 60 * 24;     
	}     
	var expires_date = new Date( today.getTime() + (expires) );  
	document.cookie="591hxsource="+value+";expires="+expires_date.toGMTString()+";path=/;domain=.591hx.com";				
}  
