﻿function showdialog(pageurl,dialogInfo,pagewidth,pageheight)
{
  var winl = (screen.width-pagewidth)/2;
  var wint = (screen.height-pageheight)/2;
  var settings ='height='+pageheight+',';
  settings +='width='+pagewidth+',';
  settings +='top='+wint+',';
  settings +='left='+winl+',';
  settings +='scrollbars=false,';
  settings +='resizable=false,';
  settings +='titlebar=false,';
  settings +='status=false,';
//  settings +='fullscreen=3';
  win = window.open(pageurl,dialogInfo,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
function closeDialog(){
    window.opener.location.reload();
    self.close();
}

function getHTTPObject(){
	var xmlhttp = false;
	if(window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest();
		if(xmlhttp.overrideMimeType){
			xmlhttp.overrideMimeType('text/xml');
		}
	}else
	{
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}
	return xmlhttp;
}

function getArticleComment(articleId){
	var req = getHTTPObject();
	req.onreadystatechange=function(){
	    if(req.readyState == 4){
			if(req.status == 200){
				if(req.responseText!=""){
						showArticleComment(req.responseText);
					}
					else{
						showArticleComment("error:无法取得评论内容！");
					}
				}
				else{
					showArticleComment("error:无法取得评论内容！");
				}
		}
	};
	req.open("POST","/webpub/bpf/comment/getComment.jsp",true);
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	req.send("articleId=" + articleId);
}

function showArticleComment(commentStr){
  document.getElementById("xbstar_commentContentArea").innerHTML = commentStr;
}

