//---------------------------------------------------------------------------------------------------------------------#
//
//	Written by Tom Sayers - SQUAREZONE Ltd
//	Copyright © 2001 - 2005 Squarezone Ltd.  All rights reserved.
//	This software may not be copied by any method in whole or part without
//	the express written permission of the copyright holder.
//	squarezone.co.uk & speedEweb.net & club-sites.co.uk
//
//---------------------------------------------------------------------------------------------------------------------#
	var patternG = /([ a-zA-Z0-9]*)\s*(centre|right|left)\s*([ a-zA-Z0-9]*)\s*/i;
function eInit()	{
	var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
	if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('FireFox')    >= 0) { win_ie_ver = 0; }
	if (isNaN(win_ie_ver) || win_ie_ver < 6.0) {
		alert('Sorry, this system will only work with Internet Explorer 6.0+ for Windows PC');
		return;
	}

	content.document.execCommand('liveResize', false, 1);
	content.document.execCommand('multipleSelection', false, 1);

	content.setActive();

	if(document.styleSheets(1).rules.item(4).selectorText.toUpperCase() == 'HTML' && document.styleSheets(1).rules.item(4).style.padding != ''){
		eOffset = document.styleSheets(1).rules.item(4).style.padding.split('px');
		document.body.style.paddingTop = eval(eOffset[0]) + editMenu.offsetHeight + 'px';
	} else {
		document.body.style.paddingTop = editMenu.offsetHeight + 'px';
	}

	if(document.getElementById("menu") && document.styleSheets(1).rules.item(0).selectorText.toUpperCase() == '#MENU'){
		eText = document.styleSheets(1).rules.item(0).style.top.split('px');
		menu.style.top = eval(eText[0]) + editMenu.offsetHeight + 'px';
	}

	if(document.getElementById("right") && document.styleSheets(1).rules.item(1).selectorText.toUpperCase() == '#RIGHT'){
		eText = document.styleSheets(1).rules.item(1).style.top.split('px');
		right.style.top = eval(eText[0]) + editMenu.offsetHeight + 'px';
	}

	if(document.getElementById("left") && document.styleSheets(1).rules.item(2).selectorText.toUpperCase() == '#LEFT'){
		eText = document.styleSheets(1).rules.item(2).style.top.split('px');
		left.style.top = eval(eText[0]) + editMenu.offsetHeight + 'px';
	}

	if(document.getElementById("logo") && document.styleSheets(1).rules.item(3).selectorText.toUpperCase() == '#LOGO'){
		eText = document.styleSheets(1).rules.item(3).style.top.split('px');
		logo.style.top = eval(eText[0]) + editMenu.offsetHeight + 'px';
	}
	if(document.forms[1] && document.forms[1][0].type == 'text'){document.forms[1][0].focus();}

	sTextG = document.getElementById('content').firstChild;
	eButtonCheck();
}

function eSelect(){
	if(content.isContentEditable == true){
		sTextG = window.event.srcElement;
		if(sTextG.id != 'content'){
			var eStatus = '<' + sTextG.tagName.toLowerCase();
			eStatus += sTextG.id ? ' id=\"' + sTextG.id  + '\"': '';
			eStatus += sTextG.className ? ' class=\"' + sTextG.className  + '\"': '';
			eStatus += sTextG.title ? ' title=\"' + sTextG.title  + '\"': '';
			eStatus += sTextG.name ? ' name=\"' + sTextG.name  + '\"': '';
			eStatus += sTextG.width ? ' width=\"' + sTextG.width  + '\"': '';
			eStatus += (sTextG.height && sTextG.height < 2000) ? ' height=\"' + sTextG.height  + '\"': '';
//			eStatus += sTextG.style ? ' style=\"' + sTextG.style.width  + '\"': '';
			eStatus += sTextG.value ? ' value=\"' + sTextG.value  + '\"': '';
			if(sTextG.tagName.toUpperCase() == 'IMG'){
				eStatus += sTextG.alt ? ' alt="' + sTextG.alt  + '"': '';
				temp = sTextG.src.split('/images');
				eStatus += temp[1] ? ' src="/images' + temp[1]  + '"': ' NOT YET UPLOADED';
			} else {
				eStatus += sTextG.href ? ' href="' + sTextG.href + '"': '';
			}
			eStatus += '>';
			window.status = eStatus;
			eButtonCheck();
		}
	}
}
function cpPos() {
	editMenu.style.top = document.body.scrollTop;
}
function cpTop() {
	document.body.style.paddingTop = editMenu.offsetHeight;
}
function eButtonCheck1(){
	sTextG = document.selection.createRange();
	if(sTextG)
		sTextG = sTextG.parentElement();
	eButtonCheck();
}

