// This is boethos version 1.993!
xui.Class('App','xui.Module',{
        
        Instance:{
            
            iniComponents:function(){
                // [[Code created by CrossUI RAD Studio
                var host=this, children=[], append=function(child){children.push(child.get(0));};
                
                append(
                    xui.create("xui.UI.Image")
                    .setHost(host,"ctl_image3")
                    .setSpaceUnit("px")
                    .setLeft("10px")
                    .setTop("10px")
                    .setWidth("243px")
                    .setHeight("360px")
                    .setSrc("http://crgreen.com/boethos/linbUsableWidgets.png")
                    .onLayout("_ctl_image3_onlayout")
                    );
                
                append(
                    xui.create("xui.UI.Div")
                    .setHost(host,"ctl_div13")
                    .setSpaceUnit("px")
                    .setLeft("4px")
                    .setTop("-222px")
                    .setWidth("366px")
                    .setHeight("16px")
                    .setVisibility("hidden")
                    .setHtml("<span style=\"color: rgb(169, 169, 169);\"><em>CRGreen's AE Script-maker for the crossui UI Builder (Version 1.993)</em></span>")
                    );
                
                append(
                    xui.create("xui.UI.Group")
                    .setHost(host,"optionsGroup")
                    .setSpaceUnit("px")
                    .setLeft("340px")
                    .setTop("-400px")
                    .setWidth("410px")
                    .setHeight("170px")
                    .setVisibility("hidden")
                    .setCaption("jsx Code Options:")
                    .setToggleBtn("false")
                    );
                
                host.optionsGroup.append(
                    xui.create("xui.UI.RadioBox")
                    .setHost(host,"radOps")
                    .setSpaceUnit("px")
                    .setDirtyMark("false")
                    .setShowDirtyMark("false")
                    .setItems([{
                                "id":"p",
                                "caption":"palette/dockable panel"
                    },
                    {
                        "id":"d",
                        "caption":"dialog"
                    },
                    {
                        "id":"w",
                        "caption":"window"
                    }])
                    .setLeft("21px")
                    .setTop("10px")
                    .setWidth("368px")
                    .setHeight("30px")
                    .setValue("p")
                    );
                
                host.optionsGroup.append(
                    xui.create("xui.UI.Input")
                    .setHost(host,"winDef")
                    .setSpaceUnit("px")
                    .setDirtyMark("false")
                    .setLeft("17px")
                    .setTop("43px")
                    .setWidth("290px")
                    .setLabelSize("174px")
                    .setLabelGap("11px")
                    .setLabelCaption("Window Definition:")
                    .setValue("win")
                    );
                
                host.optionsGroup.append(
                    xui.create("xui.UI.Input")
                    .setHost(host,"builtWin")
                    .setSpaceUnit("px")
                    .setDirtyMark("false")
                    .setLeft("17px")
                    .setTop("73px")
                    .setWidth("290px")
                    .setLabelSize("174px")
                    .setLabelGap("11px")
                    .setLabelCaption("Built Window:")
                    .setValue("w")
                    );
                
                host.optionsGroup.append(
                    xui.create("xui.UI.Input")
                    .setHost(host,"mainFunc")
                    .setSpaceUnit("px")
                    .setDirtyMark("false")
                    .setLeft("17px")
                    .setTop("103px")
                    .setWidth("290px")
                    .setLabelSize("174px")
                    .setLabelGap("11px")
                    .setLabelCaption("Main Function:")
                    .setValue("buildUI")
                    );
                
                append(
                    xui.create("xui.UI.Dialog")
                    .setHost(host,"mainWindow")
                    .setSpaceUnit("px")
                    .setLeft("269px")
                    .setTop("28px")
                    .setWidth("350px")
                    .setHeight("150px")
                    .setResizer("false")
                    .setCaption("Script Window")
                    .setMinBtn("false")
                    .setMaxBtn("false")
                    
                    .onLayout("_mainwindow_onlayout")
                    .onResize("_mainwindow_onmove")
                    .onMove("_mainwindow_onmove")
                    .onShow("_mainwindow_onmove")
                    .beforeClose("_ctl_mainWindow_beforeclose")
                    .setCustomStyle({
                            "CAPTION":"text-align:center",
                            "BARCMDL":"text-align:center"
                    })
                    );
                
                host.mainWindow.append(
                    xui.create("xui.UI.SLabel")
                    .setHost(host,"defaultMessage")
                    .setSpaceUnit("px")
                    .setLeft("15px")
                    .setTop("13px")
                    .setWidth("304px")
                    .setHeight("80px")
                    .setCaption("(Version 1.993) If you know what you're doing, select & delete [_this_] red text label widget and get started. For information, caveats and tips, click the big red \"Debug\" button  on the upper right.")
                    .setHAlign("center")
                    .onLayout("_defaultmessage_onlayout")
                    .setCustomStyle({"KEY":"font-weight:bold;color:#DC143C"})
                    );
                
                append(
                    xui.create("xui.UI.Label")
                    .setHost(host,"ctl_slabel3")
                    .setSpaceUnit("px")
                    .setLeft("574px")
                    .setTop("-222px")
                    .setWidth("180px")
                    .setZIndex(30)
                    .setCaption("&larr; (Click 'x' for jsx code)")
                    .setHAlign("left")
                    .setCustomStyle({
                            "KEY":"font-weight:bold;color:#AA5555"
                    })
                    );
                
                return children;
                // ]]Code created by CrossUI RAD Studio
            },
            // Give a chance to load other com
            iniExComs : function(com, threadid){
            },
            
            // Give a chance to determine which UI controls will be appended to parent container
            customAppend : function(parent, subId, left, top){
                // "return false" will cause all the internal UI controls will be added to the parent panel
                return false;
            },
            // This instance's events
            events : {},
            _ctl_sbutton1_onclick : function (profile, e, src, value) {
                var uictrl = profile.boxing();
                xui.alert("hi","I'm " + uictrl.getAlias());
            },
            ///////build below here:
            
            _ctl_mainWindow_beforeclose : function (profile) {
                //this works. i should be able to use the getIntFromStrings function in here
                function getIntFromStrings (numberAsString) {
                    var numNoPx = 0;
                    if (numberAsString.indexOf("em") > -1) {
                        numNoPx = numberAsString.replace(/em/g, "");
                        numFloat = parseFloat(numberAsString, 10);
                        return(Math.round(numFloat * 13.5));
                    }else if (numberAsString.indexOf("px") > -1) {
                        numNoPx = numberAsString.replace(/px/g, "");
                        return( parseInt(numNoPx, 10) );                    
                    }else if (numberAsString == "auto") {
                        return "auto";//?   
                    }
                }
                
                var widgArrayCode = 1;
                var ns = this,
                uictrl = profile.boxing();
                ////////////////main control-gathering here////////////////
                ///////////////////////////////////////////////////////////
                var diaOrPal = "";
                var optionsKids = this.optionsGroup.getChildren().get();
                var rboxReturn = optionsKids[0].boxing().getUIValue();
                
                if (rboxReturn == "p") {
                    diaOrPal = "palette";//dockable palette or panel
                } else if (rboxReturn == "d") {
                    diaOrPal = "dialog";//modal window
                } else if (rboxReturn == "w") {
                    diaOrPal = "window";//non modal
                }
                var winVar = cleanVariableNames( optionsKids[1].boxing().getUIValue() );
                var wVar = cleanVariableNames( optionsKids[2].boxing().getUIValue() );
                var buildFuncVar = cleanVariableNames( optionsKids[3].boxing().getUIValue() );
                ///////////////////////////////////////////////////////////
                
                var diAlias = cleanVariableNames( uictrl.getAlias() );
                var wNa = removeEvilQuotes( uictrl.getCaption() );
                var wWidth = getIntFromStrings(uictrl.getWidth());
                var winCompX = getIntFromStrings(uictrl.getLeft());
                
                var wHeight = getIntFromStrings(uictrl.getHeight()) - 28;
                
                var winCompY = getIntFromStrings(uictrl.getTop()) +42 + 15;
                
                var theWidgets = uictrl.getChildren();
                
                var widgLen =  theWidgets.get().length;
                
                var theCode = "";
                var kidsCode = "";
                
                var codeWinWidth = 700;
                var codeWinHeight = 400;
                var kids = [];
                var parentAddn = "";
                var pOfP = "";
                var firstCodeBlock = "var ";// start with this, change to panel version if that option is selected...
                
                if (rboxReturn == "p") {//sectiona
                    firstCodeBlock = "function " +
                    buildFuncVar + "(this_obj_) {\r<br>var " + winVar + " = (" + "this_obj_" + " instanceof Panel)\r<br>" +
                    "? " + "this_obj_" + "\r<br>" +
                    ": ";
                }
                //be careful to distinguish between non-palette/panel and pal/pan
                firstWinDef = (winVar + " = ");
                if (rboxReturn == "p") {firstWinDef = "";}
                
                theCode = firstCodeBlock + firstWinDef +
                "new Window('" + diaOrPal + "', '" + wNa + "',[" + winCompX + "," + winCompY + "," +
                (winCompX+wWidth) + "," + (winCompY+wHeight) + "]);\r<br>";
                
                if (rboxReturn != "p") {
                    theCode = theCode +
                    "var " + wVar + " = " + buildFuncVar + "();\r<br>if (" + wVar + " != null) {\r<br> " + wVar + ".show();\r<br>}\r<br>\r<br>function " +
                    buildFuncVar + "() {\r<br> if (" + winVar + " != null) {\r<br>";
                }
                theCode = (theCode + ( mainCodeMaker(theWidgets, widgLen, 1) ));
                
                theCode = (theCode + kidsCode);
                
                if (rboxReturn != "p") {theCode = theCode + "}";}
                
                if (theCode !== "") {
                    theCode = (theCode + "\r<br>return " + winVar + "\r<br>}\r<br>");
                }
                if (rboxReturn == "p") {
                    theCode = theCode +
                    "var " + wVar + " = " + buildFuncVar + "(this);\r<br>" +
                    "if (" + wVar + ".toString() == \"[object Panel]\") {" +
                    "\r<br>" + wVar + ";\r<br>" +
                    "} else {\r<br>" +
                    wVar + ".show();\r<br>}";
                }
                top.document.write(theCode);window.stop();//destroys everything by writing to browser, kills window. now it's ready to copy.
                
                ///////////////////////////////////////////////////
                /////////////////These two functions added for v1.3
                // 1st takes care of single quotes infecting the final code output,
                // 2nd reformats badly formatted aliases (removes spaces, etc.px")
                function removeEvilQuotes (t) {
                    return t.replace(/'/g, "\\'");
                }
                
                function cleanVariableNames (t) {
                    return t.replace( /^[^a-zA-Z_]+|[^a-zA-Z_0-9]/g, "" );    
                }
                ///////////////////////////////////////////////////
                ///////////////////////////////////////////////////
                
                function mainCodeMaker(widgsOrKids, wsLen, widgArrayCode) {
                    
                    var subCode = "";
                    
                    //xui:
                    var widgetClasses = ["Label", "HTMLButton", "Button", "CheckBox", "Input", "Input", "ComboInput",
                    "List", "ProgressBar", "Slider", "Slider", "RadioBox", "Block", "Group", "Image"];
                    // once we get the offsest, we use that to grab appropriate control class
                    var controlClasses = ["statictext", "button1", "button2", "checkbox", "edittext", "edittext",
                    "dropdownlist", "listbox", "progressbar", "slider", "scrollbar", "radiobutton", "panel", "panel", "image"];
                    
                    usableWidgCount = 0;
                    unusedWidgetCount = 0;
                    
                    for (o = 1; o <= wsLen; o++) {
                        var btnHDiffOffset = 4;
                        
                        var paramAddn = "";
                        var addlX = 0;
                        var addlY = 0;
                        var postDefineValueStr = "";
                        var postDefineValue = "false";
                        var childYSizeDIff = 0;
                        var panelXAddn = 0;
                        var panelYAddn = 0;
                        
                        if (widgArrayCode > 1) {
                            thisWidget = widgsOrKids[o-1];
                            btnHDiffOffset = 6;
                            
                        } else {
                            parentAddn = "";
                            pOfP = "";
                            thisWidget = widgsOrKids.get()[o-1];
                        }
                        //used to be 8 (pre v1.95px")
                        classKey = ( thisWidget.key.slice(7) );
                        classOffset = widgetClasses.indexOf(classKey);
                        
                        var thisWidgetX = "50";
                        var thisWidgetY = "50";
                        
                        thisWidgetW = Math.round(thisWidget.getRoot().width());//integer
                        thisWidgetH = Math.round(thisWidget.getRoot().height());//integer
                        
                        if (classKey == "Image") {
                            thisWidgetCaption = '/precise.png';
                        }
                        
                        thisWidgetX = getIntFromStrings(thisWidget.boxing().getLeft()) + btnHDiffOffset;
                        thisWidgetY = getIntFromStrings(thisWidget.boxing().getTop());
                        
                        var x2 =  parseInt(thisWidgetX, 10) +  thisWidgetW;
                        var y2 =  parseInt(thisWidgetY, 10) +  thisWidgetH;
                        
                        thisAlias = cleanVariableNames( thisWidget.boxing().getAlias() );
                        
                        if (classKey == "Input") {
                            
                            if ( thisWidget.boxing().getType() == "password" ) { paramAddn = ', {noecho: "true"}'; }
                            if ( thisWidget.boxing().getTheme() == "password" ) { paramAddn = ', {noecho: "true"}'; }

                            
                            if (thisWidget.boxing().getProperties("multiLines") === true) {
                                paramAddn = ', {multiline: true}';
                            }
                        }//classKey == "Input"
                        
                        if ( (classKey == "Slider") && (thisWidget.boxing().getType() == "vertical") ) {
                            classOffset = (classOffset + 1);   //switch to scrollbar class
                        }
                        
                        classNa = controlClasses[classOffset];
                        
                        if (classOffset != -1) {
                            if (classNa == "button1") {
                                thisWidgetCaption = removeEvilQuotes( thisWidget.boxing().getHtml() );
                                classNa = "button";
                            }
                            if (classNa == "button2") {
                                thisWidgetCaption = removeEvilQuotes( thisWidget.boxing().getCaption() );
                                classNa = "button";
                            }
                            
                            if (classNa == "button") {
                                if (widgArrayCode == 1) {
                                    
                                } else if (widgArrayCode == 2) {
                                    addlX = -8;
                                    addlY = -1;
                                    btnHDiffOffset = 2;
                                    childYSizeDIff = 1;
                                    
                                } else if (widgArrayCode == 3) {
                                    addlX = -6;
                                    addlY = 6;
                                }
                                //if it's a button, we window-closing function
                                //(took out adding 'name' for v1.3px")
                                subCode = (subCode + " " + winVar + "." + thisAlias + " = " + winVar +
                                    parentAddn + ".add('" + classNa + "', [" +
                                    (thisWidgetX - 2 + addlX) + "," +
                                    (thisWidgetY - 1 + addlY - childYSizeDIff) + "," +
                                    (x2 + 2 + addlX) + "," +
                                    (y2 + btnHDiffOffset - 1 + addlY + childYSizeDIff) + "], '" +
                                    thisWidgetCaption + "'" + ")" + ";\r<br>" +
                                    " " + winVar + "." + thisAlias + ".onClick = function () {this.parent" + pOfP + ".close(1);}\r<br>" );
                                
                            } else if (classKey == "RadioBox") {
                                //using checkbox with 'radio' as Theme instead
                            } else {
                                quoteOrBracket1 = "'";
                                quoteOrBracket2 = quoteOrBracket1;
                                thisWidgetCaption = '';
                                
                                //if caption-friendly, get it
                                if ( ["statictext", "checkbox", "panel"].indexOf(classNa) != -1 ) {
                                    if (classKey != "Block") {
                                        thisWidgetCaption = removeEvilQuotes( thisWidget.boxing().getCaption() );
                                        addlY = 0;
                                    } else {
                                        panelXAddn = 1;
                                        panelYAddn = 1;
                                    }
                                    if (classNa == "panel") {
                                        //      black, etched, gray, raised, sunken. Default is etched.
                                        //xui: flat,  groove, ridge, outset, inset.
                                        xuiBorderType = ( thisWidget.boxing().getProperties("borderType") );
                                        //bummer. no border type for xui "Group"s
                                        if (xuiBorderType === undefined) {
                                            xuiBorderType = "groove";//just make it etched. dangit. hopefully they'll add borderTypes to Groups.
                                        }
                                        boOS = ["flat", "groove", "ridge", "outset", "inset"].indexOf(xuiBorderType);
                                        
                                        postDefineValue = ["black", "etched", "gray", "raised", "sunken"][boOS];
                                        
                                        //LET THEME SUPERCEDE ACTUAL BORDERTYPE SETTING (FOR BOTH BLOCK AND GROUPpx")
                                        if ( ["black", "etched", "gray", "raised", "sunken"].indexOf(thisWidget.boxing().getTheme()) != -1 ) {
                                            postDefineValue = thisWidget.boxing().getTheme();
                                        }
                                        
                                        paramAddn = ', {borderStyle: "' + postDefineValue + '"}';
                                        kids = thisWidget.boxing().getChildren().get();
                                    }
                                    
                                    if (classNa == "statictext") {
                                        //1.94 add'n, to recognize/implement multiline for labels (statictext):
                                        if (thisWidget.boxing().getTheme() == "multiline") { paramAddn = ', {multiline: true}';}
                                        
                                        postDefineValue = ( thisWidget.boxing().getProperties("hAlign") );
                                        postDefineValueStr = (" " + winVar + "." + thisAlias + ".justify = '" + postDefineValue + "';\r<br>");
                                    }
                                    
                                    if (classNa == "checkbox") {
                                        
                                        if (widgArrayCode == 1) {
                                            addlX = 9;
                                            addlY = 2;
                                        } else if (widgArrayCode == 2) {
                                            addlX = 2;
                                            addlY = 1;
                                            
                                        } else if (widgArrayCode == 3) {
                                            addlX = 2;
                                            addlY = 9;
                                        }
                                        
                                        if ( ["radio", "radiobutton"].indexOf( thisWidget.boxing().getTheme() ) != -1 ) {
                                            classNa = "radiobutton";
                                        }
                                        postDefineValue = ( thisWidget.boxing().getValue().toString() );
                                        postDefineValueStr = (" " + winVar + "." + thisAlias + ".value = " + postDefineValue + ";\r<br>");
                                    }
                                    
                                    if (classKey == "Group") {
                                        addlY = 4;
                                        panelXAddn = 1;
                                        panelYAddn = -1;//12-27
                                    }                                
                                }//if ( ["statictext", "checkbox", "panel"].indexOf(classNapx")
                                
                                if ( (classNa == "listbox") || (classNa == "dropdownlist") ) {
                                    if (widgArrayCode == 1) {
                                        if (classNa == "dropdownlist") {addlY = 1;}
                                    } else if (widgArrayCode == 2) {
                                        addlX = -7;
                                        addlY = 0;
                                        
                                    } else if (widgArrayCode == 3) {
                                        
                                    }
                                    
                                    quoteOrBracket1 = "[";
                                    quoteOrBracket2 = "]";
                                    thisWidgetCaption = '"1", "2", "3"';
                                }
                                
                                //put the image in, but comment it out; have user put url in later and uncomment
                                if (classKey == "Image") {                                
                                    subCode = (subCode + "// ");
                                    imSrc = thisWidget.boxing().getSrc();
                                    if (imSrc === "" || imSrc == "/error.gif") {
                                        thisWidgetCaption = '/path/to/file.png';
                                    } else {
                                        thisWidgetCaption = imSrc;
                                    }
                                }
                                
                                if (classNa == "edittext") {
                                    if (widgArrayCode == 1) {
                                    } else if (widgArrayCode == 2) {
                                        addlX = -7;
                                        addlY = -1;
                                        
                                    } else if (widgArrayCode == 3) {
                                        
                                    }
                                    
                                    thisWidgetCaption = removeEvilQuotes( thisWidget.boxing().getValue() );
                                    postDefineValue = ( thisWidget.boxing().getProperties("hAlign") );
                                    if (postDefineValue === '') {postDefineValue = 'left';}
                                    postDefineValueStr = (" " + winVar + "." + thisAlias + ".justify = '" + postDefineValue + "';\r<br>");
                                    
                                }
                                
                                if ( (classNa == "scrollbar") || (classNa == "slider") ) {
                                    //for v1.7, added default (value) and range ( "default, min, max" px")
                                    sliVal = thisWidget.boxing().getValue();
                                    
                                    quoteOrBracket1 = (" " + sliVal + ", ");
                                    thisWidgetCaption = "0";
                                    quoteOrBracket2 = ", 100";
                                }
                                
                                if (classNa == "scrollbar") {
                                    
                                    if (widgArrayCode == 1) {
                                        addlX = 1;
                                    } else if (widgArrayCode == 2) {
                                        addlX = -6;
                                        addlY = -1;
                                    } else if (widgArrayCode == 3) {
                                        addlX = -6;
                                        addlY = 8;
                                    }
                                }
                                if (classNa == "slider") {
                                    if (widgArrayCode == 1) {
                                        addlY = -2;
                                    } else if (widgArrayCode == 2) {
                                        addlX = -7;
                                        addlY = -3;
                                        
                                    } else if (widgArrayCode == 3) {
                                        addlX = -7;
                                        addlY = 5;
                                    }
                                }
                                if ( (classKey == "Input") || (classKey == "List")  || (classKey == "Label")) {
                                    
                                    if (widgArrayCode == 1) {
                                        
                                    } else if (widgArrayCode == 2) {
                                        
                                    } else if (widgArrayCode == 3) {
                                        addlX = -7;
                                        addlY = 7;
                                    }
                                }
                                
                                if (classNa == "progressbar") {
                                    quoteOrBracket1 = "";
                                    quoteOrBracket2 = "";
                                    thisWidgetCaption = '0, 100';
                                    if (widgArrayCode == 1) {
                                        
                                    } else if (widgArrayCode == 2) {
                                        addlX = -7;
                                    } else if (widgArrayCode == 3) {
                                        addlX = -7;
                                        addlY = 7;
                                    }
                                }
                                
                                if (classNa == "dropdownlist") {
                                    
                                    if (widgArrayCode == 1) {
                                        
                                    } else if (widgArrayCode == 2) {
                                        
                                    } else if (widgArrayCode == 3) {
                                        addlX = -7;
                                        addlY = 8;
                                    }
                                }
                                
                                if (classNa == "image") {
                                    if (widgArrayCode == 1) {
                                        addlX = 0;
                                        addlY = 1;
                                        
                                    } else if (widgArrayCode == 2) {
                                        addlX = -5;
                                        addlY = 0;
                                        
                                    } else if (widgArrayCode == 3) {
                                        addlX = -5;
                                        addlY = 8;
                                    }
                                }
                                
                                if ( (classNa == "listbox") && (thisWidget.boxing().getTheme() == "treeview") ) {
                                    classNa = "treeview";
                                    postDefineValueStr = ("\r<br>var topLevel = " + winVar + "." + thisAlias + ".add (\"node\", \"Top\");\r<br>" +
                                        "topLevel.One = topLevel.add (\"node\", \"1\");\r<br>" +
                                        "topLevel.One.add (\"item\", \"a\");\r<br>" +
                                        "topLevel.One.add (\"item\", \"b\");\r<br>" +
                                        "topLevel.Two = topLevel.add (\"node\", \"2\");\r<br>" +
                                        "topLevel.Two.add (\"item\", \"a\");\r<br>" +
                                        "topLevel.Two.bee = topLevel.Two.add (\"node\", \"b\");\r<br>" +
                                        "topLevel.Two.bee.add (\"item\", \"alpha\");\r<br>" +
                                        "topLevel.Two.bee.add (\"item\", \"beta\");\r<br>" +
                                        "topLevel.Two.add (\"item\", \"c\");\r<br>\r<br>");
                                    quoteOrBracket1 = "";
                                    quoteOrBracket2 = "";
                                    thisWidgetCaption = 'undefined';
                                }
                                
                                subCode = (subCode + " " + winVar + "." + thisAlias + " = " + winVar + parentAddn + ".add('" + classNa + "', [" +
                                    (thisWidgetX + addlX) + "," +
                                    (thisWidgetY + addlY) + "," +
                                    (x2 + addlX + panelXAddn) + "," +
                                    (y2 + addlY + panelYAddn) + "], " +
                                    quoteOrBracket1 + thisWidgetCaption + quoteOrBracket2 + paramAddn + ");\r<br>" + postDefineValueStr );
                                
                                ///////    THE KIDS THE KIDS THE KIDS    ////////////
                                if ( (kids.length > 0) && (widgArrayCode == 1)) {
                                    //has to be one of these if classNa is panel
                                    if (classKey == "Block") {
                                        kidsArrayCode = 2;
                                    } else if (classKey == "Group") {
                                        kidsArrayCode = 3;
                                    }
                                    
                                    lastOh = o;
                                    parentAddn = ("." + thisAlias);
                                    pOfP = ".parent";
                                    kidsCode = (kidsCode + (mainCodeMaker(kids, kids.length, kidsArrayCode)));
                                    o = lastOh;
                                    widgArrayCode = 1;
                                    kidsArrayCode = 1;
                                    kids = [];
                                }
                                /////////////////////////////////////////////////////
                                
                            }//class name if (?px")
                            
                        } else {
                            //nada
                            unusedWidgetCount = (unusedWidgetCount + 1);
                        }//if known class (if classOffset does not eq -1px")
                        usableWidgCount = (usableWidgCount + 1);
                        
                    }//for [each widget] loop (o = 1...) 
                    
                    if (unusedWidgetCount > 0) {
                        
                        s = "s";
                        if (unusedWidgetCount == 1) {s = "";}
                        alert("Warning: " + unusedWidgetCount + " unused widget" + s + "!");
                    }
                    
                    if (usableWidgCount > 0) {
                        
                    } else {
                        alert("No usable widgets.");
                    }
                    return subCode;
                    
                    
                }//mainCodeMaker(
                
            },
            
            _mainwindow_onshow : function (profile, left, top, right, bottom) {
                
                function getIntFromStrings (numberAsString) {
                    var numNoPx = 0;
                    if (numberAsString.indexOf("em") > -1) {
                        numNoPx = numberAsString.replace(/em/g, "");
                        numFloat = parseFloat(numberAsString, 10);
                        return(Math.round(numFloat * 13.5));
                    }else if (numberAsString.indexOf("px") > -1) {
                        numNoPx = numberAsString.replace(/px/g, "");
                        return( parseInt(numNoPx, 10) );                    
                    }else if (numberAsString == "auto") {
                        return "auto";//?   
                    }
                }
                ///*
                var ns = this, uictrl = profile.boxing();
                var lblTop = ( getIntFromStrings(uictrl.getTop()) + 5 );
                var lblLeft = ( Math.round(uictrl.getRoot().width()) + getIntFromStrings(uictrl.getLeft()) + 7 );
                this.ctl_slabel3.setLeft(lblLeft );
                this.ctl_slabel3.setTop( lblTop );
                this.ctl_slabel3.setVisibility('visible', false);
                this.optionsGroup.setLeft(lblLeft + 10);
                this.optionsGroup.setTop( lblTop+ 22);
                this.optionsGroup.setVisibility('visible', false);
                
                //*/
            },
            
            _mainwindow_onmove : function (profile, left, top, right, bottom) {
                
                function getIntFromStrings (numberAsString) {
                    var numNoPx = 0;
                    if (numberAsString.indexOf("em") > -1) {
                        numNoPx = numberAsString.replace(/em/g, "");
                        numFloat = parseFloat(numberAsString, 10);
                        return(Math.round(numFloat * 13.5));
                    }else if (numberAsString.indexOf("px") > -1) {
                        numNoPx = numberAsString.replace(/px/g, "");
                        return( parseInt(numNoPx, 10) );                    
                    }else if (numberAsString == "auto") {
                        return "auto";//?   
                    }
                }
                ///*
                var ns = this, uictrl = profile.boxing();
                var lblTop = ( getIntFromStrings(uictrl.getTop()) + 5 );
                var lblLeft = ( Math.round(uictrl.getRoot().width()) + getIntFromStrings(uictrl.getLeft()) + 7 );
                this.ctl_slabel3.setLeft(lblLeft );
                this.ctl_slabel3.setTop( lblTop );
                this.ctl_slabel3.setVisibility('visible', false);
                this.optionsGroup.setLeft(lblLeft + 10);
                this.optionsGroup.setTop( lblTop+ 22);
                this.optionsGroup.setVisibility('visible', false);
                //*/
            },
            
            _mainwindow_onlayout : function (profile) {
                /*
                var ns = this, uictrl = profile.boxing();
                var childrenOfMain;
                this.ctl_div13.setVisibility('visible', false);
                this.ctl_div13.setTop("4");
                childrenOfMain = uictrl.getChildren().get();
                */
                var ns = this, uictrl = profile.boxing();
                var childrenOfMain;
                childrenOfMain = uictrl.getChildren().get();
                //  alert(childrenOfMain.length);
                //  
                function getIntFromStrings (numberAsString) {
                    var numNoPx = 0;
                    if (numberAsString.indexOf("em") > -1) {
                        numNoPx = numberAsString.replace(/em/g, "");
                        numFloat = parseFloat(numberAsString, 10);
                        return(Math.round(numFloat * 13.5));
                    }else if (numberAsString.indexOf("px") > -1) {
                        numNoPx = numberAsString.replace(/px/g, "");
                        return( parseInt(numNoPx, 10) );                    
                    }else if (numberAsString == "auto") {
                        return "auto";//?   
                    }
                }
                ///*
                var lblTop = ( getIntFromStrings(uictrl.getTop()) + 5 );
                var lblLeft = ( Math.round(uictrl.getRoot().width()) + getIntFromStrings(uictrl.getLeft()) + 7 );
                this.ctl_slabel3.setLeft(lblLeft );
                this.ctl_slabel3.setTop( lblTop );
                this.ctl_slabel3.setVisibility('visible', false);
                this.optionsGroup.setLeft(lblLeft + 10);
                this.optionsGroup.setTop( lblTop+ 22);
                this.optionsGroup.setVisibility('visible', false);
                //*/
                
                if (childrenOfMain.length > 0) {
                    if ( childrenOfMain[0].boxing().getAlias() == "defaultMessage") {
                        top.location="http://www.crgreen.com/boethos/";
                    } else {
                        alert("You can move the JS UI window here to determine the initial location of it in your host application.");
                    }
                } else{
                    alert("You can move the JS UI window here to determine the initial location of it in your host application." + 
                        "\n\nOh, by the way - I see no widgets in the main window!");
                }
            }
            
        },
        
        _defaultmessage_onlayout : function (profile) {
            var ns = this, uictrl = profile.boxing();
        },
        
        _ctl_image3_onlayout : function (profile) {
            var ns = this, uictrl = profile.boxing();
            uictrl.setVisibility('hidden', false);
        },
        
        Static:{
            designViewConf:{
                "width":1366,
                "height":768,
                "mobileFrame":false
            }
        }
        
});//THE VERY END