<!--
function getParameter(url,name) {
	var value = "";
	var namelength = name.length+1;
	var isLast = url.indexOf("&",url.indexOf(name+"="));
	if (url.indexOf(name+"=")!=-1) {
		if (isLast!=-1) {
			value = url.substring(url.indexOf(name+"=")+namelength,isLast);
		} else {
			value = url.substring(url.indexOf(name+"=")+namelength);
		}		
		return value;
	} else {
		return "";
	}
}

function writePreMark() {
	document.writeln("<!--");
}

function writePostMark() {
	document.writeln("//-->");
}

function reloadPage(url) {
	if (getParameter(url, "reload")=="true") {
		reloadwindow = window.open('', 'reload', 'width=100,height=100,dependent=1,resizable=0,location=0,scrollbars=0,top='+screen.availHeight+',left='+screen.availWidth);
		if (reloadwindow!=null) {
			if (reloadwindow.opener==null) {
				reloadwindow.opener=window;
			}

			reloadwindow.location.href="/community/epage/dtemplate?cfile=reload.txt&tfile=reload.html";
	
			if (reloadwindow.reloadcheck=="false") {
				reloadwindow.reloadcheck="true";
				document.location.reload();
			} else {
				reloadwindow.close();
				alert("登入/登出成功！");
				document.location.href = url.split("reload=true").join("reload=false");
			}	
		}	
	}	
}

function setToPage(myform) {
	myform.topage.value=document.location.href;
}

function loginSubmit(myform){
	if (myform.pUserID.value == "") {
		alert("請填入您的帳號!");
		myform.pUserID.focus(); return false;
	} else if (myform.pPassword.value == "") {
		alert("請填入您的密碼!");
		myform.pPassword.focus(); return false;
	} else {
		if (document.location.href.substring(document.location.href.lastIndexOf("/"),document.location.href.length)=="/eforum" || document.location.href.substring(document.location.href.lastIndexOf("/"),document.location.href.length)=="/chat") {
			myform.topage.value=document.location.href+"?dummy=0";
		} else {
			myform.topage.value=document.location.href;
		}
		return true;
	}
}

function logoutSubmit(myform){
	if (document.location.href.substring(document.location.href.lastIndexOf("/"),document.location.href.length)=="/eforum" || document.location.href.substring(document.location.href.lastIndexOf("/"),document.location.href.length)=="/chat") {
		myform.topage.value=document.location.href+"?dummy=0";
	} else {
		myform.topage.value=document.location.href;
	}
	myform.submit();
}
//-->	
