<!-- Title: MyHTMLForm -->
<!-- Original:  Jonathan Feaster (http://www.archreality.com/) -->
<!-- Web Site:  http://www.archreality.com/ -->

<!--

// Configurations

// Doctype Mode
// Set var value to 1 for XHTML 1.0 Strict DTD. Default is HTML 4.01 Strict DTD

var dmode = 0;

// Form Field Element ID Name Default
// Set var value to form field element id name

var einme = "desc_problema";

// Form Field Element CSS Class Default
// Set var value to form field element css class

var cscls = "";

// Interface Tools Customization Defaults
// Set var value to 0 to disable

var ehelp = 1; // Help
var ehead = 1; // Heading
var epara = 1; // Paragraph
var ebr = 1; // Break
var ebold = 1; // Embolden
var eitalic = 1; // Italicize
var elink = 1; // Anchor Link
var ehrule = 1; // Horizontal Rule
var eimage = 1; // Image
var elist = 1; // List

// List Warning Maximum Tolerance

var lmax = 15;

// phpMyAdmin Insert at Cursor with myValueEnd modification by Jonathan Feaster http://www.archreality.com/

function insertAtCursor(myField, myValue, myValueEnd) {
//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
if (myValueEnd != null){
sel.text = myValue + sel.text + myValueEnd;
}
else {
sel.text = myValue;
}
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == 0) {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
if (myValueEnd != null){
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(startPos, endPos)
+ myValueEnd
+ myField.value.substring(endPos, myField.value.length);
}
else {
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
}
} else {
if (myValueEnd != null){
myField.value = myField.value + myValue + myValueEnd;
}
else {
myField.value = myField.value + myValue;
}
}
}

// Replace Illegal Characters

function richars(ichars) {
ichars = ichars.replace(/&/g, "&amp;");
ichars = ichars.replace(/ /g, "%20");
return ichars
}

// Interface Tools Initiation