function eButtonCheck(){
	if(sTextG){
		eResetMenu();	// reset all names to off

		bBold.name = eCheckParents(1,'STRONG','B');
		bItalic.name = eCheckParents(1,'EM','I');
		bOrdered.name = eCheckParents(1,'OL');
		bBulleted.name = eCheckParents(1,'UL');
		bBlockq.name = eCheckParents(1,'BLOCKQUOTE');

		if(sTextG.previousSibling && sTextG.previousSibling.tagName == 'BR' && sTextG.previousSibling.outerHTML.toUpperCase() == '<BR CLEAR=ALL>'){
				bBreak.name = 'on';
		}

		bLink.name = eCheckParents(5,'A','HREF');
		bAnchor.name = eCheckParents(5,'A','NAME');

		document.upload.bImg.name = eCheckParents(1,'IMG');

		bHr.name = eCheckParents(1,'HR');

		bLeft.name = eCheckParents(2,'LEFT');

		bCentre.name = eCheckParents(2,'CENTRE');

		bRight.name = eCheckParents(2,'RIGHT');

		bPara.name = eCheckParents(1,'P');

		bH1.name = eCheckParents(1,'H1');
		bH2.name = eCheckParents(1,'H2');
		bH3.name = eCheckParents(1,'H3');
		bH4.name = eCheckParents(1,'H4');
		bH5.name = eCheckParents(1,'H5');
		bH6.name = eCheckParents(1,'H6');
		
		if(sTextG.tagName == "BR")
			bBreak.name = "on";

		if(content.isContentEditable)
			bEdit.name = "on";

		if(eCheckParents(4)){
			eEd.innerText = "Selection may not be edited";
		} else {
			eEd.innerText = "";
		}


		if(!document.getElementById('newImg'))
			document.upload.eFilename.style.display = 'inline';

		eSetMenu();	// Set
	}
}

