/*
 * Author       : lozc
 * Generated on : 23-Nov-2009 06:10:15
 * Version      : 3.0
 */
application "Zyndafeed v0.01"
{
    type = public
    allow html = true
    date format = "dd-MMM-yyyy"
    time zone = "America/Los_Angeles"
    section Main
    {
        form  Welcome
        {
            
            welcome_display
            (
                type  =  plaintext
            )

            actions
            {
                on add
                {
                    on load
                    {
                        // $Id$
                        // $Date$
                        // $Revision$
                        // $HeadURL$
                        // $Author$
                        logging = true;
                        input.welcome_display = (((((((("<table cellpadding='10' border='0'><tr><td style='background-color: #bcf;border:dashed 1px #63f;'") + " valign='top'><p style='color:#006'>") + "Zyndafeed lets you manage your <a href='http://www.syndafeed.com'>Syndafeed</a> <a href='http://www.syndafeed.com/display.php?id=0001&title=What%20You%20Get&newcnt=1'>real estate listings</a> with Zoho Creator.  ") + "<p style='color:#006'>To get started with Zyndafeed, <strong>Create</strong> some listings and <strong>Publish</strong> them.") + "  Your latest feed is always available at the URL linked to in the <strong>Feed</strong> area.</p>") + "</td>") + "<td valign='top'><h3 align='center'>Zyndafeed</h3><br/>") + "<h3 align='center'>v0.01</h3><p align='center'>pete at <a href='http://landofzohocreator.com'>LoZC</a></p></td>") + "</tr></table>";
                        if (logging  &&  (zoho.loginuser  !=  zoho.adminuser))
                        {
                            app = "Zyndafeed";
                            // REPLACE value with name of this application.
                            frm = "Welcome";
                            // REPLACE value with the name of this form.
                            usr = zoho.loginuser;
                            // The username of the current ZC user.
                            tst = zoho.currenttime.toLong();
                            // A timestamp of the current time.
                            // Your logging app's form on load {} action can store this string any way it wants.
                            // See http://landofzohocreator.com/2007/07/23/when-guests-arrive/ for an example.
                            log_entry = "Entry String : " + "App" + "|" + app + "*" + "Form" + "|" + frm + "*" + "User" + "|" + usr + "*" + "Time" + "|" + tst;
                            sendmail
                            (
                                To       :  "lozc-376@forms.zohocreator.com" 
                                From     :  zoho.adminuserid 
                                Subject  :  "Log Entry" 
                                Message  :  log_entry 
                            )
                        }
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        form  Feed
        {
            
            feed_display
            (
                type  =  plaintext
            )

            actions
            {
                on add
                {
                    on load
                    {
                        input.feed_display = "<p style='color:#006'>This page links to your current " + "<a href='http://creator.zoho.com/lozc/tsv/45/xYt9FDOaWJdmusDy40QjbQDBkn2rB8ZCBMRMqR2VtDkSWT6EKjtHCXpsBEOwUET8E1A0GqsBWjtqZEnHBA10G3kQ9atbAgmhFn7w/'>XML feed</a>.  Syndafeed can poll it to receive your latest updates.</p>";
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

    }

    section Create
    {
        form  create_help
        {
            displayname  =  "Help"
            
            help_display
            (
                type  =  plaintext
            )

            actions
            {
                on add
                {
                    on load
                    {
                        input.help_display = (((((("<table cellpadding='10' border='0'><tr><td style='background-color: #bcf;border:dashed 1px #63f;'") + " valign='top'><h3 style='color:#006' align='center'>Create listings</h3><p style='color:#006'><ol style='color:#006'><li>Add <em>New</em> listings</li>") + "<li>Complete them by filling out <em>Location</em>, <em>Attribute</em>, and <em>Seller Info</em></li>") + "</ol></td>") + "<td valign='top'><p align='center'>Zyndafeed</p><br/>") + "</td>") + "</tr></table>";
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        form  Essentials
        {
            displayname  =  "1. New"
            success message  =  "Essential info added."
            
            column
            {
                unique_id_display
                (
                    type  =  plaintext
                )

                must  have  title
                (
                    displayname  =  "Title"
                    type  =  text
                    on user input
                    {
                        input.listing_label = input.unique_id + ":" + input.title;
                    }
                )

                must  have  price
                (
                    displayname  =  "Price $"
                    type  =  USD
                    width  =  20
                )

                must  have  property_type
                (
                    displayname  =  "Property Type"
                    type  =  picklist
                    values  =  {"Single Family",   "Condominium",   "Duplex",   "Land",   "Commercial",   "Townhome"}
                    defaultvalue  =  "Single Family"
                )

                must  have  description
                (
                    displayname  =  "Description"
                    type  =  textarea
                )

                must  have  status
                (
                    displayname  =  "Status"
                    type  =  radiobuttons
                    values  =  {"incomplete",   "ready",   "published"}
                    defaultvalue  =  "incomplete"
                )

            }
            column
            {
                photos_total
                (
                    displayname  =  "Total photos to upload?"
                    type  =  picklist
                    values  =  {"1",   "2",   "3",   "4",   "5",   "6",   "7",   "8",   "9",   "10",   "11",   "12",   "13",   "14",   "15",   "16",   "17",   "18",   "19",   "20",   "21",   "22",   "23",   "24",   "25",   "26",   "27",   "28",   "29",   "30",   "31",   "32",   "33",   "34",   "35",   "36",   "37",   "38",   "39",   "40",   "41",   "42",   "43",   "44",   "45",   "46",   "47",   "48",   "49",   "50"}
                    defaultvalue  =  "1"
                    on user input
                    {
                        if (input.photos_total.toLong()  >  1)
                        {
                            show photo_2;
                        }
                        if (input.photos_total.toLong()  >  2)
                        {
                            show photo_3;
                        }
                        if (input.photos_total.toLong()  >  3)
                        {
                            show photo_4;
                        }
                        if (input.photos_total.toLong()  >  4)
                        {
                            show photo_5;
                        }
                        if (input.photos_total.toLong()  >  5)
                        {
                            show photo_6;
                        }
                        if (input.photos_total.toLong()  >  6)
                        {
                            show photo_7;
                        }
                        if (input.photos_total.toLong()  >  7)
                        {
                            show photo_8;
                        }
                        if (input.photos_total.toLong()  >  8)
                        {
                            show photo_9;
                        }
                        if (input.photos_total.toLong()  >  9)
                        {
                            show photo_10;
                        }
                        if (input.photos_total.toLong()  >  10)
                        {
                            show photo_11;
                        }
                        if (input.photos_total.toLong()  >  11)
                        {
                            show photo_12;
                        }
                        if (input.photos_total.toLong()  >  12)
                        {
                            show photo_13;
                        }
                        if (input.photos_total.toLong()  >  13)
                        {
                            show photo_14;
                        }
                        if (input.photos_total.toLong()  >  14)
                        {
                            show photo_15;
                        }
                        if (input.photos_total.toLong()  >  15)
                        {
                            show photo_16;
                        }
                        if (input.photos_total.toLong()  >  16)
                        {
                            show photo_17;
                        }
                        if (input.photos_total.toLong()  >  17)
                        {
                            show photo_18;
                        }
                        if (input.photos_total.toLong()  >  18)
                        {
                            show photo_19;
                        }
                        if (input.photos_total.toLong()  >  19)
                        {
                            show photo_20;
                        }
                        if (input.photos_total.toLong()  >  20)
                        {
                            show photo_21;
                        }
                        if (input.photos_total.toLong()  >  21)
                        {
                            show photo_22;
                        }
                        if (input.photos_total.toLong()  >  22)
                        {
                            show photo_23;
                        }
                        if (input.photos_total.toLong()  >  23)
                        {
                            show photo_24;
                        }
                        if (input.photos_total.toLong()  >  24)
                        {
                            show photo_25;
                        }
                        if (input.photos_total.toLong()  >  25)
                        {
                            show photo_26;
                        }
                        if (input.photos_total.toLong()  >  26)
                        {
                            show photo_27;
                        }
                        if (input.photos_total.toLong()  >  27)
                        {
                            show photo_28;
                        }
                        if (input.photos_total.toLong()  >  28)
                        {
                            show photo_29;
                        }
                        if (input.photos_total.toLong()  >  29)
                        {
                            show photo_30;
                        }
                        if (input.photos_total.toLong()  >  30)
                        {
                            show photo_31;
                        }
                        if (input.photos_total.toLong()  >  31)
                        {
                            show photo_32;
                        }
                        if (input.photos_total.toLong()  >  32)
                        {
                            show photo_33;
                        }
                        if (input.photos_total.toLong()  >  33)
                        {
                            show photo_34;
                        }
                        if (input.photos_total.toLong()  >  34)
                        {
                            show photo_35;
                        }
                        if (input.photos_total.toLong()  >  35)
                        {
                            show photo_36;
                        }
                        if (input.photos_total.toLong()  >  36)
                        {
                            show photo_37;
                        }
                        if (input.photos_total.toLong()  >  37)
                        {
                            show photo_38;
                        }
                        if (input.photos_total.toLong()  >  38)
                        {
                            show photo_39;
                        }
                        if (input.photos_total.toLong()  >  39)
                        {
                            show photo_40;
                        }
                        if (input.photos_total.toLong()  >  40)
                        {
                            show photo_41;
                        }
                        if (input.photos_total.toLong()  >  41)
                        {
                            show photo_42;
                        }
                        if (input.photos_total.toLong()  >  42)
                        {
                            show photo_43;
                        }
                        if (input.photos_total.toLong()  >  43)
                        {
                            show photo_44;
                        }
                        if (input.photos_total.toLong()  >  44)
                        {
                            show photo_45;
                        }
                        if (input.photos_total.toLong()  >  45)
                        {
                            show photo_46;
                        }
                        if (input.photos_total.toLong()  >  46)
                        {
                            show photo_47;
                        }
                        if (input.photos_total.toLong()  >  47)
                        {
                            show photo_48;
                        }
                        if (input.photos_total.toLong()  >  48)
                        {
                            show photo_49;
                        }
                        if (input.photos_total.toLong()  >  49)
                        {
                            show photo_50;
                        }
                        if (input.photos_total.toLong()  <  2)
                        {
                            hide photo_2;
                        }
                        if (input.photos_total.toLong()  <  3)
                        {
                            hide photo_3;
                        }
                        if (input.photos_total.toLong()  <  4)
                        {
                            hide photo_4;
                        }
                        if (input.photos_total.toLong()  <  5)
                        {
                            hide photo_5;
                        }
                        if (input.photos_total.toLong()  <  6)
                        {
                            hide photo_6;
                        }
                        if (input.photos_total.toLong()  <  7)
                        {
                            hide photo_7;
                        }
                        if (input.photos_total.toLong()  <  8)
                        {
                            hide photo_8;
                        }
                        if (input.photos_total.toLong()  <  9)
                        {
                            hide photo_9;
                        }
                        if (input.photos_total.toLong()  <  10)
                        {
                            hide photo_10;
                        }
                        if (input.photos_total.toLong()  <  11)
                        {
                            hide photo_11;
                        }
                        if (input.photos_total.toLong()  <  12)
                        {
                            hide photo_12;
                        }
                        if (input.photos_total.toLong()  <  13)
                        {
                            hide photo_13;
                        }
                        if (input.photos_total.toLong()  <  14)
                        {
                            hide photo_14;
                        }
                        if (input.photos_total.toLong()  <  15)
                        {
                            hide photo_15;
                        }
                        if (input.photos_total.toLong()  <  16)
                        {
                            hide photo_16;
                        }
                        if (input.photos_total.toLong()  <  17)
                        {
                            hide photo_17;
                        }
                        if (input.photos_total.toLong()  <  18)
                        {
                            hide photo_18;
                        }
                        if (input.photos_total.toLong()  <  19)
                        {
                            hide photo_19;
                        }
                        if (input.photos_total.toLong()  <  20)
                        {
                            hide photo_20;
                        }
                        if (input.photos_total.toLong()  <  21)
                        {
                            hide photo_21;
                        }
                        if (input.photos_total.toLong()  <  22)
                        {
                            hide photo_22;
                        }
                        if (input.photos_total.toLong()  <  23)
                        {
                            hide photo_23;
                        }
                        if (input.photos_total.toLong()  <  24)
                        {
                            hide photo_24;
                        }
                        if (input.photos_total.toLong()  <  25)
                        {
                            hide photo_25;
                        }
                        if (input.photos_total.toLong()  <  26)
                        {
                            hide photo_26;
                        }
                        if (input.photos_total.toLong()  <  27)
                        {
                            hide photo_27;
                        }
                        if (input.photos_total.toLong()  <  28)
                        {
                            hide photo_28;
                        }
                        if (input.photos_total.toLong()  <  29)
                        {
                            hide photo_29;
                        }
                        if (input.photos_total.toLong()  <  30)
                        {
                            hide photo_30;
                        }
                        if (input.photos_total.toLong()  <  31)
                        {
                            hide photo_31;
                        }
                        if (input.photos_total.toLong()  <  32)
                        {
                            hide photo_32;
                        }
                        if (input.photos_total.toLong()  <  33)
                        {
                            hide photo_33;
                        }
                        if (input.photos_total.toLong()  <  34)
                        {
                            hide photo_34;
                        }
                        if (input.photos_total.toLong()  <  35)
                        {
                            hide photo_35;
                        }
                        if (input.photos_total.toLong()  <  36)
                        {
                            hide photo_36;
                        }
                        if (input.photos_total.toLong()  <  37)
                        {
                            hide photo_37;
                        }
                        if (input.photos_total.toLong()  <  38)
                        {
                            hide photo_38;
                        }
                        if (input.photos_total.toLong()  <  39)
                        {
                            hide photo_39;
                        }
                        if (input.photos_total.toLong()  <  40)
                        {
                            hide photo_40;
                        }
                        if (input.photos_total.toLong()  <  41)
                        {
                            hide photo_41;
                        }
                        if (input.photos_total.toLong()  <  42)
                        {
                            hide photo_42;
                        }
                        if (input.photos_total.toLong()  <  43)
                        {
                            hide photo_43;
                        }
                        if (input.photos_total.toLong()  <  44)
                        {
                            hide photo_44;
                        }
                        if (input.photos_total.toLong()  <  45)
                        {
                            hide photo_45;
                        }
                        if (input.photos_total.toLong()  <  46)
                        {
                            hide photo_46;
                        }
                        if (input.photos_total.toLong()  <  47)
                        {
                            hide photo_47;
                        }
                        if (input.photos_total.toLong()  <  48)
                        {
                            hide photo_48;
                        }
                        if (input.photos_total.toLong()  <  49)
                        {
                            hide photo_49;
                        }
                        if (input.photos_total.toLong()  <  50)
                        {
                            hide photo_50;
                        }
                    }
                )

                must  have  photo_1
                (
                    displayname  =  "Photo 1"
                    type = upload file
                )

                photo_2
                (
                    displayname  =  "Photo 2"
                    type = upload file
                )

                photo_3
                (
                    displayname  =  "Photo 3"
                    type = upload file
                )

                photo_4
                (
                    displayname  =  "Photo 4"
                    type = upload file
                )

                photo_5
                (
                    displayname  =  "Photo 5"
                    type = upload file
                )

                photo_6
                (
                    displayname  =  "Photo 6"
                    type = upload file
                )

                photo_7
                (
                    displayname  =  "Photo 7"
                    type = upload file
                )

                photo_8
                (
                    displayname  =  "Photo 8"
                    type = upload file
                )

                photo_9
                (
                    displayname  =  "Photo 9"
                    type = upload file
                )

                photo_10
                (
                    displayname  =  "Photo 10"
                    type = upload file
                )

                photo_11
                (
                    displayname  =  "Photo 11"
                    type = upload file
                )

                photo_12
                (
                    displayname  =  "Photo 12"
                    type = upload file
                )

                photo_13
                (
                    displayname  =  "Photo 13"
                    type = upload file
                )

                photo_14
                (
                    displayname  =  "Photo 14"
                    type = upload file
                )

                photo_15
                (
                    displayname  =  "Photo 15"
                    type = upload file
                )

                photo_16
                (
                    displayname  =  "Photo 16"
                    type = upload file
                )

                photo_17
                (
                    displayname  =  "Photo 17"
                    type = upload file
                )

                photo_18
                (
                    displayname  =  "Photo 18"
                    type = upload file
                )

                photo_19
                (
                    displayname  =  "Photo 19"
                    type = upload file
                )

                photo_20
                (
                    displayname  =  "Photo 20"
                    type = upload file
                )

                photo_21
                (
                    displayname  =  "Photo 21"
                    type = upload file
                )

                photo_22
                (
                    displayname  =  "Photo 22"
                    type = upload file
                )

                photo_23
                (
                    displayname  =  "Photo 23"
                    type = upload file
                )

                photo_24
                (
                    displayname  =  "Photo 24"
                    type = upload file
                )

                photo_25
                (
                    displayname  =  "Photo 25"
                    type = upload file
                )

                photo_26
                (
                    displayname  =  "Photo 26"
                    type = upload file
                )

                photo_27
                (
                    displayname  =  "Photo 27"
                    type = upload file
                )

                photo_28
                (
                    displayname  =  "Photo 28"
                    type = upload file
                )

                photo_29
                (
                    displayname  =  "Photo 29"
                    type = upload file
                )

                photo_30
                (
                    displayname  =  "Photo 30"
                    type = upload file
                )

                photo_31
                (
                    displayname  =  "Photo 31"
                    type = upload file
                )

                photo_32
                (
                    displayname  =  "Photo 32"
                    type = upload file
                )

                photo_33
                (
                    displayname  =  "Photo 33"
                    type = upload file
                )

                photo_34
                (
                    displayname  =  "Photo 34"
                    type = upload file
                )

                photo_35
                (
                    displayname  =  "Photo 35"
                    type = upload file
                )

                photo_36
                (
                    displayname  =  "Photo 36"
                    type = upload file
                )

                photo_37
                (
                    displayname  =  "Photo 37"
                    type = upload file
                )

                photo_38
                (
                    displayname  =  "Photo 38"
                    type = upload file
                )

                photo_39
                (
                    displayname  =  "Photo 39"
                    type = upload file
                )

                photo_40
                (
                    displayname  =  "Photo 40"
                    type = upload file
                )

                photo_41
                (
                    displayname  =  "Photo 41"
                    type = upload file
                )

                photo_42
                (
                    displayname  =  "Photo 42"
                    type = upload file
                )

                photo_43
                (
                    displayname  =  "Photo 43"
                    type = upload file
                )

                photo_44
                (
                    displayname  =  "Photo 44"
                    type = upload file
                )

                photo_45
                (
                    displayname  =  "Photo 45"
                    type = upload file
                )

                photo_46
                (
                    displayname  =  "Photo 46"
                    type = upload file
                )

                photo_47
                (
                    displayname  =  "Photo 47"
                    type = upload file
                )

                photo_48
                (
                    displayname  =  "Photo 48"
                    type = upload file
                )

                photo_49
                (
                    displayname  =  "Photo 49"
                    type = upload file
                )

                photo_50
                (
                    displayname  =  "Photo 50"
                    type = upload file
                )

                photos_display
                (
                    displayname  =  "Photos Display"
                    type  =  textarea
                )

                must  have  unique  unique_id
                (
                    displayname  =  "Unique ID"
                    type  =  text
                    width  =  20
                )

                must  have  listing_label
                (
                    displayname  =  "Label"
                    type  =  text
                )

                public_link
                (
                    displayname  =  "Public Link"
                    type  =  text
                )

                public_url
                (
                    displayname  =  "Public URL"
                    type  =  text
                )

                image_url
                (
                    type  =  formula
                    value  =  "http://creator.zoho.com/DownloadFile.do?filepath=/" + photo_1 + "&amp;sharedBy=" + zoho.adminuser
                )

            }
            actions
            {
                on add
                {
                    on load
                    {
                        hide unique_id;
                        hide listing_label;
                        hide status;
                        hide photos_display;
                        hide public_link;
                        hide public_url;
                        hide photo_2;
                        hide photo_3;
                        hide photo_4;
                        hide photo_5;
                        hide photo_6;
                        hide photo_7;
                        hide photo_8;
                        hide photo_9;
                        hide photo_10;
                        hide photo_11;
                        hide photo_12;
                        hide photo_13;
                        hide photo_14;
                        hide photo_15;
                        hide photo_16;
                        hide photo_17;
                        hide photo_18;
                        hide photo_19;
                        hide photo_20;
                        hide photo_21;
                        hide photo_22;
                        hide photo_23;
                        hide photo_24;
                        hide photo_25;
                        hide photo_26;
                        hide photo_27;
                        hide photo_28;
                        hide photo_29;
                        hide photo_30;
                        hide photo_31;
                        hide photo_32;
                        hide photo_33;
                        hide photo_34;
                        hide photo_35;
                        hide photo_36;
                        hide photo_37;
                        hide photo_38;
                        hide photo_39;
                        hide photo_40;
                        hide photo_41;
                        hide photo_42;
                        hide photo_43;
                        hide photo_44;
                        hide photo_45;
                        hide photo_46;
                        hide photo_47;
                        hide photo_48;
                        hide photo_49;
                        hide photo_50;
                        uid  =  seed_unique_id  [unique_id != 0];
                        current_uid = (uid.unique_id  +  1);
                        uid.unique_id = current_uid;
                        input.unique_id_display = "<p><em>Unique ID for this listing will be <strong>" + uid.prefix + current_uid + "</strong></em></p>";
                        input.unique_id = uid.prefix + current_uid;
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                        on success
                        {
                            e  =  Essentials  [ID == input.ID];
                            p_buffer = ("<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_1 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            if (e.photo_2  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_2 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_3  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_3 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_4  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_4 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_5  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_5 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_6  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_6 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_7  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_7 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_8  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_8 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_9  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_9 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_10  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_10 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_11  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_11 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_12  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_12 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_13  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_13 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_14  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_14 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_15  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_15 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_16  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_16 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_17  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_17 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_18  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_18 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_19  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_19 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_20  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_20 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_21  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_21 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_22  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_22 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_23  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_23 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_24  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_24 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_25  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_25 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_26  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_26 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_27  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_27 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_28  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_28 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_29  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_29 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_30  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_30 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_31  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_31 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_32  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_32 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_33  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_33 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_34  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_34 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_35  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_35 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_36  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_36 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_37  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_37 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_38  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_38 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_39  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_39 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_40  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_40 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_41  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_41 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_42  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_42 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_43  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_43 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_44  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_44 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_45  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_45 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_46  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_46 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_47  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_47 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_48  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_48 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_49  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_49 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_50  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_50 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            ampsToReplaceTotal = (input.description).getOccurenceCount("&");
                            if (ampsToReplaceTotal  >  0)
                            {
                                raw = input.description;
                                processed = "";
                                for each j in Iterations  [iteration < ampsToReplaceTotal]
                                {
                                    pre = raw.getPrefix("&");
                                    post = raw.getSuffix("&");
                                    processed = processed + pre + "&";
                                    if ((post).getOccurenceCount("&")  >  0)
                                    {
                                        raw = post;
                                    }
                                    else
                                    {
                                        processed = processed + post;
                                    }
                                }
                                input.description = processed;
                            }
                            input.photos_display = p_buffer;
                            input.public_url = ((("http://creator.zoho.com/showForm.do?formLinkId=608&amp;link=true&amp;sharedBy=" + zoho.adminuser) + "&amp;unique_id=") + e.unique_id) + "&amp;privatelink=D96EdYb4Zf7YCuvT5PBDQfPZEO5OA7A7dgh4tEsW268p6R44s1gUCvDUqbqG1CV0GeknRbMn3EytGP05ANUVjZPeJCChvuCKENBN";
                            input.public_link = ((("<a href='http://creator.zoho.com/showForm.do?formLinkId=608&link=true&sharedBy=" + zoho.adminuser) + "&unique_id=") + e.unique_id) + "&privatelink=D96EdYb4Zf7YCuvT5PBDQfPZEO5OA7A7dgh4tEsW268p6R44s1gUCvDUqbqG1CV0GeknRbMn3EytGP05ANUVjZPeJCChvuCKENBN'>[public link]</a>";
                        }
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    on load
                    {
                        hide photos_display;
                        hide unique_id;
                        hide photo_2;
                        hide photo_3;
                        hide photo_4;
                        hide photo_5;
                        hide photo_6;
                        hide photo_7;
                        hide photo_8;
                        hide photo_9;
                        hide photo_10;
                        hide photo_11;
                        hide photo_12;
                        hide photo_13;
                        hide photo_14;
                        hide photo_15;
                        hide photo_16;
                        hide photo_17;
                        hide photo_18;
                        hide photo_19;
                        hide photo_20;
                        hide photo_21;
                        hide photo_22;
                        hide photo_23;
                        hide photo_24;
                        hide photo_25;
                        hide photo_26;
                        hide photo_27;
                        hide photo_28;
                        hide photo_29;
                        hide photo_30;
                        hide photo_31;
                        hide photo_32;
                        hide photo_33;
                        hide photo_34;
                        hide photo_35;
                        hide photo_36;
                        hide photo_37;
                        hide photo_38;
                        hide photo_39;
                        hide photo_40;
                        hide photo_41;
                        hide photo_42;
                        hide photo_43;
                        hide photo_44;
                        hide photo_45;
                        hide photo_46;
                        hide photo_47;
                        hide photo_48;
                        hide photo_49;
                        hide photo_50;
                    }
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                        on validate
                        {
                            e  =  Essentials  [ID == input.ID];
                            if (input.ID  !=  e.ID)
                            {
                                alert "The unique ID cannot be edited.";
                                cancel submit;
                            }
                        }
                        on success
                        {
                            e  =  Essentials  [ID == input.ID];
                            p_buffer = ("<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_1 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            if (e.photo_2  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_2 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_3  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_3 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_4  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_4 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_5  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_5 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_6  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_6 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_7  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_7 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_8  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_8 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_9  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_9 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_10  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_10 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_11  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_11 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_12  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_12 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_13  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_13 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_14  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_14 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_15  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_15 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_16  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_16 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_17  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_17 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_18  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_18 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_19  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_19 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_20  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_20 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_21  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_21 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_22  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_22 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_23  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_23 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_24  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_24 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_25  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_25 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_26  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_26 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_27  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_27 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_28  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_28 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_29  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_29 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_30  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_30 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_31  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_31 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_32  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_32 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_33  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_33 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_34  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_34 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_35  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_35 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_36  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_36 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_37  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_37 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_38  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_38 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_39  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_39 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_40  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_40 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_41  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_41 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_42  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_42 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_43  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_43 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_44  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_44 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_45  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_45 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_46  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_46 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_47  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_47 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_48  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_48 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_49  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_49 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            if (e.photo_50  !=  "")
                            {
                                p_buffer = (p_buffer + "<img width='50' height='50' src='/DownloadFile.do?filepath=/" + e.photo_50 + "&sharedBy=" + zoho.adminuser) + "'/>";
                            }
                            ampsToReplaceTotal = (input.description).getOccurenceCount("&");
                            if (ampsToReplaceTotal  >  0)
                            {
                                raw = input.description;
                                processed = "";
                                for each j in Iterations  [iteration < ampsToReplaceTotal]
                                {
                                    pre = raw.getPrefix("&");
                                    post = raw.getSuffix("&");
                                    processed = processed + pre + "&";
                                    if ((post).getOccurenceCount("&")  >  0)
                                    {
                                        raw = post;
                                    }
                                    else
                                    {
                                        processed = processed + post;
                                    }
                                }
                                input.description = processed;
                            }
                            input.photos_display = p_buffer;
                            input.public_url = ((("http://creator.zoho.com/showForm.do?formLinkId=608&amp;link=true&amp;sharedBy=" + zoho.adminuser) + "&amp;unique_id=") + e.unique_id) + "&amp;privatelink=D96EdYb4Zf7YCuvT5PBDQfPZEO5OA7A7dgh4tEsW268p6R44s1gUCvDUqbqG1CV0GeknRbMn3EytGP05ANUVjZPeJCChvuCKENBN";
                            input.public_link = ((("<a href='http://creator.zoho.com/showForm.do?formLinkId=608&link=true&sharedBy=" + zoho.adminuser) + "&unique_id=") + e.unique_id) + "&privatelink=D96EdYb4Zf7YCuvT5PBDQfPZEO5OA7A7dgh4tEsW268p6R44s1gUCvDUqbqG1CV0GeknRbMn3EytGP05ANUVjZPeJCChvuCKENBN'>[public link]</a>";
                        }
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        form  Location
        {
            displayname  =  "2. Add Location"
            success message  =  "Location info added."
            
            must  have  essentials_dropdown
            (
                displayname  =  "For which listing?"
                type  =  picklist
                values  =  {"Option 1",   "Option 2",   "Option 3",   "ZYND2007009:This is a test",   "ZYND2007012:Test Listing #2",   "ZYND2007015:Test Listing #6",   "ZYND2007045:Kansas City 4Plex",   "ZYND2007063:Big house"}
                on user input
                {
                    e  =  Essentials  [listing_label == input.essentials_dropdown];
                    input.unique_id = e.unique_id;
                    buffer = "<p><strong>Essentials</strong>:</p><ul><li><strong>Description</strong>: " + e.description + "</li><li><strong>Price</strong>: " + e.price + "</li></ul>";
                    for each a in Attributes  [unique_id == e.unique_id]
                    {
                        buffer = (((((buffer + "<p><strong>Attributes</strong>:</p><ul><li><strong>Year Built</strong>: " + a.year_built + "</li><li><strong>Square Ft</strong>: " + a.square_feet + "</li><li><strong>Lot Size</strong>: " + a.lot_size) + "</li><li><strong>Bedrooms</strong>: ") + a.bedrooms) + "</li><li><strong>Bathrooms</strong>: ") + a.bathrooms) + "</li></ul>";
                    }
                    for each s in Seller_Info  [unique_id == e.unique_id]
                    {
                        buffer = buffer + "<p><strong>Seller Info</strong>:</p><ul><li><strong>Agent ID</strong>: " + s.agent_name + "</li><li><strong>MLS ID</strong>: " + s.mls_id + "</li></ul>";
                    }
                    show address;
                    show city;
                    show state;
                    show zip_code;
                    input.saved_display = buffer;
                }
            )

            saved_display
            (
                type  =  plaintext
            )

            must  have  address
            (
                displayname  =  "Address"
                type  =  text
            )

            must  have  city
            (
                displayname  =  "City"
                type  =  text
            )

            must  have  state
            (
                displayname  =  "State"
                type  =  picklist
                values  =  {"AL",   "AK",   "AS",   "AZ",   "AR",   "CA",   "CO",   "CT",   "DE",   "DC",   "FM",   "FL",   "GA",   "GU",   "HI",   "ID",   "IL",   "IN",   "IA",   "KS",   "KY",   "LA",   "ME",   "MH",   "MD",   "MA",   "MI",   "MN",   "MS",   "MO",   "MT",   "NE",   "NV",   "NH",   "NJ",   "NM",   "NY",   "NC",   "ND",   "MP",   "OH",   "OK",   "OR",   "PW",   "PA",   "PR",   "RI",   "SC",   "SD",   "TN",   "TX",   "UT",   "VT",   "VI",   "VA",   "WA",   "WV",   "WI",   "WY"}
                defaultvalue  =  "AL"
            )

            must  have  zip_code
            (
                displayname  =  "Zip Code"
                type  =  text
            )

            must  have  unique  unique_id
            (
                displayname  =  "Unique ID"
                type  =  text
                width  =  20
            )

            actions
            {
                on add
                {
                    on load
                    {
                        hide unique_id;
                        hide address;
                        hide city;
                        hide state;
                        hide zip_code;
                        essentials_dropdown:ui.add("-Select-");
                        total_records = 0;
                        for each e in Essentials
                        {
                            if ((count(Location[unique_id == e.unique_id])  ==  0)  &&  (e.status  ==  "incomplete"))
                            {
                                essentials_dropdown:ui.add(e.listing_label);
                                total_records = (total_records  +  1);
                            }
                        }
                        if (total_records  ==  0)
                        {
                            hide essentials_dropdown;
                            hide address;
                            hide state;
                            hide city;
                            hide zip_code;
                            input.saved_display = "<em>No listings are in need of location info.<ul><li>To add a new listing use form 1. New</li>" + "<li>To add attribute info use form 3. Add Attributes</li>" + "<li>To add seller info use form 4. Add Seller Info</li></ul></em>";
                        }
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    on load
                    {
                        hide unique_id;
                        hide essentials_dropdown;
                        essentials_dropdown:ui.add("Current");
                    }
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                        on validate
                        {
                            l  =  Location  [ID == input.ID];
                            if (input.ID  !=  l.ID)
                            {
                                alert "The unique ID cannot be edited.";
                                cancel submit;
                            }
                        }
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        form  Attributes
        {
            displayname  =  "3. Add Attributes"
            success message  =  "Attributes info added."
            
            must  have  essentials_dropdown
            (
                displayname  =  "For which listing?"
                type  =  picklist
                values  =  {"Option 1",   "Option 2",   "Option 3",   "ZYND2007009:This is a test",   "ZYND2007012:Test Listing #2",   "ZYND2007015:Test Listing #6",   "ZYND2007024:Test Listing #26",   "ZYND2007045:Kansas City 4Plex"}
                on user input
                {
                    e  =  Essentials  [listing_label == input.essentials_dropdown];
                    input.unique_id = e.unique_id;
                    buffer = "<p><strong>Essentials</strong>:</p><ul><li><strong>Description</strong>: " + e.description + "</li><li><strong>Price</strong>: " + e.price + "</li></ul>";
                    for each l in Location  [unique_id == e.unique_id]
                    {
                        buffer = buffer + "<p><strong>Location Info</strong>:</p><ul><li><strong>Address</strong>: " + l.address + "</li><li><strong>City</strong>: " + l.city + "</li><li><strong>State</strong>: " + l.state + "</li><li><strong>Zip Code</strong>: " + l.zip_code + "</li></ul>";
                    }
                    for each s in Seller_Info  [unique_id == e.unique_id]
                    {
                        buffer = buffer + "<p><strong>Seller Info</strong>:</p><ul><li><strong>Agent ID</strong>: " + s.agent_name + "</li><li><strong>MLS ID</strong>: " + s.mls_id + "</li></ul>";
                    }
                    show lot_size;
                    show lot_length_width;
                    show bathrooms;
                    show bedrooms;
                    show square_feet;
                    show year_built;
                    show irregular_lot;
                    input.saved_display = buffer;
                }
            )

            saved_display
            (
                type  =  plaintext
            )

            must  have  year_built
            (
                displayname  =  "Year Built"
                type  =  number
                width  =  20
            )

            must  have  square_feet
            (
                displayname  =  "Square Feet"
                type  =  decimal
                width  =  20
            )

            must  have  lot_size
            (
                displayname  =  "Lot Size"
                type  =  text
                width  =  20
            )

            lot_length_width
            (
                displayname  =  "Lot Length Width"
                type  =  text
            )

            irregular_lot
            (
                displayname  =  "Irregular lot?"
                type  =  checkbox
                defaultvalue  =  false
            )

            must  have  bedrooms
            (
                displayname  =  "Bedrooms"
                type  =  picklist
                values  =  {"1",   "2",   "3",   "4",   "5",   "6",   "7",   "8",   "9",   "10",   "11",   "12",   "14",   "15",   "16",   "17",   "18",   "19",   "20"}
                defaultvalue  =  "1"
            )

            must  have  bathrooms
            (
                displayname  =  "Bathrooms"
                type  =  picklist
                values  =  {".5",   ".75",   "1",   "1.5",   "1.75",   "2",   "2.5",   "2.75",   "3",   "3.5",   "3.75",   "4",   "4.5",   "4.75",   "5"}
                defaultvalue  =  ".5"
            )

            must  have  unique  unique_id
            (
                displayname  =  "Unique ID"
                type  =  text
                width  =  20
            )

            actions
            {
                on add
                {
                    on load
                    {
                        hide unique_id;
                        hide lot_size;
                        hide lot_length_width;
                        hide bathrooms;
                        hide bedrooms;
                        hide square_feet;
                        hide year_built;
                        hide irregular_lot;
                        essentials_dropdown:ui.add("-Select-");
                        total_records = 0;
                        for each e in Essentials
                        {
                            if ((count(Attributes[unique_id == e.unique_id])  ==  0)  &&  (e.status  ==  "incomplete"))
                            {
                                essentials_dropdown:ui.add(e.listing_label);
                                total_records = (total_records  +  1);
                            }
                        }
                        if (total_records  ==  0)
                        {
                            hide essentials_dropdown;
                            hide bathrooms;
                            hide bedrooms;
                            hide lot_size;
                            hide square_feet;
                            hide year_built;
                            hide lot_length_width;
                            hide irregular_lot;
                            input.saved_display = "<em>No listings are in need of attribute info.<ul><li>To add a new listing use form 1. New</li>" + "<li>To add location info use form 2. Add Location</li>" + "<li>To add seller info use form 4. Add Seller Info</li></ul></em>";
                        }
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    on load
                    {
                        hide unique_id;
                        hide essentials_dropdown;
                        essentials_dropdown:ui.add("Current");
                    }
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                        on validate
                        {
                            a  =  Attributes  [ID == input.ID];
                            if (input.ID  !=  a.ID)
                            {
                                alert "The unique ID cannot be edited.";
                                cancel submit;
                            }
                        }
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        form  Seller_Info
        {
            displayname  =  "4. Add Seller Info"
            success message  =  "Seller info added."
            
            must  have  essentials_dropdown
            (
                displayname  =  "For which listing?"
                type  =  picklist
                values  =  {"Option 1",   "Option 2",   "Option 3",   "ZYND2007009:This is a test",   "ZYND2007012:Test Listing #2",   "ZYND2007015:Test Listing #6",   "ZYND2007024:Test Listing #26",   "ZYND2007045:Kansas City 4Plex"}
                on user input
                {
                    e  =  Essentials  [listing_label == input.essentials_dropdown];
                    input.unique_id = e.unique_id;
                    buffer = "<p><strong>Essentials</strong>:</p><ul><li><strong>Description</strong>: " + e.description + "</li><li><strong>Price</strong>: " + e.price + "</li></ul>";
                    for each l in Location  [unique_id == e.unique_id]
                    {
                        buffer = buffer + "<p><strong>Location Info</strong>:</p><ul><li><strong>Address</strong>: " + l.address + "</li><li><strong>City</strong>: " + l.city + "</li><li><strong>State</strong>: " + l.state + "</li><li><strong>Zip Code</strong>: " + l.zip_code + "</li></ul>";
                    }
                    for each a in Attributes  [unique_id == e.unique_id]
                    {
                        buffer = (((((buffer + "<p><strong>Attribute Info</strong>:</p><ul><li><strong>Year Built</strong>: " + a.year_built + "</li><li><strong>Square Ft</strong>: " + a.square_feet + "</li><li><strong>Lot Size</strong>: " + a.lot_size) + "</li><li><strong>Bedrooms</strong>: ") + a.bedrooms) + "</li><li><strong>Bathrooms</strong>: ") + a.bathrooms) + "</li></ul>";
                    }
                    show mls_id;
                    show agent_name;
                    show listing_status;
                    input.saved_display = buffer;
                }
            )

            saved_display
            (
                type  =  plaintext
            )

            must  have  listing_status
            (
                displayname  =  "Listing Status"
                type  =  picklist
                values  =  {"Active",   "Subject To Inspection",   "Pending",   "Sold"}
                defaultvalue  =  "Active"
            )

            must  have  agent_name
            (
                displayname  =  "Agent ID"
                type  =  text
            )

            mls_id
            (
                displayname  =  "MLS#"
                type  =  text
            )

            must  have  unique  unique_id
            (
                displayname  =  "Unique ID"
                type  =  text
                width  =  20
            )

            actions
            {
                on add
                {
                    on load
                    {
                        hide unique_id;
                        hide mls_id;
                        hide agent_name;
                        hide listing_status;
                        essentials_dropdown:ui.add("-Select-");
                        total_records = 0;
                        for each e in Essentials
                        {
                            if ((count(Seller_Info[unique_id == e.unique_id])  ==  0)  &&  (e.status  ==  "incomplete"))
                            {
                                essentials_dropdown:ui.add(e.listing_label);
                                total_records = (total_records  +  1);
                            }
                        }
                        if (total_records  ==  0)
                        {
                            hide essentials_dropdown;
                            hide agent_name;
                            hide mls_id;
                            hide listing_status;
                            input.saved_display = "<em>No listings are in need of seller info.<ul><li>To add a new listing use form 1. New</li>" + "<li>To add location info use form 2. Add Location</li>" + "<li>To add attribute info use form 3. Add Attributes</li></ul></em>";
                        }
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    on load
                    {
                        hide unique_id;
                        hide essentials_dropdown;
                        essentials_dropdown:ui.add("Current");
                    }
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                        on validate
                        {
                            s  =  Seller_Info  [ID == input.ID];
                            if (input.ID  !=  s.ID)
                            {
                                alert "The unique ID cannot be edited.";
                                cancel submit;
                            }
                        }
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

    }

    section View
    {
        form  view_help
        {
            displayname  =  "Help"
            
            help_display
            (
                type  =  plaintext
            )

            actions
            {
                on add
                {
                    on load
                    {
                        input.help_display = ((((("<table cellpadding='10' border='0'><tr><td style='background-color: #bcf;border:dashed 1px #63f;'") + " valign='top'><h3 style='color:#006' align='center'>View listings</h3><p style='color:#006'>Access listing details by browsing <em>Main</em>,") + " <em>Location</em>, <em>Attributes</em>, and <em>Seller Info</em>.</p>") + "</td>") + "<td valign='top'><p align='center'>Zyndafeed</p></td>") + "</tr></table>";
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  Main
        {
            displayname = "1. Main"
            show  all  rows  from  Essentials 
            (
                unique_id as "Unique ID"
                title as "Title"
                description as "Description"
                price as "Price $"
                status as "Status"
                photos_display as "Photos Display"
                public_link as "Detail Page"
            )
            options
            (
                display rows = 100
            )
        }

        list  Location
        {
            displayname = "2. Location"
            show  all  rows  from  Location 
            (
                unique_id as "Unique ID"
                address as "Address"
                city as "City"
                state as "State"
                zip_code as "Zip Code"
            )
            options
            (
                display rows = 100
            )
        }

        list  Attributes
        {
            displayname = "3. Attributes"
            show  all  rows  from  Attributes 
            (
                unique_id as "Unique ID"
                year_built as "Year Built"
                square_feet as "Square Feet"
                lot_size as "Lot Size"
                bedrooms as "Bedrooms"
                bathrooms as "Bathrooms"
            )
            options
            (
                display rows = 100
            )
        }

        list  Seller_Info
        {
            displayname = "4. Seller Info"
            show  all  rows  from  Seller_Info 
            (
                unique_id as "Unique ID"
                agent_name as "Agent Name"
                mls_id as "MLS#"
            )
            options
            (
                display rows = 100
            )
        }

    }

    section Publish
    {
        form  publish_help
        {
            displayname  =  "Help"
            
            help_display
            (
                type  =  plaintext
            )

            actions
            {
                on add
                {
                    on load
                    {
                        input.help_display = (((((("<table cellpadding='10' border='0'><tr><td style='background-color: #bcf;border:dashed 1px #63f;' valign='top'>") + "<h3 style='color:#006' align='center'>Publish listings</h3><p style='color:#006'>") + "Update your Syndafeed real estate feed with the latest listings</p>") + "</td>") + "<td valign='top'><p align='center'>Zyndafeed</p>") + "</td>") + "</tr></table>";
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        form  Publish
        {
            success message  =  "Updated Oodle XML feed."
            
            ready_instructions
            (
                type  =  plaintext
            )

            noop
            (
                displayname  =  "NOOP"
                type  =  checkbox
                defaultvalue  =  false
            )

            listings_ready
            (
                type  =  plaintext
            )

            actions
            {
                on add
                {
                    on load
                    {
                        hide noop;
                        buffer = "";
                        total_count = 0;
                        lC = 0;
                        aC = 0;
                        sC = 0;
                        for each e in Essentials  [(unique_id != "" && (status == "incomplete" || status == "ready"))]
                        {
                            for each l in Location  [unique_id == e.unique_id]
                            {
                                lC = (lC  +  1);
                            }
                            for each a in Attributes  [unique_id == e.unique_id]
                            {
                                aC = (aC  +  1);
                            }
                            for each s in Seller_Info  [unique_id == e.unique_id]
                            {
                                sC = (sC  +  1);
                            }
                            if (((lC  >  0)  &&  (aC  >  0))  &&  (sC  >  0))
                            {
                                total_count = (total_count  +  1);
                                if (total_count  ==  1)
                                {
                                    input.ready_instructions = "<em>The following listings are ready to to publish.  Click submit to update your Oodle feed.</em>";
                                    buffer = "<ul>";
                                }
                                buffer = buffer + "<li>" + e.listing_label + "</li>";
                                if (e.status  ==  "incomplete")
                                {
                                    e.status = "ready";
                                }
                                if (total_count  ==  1)
                                {
                                    buffer = buffer + "</ul>";
                                }
                            }
                        }
                        if (total_count  >  0)
                        {
                            input.listings_ready = buffer;
                        }
                        else
                        {
                            input.ready_instructions = "<em>At least one listing must be ready if you want to publish. </em>";
                        }
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                        on success
                        {
                            xml = "<Listings>";
                            for each e in Essentials  [(status == "ready" || status == "published")]
                            {
                                this_id = e.unique_id;
                                l  =  Location  [unique_id == this_id];
                                a  =  Attributes  [unique_id == this_id];
                                s  =  Seller_Info  [unique_id == this_id];
                                irregularLot = "";
                                if (a.irregular_lot)
                                {
                                    irregularLot = "Y";
                                }
                                dateString = input.Modified_Time.toString();
                                day = dateString.getPrefix("-");
                                monthYear = dateString.getSuffix("-");
                                month = monthYear.getPrefix("-");
                                yearTime = monthYear.getSuffix("-");
                                year = yearTime.getPrefix(" ");
                                time = yearTime.getSuffix(" ");
                                if (month  ==  "Jan")
                                {
                                    month = "01";
                                }
                                else if (month  ==  "Feb")
                                {
                                    month = "02";
                                }
                                else if (month  ==  "Feb")
                                {
                                    month = "02";
                                }
                                else if (month  ==  "Mar")
                                {
                                    month = "03";
                                }
                                else if (month  ==  "Apr")
                                {
                                    month = "04";
                                }
                                else if (month  ==  "May")
                                {
                                    month = "05";
                                }
                                else if (month  ==  "Jun")
                                {
                                    month = "06";
                                }
                                else if (month  ==  "Jul")
                                {
                                    month = "07";
                                }
                                else if (month  ==  "Aug")
                                {
                                    month = "08";
                                }
                                else if (month  ==  "Sep")
                                {
                                    month = "09";
                                }
                                else if (month  ==  "Oct")
                                {
                                    month = "10";
                                }
                                else if (month  ==  "Nov")
                                {
                                    month = "11";
                                }
                                else
                                {
                                    month = "12";
                                }
                                dateString = year + "-" + month + "-" + day + " " + time;
                                xml = xml + "<Listing><ListingId>" + e.unique_id + "</ListingId><StreetAddress>" + l.address + "</StreetAddress><City>" + l.city + "</City><Country>US</Country>" + "<StateProvince>" + l.state + "</StateProvince><PropertyType>" + e.property_type + "</PropertyType><PostalCode>" + l.zip_code + "</PostalCode><AgentId>" + s.agent_name + "</AgentId><BathRooms>" + a.bathrooms + "</BathRooms><BedRooms>" + a.bedrooms + "</BedRooms><BrokerId>BuggyRocket</BrokerId>";
                                xml = ((((((((((((((xml + "<ListingStatus>" + s.listing_status + "</ListingStatus><GMTLastModified>" + dateString + "</GMTLastModified><Currency>USD</Currency><DescriptionLang value='en'><Description><![CDATA[" + e.description + "]]></Description><Caption><![CDATA[" + e.title + "]]></Caption><DetailsURL>" + e.public_url + "</DetailsURL></DescriptionLang><LandArea>" + a.lot_size) + "</LandArea><PropertyId>") + s.mls_id) + "</PropertyId><Price>") + e.price) + "</Price>") + "<StructureArea>") + a.square_feet) + "</StructureArea><LotLengthWidth>") + a.lot_length_width) + "</LotLengthWidth><IrregularLot>") + irregularLot) + "</IrregularLot><YearBuilt>") + a.year_built) + "</YearBuilt></Listing>";
                                if (e.status  ==  "ready")
                                {
                                    e.status = "published";
                                }
                            }
                            xml = xml + "</Listings>";
                            cx  =  Custom_XML  [ID != 0];
                            cx.xml_blob = xml;
                        }
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

    }

    section ADMIN
    {
        displayname = "__ADMIN"
        hide = true
        form  seed_unique_id
        {
            displayname  =  "Seed Unique ID"
            success message  =  "Unique ID Seeded."
            
            must  have  unique  unique_id
            (
                displayname  =  "Unique ID"
                type  =  number
                width  =  20
            )

            prefix
            (
                displayname  =  "Prefix (optional)"
                type  =  text
            )

            actions
            {
                on add
                {
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                        on validate
                        {
                            if (count(seed_unique_id[unique_id != 0])  >  0)
                            {
                                alert (("The seed record already exists.   If you wish to reset the starting values please either: ") + "<br/> <strong>(1)</strong> Delete the existing record and recreate it with new values or ") + "<br/><strong>(2)</strong> Update its existing values in the View using the <strong>Bulk Edit</strong> feature.";
                                cancel submit;
                            }
                        }
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  Seed_Unique_ID
        {
            displayname = "Seed Unique ID"
            show  all  rows  from  seed_unique_id 
            (
                unique_id as "Unique ID"
            )
            options
            (
                display rows = 100
            )
        }

        form  Custom_XML
        {
            displayname  =  "Custom XML"
            success message  =  "Custom XML updated."
            
            xml_blob
            (
                displayname  =  "<?xml version=\"1.0\" ?>"
                type  =  textarea
            )

            actions
            {
                on add
                {
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                        on validate
                        {
                            if (count(Custom_XML[ID != 0])  >  0)
                            {
                                cx  =  Custom_XML  [ID != 0];
                                cx.xml_blob = input.xml_blob;
                                cancel submit;
                            }
                        }
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  Custom_XML_View
        {
            displayname = "Custom XML View"
            show  all  rows  from  Custom_XML 
            (
                xml_blob as "<?xml version='1.0' ?>"
            )
            options
            (
                display rows = 100
            )
        }

        form  Detail_page
        {
            displayname  =  "Detail page"
            success message  =  "Message sent to agent."
            
            column
            {
                detail_left
                (
                    type  =  plaintext
                )

                must  have  unique  unique_id
                (
                    displayname  =  "Unique ID"
                    type  =  text
                    width  =  20
                )

            }
            column
            {
                detail_right
                (
                    type  =  plaintext
                )

            }
            actions
            {
                on add
                {
                    on load
                    {
                        hide unique_id;
                        e  =  Essentials  [unique_id == input.unique_id];
                        l  =  Location  [unique_id == input.unique_id];
                        a  =  Attributes  [unique_id == input.unique_id];
                        s  =  Seller_Info  [unique_id == input.unique_id];
                        left_buffer = ((((((((((((((((((((((((((((((((((((((((("<div style='background-color: #fff;border:solid 1px #63f;padding:10px;'><img src='http://creator.zoho.com/DownloadFile.do?filepath=/1195329979516_extender.png&sharedBy=lozc'/>") + "<h3 style='color:#006' align='center'>Details</h3>") + "<ul><li><strong>Year Built</strong>:  ") + a.year_built) + "</li>") + "<li><strong>Square Feet</strong>:  ") + a.square_feet) + "</li>") + "<li><strong>Lot Size</strong>:  ") + a.lot_size) + "</li>") + "<li><strong>Bedrooms</strong>:  ") + a.bedrooms) + "</li>") + "<li><strong>Bathrooms</strong>:  ") + a.bathrooms) + "</li>") + "<li><strong>Price</strong>:  ") + e.price) + "</li>") + "<li><strong>Address</strong>:  ") + l.address) + "</li>") + "<li><strong>City</strong>:  ") + l.city) + "</li>") + "<li><strong>State</strong>:  ") + l.state) + "</li>") + "<li><strong>Zip</strong>:  ") + l.zip_code) + "</li>") + "<li><strong>Listing Posted</strong>:") + s.Added_Time) + "</li>") + "<li><strong>Agent</strong>:  ") + s.agent_name) + "</li>") + "<li><strong>MLS #</strong>:  ") + s.mls_id) + "</li>") + "</ul></div>";
                        right_buffer = ((((((((((("<div style='background-color: #fff;border:solid 1px #63f;padding:10px;'") + " valign='top'><h2 style='color:#006' align='center'>") + e.title) + " </h3>") + "<img src='/DownloadFile.do?filepath=/") + e.photo_1) + "&sharedBy=") + zoho.adminuser) + "'/>") + "<p><strong>Description:</strong>  ") + e.description) + "</p>";
                        if (e.photo_2  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_2 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_3  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_3 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_4  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_4 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_5  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_5 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_6  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_6 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_7  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_7 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_8  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_8 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_9  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_9 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_10  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_10 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_11  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_11 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_12  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_12 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_13  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_13 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_14  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_14 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_15  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_15 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_16  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_16 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_17  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_17 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_18  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_18 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_19  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_19 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_20  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_20 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_21  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_21 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_22  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_22 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_23  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_23 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_24  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_24 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_25  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_25 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_26  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_26 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_27  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_27 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_28  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_28 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_29  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_29 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_30  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_30 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_31  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_31 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_32  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_32 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_33  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_33 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_34  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_34 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_35  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_35 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_36  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_36 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_37  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_37 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_38  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_38 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_39  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_39 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_40  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_40 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_41  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_41 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_42  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_42 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_43  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_43 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_44  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_44 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_45  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_45 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_46  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_46 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_47  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_47 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_48  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_48 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_49  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_49 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        if (e.photo_50  !=  "")
                        {
                            right_buffer = right_buffer + "<p><strong>More Photos:</strong></p>";
                            right_buffer = (right_buffer + "<img src='/DownloadFile.do?filepath=/" + e.photo_50 + "&sharedBy=" + zoho.adminuser) + "'/>";
                        }
                        left_buffer = left_buffer + "</div>";
                        input.detail_left = left_buffer;
                        input.detail_right = right_buffer;
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                        on validate
                        {
                            cancel submit;
                        }
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        form  Iterations
        {
            
            must  have  iteration
            (
                displayname  =  "Iteration"
                type  =  number
                width  =  20
            )

            actions
            {
                on add
                {
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

    }

}
