// These functions are part of the flatPHPbook script (c) 2003 by Thomas Hettenhausen



function addHyperlink($urlQuestion, $nameQuestion)

{

	$oldValue = document.getElementById("messagebox").value;

	$linkurl = prompt($urlQuestion, "http://");

	$linkname = prompt($nameQuestion, $linkurl);

	if (($linkurl != "http://") && ($linkurl != null) && ($linkurl != ""))	{

		if (($linkname == null) || ($linkname == $linkurl))	{

			$newValue = $oldValue + "[url]" + $linkurl + "[/url]";

		}

		else {

			$newValue = $oldValue + "[url=" + $linkurl + "]" + $linkname + "[/url]";

		}

		document.getElementById("messagebox").value = $newValue;

	}

	document.getElementById("messagebox").focus();

}





function addEmail($addressQuestion, $nameQuestion)

{

	$oldValue = document.getElementById("messagebox").value;

	$linkurl = prompt($addressQuestion);

	$linkname = prompt($nameQuestion, $linkurl);

	if (($linkurl != "") && ($linkurl != null))	{

		if (($linkname == null) || ($linkname == $linkurl))	{

			$newValue = $oldValue + "[email]" + $linkurl + "[/email]";

		}

		else {

			$newValue = $oldValue + "[email=" + $linkurl + "]" + $linkname + "[/email]";

		}

		document.getElementById("messagebox").value = $newValue;

	}

	document.getElementById("messagebox").focus();

}





function addBold($boldQuestion, $yourTextGoesHere)

{

	$oldValue = document.getElementById("messagebox").value;

	$boldtext = prompt($boldQuestion, $yourTextGoesHere);

	if (($boldtext != null) && ($boldtext != ""))	{

		$newValue = $oldValue + "[b]" + $boldtext + "[/b]";

		document.getElementById("messagebox").value = $newValue;

	}

	document.getElementById("messagebox").focus();

}



function addItalics($italicQuestion, $yourTextGoesHere)

{

	$oldValue = document.getElementById("messagebox").value;

	$italicsText = prompt($italicQuestion, $yourTextGoesHere);

	if (($italicsText != null) && ($italicsText != ""))	{

		$newValue = $oldValue + "[i]" + $italicsText + "[/i]";

		document.getElementById("messagebox").value = $newValue;

	}

	document.getElementById("messagebox").focus();

}



function addUnderline($underlineQuestion, $yourTextGoesHere)

{

	$oldValue = document.getElementById("messagebox").value;

	$underlinedText = prompt($underlineQuestion, $yourTextGoesHere);

	if (($underlinedText != null) && ($underlinedText != ""))	{

		$newValue = $oldValue + "[u]" + $underlinedText + "[/u]";

		document.getElementById("messagebox").value = $newValue;

	}

	document.getElementById("messagebox").focus();

}







function addColor($colorQuestion, $yourTextGoesHere)

{

	$oldValue = document.getElementById("messagebox").value;

	$selectedSize = document.inputform.colorselect.options[document.inputform.colorselect.selectedIndex].value;

	if ($selectedSize != "color")	{

		$coloredText = prompt($colorQuestion, $yourTextGoesHere);

		if ($coloredText != null)	{

			$newValue = $oldValue + "[color=" + $selectedSize + "]" + $coloredText + "[/color]";

			document.getElementById("messagebox").value = $newValue;

		}

	}

	document.getElementById("messagebox").focus();

}



function addSize($sizeQuestion, $yourTextGoesHere)

{

	$oldValue = document.getElementById("messagebox").value;

	$selectedSize = document.inputform.sizeselect.options[document.inputform.sizeselect.selectedIndex].value;

	if ($selectedSize != "size")	{

		$sizedText = prompt($sizeQuestion, $yourTextGoesHere);

		if ($sizedText != null)	{

			$newValue = $oldValue + "[size=" + $selectedSize + "]" + $sizedText + "[/size]";

			document.getElementById("messagebox").value = $newValue;

		}

	}

	document.getElementById("messagebox").focus();

}





function addImage($imageQuestion)

{

	$oldValue = document.getElementById("messagebox").value;

	$imageLocation = prompt($imageQuestion, "http://");

	if (($imageLocation != "http://") && ($imageLocation != null) && ($imageLocation != ""))	{

		$newValue = $oldValue + "[img]" + $imageLocation + "[/img]";

		document.getElementById("messagebox").value = $newValue;

	}

	document.getElementById("messagebox").focus();

}





function addCode($codeQuestion, $yourTextGoesHere)

{

	$oldValue = document.getElementById("messagebox").value;

	$codeText = prompt($codeQuestion, $yourTextGoesHere);

	if (($codeText != null) && ($codeText != ""))	{

		$newValue = $oldValue + "[pre]" + $codeText + "[/pre]";

		document.getElementById("messagebox").value = $newValue;

	}

	document.getElementById("messagebox").focus();

}





function clearHelp()

{

	document.getElementById("jsHelpLine").innerHTML = "&nbsp;<br>";

}





function helpHyperlink($wwwHelp)

{

	document.getElementById("jsHelpLine").innerHTML = $wwwHelp;

}





function helpEmail($emailHelp){

	document.getElementById("jsHelpLine").innerHTML = $emailHelp;

}





function helpBold($boldHelp)

{

	document.getElementById("jsHelpLine").innerHTML = $boldHelp;

}





function helpItalics($helpItalics)

{

	document.getElementById("jsHelpLine").innerHTML = $helpItalics;

}





function helpUnderline($helpUnderline)

{

	document.getElementById("jsHelpLine").innerHTML = $helpUnderline;

}





function helpColor($helpColor)

{

	document.getElementById("jsHelpLine").innerHTML = $helpColor;

}





function helpSize($helpSize)

{

	document.getElementById("jsHelpLine").innerHTML = $helpSize;

}





function helpImage($helpImage)

{

	document.getElementById("jsHelpLine").innerHTML = $helpImage;

}





function helpCode($helpCode)

{

	document.getElementById("jsHelpLine").innerHTML = $helpCode;

}

