function loadwindow(windName, url, width, height, top, left){
	if (!ie5&&!ns6)
		window.open(url,"","width=width,height=height,scrollbars=1")
	else{
		document.getElementById(windName).style.display = ''
		document.getElementById(windName).style.width = width + "px"
		document.getElementById(windName).style.height = height + "px"
		document.getElementById(windName).style.left = left + "px"
		document.getElementById(windName).style.top = top + "px"
		document.getElementById(windName+"frame").src = url
	}
}

function getMsg(nB, nM) {
	top.message.document.location.href="getmsg.cfm?brd="+ nB + "&msg="+nM;
}

function replyMsg(nB, nM) {
	window.open("reply.cfm?brd="+ nB + "&msg=" + nM , "PopWin", "height=350,width=620");
	//loadwindow("editWin", "reply.cfm?brd="+ nB + "&msg=" + nM,626,350,60,getRealLeft("habs")+156);
}

function editMsg(nB, nM) {
	window.open("edit.cfm?brd="+ nB + "&msg=" + nM , "PopWin", "height=350,width=620");
	//loadwindow("editWin", "edit.cfm?brd="+ nB + "&msg=" + nM,626,350,60,getRealLeft("habs")+156);
}

function deleteMsg(nB, nM) {
	//alert("Coming soon");
	window.open("tools/delete.cfm?brd="+ nB + "&msg=" + nM , "PopWin", "height=350,width=620");
	//loadwindow("editWin", "edit.cfm?brd="+ nB + "&msg=" + nM,626,350,60,getRealLeft("habs")+156);
}

function posterInfo(nM) {
	top.message.document.location.href="getposter.cfm?member="+nM;
}

function lockThread( nB, nM ) {
 	loadwindow("utilWin", "tools/lockthread.cfm?brd="+ nB + "&msg=" + nM, 222,148,100,getRealLeft('habs')+340);
}

function unlockThread( nB, nM ) {
 	loadwindow("utilWin", "tools/lockthread.cfm?brd="+ nB + "&msg=" + nM, 222,148,100,getRealLeft('habs')+340);
}

function penaltyBox( ) {
 	loadwindow("pBoxWin", "penaltybox.cfm", 626,594,60,getRealLeft("habs")+156);
}

function ignorePoster( nPoster ) {
	window.open("posterignore.cfm?p=" + nPoster, "HFPopup", "height=125,width=300");
}

function penalizePoster( nPoster, nBrd, nMsg ) { 
	window.open("tools/posterpenalize.cfm?p=" + nPoster + "&b=" + nBrd + "&m=" + nMsg, "HFPopup", "height=375,width=500");
}

function warnPoster( nPoster, nBrd, nMsg ) { 
	window.open("tools/posterwarn.cfm?p=" + nPoster + "&b=" + nBrd + "&m=" + nMsg, "HFPopup", "height=375,width=500");
}

function privateMessage( nPoster ) { 
	window.open("privatemessage.cfm?p=" + nPoster, "HFPopup", "height=375,width=625");
}
 
var dragapproved=false
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function closeit(windName){
	document.getElementById(windName).style.display="none"
}

function getRealTop(imgElem){
	var exclude=1;
	var agt=navigator.userAgent.toLowerCase();
	var win=0;
	var mac=0;

	if(agt.indexOf('win')!=-1){ win=1; }
	if(agt.indexOf('mac')!=-1){ mac=1; }

	var ie=0; var ie4=0; var ns4=0;
	var ns6=0; var ns7=0; var mz7=0;

	if(agt.indexOf("netscape/6")!=-1||agt.indexOf("netscape6 ")!=-1){ ns6=1; }
	else if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1){ ns6=1; ns7=1; }
	else if(agt.indexOf("gecko")!=-1) { ns6=1; mz7=1; }
	else if((agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){
		exclude=0;
		ns4=1;
		if(typeof navigator.mimeTypes['*']=="undefined"){ exclude=1; ns4=0; }
	}
	if(agt.indexOf('escape')!=-1){ exclude=1; ns4=0; }
	if(typeof navigator.productSub!="undefined"&&navigator.productSub==20021225){ ns6=1;ns7=0;mz7=0;win=0;mac=1; }
	if(agt.indexOf('icab')!=-1){ exclude=1; ie=0; ie5=0; }
	if(ns4 || ns7){
		yPos=document.images[imgElem].y;
	}
	else if(mac&&ie5){
		yPos+=parseInt(document.body.topMargin);
	}
	else {
		yPos=document.images[imgElem].offsetTop;
		tempEl=document.images[imgElem].offsetParent;
		while(tempEl!=null){
			yPos+=tempEl.offsetTop;
			tempEl=tempEl.offsetParent;
		}
	}
	return yPos;
}

function getRealLeft(imgElem){
	var exclude=1;
	var agt=navigator.userAgent.toLowerCase();
	var win=0;
	var mac=0;

	if(agt.indexOf('win')!=-1){ win=1; }
	if(agt.indexOf('mac')!=-1){ mac=1; }

	var ie=0; var ie4=0; var ns4=0;
	var ns6=0; var ns7=0; var mz7=0;

	if(agt.indexOf("netscape/6")!=-1||agt.indexOf("netscape6 ")!=-1){ ns6=1; }
	else if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1){ ns6=1; ns7=1; }
	else if(agt.indexOf("gecko")!=-1) { ns6=1; mz7=1; }
	else if((agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){
		exclude=0;
		ns4=1;
		if(typeof navigator.mimeTypes['*']=="undefined"){ exclude=1; ns4=0; }
	}
	if(agt.indexOf('escape')!=-1){ exclude=1; ns4=0; }
	if(typeof navigator.productSub!="undefined"&&navigator.productSub==20021225){ ns6=1;ns7=0;mz7=0;win=0;mac=1; }
	if(agt.indexOf('icab')!=-1){ exclude=1; ie=0; ie5=0; }
	if(ns4 || ns7){
		xPos=document.images[imgElem].x;
	}
	else if(mac&&ie5){
		xPos+=parseInt(document.body.leftMargin);
	}
	else {
		xPos=document.images[imgElem].offsetLeft;
		tempEl=document.images[imgElem].offsetParent;
		while(tempEl!=null){
			xPos+=tempEl.offsetLeft;
			tempEl=tempEl.offsetParent;
		}
	}
	return xPos;
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) {
		curleft += obj.x;
	}
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y) {
		curtop += obj.y;
	}
	return curtop;
}

