// Savon Guestbook Version 2.2
// Common JavaScript


// 带确认的超链接
function go(URL,cfmText)
{
	var ret;
	ret = confirm(cfmText);
	if(ret!=false)window.location=URL;
}

// 打开自定义窗口
function openwin(URL, width, height)
	{
	var win = window.open(URL,"openscript",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=1,menubar=0,status=1');
	}

// 打开查看回复的窗口
function openreply()
	{
	document.viewreply.msgCode.value=document.replyform.msgCode.value;
	var popupwin = window.open('details.asp', 'viewreply_page', 'scrollbars=yes,width=700,height=450');
	document.viewreply.submit()
	}

// 检查必填项
function Submitcheck()
	{
	if (document.lw_form.msgName.value.length==0){
	alert("请输入您的称呼，此为必填项！");
	document.lw_form.msgName.focus();
	return false;
		}
	if (document.lw_form.msgTitle.value.length==0){
	alert("请输入留言标题，此为必填项！");
	document.lw_form.msgTitle.focus();
	return false;
		}
	if (document.lw_form.msgContent.value.length==0){
	alert("请输入留言正文，此为必填项！");
	document.lw_form.msgContent.focus();
	return false;
		}
	return true;
	}

// 选中全部复选框
function CheckAll(form)
{
	for(var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if (e.name != 'chkall')
		{
			e.checked = form.chkall.checked;
		}
	}
}

// 页面跳转
function MM_jumpMenu(targ,selObj,restore)
{
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

// 确认批量操作
function SetSubmitType(sub_type)
{
	if(sub_type == 'del')
	{
		if(confirm("您确定要删除？"))
		{
			SetSubmitType = sub_type;
		}
	}
	else if(sub_type == 'msgunlock')
	{
		if(confirm("您确定要通过审核？"))
		{
			SetSubmitType = sub_type;
		}
	}
	else if(sub_type == 'msgbelock')
	{
		if(confirm("您确定要锁定留言？"))
		{
			SetSubmitType = sub_type;
		}
	}
}

// 选择操作类型
function Submit_all(theForm)
{
	var flag = false;
	if ( SetSubmitType == 'del')
	{
		flag = true;
		theForm.action = theForm.action + "del";
	}
	else if (SetSubmitType == 'msgunlock')
	{
		flag = true;
		theForm.action = theForm.action + "msgunlock";
	}
	else if (SetSubmitType == 'msgbelock')
	{
		flag = true;
		theForm.action = theForm.action + "msgbelock";
	}
	return flag;
}
	

function openpreview()
{
  //=document.lw_form.msgTitle.value;
  //=document.lw_form.msgContent.value;
  //=document.lw_form.UBB_super.value;
  document.preview.msgContent.value=document.lw_form.msgContent.value;
  document.preview.msgTitle.value=document.lw_form.msgTitle.value;
  document.preview.UBB_super.value=document.lw_form.UBB_super.value;
  //window.showModelessDialog('preview.asp','preview_page','dialogWidth:600px;dialogHeight:450px;center:yes;help:yes;resizable:yes;status:yes');
  document.preview.submit()
}
