//图片置换
var loaded = new Array();
function F_loadRollover(image,imageName) {
 	if(image && image.src && (null == image.out || typeof(image.out) == typeof(void(0)))) {
   	s = image.src;
    image.out = new Image();
    image.out.src = s;
    image.over = new Image(); 
    if(imageName.lastIndexOf('/') >= 0 || imageName.lastIndexOf('\\') >=0) {
      s = imageName;
      }
    else {
    	i = s.lastIndexOf('/');
      if (i<0) i = s.lastIndexOf('\\');
      if (i<0) { s = imageName; }
      else { s = s.substring(0,i+1) + imageName;}
      }
    image.over.src = s;
    loaded[image.name] = image;
    }
	}
function F_roll(imageName,over) {
	if (document.images) {
  if (over) { imageObject = "over"; }
  else { imageObject = "out"; }
  image = loaded[imageName];
  if(image) {
    ref = eval("image."+imageObject);
    if (ref) image.src = eval("image."+imageObject+".src");
   	}
  if (window.event)
    window.event.cancelBubble = true;
   	}
	}

function showhidediv() 
{ 
	var targetDiv =eval("expand");
	if(targetDiv.style.display == "none") 
	{
		targetDiv.style.display = "block";
	}else{
		targetDiv.style.display = "none";
	}
}


function deletemsg(id)
{
	if((confirm("您确定要从数据库中删除这个留言吗？"))==true)
	{
	document.form.action.value="deletemsg";
	document.form.id.value=""+id+"";
	document.form.submit();
	}
}

function msgshow(id)
{
	document.form.action.value="msgshow";
	document.form.id.value=""+id+"";
	document.form.submit();
}

function msghide(id)
{
	document.form.action.value="msghide";
	document.form.id.value=""+id+"";
	document.form.submit();
}

function modmsg(id)
{
window.open("admin_modmsg.asp?id="+id+"","modmsg","height=370,width=410,status=no,location=no,toolbar=no,directories=no,menubar=no");
}

function remsg(id)
{
window.open("admin_remsg.asp?id="+id+"","modmsg","height=240,width=410,status=no,location=no,toolbar=no,directories=no,menubar=no");
}


function checktext(text)
{
	allValid = true;
	for (i = 0;  i < text.length;  i++)
	{
		if (text.charAt(i) != " ")
		{
		allValid = false;
		break;
		}
	}
	return allValid;
}

function formcheckmsg()
{


if (document.form.name.value == "")
{
	alert("请问您怎么称呼？");
	document.form.name.focus();
	return false;
}

if (document.form.name.value.length>=10)
{
	alert("您的名称应该小于10个字符！");
	document.form.name.focus();
	return false;
}


	if (document.form.email.value == "") 
	{ 
		alert("请填写您的EMAIL电子邮件地址！"); 
		document.form.email.focus(); 
		return (false); 
	} 
 
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_@."; 
	var checkStr = document.form.email.value; 
	var allValid = true; 
	for (i = 0;  i < checkStr.length;  i++) 
	{ 
		ch = checkStr.charAt(i); 
		for (j = 0;  j < checkOK.length;  j++) 
		if (ch == checkOK.charAt(j)) 
			break; 
		if (j == checkOK.length) 
		{ 
			allValid = false; 
			break; 
		} 
	} 
 
	if (document.form.email.value.length< 6) 
	{ 
			allValid = false; 
	} 

	if (!allValid) 
	{ 
		alert("为什么不能老老实实地填写您的邮件地址呢？"); 
		document.form.email.focus(); 
		return (false); 
	} 
	
	address=document.form.email.value; 
	if(address.length>0) 
    { 
        i=address.indexOf("@"); 
        if(i==-1) 
	{ 
			window.alert("还是我来提醒您吧，邮件地址缺少@符号！") 
			document.form.email.focus(); 
			return false 
        } 
       ii=address.indexOf(".") 
        if(ii==-1) 
	{ 
			window.alert("为什么不能老老实实地填写您的邮件地址呢？") 
			document.form.email.focus(); 
			return false 
        } 
    } 
	if (checktext(document.form.email.value)) 
	{ 
		alert("哎，我晕，麻烦您好好检查您的电子信箱地址好吗？"); 
		document.form.email.select(); 
		document.form.email.focus(); 
		return (false); 
	} 

        if (document.form.email.value.length>=50)
        {
        alert("您的邮件地址也太长了，注册个小于50个字符的好吗？");
	document.form.email.focus();        
	return false;
        }

var checkname = "主页地址";
var checklink = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=?/:.";
var checkStrlink = document.form.homepage.value;
var allValid = true;
for (i = 0;  i < checkStrlink.length;  i++)
{
	ch = checkStrlink.charAt(i);
	for (j = 0;  j < checklink.length;  j++)
	if (ch == checklink.charAt(j))
	break;
	if (j == checklink.length)
	{
	allValid = false;
	break;
	}
}
if (document.form.homepage.value.length< 7)
{
	allValid = false;
}
if (!allValid)
{
	alert("请填写正确的"+checkname+"！");
	document.form.homepage.select();
	document.form.homepage.focus();
	return (false);
}
linkaddress=document.form.homepage.value;
if(linkaddress.length>7)
{
	i=linkaddress.indexOf("http://");
	if(i==-1)
	{
		window.alert("您忘记填写"+checkname+"基本符http://了！")
		document.form.homepage.focus();
		return false
	}
	ii=linkaddress.indexOf(".")
	if(ii==-1)
	{
		window.alert("请您输入有效的"+checkname+"！")
		document.form.homepage.focus();
		return false
	}
}
if (checktext(document.form.homepage.value))
{
	alert("请您输入有效的"+checkname+"！");
	document.form.homepage.select();
	document.form.homepage.focus();
	return (false);
}
if (document.form.homepage.value.length>=100)
{
	alert("注意"+checkname+"不能大于100！");
	document.form.homepage.focus();
	return false;
}

if (document.form.subject.value == "")
{
	alert("请填写您留言的主题！");
	document.form.subject.focus();
	return false;
}

if (document.form.subject.value.length>=30)
{
	alert("您的留言主题请控制在30个字符以内！");
	document.form.subject.focus();
	return false;
}

if (document.form.content.value == "")
{
	alert("请填写您留言的内容！");
	document.form.content.focus();
	return false;
}

if (document.form.content.value.length>=1000)
{
	alert("您的留言内容请控制在1000个字符以内！");
	document.form.content.focus();
	return false;
}



}

