		function toggleLayer( whichLayer )
		{
		var elem, vis;
		if( document.getElementById ) // this is the way the standards work
			elem = document.getElementById( whichLayer );
		else if( document.all ) // this is the way old msie versions work
				elem = document.all[whichLayer];
		else if( document.layers ) // this is the way nn4 works
			elem = document.layers[whichLayer];
		vis = elem.style;
		// if the style.display value is blank we try to figure it out here
		if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
			vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
		vis.display = (vis.display==''||vis.display=='block')?'none':'block';
		}

	function openpopup(){
		var popurl="files/upload.php"
		winpops=window.open(popurl,"","width=450,height=200,scrollbars,popFrameless")
		}

function insertAtCursor(myField, myValue) {
			myField.focus();
	
		//IE support
		if (document.selection) {
			myField.focus();
			sel = document.selection.createRange();
			sel.text = myValue;
		}
		//MOZILLA/NETSCAPE support
		else if (myField.selectionStart || myField.selectionStart == '0') {
			var startPos = myField.selectionStart;
			var endPos = myField.selectionEnd;
			myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
		} else {
			myField.value += myValue;
		}
	}
		
	var j = 0;
	var k = 0;
	var l = 0;
	var m = 0;
	var n = 0;
	var p = 0;
	
	function Bold(form) {
		if (j % 2 == 0) {
			insertAtCursor(form, '[b]');
		} else {
			insertAtCursor(form, '[/b]');
		}
		j += 1;
	}
	function Underline(form) {
		if (k % 2 == 0) {
			insertAtCursor(form, '[u]');
		} else {
			insertAtCursor(form, '[/u]');
		}
		k += 1;
	}
	function Italic(form) {
		if (l % 2 == 0) {
			insertAtCursor(form, '[i]');
		} else {
			insertAtCursor(form, '[/i]');
		}
		l += 1;
	}
	function List(form) {
		if (m % 2 == 0) {
			insertAtCursor(form, '[li]');
		} else {
			insertAtCursor(form, '[/li]');
		}
		m += 1;
	}
	function Header(form) {
		if (n % 2 == 0) {
			insertAtCursor(form, '[h3]');
		} else {
			insertAtCursor(form, '[/h3]');
		}
		n += 1;
	}

	function Paragraph(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[p]');
		} else {
			insertAtCursor(form, '[/p]');
		}
		p += 1;
	}

	function Left(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[left]');
		} else {
			insertAtCursor(form, '[/left]');
		}
		p += 1;
	}

	function Right(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[right]');
		} else {
			insertAtCursor(form, '[/right]');
		}
		p += 1;
	}

	function Red(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[color=red]');
		} else {
			insertAtCursor(form, '[/color]');
		}
		p += 1;
	}
	function Blue(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[color=blue]');
		} else {
			insertAtCursor(form, '[/color]');
		}
		p += 1;
	}
	function Green(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[color=green]');
		} else {
			insertAtCursor(form, '[/color]');
		}
		p += 1;
	}
	function Yellow(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[color=yellow]');
		} else {
			insertAtCursor(form, '[/color]');
		}
		p += 1;
	}
	function Brown(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[color=brown]');
		} else {
			insertAtCursor(form, '[/color]');
		}
		p += 1;
	}
	function Purple(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[color=purple]');
		} else {
			insertAtCursor(form, '[/color]');
		}
		p += 1;
	}
	function Pink(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[color=pink]');
		} else {
			insertAtCursor(form, '[/color]');
		}
		p += 1;
	}
	function Big(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[big]');
		} else {
			insertAtCursor(form, '[/big]');
		}
		p += 1;
	}
	function Small(form) {
		if (p % 2 == 0) {
			insertAtCursor(form, '[sm]');
		} else {
			insertAtCursor(form, '[/sm]');
		}
		p += 1;
	}


	function inserta(form) {
		insertAtCursor(form, '[eurl="http://www.domain.com"]Text[/url]');
	}


	function insertURL(form) {
		insertAtCursor(form, '[url="http://www.domain.com"]Text[/url]');
	}

	function insertEmail(form) {
		insertAtCursor(form, '[email=address@domain.com]Text[/email]');
	}

	function insertImage(form) {
		insertAtCursor(form, '[img]http://www.domain.com/image.jpg[/img]');
	}
	function insertFL(form) {
		insertAtCursor(form, 'fixtureslive(DIVISION/TEAM:123456)');
	}



