//通用函数

//弹出窗口页（居中）
function ol(url,w,h) {
    //URL=obj.href;
	if(!w || isNaN(w))
	    w = 490;
	if(!h || isNaN(h))
    	h = 180;
    var left = ( screen.width - w ) / 2;
    var top = ( screen.height - h ) / 2;
	//alert(w+":"+h);
    window.open(url,'','width='+w+',height='+h+',top='+top+',left='+left+',scrollbars=0,resizable=0');
    //return false;
}

function ShowGoPage(answercount,pagesize,boardid,infoid){
	var s = new Array();
	var PageCount = parseInt((answercount + pagesize - 1) / pagesize);
	//alert(answercount + " : " + pagesize + " : " + PageCount);
	var p = PageCount < 8 ? PageCount : 8;
	s.push('<div style="float: left">[&nbsp;</div>');
	s.push('<div style="float: left"><img style="margin-top: 7px" alt="" src="Skins/Default/pagelist.gif"></div>');
	s.push('<div style="float: left">&nbsp;');
	for(var i=0;i<p-1;i++){
		s.push('<b><a href="postlist.jsp?boardid=' + boardid + '&infoid=' + infoid + '&Page=' + (i+2) + '"><font color=red>' + (i+2) + '</font></a></b>&nbsp;');
	}
	if( p > 8){
		s.push('....');
		s.push('<b><a href="postlist.jsp?boardid=' + boardid + '&infoid=' + infoid + '&Page=' + PageCount + '"><font color=red>' + PageCount + '</font></a></b>&nbsp;');
	}
	s.push(']</div>');
	return s.join('');
}
function Register(){
	var frm = document.GoRegFrm;
	frm.fromurl.value=top.location.href;
	//alert(frm.fromurl.value);
	frm.submit();
}
function Logout(){
try{
	//top.document.body.style.display="none";
	var frm = document.LogOutFrm;
	var url = location.href;
	frm.requesturl.value=top.location.href;
	//alert(frm.requesturl.value)
	if(url.indexOf("?") != -1){
		frm.action = url.split("?")[0]+"?action=loginout&"+url.split("?")[1];
	}else{
		frm.action = "?action=loginout";
	}
	//alert(frm.action)
	frm.submit();
	setTimeout("top.location.replace(top.location.href);",500);
}catch(e){top.location.replace(top.location.href);}
}

function Logout1(){
try{
	//top.document.body.style.display="none";
	var frm = document.LogOutFrm;

	frm.requesturl.value=top.location.href;
	//alert(frm.requesturl.value)

		frm.action = frm.action+"?action=loginout";

	//alert(frm.action)
	frm.submit();
	setTimeout("top.location.replace(top.location.href);",500);
}catch(e){top.location.replace(top.location.href);}
}