// clicks button when enter is pressed
function clickButton(e, buttonid){ 
	if (e.keyCode == 13){ 
		var bt = document.getElementById(buttonid); 
		bt.click(); 
		return false; 
	} 
} 

// do nothing when enter is pressed, just absorb it
function ignoreEnter(e){ 
	if (e.keyCode == 13){ 
		return false; 
	}
} 

function popUp(url, width, height) {
	window.open(url,'popup','height=' + height + ',width=' + width + ',toolbar=no,scrollbars=yes');
}

function blockon(id) {
	setblock(id, 'block');
}

function blockoff(id) {
	setblock(id, 'none');
}

function setblock(id, val)
{
	if (document.layers) /* Don't know what browser this is for */
	{
		document.layers[id].display = val;
	}
	else if (document.all)/* IE */
	{
		document.all[id].style.display = val;
	}
	else if (document.getElementById) /* FireFox */
	{
		document.getElementById(id).style.display = val;
	}
}

function reverseblock(id) {
	if (document.layers) /* Don't know what browser this is for */
	{
		if (document.layers[id].display == 'block')
			document.layers[id].display = 'none';
		else
			document.layers[id].display = 'block';
	}
	else if (document.all)/* IE */
	{
		if (document.all[id].style.display == 'block')
			document.all[id].style.display = 'none';
		else
			document.all[id].style.display = 'block';
	}
	else if (document.getElementById) /* FireFox */
	{
		if (document.getElementById(id).style.display == 'block')
			document.getElementById(id).style.display = 'none';
		else
			document.getElementById(id).style.display = 'block';
	}
}

function ClipboardCopy(text) {
	if (window.clipboardData) { /* IE */
		window.clipboardData.setData("Text", text);
	}
	else if (window.netscape) { /* Mozilla */
		try {
			netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
		} catch (error) {
			alert('You must set signed.applets.codebase_principal_support to true in about:config for the clipboard to work in a mozilla browser.');
			return;
		}
		var clipid = Components.interfaces.nsIClipboard;
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(clipid);
		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		if (!clip || !trans) return;
		str.data=text;
		trans.addDataFlavor('text/unicode');
		trans.setTransferData("text/unicode",str,text.length*2);
		clip.setData(trans,null,clipid.kGlobalClipboard);
	}
   return;
}