function eCheckParents(eTest,eValue,eValue2,eValue3,eValue4,eValue5){
	var eText = sTextG;
	var eFound;
	for(var ii = 0; ii < 10; ii++) {
		if(eText.tagName){
			if(eTest == 1){
				// Test tagName only
				var eTextL = eText.tagName.toUpperCase();
				if(eTextL == eValue || eTextL == eValue2 || eTextL == eValue3 || eTextL == eValue4)
					return "on";
			}
			if(eTest == 2){
				// Test className only
				var eTextL = eText.className.toUpperCase();
				if(eTextL.indexOf(eValue) >= 0)
					return "on";
			}
			if(eTest == 3){
				var eTextL = eText.tagName.toUpperCase();
				if(eTextL == eValue || eTextL == eValue2 || eTextL == eValue3 || eTextL == eValue4 || eTextL == eValue5)
					eFound = eText.parentNode;
			}
			if(eTest == 4){
				if(!eText.isContentEditable)
					return 0;
			}
			if(eTest == 5){

				if(eValue2 == 'HREF' && eText.href && eText.tagName.toUpperCase() == 'A')
					return "on";

				if(eValue2 == 'NAME' && eText.name && eText.tagName.toUpperCase() != 'BODY')
					return "on";

			}
			if(eTest == 6){
				var eTextL = eText.tagName.toUpperCase();
				if(eTextL == eValue || eTextL == eValue2 || eTextL == eValue3 || eTextL == eValue4 || eTextL == eValue5)
					eFound = eText;
			}
			if(!eText.parentNode){break;}
			eText = eText.parentNode;
		} // end if(eText.tagName)
	} // end for

	if(eFound)
		return eFound;
}
  function selOn(ctrl){
  	// onMouseOver
	// if active normal background
	if(ctrl.name == "on"){
		ctrl.style.backgroundColor = 'buttonFace';
	} else {
		// Raised border
		ctrl.style.borderTop = '1px solid threedHighlight';
		ctrl.style.borderLeft = '1px solid threedHighlight';
		ctrl.style.borderBottom = '1px solid threedShadow';
		ctrl.style.borderRight = '1px solid threedShadow';
	}
  }
  
  function selOff(ctrl){
  	// onMouseOut
	// if active light background
	if(ctrl.name == "on"){
		ctrl.style.backgroundColor = 'buttonHighlight';
	} else {
		ctrl.style.borderColor = '';  
	    ctrl.style.border = '1px solid';
	}
  }
  
  function selDown(ctrl){
  	// onMouseDown
	if(ctrl.name != "on"){
		// Depressed border
		ctrl.style.borderTop = '1px solid threedShadow';
		ctrl.style.borderLeft = '1px solid threedShadow';
		ctrl.style.borderBottom = '1px solid threedHighlight';
		ctrl.style.borderRight = '1px solid threedHighlight';
	}
  }
  
  function selUp(ctrl){
  	// onMouseUp
	if(ctrl.name == "on"){
		// Raised border
		ctrl.style.borderTop = '1px solid threedHighlight';
		ctrl.style.borderLeft = '1px solid threedHighlight';
		ctrl.style.borderBottom = '1px solid threedShadow';
		ctrl.style.borderRight = '1px solid threedShadow';
	}
  }
    