function MyHTMLForm(einme, cscls, ehelp, ehead, epara, ebr, ebold, eitalic, elink, ehrule, eimage, elist) {
if (cscls == null){
cscls = "";
}
document.write("<p>\r");
if (dmode == 1){
document.write("<input type=\"button\" value=\"Preview\" onClick=\"xprev('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"Preview\" onClick=\"xprev('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
if (ehelp != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"Help\" onClick=\"xhelp('" + einme + "'," + epara + "," + ebr + "," + ebold + "," + eitalic + "," + elink + "," + ehrule + "," + eimage + ")\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"Help\" onClick=\"xhelp('" + einme + "'," + epara + "," + ebr + "," + ebold + "," + eitalic + "," + elink + "," + ehrule + "," + eimage + ")\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (dmode == 1){
document.write("<input type=\"button\" value=\"About\" onClick=\"xabout('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"About\" onClick=\"xabout('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
document.write("<\/p>\r");
if (ehead != 0 || epara != 0 || ebr != 0 || ebold != 0 || eitalic != 0 || elink != 0 || ehrule != 0 || eimage != 0 || elist != 0){
document.write("<p>\r");
}
if (ehead != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"Heading\" onClick=\"xhead('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"Heading\" onClick=\"xhead('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (epara != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"&lt;p&gt;\" onClick=\"xpara('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"&lt;p&gt;\" onClick=\"xpara('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (ebr != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"&lt;br&gt;\" onClick=\"xbr('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"&lt;br&gt;\" onClick=\"xbr('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (ebold != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"&lt;b&gt;\" onClick=\"xbold('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"&lt;b&gt;\" onClick=\"xbold('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (eitalic != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"&lt;i&gt;\" onClick=\"xitalic('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"&lt;i&gt;\" onClick=\"xitalic('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (elink != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"&lt;a&gt;\" onClick=\"xlink('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"&lt;a&gt;\" onClick=\"xlink('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (ehrule != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"&lt;hr&gt;\" onClick=\"xhrule('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"&lt;hr&gt;\" onClick=\"xhrule('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (eimage != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"&lt;img&gt;\" onClick=\"ximage('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"&lt;img&gt;\" onClick=\"ximage('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (elist != 0){
if (dmode == 1){
document.write("<input type=\"button\" value=\"List\" onClick=\"xlist('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\" \/>\r");
}
else {
document.write("<input type=\"button\" value=\"List\" onClick=\"xlist('" + einme + "')\" id=\"button\" name=\"button\" class=\"" + cscls + "\">\r");
}
}
if (ehead != 0 || epara != 0 || ebr != 0 || ebold != 0 || eitalic != 0 || elink != 0 || ehrule != 0 || eimage != 0 || elist != 0){
document.write("<\/p>\r");
}
}

// Preview

function xprev(einme){
var cnt = document.getElementById(einme).value;
var pvwin=window.open("","pvwin");
if (dmode == 1){
pvwin.document.write("<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd\">\r");
}
else {
pvwin.document.write("<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01\/\/EN\" \"http:\/\/www.w3.org\/TR\/html4\/strict.dtd\">\r");
}
pvwin.document.write("<html>\r");
pvwin.document.write("<head>\r");
if (dmode == 1){
pvwin.document.write("<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=iso-8859-1\" \/>\r");
pvwin.document.write("<meta http-equiv=\"Content-Script-Type\" content=\"text\/javascript\" \/>\r");
}
else {
pvwin.document.write("<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=iso-8859-1\">\r");
pvwin.document.write("<meta http-equiv=\"Content-Script-Type\" content=\"text\/javascript\">\r");
}
pvwin.document.write("<title>Preview<\/title>\r");
pvwin.document.write("<!-- created with MyHTMLForm by Jonathan Feaster (http:\/\/www.archreality.com\/) -->\r");
pvwin.document.write("<\/head>\r");
pvwin.document.write("<body>\r");
pvwin.document.write(cnt + "\r");
pvwin.document.write("<\/body>\r");
pvwin.document.write("<\/html>\r");
return true;
}

// Help

function xhelp(einme, epara, ebr, ebold, eitalic, elink, ehrule, eimage) {
var dnme = "HTML 4.01 Strict";
var hitm = "";
if (dmode == 1){
dnme = "XHTML 1.0 Strict";
}

if (epara != 0){
hitm = hitm + "<p> = Paragraph\n";
}
if (ebr != 0){
hitm = hitm + "<br> = Break\n";
}
if (ebold != 0){
hitm = hitm + "<b> = Embolden\n";
}
if (eitalic != 0){
hitm = hitm + "<i> = Italicize\n";
}
if (elink != 0){
hitm = hitm + "<a> = Anchor Link\n";
}
if (ehrule != 0){
hitm = hitm + "<hr> = Horizontal Rule\n";
}
if (eimage != 0){
hitm = hitm + "<img> = Image";
}

alert("HELP:\n\nDoctype Mode: " + dnme + "\n\n" + hitm);
document.getElementById(einme).focus();
}

// About

function xabout(einme) {
alert("ABOUT MyHTMLForm:\n\nCopyright " + unescape("%A9") + " 2007 Jonathan Feaster\n(Archreality) all rights reserved.\n\nAuthor: Jonathan Feaster (Archreality)\nSite: http:\/\/www.archreality.com\/\nNotes: Conforms to the official HTML 4.01\nStrict DTD and the official XHTML 1.0 Strict DTD");
document.getElementById(einme).focus();
}

// Heading

function xhead(einme) {
var hlvl = 1;
var hcnt = "";
hlvl = prompt("Enter heading level (1-6):", hlvl);
if (hlvl == null || isNaN(hlvl) == true || hlvl <= 0 || hlvl > 6){
if (hlvl == null || isNaN(hlvl) == true || hlvl <= 0){
hlvl = 1;
}
else {
hlvl = 6;
}
}
hcnt = prompt("Enter heading text:", hcnt);
if (hcnt == null){
hcnt = "";
}
insertAtCursor(document.getElementById(einme), "<h" + hlvl + ">" + hcnt + "<\/h" + hlvl + ">");
document.getElementById(einme).focus();
}

// Paragraph

function xpara(einme) {
insertAtCursor(document.getElementById(einme), "<p>", "<\/p>");
document.getElementById(einme).focus();
}

// Break

function xbr(einme) {
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<br \/>");
}
else {
insertAtCursor(document.getElementById(einme), "<br>");
}
document.getElementById(einme).focus();
}

// Embolden

function xbold(einme) {
insertAtCursor(document.getElementById(einme), "<b>", "<\/b>");
document.getElementById(einme).focus();
}

// Italicize

function xitalic(einme) {
insertAtCursor(document.getElementById(einme), "<i>", "<\/i>");
document.getElementById(einme).focus();
}

// Anchor Link

function xlink(einme) {
var lurl = "";
lurl = prompt("Enter link URL:", "http:\/\/");
if (lurl == null){
lurl = "";
}
insertAtCursor(document.getElementById(einme), "<a href=\"" + richars(lurl) + "\">", "<\/a>");
document.getElementById(einme).focus();
}

// Horizontal Rule

function xhrule(einme) {
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<hr \/>");
}
else {
insertAtCursor(document.getElementById(einme), "<hr>");
}
document.getElementById(einme).focus();
}

// Image

function ximage(einme) {
var iloc = "";
var iurl = "";
var ialt = "";
var iw = "";
var ih = "";
var ilnk = confirm("Is this image a link?");
iloc = prompt("Enter image location:", "http:\/\/" + iloc);
if (iloc == null){
iloc = "";
}
iw = prompt("Enter image width:", iw);
if (iw == null || isNaN(iw) == true || iw <= 0){
iw = "";
}
ih = prompt("Enter image height:", ih);
if (ih == null || isNaN(ih) == true || ih <= 0){
ih = "";
}
ialt = prompt("Enter image alternate text:", iloc);
if (ialt == null){
ialt = "";
}

if (ilnk){
iurl = prompt("Enter image URL:", "http:\/\/", iloc);
if (iurl == null){
iurl = "";
}
if (iw == "" && ih == ""){
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<a href=\"" + richars(iurl) + "\"><img src=\"" + richars(iloc) + "\" alt=\"" + ialt + "\" style=\"border: none;\" \/><\/a>");
}
else {
insertAtCursor(document.getElementById(einme), "<a href=\"" + richars(iurl) + "\"><img src=\"" + richars(iloc) + "\" alt=\"" + ialt + "\" style=\"border: none;\"><\/a>");
}
document.getElementById(einme).focus();
}
else if (iw == "" && ih != ""){
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<a href=\"" + richars(iurl) + "\"><img src=\"" + richars(iloc) + "\" height=\"" + ih + "\" alt=\"" + ialt + "\" style=\"border: none;\" \/><\/a>");
}
else {
insertAtCursor(document.getElementById(einme), "<a href=\"" + richars(iurl) + "\"><img src=\"" + richars(iloc) + "\" height=\"" + ih + "\" alt=\"" + ialt + "\" style=\"border: none;\"><\/a>");
}
document.getElementById(einme).focus();
}
else if (ih == "" && iw != ""){
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<a href=\"" + richars(iurl) + "\"><img src=\"" + richars(iloc) + "\" width=\"" + iw + "\" alt=\"" + ialt + "\" style=\"border: none;\" \/><\/a>");
}
else {
insertAtCursor(document.getElementById(einme), "<a href=\"" + richars(iurl) + "\"><img src=\"" + richars(iloc) + "\" width=\"" + iw + "\" alt=\"" + ialt + "\" style=\"border: none;\"><\/a>");
}
document.getElementById(einme).focus();
}
else {
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<a href=\"" + richars(iurl) + "\"><img src=\"" + richars(iloc) + "\" width=\"" + iw + "\" height=\"" + ih + "\" alt=\"" + ialt + "\" style=\"border: none;\" \/><\/a>");
}
else {
insertAtCursor(document.getElementById(einme), "<a href=\"" + richars(iurl) + "\"><img src=\"" + richars(iloc) + "\" width=\"" + iw + "\" height=\"" + ih + "\" alt=\"" + ialt + "\" style=\"border: none;\"><\/a>");
}
document.getElementById(einme).focus();
}
}

