window.name = "main";
window.defaultStatus = "(c) Xanadu Community";
function OpenWindow(url, name, vwidth, vheight, vscreenX, vscreenY, vresizeable, vscrollbars, vmenubar) {
  NewWindow = window.open('' + url + '','' + name + '','width=' + vwidth + ',height=' + vheight + ',screenX=' + vscreenX + ',screenY=' + vscreenY + ',resizable=' + vresizeable + ',scrollbars=' + vscrollbars + ',menubar=' + vmenubar);
}

function imgPreload() {
	var args = imgPreload.arguments; 
	document.imageArray = new Array(args.length);
	for(var i=0; i<args.length; i++) {
	    document.imageArray[i] = new Image;
	    document.imageArray[i].src = args[i];
	}
}

function ShowHideElement(id) {
	if(document.getElementById(id).style.display != "none")
		document.getElementById(id).style.display = "none";
	else
		document.getElementById(id).style.display = "";
}

// JavaScript to insert text at the current position of the cursor in a textarea. 
// This is a genericized version of a function found in PHPMyAdmin.

function insertAtCursor(myField, myValue)
{
	if(document.selection) {
		// IE/OPERA support
		myField.focus();
		sel = document.selection.createRange();
		sel.text = myValue;
	} else if(myField.selectionStart || myField.selectionStart == '0') {
		// MOZILLA/NETSCAPE support
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;
		myField.value = myField.value.substring(0, startPos)
		+ myValue
		+ myField.value.substring(endPos, myField.value.length);
	} else {
		// IF BOTH FAIL, ADD TEXT AT END
		myField.value += myValue;
	}
}

