function hideComment() {
if(document.all) {
var commentlayer=document.all.commentPage;
} else if (!document.all && document.getElementById) {
var commentlayer=document.getElementById('commentPage');
}
commentlayer.style.display = 'none';
}

function showuser(userid) {
var usrinfoRequest=null
if (window.XMLHttpRequest) 
{ 
usrinfoRequest=new XMLHttpRequest() 
} 
else if (window.ActiveXObject) 
{ 
usrinfoRequest=new ActiveXObject("Microsoft.XMLHTTP") 
}  
	// Create a function that will receive data sent from the server
	usrinfoRequest.onreadystatechange = function(){
	if(usrinfoRequest.readyState == 4){
			var ajaxDisplay = document.all.thisuser;
			ajaxDisplay.innerHTML = usrinfoRequest.responseText;
		}
}
	usrinfoRequest.open("GET", "getuserinfo.php?userid=" + userid, true);
	usrinfoRequest.send(null); 
	
}	
function writeComment(itemid,user) {
showuser(user);
if(document.all) {
var hpart_id=document.all.hpartid;
var commentlayer=document.all.commentPage;
} else if (!document.all && document.getElementById) {
var commentlayer=document.getElementById('commentPage');
var hpart_id=document.getElementById('hpartid');
}
window.onscroll = function() {
commentlayer.style.top = document.body.scrollTop;
};
commentlayer.style.display = 'block';
commentlayer.style.top = document.body.scrollTop;
hpart_id.value=itemid;

showuser(user);
}
function hideLogin() {
if(document.all) {
var loginlayer=document.all.loginPage;
} else if (!document.all && document.getElementById) {
var loginlayer=document.getElementById('loginPage');
}
loginlayer.style.display = 'none';
}

function doLogin() {
if(document.all) {
var loginlayer=document.all.loginPage;
} else if (!document.all && document.getElementById) {
var loginlayer=document.getElementById('loginPage');
}
window.onscroll = function() {
loginlayer.style.top = document.body.scrollTop;
};
loginlayer.style.display = 'block';
loginlayer.style.top = document.body.scrollTop;
}

function hideRegistration() {
if(document.all) {
var registerlayer=document.all.registerPage;
} else if (!document.all && document.getElementById) {
var registerlayer=document.getElementById('registerPage');
}
registerlayer.style.display = 'none';
}

function doRegistration() {
if(document.all) {
var registerlayer=document.all.registerPage;
} else if (!document.all && document.getElementById) {
var registerlayer=document.getElementById('registerPage');
}
window.onscroll = function() {
registerlayer.style.top = document.body.scrollTop;
};
registerlayer.style.display = 'block';
registerlayer.style.top = document.body.scrollTop;
}

function hideHelp() {
if(document.all) {
var helplayer=document.all.helpPage;
} else if (!document.all && document.getElementById) {
var helplayer=document.getElementById('helpPage');
}
helplayer.style.display = 'none';
}

function showHelp() {
if(document.all) {
var  helplayer=document.all.helpPage;
} else if (!document.all && document.getElementById) {
var helplayer=document.getElementById('helpPage');
}
window.onscroll = function() {
helplayer.style.top = document.body.scrollTop;
};
helplayer.style.display = 'block';
helplayer.style.top = document.body.scrollTop;
}

function addComment() {
var commentRequest=null
if(document.all) {
var partid=document.all.hpartid;
var commentitem=document.all.comment;
} else if (!document.all && document.getElementById) {
var commentitem=document.getElementById("comment");
var partid=document.getElementById("hpartid");
}
if (window.XMLHttpRequest) 
{ 
commentRequest=new XMLHttpRequest() 
} 
else if (window.ActiveXObject) 
{ 
commentRequest=new ActiveXObject("Microsoft.XMLHTTP") 
}  
	// Create a function that will receive data sent from the server
	commentRequest.onreadystatechange = function(){
		if(commentRequest.readyState == 4){
			alert(commentRequest.responseText);
			partid.value="";
			commentitem.value="";
			hideComment();
		}
}
	var c = commentitem.value;
	var p = partid.value;
	var queryString = "?c=" + c + "&p=" + p;
	commentRequest.open("GET", "submitcomment.php" + queryString, true);
	commentRequest.send(null); 
	
}	