//my new scripts
function docInfo() {
	var foo = false;
	if (document.compatMode) {
		if ( document.compatMode!= "BackCompat" &&!document.doctype ) {
			if (document.getElementsByTagName('!')[0].text.indexOf("dtd")!= -1)
				foo = true;
			}
	}else{
		foo = true;
	}
	return foo;
} 


function findX(obj) {
	var x = 0;
	while (obj) {
		x += obj.offsetLeft
		obj = obj.offsetParent;
	}
	return(x);
} 

function findY(obj) {
	var y = 0;
	while (obj) {
		y += obj.offsetTop
		obj = obj.offsetParent;
	}
	return(y);
} 

function findXY(thisObj) {
	var thisY = findY(thisObj);
	var thisX = findX(thisObj);
	alert(thisX + " - " + thisY);
} 


function firePopMenu(thisPopup, thisTarget, xOffset, yOffset) {
	var plusX = xOffset;
	var plusY = yOffset;
	var leftOffset = findX(thisTarget) + plusX;
	var topOffset = findY(thisTarget) + plusY;
	//alert(leftOffset + " - " + topOffset);
	if (document.getElementById(thisPopup).style.display != "block"){
		document.getElementById(thisPopup).style.display = "block";
	}else{
		document.getElementById(thisPopup).style.display = "none";
	}	
	document.getElementById(thisPopup).style.top = topOffset + "px";
	document.getElementById(thisPopup).style.left = leftOffset + "px";
}

function closePopMenu(thisPopup){
	//alert(thisPopup);
	document.getElementById(thisPopup).style.display = "none";
}

function updateForeColor(thisColor){
	document.getElementById('forecolor').style.backgroundColor=thisColor;
	document.getElementById('fColor').value=thisColor;
	document.getElementById('colorPopMenu').style.display = "none";
	updateColor();
	//alert(thisColor);
}

function updateColor(){
	//alert(document.getElementById('fColor').value);
	showcolor2(document.getElementById('fColor').value);
}
function makeBigger(direction) {
  var txtarea = document.PostTopic.Message;//document.getElementById('d');
  if (direction==1) {
//    txtarea.cols = txtarea.cols + 10;
    txtarea.rows = txtarea.rows + 5;
  } else {
//    txtarea.cols = txtarea.cols - 10;
    txtarea.rows = txtarea.rows - 5;
  }
  document.getElementById("textarea_next_time").value=txtarea.cols+","+txtarea.rows;
}

function showcolor2(color) {
	var text = getText();
	if (color) {
		if (helpstat) {
			alert("Color Tag Sets the text color. Any named color can be used.\n\nUSE: ["+color+"]This is some "+color+" text[/"+color+"]");
		} else if (basic) {
			AddTxt='[COLOR="' + color + '"]' + text + '[/COLOR]';//["+color+"]" + text + "[/"+color+"]";
			AddText(AddTxt);
		} else {
			if (text) {
		     		txt=prompt("Text to be "+color,text);
			} else {
	     			txt=prompt("Text to be "+color,"Text");
			}
			if(txt!=null) {
				AddTxt='[COLOR="' + color + '"]' + text + '[/COLOR]';//"["+color+"]"+txt+"[/"+color+"]";
				AddText(AddTxt);
			}
		}
	//document.PostTopic.Color.selectedIndex = 0;
	}
}