function eSetMenu(){
	var ctrl = document.getElementsByTagName("img")
	for(var ii = 0; ii < ctrl.length; ii++) {
		if(ctrl(ii).className == "butn"){
			if(ctrl(ii).name == "off"){
				ctrl(ii).style.display = 'none';
			} else {
				if(ctrl(ii).name == "on"){
					ctrl(ii).style.backgroundColor = 'buttonHighlight';
					ctrl(ii).style.borderTop = '1px solid threedShadow';
					ctrl(ii).style.borderLeft = '1px solid threedShadow';
					ctrl(ii).style.borderBottom = '1px solid threedHighlight';
					ctrl(ii).style.borderRight = '1px solid threedHighlight';
				} else {
					ctrl(ii).style.backgroundColor = 'buttonFace';
					ctrl(ii).style.borderColor = '';
				    ctrl(ii).style.border = '1px solid';
				}
			}
		}
	}
	cpPos();
}
function eResetMenu(){
	var ctrl = document.getElementsByTagName("img")
	for(var ii = 0; ii < ctrl.length; ii++) {
		if(ctrl(ii).className == "butn"){
			ctrl(ii).name = "";
		}
	}
}
function eBold(){
	if(document.execCommand('bold', false, null))
		eButtonCheck1();
}
function eItalic(){
	if(document.execCommand('italic', false, null))
		eButtonCheck1();
}
function eLeft(){
	eIsJ('left');
}
function eRight(){
	eIsJ('right');
}
function eIsJ(eLorR){
	if(sTextG && sTextG.id != 'content'){
		var eText = eCheckParents(3,'STRONG','B','EM','I');
		if(!eText)
			eText = sTextG

		var aTest = eText.className.split(" ");
		var eRem;
		eText.className = "";
		for(var ii = 0; ii < aTest.length; ii++){
			if(aTest[ii] == eLorR){
				aTest[ii] = "";
				eRem = 1;
			}

			if(aTest[ii] == "centre" || aTest[ii] == "right" || aTest[ii] == "left")
				aTest[ii] = "";

			if(aTest[ii] && ii > 0)
				aTest[ii] = " " + aTest[ii];

			eText.className += aTest[ii];
		}
		if(!eRem){
			if(eText.className)
				eText.className += " ";
			eText.className += eLorR;
		}

		if(eText.style){
			eText.style.position = "";
			eText.style.left = "";
		}
		eButtonCheck();
	}
}
function eCenter(){
	if(sTextG && sTextG.id != 'content'){
		var eText = eCheckParents(3,'STRONG','B','EM','I','A');
		if(!eText)
			eText = sTextG

		var temp = /\s*([ a-zA-Z0-9]*)\s*(centre)\s*([ a-zA-Z0-9]*)\s*/i;
		var aTest = temp.exec(eText.className);	// Toggle
		if(aTest){	// already centred
			if(aTest[1] || aTest[3]){
				eText.className = aTest[1] + " " + aTest[3];
			} else {
				eText.removeAttribute("className");
			}
			if(eText.style){
				eText.style.position = "";
				eText.style.left = "";
			}
		} else {
			if(eText.tagName == "IMG"){
				eText.style.position = "relative";
				eText.style.left = document.all.content.offsetWidth/2 -
					eText.offsetWidth/2;
			}
			var aTest = patternG.exec(eText.className);
			if(aTest){
				eText.className = aTest[1] + aTest[3] + " centre";
			} else {
				eText.className = eText.className + " centre";
			}
		}
		eButtonCheck();
	}
}
function eSetTag(hType){
	if(sTextG && sTextG.tagName == 'DIV' && sTextG.id == 'content'){
		var aTag;
		sTextG = document.selection.createRange();
		sTextG.expand("word");
		if(hType == "Paragraph")
			aTag = "P";
		if(hType == "Heading 1")
			aTag = "H1";
		if(hType == "Heading 2")
			aTag = "H2";
		if(hType == "Heading 3")
			aTag = "H3";
		if(hType == "Heading 4")
			aTag = "H4";
		if(hType == "Heading 5")
			aTag = "H5";
		if(hType == "Heading 6")
			aTag = "H6";
		if(hType == "<pre>")
			aTag = "<pre>";
		sTextG.pasteHTML('<' + aTag + '>' + sTextG.text + '</' + aTag + '>');
		eButtonCheck1();
	} else {
		if(sTextG){
			if(hType == 'none'){
				if(document.execCommand('removeFormat'))
					eButtonCheck1();
			} else if(hType != ''){
				if(document.execCommand('formatblock', false, hType))
					eButtonCheck1();
			}
		}
	}
}
function eBlockquote(){
	if(sTextG.tagName == 'P' || sTextG.tagName == 'BLOCKQUOTE'){
		var eText = eCheckParents(6,'BLOCKQUOTE');
		if(!eText){
			var oSpan = document.createElement("BLOCKQUOTE");
			var sPreserve = sTextG.innerHTML;
			sTextG.replaceNode(oSpan);
			oSpan.innerHTML = sPreserve;
		} else {
			var oSpan = document.createElement("P");
			var sPreserve = sTextG.innerHTML;
			sTextG.replaceNode(oSpan);
			oSpan.innerHTML = sPreserve;
		}
		sTextG = oSpan;
		eButtonCheck();
	}
}
function eListOrd(){
	if(document.execCommand('insertorderedlist', false, null))
		eButtonCheck1();
}
function eListUOrd(){
	if(document.execCommand('insertunorderedlist', false, null))
		eButtonCheck1();
}
function eSizeCheck(){
	var sImage = document.upload.eFilename.value.toLowerCase();
	if(sImage != null){
		myImage = new Image();
		myImage.src = sImage;
		if(sImage.split('.')[1] != 'gif' && sImage.split('.')[1] != 'jpg' && sImage.split('.')[1] != 'jpeg' && sImage.split('.')[1] != 'png'){
			alert('Sorry, images must be gif, jpg, jpeg or png type only.');
			document.upload.bImg.style.display = 'none';
			return false;
		}
		document.upload.bImg.style.display = 'inline';
	}
}
function eImage(){
	if(!sTextG){
		content.setActive();
		sTextG = document.selection.createRange();
		sTextG = sTextG.parentElement();
	}
	if(sTextG){
		var sImage = document.upload.eFilename.value;
		if(sImage != '' && !document.getElementById('newImg') && myImage){
			// myImage was created in eSizeCheck
			myImage.id = 'newImg';
			myImage.onresize = 'eResize()';
			xImage = document.upload.eFilename.value.toLowerCase();
			// Image file has been chosen as sImage using Browse...
			myImage.src = sImage;
			if(xImage.split('.')[1] != 'gif' && xImage.split('.')[1] != 'jpg' && xImage.split('.')[1] != 'jpeg' && xImage.split('.')[1] != 'png'){
				alert('Sorry, images must be gif, jpg, jpeg or png type only.');
				document.upload.bImg.style.display = 'none';
				return false;
			}

			newWidth = myImage.width;
			eMessage = '';
			pageMaxW = Math.floor((document.all.content.offsetWidth - 40) / 50) * 50;
			preferredW = Math.min(pageMaxW,250);
			if(newWidth > pageMaxW){
				newWidth = preferredW;
				eMessage += 'This image is too big for this page. Width of ' + myImage.width +
'px will be reduced to ' + newWidth + "px.\n\n";
			}
			if(eMessage){
				eMessage += "Consider resizing it first because once uploaded, your image file size will be \nreduced and you may lose quality!\n\n" +
					"Select the image and use the drag handles to set the desired size before\n" +
					'uploading. Bear in mind visitors using small screens.';
				alert(eMessage);
				eFactor = newWidth / myImage.width;
				myImage.width = newWidth;
				myImage.height = eFactor * myImage.height;
			}
			
			if(!document.getElementById('newImg')){
				content.setActive();
				sTextG = document.selection.createRange();
				sTextG = sTextG.parentElement();
			}
			if(sTextG.tagName == 'DIV' && sTextG.id == 'content'){
				sTextG.insertAdjacentElement("beforeEnd",myImage);
			} else {
				sTextG.insertAdjacentElement("beforeBegin",myImage);
			}
			sTextG = document.getElementById('newImg');
			sTextG.setActive();
			
			// Set alt tag from file name
			var aImage = sImage.lastIndexOf("\\");
			sImage = sImage.slice(aImage + 1);
			if(!sTextG.alt){
				aImage = sImage.lastIndexOf(".");
				sTextG.alt = sImage.slice(0,aImage);
			}
			// Allow change of alt tag
			sTextG.alt = sTextG.alt.replace(/%20/,' ');
			sTextG.alt = sTextG.alt.replace(/_/,' ');
			var aText = prompt('Title and description of this image:',sTextG.alt);
			if(aText != null)
				sTextG.alt = aText;
				
			if(aText == '')
				sTextG.removeAttribute('alt');
				
			window.status = 'Image width: ' + myImage.width + ' Height: ' + myImage.height;	
			document.upload.eFilename.style.display = 'none';	// Hide the Browse... dialogue
		} else {
			if(sTextG.tagName.toUpperCase() == 'IMG'){
				var aText = prompt('Title and description of this image:',sTextG.alt);
				if(aText != null)
					sTextG.alt = aText;
					
				if(aText == '')
					sTextG.removeAttribute('alt');
					
			} else {
				if(document.getElementById('newImg')){
					alert('Please save this page before adding another image');
				} else {
					alert('Please select a file using Browse...');
				}
			}
		}
	}
}
function displayCpanel() {
	var cPanelOut = '<div unselectable="on" id="editMenu" style="position: absolute; width: 100%; z-index:100;top: 0;">';

	cPanelOut += '<span id="bAllButtons">';
	 cPanelOut += '<span id="bEdButtons">';
	  cPanelOut += '<img id="bBold" title="Bold" class="butn" src="/common2/bold.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Select a block of text first or apply to the current word only. Click again to cancel.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eBold(this)">';
	  cPanelOut += '<img id="bItalic" title="Italic" class="butn" src="/common2/italic.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Select a block of text first or apply to the current word only. Click again to cancel.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eItalic(this)">';
	  cPanelOut += '<img id="bLeft" title="Left" class="butn" src="/common2/left.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Justify text left or position an image on the left with text on the right. Click again to cancel.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eLeft(this)">';
	  cPanelOut += '<img id="bCentre" title="Centre" class="butn" src="/common2/center.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Justify text centre or position an image in the centre. Click again to cancel.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eCenter(this)">';
	  cPanelOut += '<img id="bRight" title="Right" class="butn" src="/common2/right.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Justify text right or position an image on the right with text on the left. Click again to cancel.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eRight(this)">';

	  cPanelOut += '<img id="bPara" title="Paragraph style" class="butn" src="/common2/para.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Apply Paragraph style to this block.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eSetTag(\'Paragraph\')">';
	  cPanelOut += '<img id="bH1" title="Heading 1 style" class="butn" src="/common2/h1.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Apply Heading style to this block.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eSetTag(\'Heading 1\')">';
	  cPanelOut += '<img id="bH2" title="Heading 2 style" class="butn" src="/common2/h2.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Apply Heading style to this block.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eSetTag(\'Heading 2\')">';
	  cPanelOut += '<img id="bH3" title="Heading 3 style" class="butn" src="/common2/h3.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Apply Heading style to this block.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eSetTag(\'Heading 3\')">';
	  cPanelOut += '<img id="bH4" title="Heading 4 style" class="butn" src="/common2/h4.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Apply Heading style to this block.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eSetTag(\'Heading 4\')">';
	  cPanelOut += '<img id="bH5" title="Heading 5 style" class="butn" src="/common2/h5.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Apply Heading style to this block.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eSetTag(\'Heading 5\')">';
	  cPanelOut += '<img id="bH6" title="Heading 6 style" class="butn" src="/common2/h6.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Apply Heading style to this block.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eSetTag(\'Heading 6\')">';
	  cPanelOut += '<img id="bBlockq" title="Blockquote style" class="butn" src="/common2/blockq.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Apply Blockquote style to this block.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eBlockquote(this)">';

	  cPanelOut += '<img id="bOrdered" title="Ordered List" class="butn" src="/common2/ordlist.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Convert a block of text to an ordered list. Select a list and click to convert back to text.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eListOrd(this)">';
	  cPanelOut += '<img id="bBulleted" title="Bulleted List" class="butn" src="/common2/bullist.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Convert a block of text to an unordered list. Select a list and click to convert back to text.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eListUOrd(this)">';

	  cPanelOut += '<img class="butn" src="/common2/sep.gif" />';
	  cPanelOut += '<img id="bLink" title="[Disabled] Hyperlink" class="butn" src="/common2/link.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Insert a hyperlink. Select the link text first for a hidden Url. Clear the Url in the dialogue box to remove the hyperlink.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)">';
	  cPanelOut += '<img id="bAnchor" title="[Disabled] Anchor" class="butn" src="/common2/anchor.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Insert an Anchor tag. This is a bookmark, usually in a long page. Create a link as #bookmark_name.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)">';
	  cPanelOut += '<img id="bHr" title="[Disabled] Horizontal Rule" class="butn" src="/common2/rule.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Insert a horizontal rule. Drag the selectors to resize it.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)">';
	  cPanelOut += '<img id="bBreak" title="[Disabled] Break" class="butn" src="/common2/break.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Insert a break to ensure that the next paragraph appears beneath an image.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)">';
	  cPanelOut += '<img id="bTable" title="[Disabled] Events table" class="butn" src="/common2/table.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Insert an Events Table.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)">';
	 cPanelOut += '</span>';

//	 Image upload
	 cPanelOut += '<form style="text-align:left; display: inline;" id="eForm" name="upload" method="post" enctype="multipart/form-data" action="">';
	 cPanelOut += '	<img id="bImg" name="bImg" title="Image" class="butn" style="display:none" src="/common2/image.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Insert an image stored on your computer. Select the image file first using Browse.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eImage(this)">';
	 cPanelOut += '	<input id="bBrowse" style="display:none;width:0;border:0;margin:3px 0;" type="file" name="eFilename" onChange="eSizeCheck()" unselectable="on" onMouseOver="window.status=\'Select an image file from your computer to be uploaded to the server (gif and jpg only).\'" onMouseOut="window.status=\'\'" title="Image file upload" /><br />';
	 cPanelOut += '</form>';

//	 Page management
	 cPanelOut += '<img id="bSave" title="[Disabled] Save changes" class="butn" style="display:inline" src="/common2/save.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Save your changes.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';
	 cPanelOut += '<img id="bNewPage" title="[Disabled] New page - no menu entry" class="butn" style="display:inline" src="/common2/newpage.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Create a new page with no menu entry. You will need to manually link to this page.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';
	 cPanelOut += '<img id="bDelete" title="[Disabled] Delete page" class="butn" style="display:inline" src="/common2/delete.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Delete this page.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';
	 cPanelOut += '<img id="bRestore" title="[Disabled] Revert to published file" class="butn" style="display:none" src="/common2/restore1.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Discard your changes.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';
	 cPanelOut += '<img id="bPublish" title="[Disabled] Publish" class="butn" style="display:none" src="/common2/pub.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Make your changes visible to your visitors.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';

//	 Menu control
	 cPanelOut += '<img id="bNewSubDir" title="[Disabled] New sub-menu entry" class="butn" style="display:inline" src="/common2/newsm.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Create a new sub-menu entry following the current sub-menu item.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';
	 cPanelOut += '<img class="butn" src="/common2/sep.gif" />';
	 cPanelOut += '<img id="bNewDir" title="[Disabled] New menu entry" class="butn" style="display:inline" src="/common2/newm.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Create a new menu entry following the current main menu item.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';
	 cPanelOut += '<img id="bMenuName" title="[Disabled] Rename menu - immediate effect!" class="butn" style="display:inline" src="/common2/new.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Rename this menu and change the hover text. This will take immediate effect on your web site.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';
	 cPanelOut += '<img id="bMenuDown" title="[Disabled] Move menu - immediate effect!" class="butn" style="display:inline" src="/common2/down.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Move the current menu item down or left/right (away from Home). This will take immediate effect on your web site.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';
	 cPanelOut += '<img id="bMenuUp" title="[Disabled] Move menu - immediate effect!" class="butn" style="display:inline" src="/common2/up.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Move the current menu item up or left/right (towards Home). This will take immediate effect on your web site.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" />';
	 cPanelOut += '<img class="butn" src="/common2/sep.gif" />';
	cPanelOut += '</span>';

//	System control
	cPanelOut += '<img id="bEdit" title="[Disabled] Edit off/on" class="butn" style="display:none" src="/common2/unlock.gif" width="23px" unselectable="on" onMouseOver="window.status=\'Lock the page to test links.\';selOn(this)" onMouseOut="window.status=\'\';selOff(this)" onMouseDown="selDown(this)" onMouseUp="selUp(this)" onClick="eEditable(this)">';

	cPanelOut += '<span unselectable="on" class="colour">Squarezone Club-Sites Control Panel 2 </span>';
	cPanelOut += '<span unselectable="on" id="eEd" class="warning"></span>';
	cPanelOut += '</div>';

	document.write(cPanelOut);
}

