﻿// JavaScript Document
//登陆用
function check()
{
if (document.form1.loginname.value=="")
{
alert("× 您的用户名不能为空！");
document.form1.loginname.focus();
return false;
}
else if (document.form1.loginpwd.value==""){
alert("× 您的密码不能为空！");
document.form1.loginpwd.focus();
return false;
}
return true;
}

//注册用
function reg_check()
{
var login_name=document.form1.login_name.value; 
if(document.form1.login_name.value=="")
{
    alert("用户名不能为空！");
	document.form1.login_name.focus();
	return false;
}
if(!/^[a-z0-9]+$/.test(login_name)) 
{ 
alert("用户名只能由英文和数字组成!"); 
document.form1.login_name.focus(); 
document.form1.login_name.select();
return false; 
}
var password=document.form1.password.value;
if(document.form1.password.value=="")
{
	alert("密码不能为空！");
	document.form1.password.focus();
	return false;
}
if(!/^[a-z0-9]+$/.test(password)) 
{ 
alert("密码只能由英文和数字组成!"); 
document.form1.password.focus(); 
document.form1.password.select();
return false; 
}
if(document.form1.password.value!=document.form1.repassword.value)
{
	alert("两次密码输入不一至！");
	document.form1.repassword.focus();
	document.form1.repassword.select();
	return false;
}
var email=document.form1.email.value; 
if(document.form1.email.value=="")
{
	alert("email不能为空！");
	document.form1.email.focus();
	return false;
}
if(!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(email)) 
{ 
alert("email格式不对，请重新输入"); 
document.form1.email.focus(); 
return false; 
}
if(document.form1.code.value==""){
alert("× 你的验证码不能为空！");
document.form1.code.focus();
return false;
}
return true;
}

//收录用
function web_check()
{
if (document.form1.w_name.value=="")
{
alert("× 网站名称不能为空！");
document.form1.w_name.focus();
return false;
}
else if (document.form1.w_describe.value==""){
alert("× 搜索关键字不能为空！");
document.form1.w_describe.focus();
return false;
}
else if (document.form1.w_url.value==""){
alert("× 网址不能为空！");
document.form1.w_url.focus();
return false;
}
return true;
}

//意见用
function suggest_check()
{
if (document.form1.email.value=="")
{
alert("× 邮箱不能为空！");
document.form1.email.focus();
return false;
}
else if (document.form1.tit.value==""){
alert("× 标题不能为空！");
document.form1.tit.focus();
return false;
}
else if (document.form1.con.value==""){
alert("× 内容不能为空！");
document.form1.con.focus();
return false;
}
return true;
}

function display()
{
	if(document.form1.showd.checked)
	{
		document.getElementById('div_high').style.display='block'; 
	}
	else
	{
		document.getElementById('div_high').style.display='none'; 
	}
}

function init()
{
	document.getElementById('div_high').style.display='none'; 
}

function mypwd()
{
if(document.form1.user_oldpwd.value=="")
{
	alert("原始密码不能为空！");
	document.form1.user_oldpwd.focus();
	return false;
}

if(document.form1.user_newpwd.value=="")
{
	alert("新密码不能为空！");
	document.form1.user_newpwd.focus();
	return false;
}

if(document.form1.user_newpwd2.value != document.form1.user_newpwd.value)
{
alert("两次密码输入不一至！");
document.form1.user_newpwd2.focus();
document.form1.user_newpwd2.select();
return false;
}
return true;
}

function sp_check()
{
	if (document.getElementById("sp_area_1").value=="0")
	{
		alert("× 请选择空间所在地区！");
		document.getElementById("sp_area_1").focus();
		return false;
	}
	else if (document.getElementById("sp_industry").value=="0")
	{
		alert("× 请选择空间所属行业！");
		document.getElementById("sp_industry").focus();
		return false;
	}
	return true;
}

function get_pwd_check()
{
if(document.form1.email.value=="")
{
	alert("email不能为空！");
	document.form1.email.focus();
	return false;
}

return true;
}

function time_output(total_time,interval,asc_desc)
{
	
}

function closeit(time)
{
setTimeout("self.close()",time) //毫秒 
}

function over(i)
{
var id="i"+i;
document.getElementById(id).src='images/index/button/Anniu-'+i+'-over.gif';
}

function out(i)
{
var id="i"+i;
document.getElementById(id).src='images/index/button/Anniu-'+i+'-out.gif';
}

function show(div)
{
	document.getElementById(div).style.display='block'; 
}

function hide(div)
{
	document.getElementById(div).style.display='none'; 
}

function SearchIt()
{
	var wd=document.getElementById("wd").value;
	location="S.do?wd="+wd;
}

function newwindow(f_address,c_address,width,height)
{
	var timenow = new Date().getTime();
	var arr = window.showModalDialog(c_address+timenow,newwindow,"dialogWidth:"+width+"px;dialogHeight:"+height+"px;help:no;center:yes") + "";
	window.location.href= f_address; 
}