else {
if (iw == "" && ih == ""){
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<img src=\"" + richars(iloc) + "\" alt=\"" + ialt + "\" style=\"border: none;\" \/>");
}
else {
insertAtCursor(document.getElementById(einme), "<img src=\"" + richars(iloc) + "\" alt=\"" + ialt + "\" style=\"border: none;\">");
}
document.getElementById(einme).focus();
}
else if (iw == "" && ih != ""){
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<img src=\"" + richars(iloc) + "\" height=\"" + ih + "\" alt=\"" + ialt + "\" style=\"border: none;\" \/>");
}
else {
insertAtCursor(document.getElementById(einme), "<img src=\"" + richars(iloc) + "\" height=\"" + ih + "\" alt=\"" + ialt + "\" style=\"border: none;\">");
}
document.getElementById(einme).focus();
}
else if (ih == "" && iw != ""){
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<img src=\"" + richars(iloc) + "\" width=\"" + iw + "\" alt=\"" + ialt + "\" style=\"border: none;\" \/>");
}
else {
insertAtCursor(document.getElementById(einme), "<img src=\"" + richars(iloc) + "\" width=\"" + iw + "\" alt=\"" + ialt + "\" style=\"border: none;\">");
}
document.getElementById(einme).focus();
}
else {
if (dmode == 1){
insertAtCursor(document.getElementById(einme), "<img src=\"" + richars(iloc) + "\" width=\"" + iw + "\" height=\"" + ih + "\" alt=\"" + ialt + "\" style=\"border: none;\" \/>");
}
else {
insertAtCursor(document.getElementById(einme), "<img src=\"" + richars(iloc) + "\" width=\"" + iw + "\" height=\"" + ih + "\" alt=\"" + ialt + "\" style=\"border: none;\">");
}
document.getElementById(einme).focus();
}
}
}

// List

function xlist(einme) {
var lamt = 1;
var litm = "";
var list = "";
var iorl = confirm("Is this list an ordered list?");
lamt = prompt("How many items are in this list?", lamt);
if (lamt == null || isNaN(lamt) == true || lamt < 1){
lamt = 1;
}
if (lamt > lmax){
var clli = confirm("The number of items in this list (" + lamt + ") exceeds " + lmax + " items. Do you want to continue?");
}

if (lamt <= lmax || clli){
var i = 0;
for (i=1;i<=lamt;i++){
litm = prompt("Enter list item " + i + " of " + lamt + ":", "");
if (litm == null){
litm = "";
}
list = list + "<li>" + litm + "<\/li>\r"
}

if (iorl){
insertAtCursor(document.getElementById(einme), "<ol>\r" + list + "<\/ol>");
document.getElementById(einme).focus();
}

else {
insertAtCursor(document.getElementById(einme), "<ul>\r" + list + "<\/ul>");
document.getElementById(einme).focus();
}
}
else {
document.getElementById(einme).focus();
}
}

// -->