[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

08/26/2007 at 01:43PM PDT, ID: 22788031
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

ASP.NET page posts back twice on single button click

Asked by moshecristel in Programming for ASP.NET, WebApplications, .NET Framework 2.x

Tags: twice, click, page

I have a *very* perplexing problem with my ASP.NET (2.0) application.  When I post back the page, via the click of an ImageButton, all events fire twice (Page Load, Button Click, etc.)  It seems that the page is simply posting back twice.  

I've read that having AutoEventWireup="true" can cause problems with registering events more than once  so I set the AutoEventWireup="false" and registered my events manually in the code-behind page:

 protected override void OnInit(EventArgs e)
    {
        initComponents();
        base.OnInit(e);
    }

    protected void initComponents()
    {
        btnPreview.Click += new ImageClickEventHandler(this.prevClicked);
        this.Load += new System.EventHandler(this.Page_Load);
    }

Also, I've read that having something like this can cause it too:

<td background="red">

But I am not finding any such references in my code, or even in my external CSS classes.  I am using a master page and together with the offending page and it's corresponding code-behind, there are a lot of places that something could be going wrong.  Any ideas about where to look next?

Thanks in advance for your help!  Below is some of the code (my apologies for what an exhausting mess it is):


============================================================================
==================== PostAd.aspx =============================================
============================================================================

<%@ Page Language="C#" MasterPageFile="~/ArmadilloMasterPage.master" AutoEventWireup="false" CodeFile="PostAd.aspx.cs" Inherits="PostAd" Title="ArmadilloPages | Post Ad" EnableEventValidation="false"%>
<%@ MasterType TypeName="ArmadilloMasterPage" %>
<%@ Register TagPrefix="armadillo" Assembly="ArmadilloLibrary" Namespace="armadillo"%>
<%@ Register TagPrefix="armadillo" TagName="CategorySelectControl" Src="~/Controls/CategorySelectControl.ascx" %>


<asp:Content ID="postAdHeaderContent" ContentPlaceHolderID="masterPlaceHolderHeader" Runat="Server">
    <link href="CSS/Calendar.css" rel="stylesheet" type="text/css" />
      <script language="javascript" type="text/javascript" src="Scripts/Home.js"></script>
      <script language="javascript" type="text/javascript" src="Scripts/Search.js"></script>
      <script language="javascript" type="text/javascript" src="Scripts/Post_Ad.js"></script>
      <script language="javascript" type="text/javascript" src="Scripts/Posting.js"></script>
      <script language="javascript" type="text/javascript" src="Scripts/My_Account.js"></script>
      <script language="javascript" type="text/javascript" src="Scripts/Common.js"></script>
      <script language="javascript" type="text/javascript" src="Scripts/CalendarPopup/CalendarPopup.js"></script>
      <script language="javascript" type="text/javascript" src="Scripts/CalendarPopup/AnchorPosition.js"></script>
      <script language="javascript" type="text/javascript" src="Scripts/CalendarPopup/date.js"></script>
      <script language="javascript" type="text/javascript" src="Scripts/CalendarPopup/PopupWindow.js"></script>
      <script language="javascript" type="text/javascript">
      
          /*
            Contains all of the required for the EXPIRATION DATE CALENDAR (Post Ad page) to initiate and run
           
            Including:
            * Popup calendar setup
            * isLeapYear
            * registerDate
            * monthChanged
            * initCalendarDropdowns
            * launchCalendar
            * setComboDate
            * getComboDate
        */

        document.write(getCalendarStyles());

        // Initialize variables       
        var cboExpMoClientID = "";           // Holds the client id for the MONTH drop-down, required for calendar popup callback
        var cboExpDayClientID = "";          // Holds the client id for the DAY drop-down, required for calendar popup callback

        var maxDays = 28;               // The maximum number of days in the future that the ad can be set to expire
        var now = new Date();           // Today's date
        var later = new Date();         // The last day that the calendar should allow the user to pick
        later.setDate(now.getDate() + maxDays + 1);

        var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
        var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
        var beginMonth = now.getMonth(); // Note the beginning month may be next month if this is the last day of the month (today is not selectable)
        var beginDay = now.getDate();    // Note that the beginning day will be one day after today (today is not selectable)


        // If it's the last day of the month move forward one month
        // ... and move the date forward one month as well
        if(now.getDate() == daysInMonth[now.getMonth()])
        {
            beginMonth = (beginMonth + 1) % 11;
            beginDay = 1;
        }
        else
        {
            beginDay += 1;
        }

        var startDay = new Array();     // One item for each enabled month with the number of the start day for that month (ie. 1)
        var endDay = new Array();       // One item for each enabled month with the number of the end day for that month (ie. 31)

        // Set up calendar popup
        var cal = new CalendarPopup("calendarDiv");
        cal.setCssPrefix("Armadillo");
        cal.addDisabledDates(null,formatDate(now,"yyyy-MM-dd"));  
        cal.addDisabledDates(formatDate(later,"yyyy-MM-dd"),null);
        cal.setReturnFunction("registerDate");  
                           
        // Adjust days in feb for leap year
        if(isLeapYear(now.getFullYear()))
            daysInMonth[1] = 29;

        // Initialize control helper variables
        var daysSoFar = 0;  // Days accounted for so far
        var monthIndex = 0; // The index of the month starting from current month = 0
         
        while(daysSoFar < maxDays)
        {
            if(daysSoFar == 0) // If it is the current month
            {
                startDay[monthIndex] = beginDay;
                endDay[monthIndex] = daysInMonth[beginMonth]
                daysSoFar = (endDay[monthIndex] - startDay[monthIndex]) + 1;
               
                if(daysSoFar > maxDays)
                {
                    endDay[monthIndex] -= (daysSoFar - maxDays);
                    daysSoFar = maxDays;
                }
            }
            else // If it is a subsequent month
            {
                var daysInSubsequentMonth = daysInMonth[(beginMonth+monthIndex)%11];
                var daysRemaining = maxDays - daysSoFar;
               
                startDay[monthIndex] = 1;
                endDay[monthIndex] = Math.min(daysInSubsequentMonth, daysRemaining);
               
                daysSoFar += ((endDay[monthIndex] - startDay[monthIndex]) + 1)
            }  
            monthIndex++;
        }

        var totalMonths = monthIndex;

        // returns true if the given year is a leap year
        function isLeapYear(inYear)
        {      
            if (inYear % 4 == 0) {            
                if (inYear % 100 == 0) {                  
                    return (inYear % 400 == 0);            
                } else {                  
                    return (true);            
                }      
            } else {            
                return (false);      
            }
        }

        /* Called after calendar date is selected from Javascript calendar control */
        function registerDate(y, m, d)
        {
            var dateString = m+"/"+d+"/"+y;
            var d = parseDate(dateString);
            setComboDate(d);
            var days = Math.round((d-now)/(24*60*60*1000));
        }

        /* For passing server-side client ids to the client - probably a better way of doing this */
        function monthChanged(cboExpMoCID, cboExpDayCID)
        {
            var cboExpMo = document.getElementById(cboExpMoCID);
            var cboExpDay = document.getElementById(cboExpDayCID);
            var monthIndex = cboExpMo.selectedIndex;
           
            cboExpDay.options.length = (endDay[monthIndex]-startDay[monthIndex])+1;
            for(i = startDay[monthIndex], j=0; i <= endDay[monthIndex]; i++, j++)
            {
                cboExpDay.options[j].value = i + "";
                if(i < 10){
                    cboExpDay.options[j].text = "0" + i;  
                } else {
                    cboExpDay.options[j].text = i;
                }
               
            }
        }
       
        /* Due to issues passing the selected date directly to the server page,
           the day is stored temporarily in a hidden text field.  May fix this later. */
        function recordHiddenDate()
        {
            var txtHiddenExpirationDay = document.getElementById('<%= txtHiddenExpirationDay.ClientID %>');
            var txtHiddenExpirationMonth = document.getElementById('<%= txtHiddenExpirationMonth.ClientID %>');
            var cboExpirationDay = document.getElementById('<%= cboExpirationDay.ClientID %>');
            var cboExpirationMonth = document.getElementById('<%= cboExpirationMonth.ClientID %>');
            txtHiddenExpirationDay.value = cboExpirationDay.options[cboExpirationDay.selectedIndex].value;
            txtHiddenExpirationMonth.value = (eval(cboExpirationMonth.options[cboExpirationMonth.selectedIndex].value) + 1) + "";
        }

        function initCalendarDropdowns(cboExpMoCID, cboExpDayCID)
        {
            // Set persisiting ID's for the client... used for javascript calendar popup callback (which does not allow a mechanism for passing the client id)
            cboExpMoClientID = cboExpMoCID;
            cboExpDayClientID = cboExpDayCID;
           
            var cboExpMo = document.getElementById(cboExpMoCID);
            cboExpMo.options.length = totalMonths;
            for(i=0; i<totalMonths; i++)
            {
                cboExpMo.options[i].text = months[beginMonth + i];
                cboExpMo.options[i].value = beginMonth + i;
            }
            monthChanged(cboExpMoCID, cboExpDayCID);
            recordHiddenDate();
        }

        /* Given the client id of a text box (to contain/hide the date)
           and a link to launch the calendar, launches a calendar with the proper date selected
           (ie. the one currently selected in the month and day combo boxes */
        function launchCalendar(hiddenTextCID, dateLaunchLinkCID)
        {
            var dateToSelect = getComboDate();
            cal.select(document.getElementById(hiddenTextCID), dateLaunchLinkCID, 'MM/dd/yyyy', formatDate(dateToSelect, 'MM/dd/yyyy'));
        }

        /* Given a javascript date object, sets the month and day combo boxes to the appropriate selections.
           If there is no suitable date currently in the combo boxes, the request is simply ignored. */
        function setComboDate(newDate)
        {
            var month = newDate.getMonth();
            var day = newDate.getDate();
            if(day < 10)
                day = "0" + day;
               
            var cboExpMo = document.getElementById(cboExpMoClientID);
            var cboExpDay = document.getElementById(cboExpDayClientID);
           
            // Iterate through the available month names (only a couple)
            // and select the one that matches the given month's name
            for(i=0; i<cboExpMo.options.length; i++)
            {
                if(cboExpMo.options[i].text == months[month])
                {
                    cboExpMo.selectedIndex = i;
                   
                    // Now the dates must be repopulated
                    monthChanged(cboExpMoClientID, cboExpDayClientID);
                   
                    // Now that the month is changed, and appropriate days are available, the day can be selected
                    for(j=0; j<cboExpDay.options.length; j++)
                    {
                        if(cboExpDay.options[j].text == day)
                        {
                            cboExpDay.selectedIndex = j;
                            break;
                        }
                    }
                    break;
                }
            }
        }

        /* Returns a javascript date object representing the current selection of the month and day combo boxes.
           The year is assumed to be this year, unless the given day has already passed this year, and then it is assumed to be next year. */
        function getComboDate()
        {
            var cboExpMo = document.getElementById(cboExpMoClientID);
            var cboExpDay = document.getElementById(cboExpDayClientID);
           
            var now = new Date();
            var nowMonth = now.getMonth();
            var nowDay = now.getDate();
            var nowYear = now.getFullYear();
           
            var mo = cboExpMo.options[cboExpMo.selectedIndex].value;
            var day = cboExpDay.options[cboExpDay.selectedIndex].text;
            var year = (mo < nowMonth) ? (nowYear + 1) : nowYear;
            return parseDate((eval(mo)+1) + "/" + day + "/" + year);
        }

        /*  This method executes multiple-control radio button validation to ensure that "Yes"
            is selected for at least one of the three exchange options: Local Pickup, Local Delivery or Shipping */
        function validateExchangeRadioButtons(sender, args)
        {
            var radLocalPickup = document.getElementsByName('<%= radLocalPickup.UniqueID %>');
            var radLocalDelivery = document.getElementsByName('<%= radLocalDelivery.UniqueID %>');
            var radShipping = document.getElementsByName('<%= radShipping.UniqueID %>');
           
            args.IsValid = !(radLocalPickup[1].checked && radLocalDelivery[1].checked && radShipping[1].checked);
        }  
       
        /* Fired when the local delivery "Yes" or "No" radio button is clicked
           ... reveals/conceals the additional panel */
        function adjustDelivery() {
            var radLocalDelivery = document.getElementsByName('<%= radLocalDelivery.UniqueID %>');
            deliveryClicked(radLocalDelivery[0].checked);
        }
       
        /* Fired when the local delivery "Yes" or "No" radio button is clicked
           ... reveals/conceals the additional panel */
        function adjustShipping() {
            var radShipping = document.getElementsByName('<%= radShipping.UniqueID %>');
            shippingClicked(radShipping[0].checked);
        }
       
        /* Disables the specify delivery area text field if the corresponding radio button is not selected */
        function deliveryAreaChanged() {
            var radLocalDeliveryOptionSpecify = document.getElementById('<%= radLocalDeliveryOptionSpecify.ClientID %>');
            var txtDeliveryArea = document.getElementById('<%= txtDeliveryArea.ClientID %>');
            if(radLocalDeliveryOptionSpecify.checked) {
                txtDeliveryArea.disabled = false;    
            } else {
                txtDeliveryArea.value = '';
                txtDeliveryArea.disabled = true;
            }
        }
       
        function validateDeliveryArea(sender, args) {
            var radLocalDelivery = document.getElementsByName('<%= radLocalDelivery.UniqueID %>');  
            var radLocalDeliveryOptionSpecify = document.getElementById('<%= radLocalDeliveryOptionSpecify.ClientID %>');          
           
            // Validate only if local delivery has been checked
            if(radLocalDelivery[0].checked && radLocalDeliveryOptionSpecify.checked) {
                args.IsValid = (trim(args.Value) != '');
            }
        }
       
        // Removes the appropriate service.  This is most important when #2 is clicked
        // in order to create the appearance that the 2nd box has actually been deleted by swapping
        // values with the 3rd box before hiding the 3rd box.
        function removeService(serviceNumber)
        {
            var cboShippingService1 = document.getElementById('<%= cboShippingService1.ClientID %>');
            var cboShippingService2 = document.getElementById('<%= cboShippingService2.ClientID %>');
            var cboShippingService3 = document.getElementById('<%= cboShippingService3.ClientID %>');
           
            // Clear text fields if an item is removed
            var txtCost2 = document.getElementById('<%= txtCost2.ClientID %>');
            var txtCost3 = document.getElementById('<%= txtCost3.ClientID %>');
           
            if(serviceNumber == 2)
            {
               
                if(servicesAdded == 3) { // Do Swap
                    cboShippingService2.selectedIndex = cboShippingService3.selectedIndex;
                    txtCost2.value = txtCost3.value;
                    cboShippingService3.selectedIndex = 0;
                    txtCost3.value = "";
                } else {
                    cboShippingService2.selectedIndex = 0;
                    txtCost2.value = "";
                }
                cboShippingService1.focus();
               
            } else {    // 3
           
                txtCost3.value = "";
                cboShippingService3.selectedIndex = 0;
                cboShippingService1.focus();
            }
            adjustServices(false);
           
            // Hide errors eliminated by removing, if applicable
            serviceCostError(true, false);
            servicesError(true, false);
        }
       
        function validatePackage(sender, args)
        {
            var cboPackage = document.getElementById('<%= cboPackage.ClientID %>');  
            if(packageReadyToValidate()) {
                if(cboPackage.selectedIndex == 0)
                {
                    args.IsValid = false;
                }
                else
                {
                    if(cboPackage.options[cboPackage.selectedIndex].innerText != 'My Packaging')
                    {
                        // Clears validation error message by dimension boxes, if necessary
                        revalidate('valDimensionCustom');
                    }
                    args.IsValid = true;
                }
            }
        }
       
        function validateWeight(sender, args)
        {
            if(packageReadyToValidate()) {
                if(args.Value != '' && !isNaN(args.Value) && args.Value > 0) {
                    args.IsValid = true;  
                } else {
                    args.IsValid = false;
                }
            }
        }
       
        function validateDimensions(sender, args)
        {  
            if(packageReadyToValidate()) {
                var cboPackage = document.getElementById('<%= cboPackage.ClientID %>');  
                var txtLength = document.getElementById('<%= txtLength.ClientID %>');
                var txtWidth = document.getElementById('<%= txtWidth.ClientID %>');
                var txtHeight = document.getElementById('<%= txtHeight.ClientID %>');      
               
                if(cboPackage.options[cboPackage.selectedIndex].innerText == 'My Packaging')
                {
                    args.IsValid = packageTextFieldIsValid(txtLength) &&
                                    packageTextFieldIsValid(txtWidth) &&
                                    packageTextFieldIsValid(txtHeight);
                }
                else
                {
                    args.IsValid = true;
                }
            }
        }
       
        function validateServices1(sender, args)
        {
            if(servicesReadyToValidate()) {
                args.IsValid = args.Value != 0;
                servicesError(args.IsValid);
            } else {
                args.IsValid = true;
                servicesError(true);
            }
        }
       
        function validateServices2(sender, args)
        {
            if(servicesReadyToValidate()) {
                var shippingService2 = document.getElementById('shippingService2');
                var cboShippingService2 = document.getElementById('<%= cboShippingService2.ClientID %>');
               
                args.IsValid = shippingService2.className == "hide" || (shippingService2.className == 'show' && cboShippingService2.selectedIndex != 0);
                servicesError(args.IsValid);
            } else {
                args.IsValid = true;
                servicesError(true);
            }
        }
       
        function validateServices3(sender, args)
        {
            if(servicesReadyToValidate()) {
                var shippingService3 = document.getElementById('shippingService3');
                var cboShippingService3 = document.getElementById('<%= cboShippingService3.ClientID %>');
               
                args.IsValid = shippingService3.className == "hide" || (shippingService3.className == 'show' && cboShippingService3.selectedIndex != 0);
                servicesError(args.IsValid);
            } else {
                args.IsValid = true;
                servicesError(true);
            }
        }
       
         
        function freeShippingClicked() {
                var freeShippingCheckBox = document.getElementById('freeShippingCheckBox');
                var txtCost1 = document.getElementById('<%= txtCost1.ClientID %>');
              if(freeShippingCheckBox.checked) {
                    txtCost1.value = "0.00";
                    txtCost1.disabled = true;
              } else {
                    txtCost1.value = "";
                    txtCost1.disabled = false;
              }
              revalidate('valCost1Custom');
        }
       
        function servicesError(hide) {
       
            var servicesErrorMessage = document.getElementById('servicesErrorMessage');
            var serviceCostErrorMessage = document.getElementById('serviceCostErrorMessage');
           
            // Only hide the error message if all services fields are valid
            if(hide && (!servicesReadyToValidate() || (allServicesAreValid() && allServiceSelectionsUnique())))
            {
                servicesErrorMessage.className = 'hide';
                               
            } else {
           
                if(allServiceSelectionsUnique()) {
                    servicesErrorMessage.innerText = ' Please select a value for all services.';
                } else {
                    servicesErrorMessage.innerText = ' Please select each service only once.'
                }
           
                // This message takes precedence over the cost error message
                // But the cost error message may need to be HIDDEN
                servicesErrorMessage.className = 'show';
                serviceCostErrorMessage.className = 'hide';
            }
        }
       
        function serviceCostError(hide, force) {
            var serviceCostErrorMessage = document.getElementById('serviceCostErrorMessage');
            var servicesErrorMessage = document.getElementById('servicesErrorMessage');
           
            if(hide && (allServiceCostsAreValid() || force)) {
                serviceCostErrorMessage.className = 'hide';
            } else {
                // Even if a cost is invalid, the service message takes precedence if it is invalid
                if((allServicesAreValid() && allServiceSelectionsUnique()) || servicesErrorMessage.className == "hide") {
                    serviceCostErrorMessage.className = 'show';
                } else {
                    serviceCostErrorMessage.className = 'hide';
                }
            }
        }
       
       
        // Although only one service must be bad for the batch to be invalid
        // All must be good for the batch to be good
        function allServicesAreValid() {
            var shippingService2 = document.getElementById('shippingService2');
            var shippingService3 = document.getElementById('shippingService3');
            var cboShippingService1 = document.getElementById('<%= cboShippingService1.ClientID %>');
            var cboShippingService2 = document.getElementById('<%= cboShippingService2.ClientID %>');
            var cboShippingService3 = document.getElementById('<%= cboShippingService3.ClientID %>');
           
            return cboShippingService1.selectedIndex != 0 &&
                   (cboShippingService2.selectedIndex != 0 || shippingService2.className == 'hide') &&
                   (cboShippingService3.selectedIndex != 0 || shippingService3.className == 'hide');
        }
       
        /* Assumes that any hidden combo box will be reset to 0 -- considering them unique because they are hidden.
           That is to say that this validation assumes that the combo boxes are otherwise valid, asside from possibly being duplicated */
        function allServiceSelectionsUnique() {
            var cboShippingService1 = document.getElementById('<%= cboShippingService1.ClientID %>');
            var cboShippingService2 = document.getElementById('<%= cboShippingService2.ClientID %>');
            var cboShippingService3 = document.getElementById('<%= cboShippingService3.ClientID %>');
            ci1 = cboShippingService1.selectedIndex;
            ci2 = cboShippingService2.selectedIndex;
            ci3 = cboShippingService3.selectedIndex;
           
            ci1unique = ci1 == 0 || (ci1 != ci2 && ci1 != ci3);
            ci2unique = ci2 == 0 || (ci2 != ci1 && ci2 != ci3);
            ci3unique = ci3 == 0 || (ci3 != ci1 && ci3 != ci2);
            return ci1unique && ci2unique && ci3unique;
        }
       
        function allServiceCostsAreValid() {
            var shippingService2 = document.getElementById('shippingService2');
            var shippingService3 = document.getElementById('shippingService3');
            var txtCost1 = document.getElementById('<%= txtCost1.ClientID %>');
            var txtCost2 = document.getElementById('<%= txtCost2.ClientID %>');
            var txtCost3 = document.getElementById('<%= txtCost3.ClientID %>');
           
            var serviceCost1 = document.getElementById('serviceCost1');
           
            // Either the costs are valid because they are all not needed (ie. Calculated Rate)
            // Or they are valid because shipping is not even selected
            // Or they all either 1) have valid text or 2) are individually hidden
           
            return  packageReadyToValidate() || !servicesReadyToValidate() ||
                   ((costTextFieldIsValid(txtCost1) &&
                   (costTextFieldIsValid(txtCost2) || shippingService2.className == 'hide') &&
                   (costTextFieldIsValid(txtCost3) || shippingService3.className == 'hide')));
        }
       
        function costTextFieldIsValid(field)
        {
            return field.value != '' && isNumeric(field.value) && field.value >= 0;
        }
       
        // The first cost is unique because it is disabled when free shipping is clicked
        // which causes problems with the validation (it is initially validated once and passes with an immediate second validation that fails).
        function validateCost1(sender, args) {
           
            var freeShippingCheckBox = document.getElementById('freeShippingCheckBox');
            var txtCost1 = document.getElementById('<%= txtCost1.ClientID %>');
            if(servicesReadyToValidate() && !packageReadyToValidate()) {
                if(freeShippingCheckBox.checked || costTextFieldIsValid(txtCost1) ) {
                    args.IsValid = true;
                    serviceCostError(true, false);
                } else {
                    args.IsValid = false;
                    serviceCostError(false, false);
                }
            } else {
                args.IsValid = true;
                serviceCostError(true, false);
            }
        }
       
        function validateCost2(sender, args) {
           
            // Only validate if it is "Fixed Rate" (ie. no package information)
            // AND the second shipping service is revealed
            var shippingService2 = document.getElementById('shippingService2');
           
            if(servicesReadyToValidate() && !packageReadyToValidate() && shippingService2.className == 'show') {
                if(args.Value != '' && isNumeric(args.Value) && args.Value >= 0) {
                    args.IsValid = true;
                    serviceCostError(true, false);
                } else {
                    args.IsValid = false;
                    serviceCostError(false, false);
                }
            } else {
                args.IsValid = true;
                serviceCostError(true, false);
            }
        }
       
        function validateCost3(sender, args) {
           
            // Only validate if it is "Fixed Rate" (ie. no package information)
            // AND the second shipping service is revealed
            var shippingService3 = document.getElementById('shippingService3');
           
            if(servicesReadyToValidate() && !packageReadyToValidate() && shippingService3.className == 'show') {
                if(args.Value != '' && isNumeric(args.Value) && args.Value >= 0) {
                    args.IsValid = true;
                    serviceCostError(true, false);
                } else {
                    args.IsValid = false;
                    serviceCostError(false, false);
                }
            } else {
                args.IsValid = true;
                serviceCostError(true, false);
            }
        }
       
        /* When "Calculated Rate" is clicked, clear & revalidate cost fields to clear failed validation (it is no longer required that they be filled out) */
        function revalidateCosts() {
            var radCalculatedRate = document.getElementById('<%= radCalculatedRate.ClientID %>');
            var txtCost1 = document.getElementById('<%= txtCost1.ClientID %>');
            var txtCost2 = document.getElementById('<%= txtCost2.ClientID %>');
            var txtCost3 = document.getElementById('<%= txtCost3.ClientID %>');
           
            if(radCalculatedRate.checked) {
                var freeShippingCheckBox = document.getElementById('freeShippingCheckBox');
                if(!freeShippingCheckBox.checked) {
                    txtCost1.value = "";
                }
                txtCost2.value = "";
                txtCost3.value = "";
                revalidate('valCost1Custom');
                revalidate('valCost2Custom');
                revalidate('valCost3Custom');
                serviceCostError(true, true);
            }
        }
       
        // Only validate service section if the "Yes" to shipping radio button is checked
        function servicesReadyToValidate() {
            var radShipping = document.getElementsByName('<%= radShipping.UniqueID %>');
            return radShipping[0].checked;
        }
       
        // Only validate the package section if the "Calculated Rate" radio is checked
        function packageReadyToValidate() {
            var radCalculatedRate = document.getElementById('<%= radCalculatedRate.ClientID %>');
            return servicesReadyToValidate() && radCalculatedRate.checked;
        }
       
        // Package text fields (weight, length, width and height) must not be blank and must contain a positive numeric value
        function packageTextFieldIsValid(field)
        {
            return field.value != '' && isNumeric(field.value) && field.value > 0;
        }
       
       
       
        /*  This function does multiple control validation for the IM handle and IM type drop-down fields
        using the getClientID function created using ClientScriptUtils.cs */
        function validateIM(sender, args)
        {
            var txtIMHandle = document.getElementById('<%= txtIMHandle.ClientID %>');
            var cboIMType = document.getElementById('<%= cboIMType.ClientID %>');
            if(txtIMHandle.value.replace(/^\s+|\s+$/, '') != '') {
                // If there is a value in the "IM Handle" field then the user
                // needs to select an IM type
                args.IsValid = (cboIMType.selectedIndex != 0);  
            } else {
                args.IsValid = true;
            }
        }
               
      </script>
</asp:Content>

<asp:Content ID="postAdContent" ContentPlaceHolderID="masterPlaceHolder" Runat="Server">

    <!-- MAIN AREA CONTENT -->
      <table>
            <tr>
                  <td class="mainContentAreaCell">
                  <div class="pageTitle" style="padding-left:0px;">
                        Post Ad
                  </div>
                  <div class="pageNoteContent" style="padding-top:10px;">
                        Create your classified ad below. You'll be given a chance to preview your ad before posting.
                  </div>
                  <div class="postAdRequiredFields" style="padding-top:10px;">
                        <span class="postAdAstrisk">*</span> Required Fields
                  </div>
                  <br />
                  </td>
            </tr>
            <tr>
                  <td>
                  <!-- BEGIN STEP 1 SECTION -->
                  <table cellpadding="0" cellspacing="0" style="width:100%;"><tr><td>
                  <table cellpadding="0" cellspacing="0" border="0" style="width:100%;">
                        <tr>
                              <td height="0" width="42" rowspan="2"><img alt="" src="Images/Post_Ad_Area_Step_1.jpg"/></td>
                              <td class="postAdAreaTBGLeft" valign="top" colspan=3><img src="Images/Post_Ad_Title_Enter_Ad_Information.png"/></td>
                              <td width=11><img src="Images/Post_Ad_Area_TR_Corner.png"/></td>
                        </tr>
                        <!-- LOWER TITLE ROW -->
                        <tr height=9>
                              <td style="background-color:#dcefdc;"></td>
                              <td width=2 style="background-color:white;"></td>
                              <td style="background-color:#F1FAF1;" width="100%"><img src="Images/Transparent_Pixel.png" width=1 height=9/></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:red;"></td>
                        </tr>
                        <!-- LOWER TITLE ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Category&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                              <armadillo:CategorySelectControl ID="armCategorySelect" runat="server" InitialItem="-- Select Category --"/>
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END CATEGORIES ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr style="height:2px;">
                              <td style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;width:42px;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;width:11px;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN AD TITLE ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Ad Title&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td style="background-color:#F1FAF1;" width="100%">
                                    <div class="postAdFieldRight">
                            <asp:TextBox ID="txtAdTitle" runat="server" CssClass="standardTextField" Width="400px"/>
                            <asp:RequiredFieldValidator ID="titleValidator"
                                                        runat="server"
                                                        ErrorMessage="Please enter a title."
                                                        ControlToValidate="txtAdTitle"
                                                        CssClass="validationText"
                                                        Display="dynamic"
                                                        SetFocusOnError="true" />
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END AD TITLE ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr style="height:2px;">
                              <td style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;width:42px;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;width:11px;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN AD DESCRIPTION ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Ad Description&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td style="background-color:#F1FAF1;" width="100%">
                                    <div class="postAdFieldRight">
                                          <textarea id="txtAdDescription" cols="80" class="standardTextField" style="width:400px;height:140px;font-family:arial,verdana,sans Serif;" runat="server"></textarea>
                            <asp:RequiredFieldValidator ID="descriptionValidator"
                                                        runat="server"
                                                        ErrorMessage="Please enter a description."
                                                        ControlToValidate="txtAdDescription"
                                                        CssClass="validationText"
                                                        Display="dynamic"
                                                        SetFocusOnError="true" />
                                          
                                          
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END AD DESCRIPTION ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr style="height:2px;">
                              <td style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;width:42px;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;width:11px;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN ASKING PRICE ROW -->
                        <tr>
                              <td colspan=2 style="background-image: url(Images/Post_Ad_Area_LBG.jpg);background-repeat:repeat-y;background-position:left;background-color:#dcefdc;">
                                    <div class="postAdFieldLabelTop">
                                          Asking&nbsp;Price&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td style="background-color:white;width:2px;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td style="background-color:#F1FAF1;width:100%;">
                                    <div class="postAdFieldRight">
                            <span class="postAdFieldLabelRight">$</span> <asp:TextBox ID="txtPrice" runat="server" style="width:90px;" CssClass="standardTextField"/>
                            <asp:RequiredFieldValidator ID="askingPriceValidator"
                                                        runat="server"
                                                        ErrorMessage="Please enter an asking price."
                                                        ControlToValidate="txtPrice"
                                                        CssClass="validationText"
                                                        Display="dynamic"
                                                        SetFocusOnError="true" />
                            <asp:RegularExpressionValidator ID="askingPriceValidator2"
                                                            runat="server"
                                                            ErrorMessage="Please enter a valid price."
                                                            ControlToValidate="txtPrice"
                                                            CssClass="validationText"
                                                            SetFocusOnError="true"
                                                            ValidationExpression="\s*\$*\s*(?:[\d]{1,3},[\d]{3},[\d]{3}|[\d]{1,3},[\d]{3}|[\d]{1,3}|[\d]{1,10})(?:[.][\d]{2})*\s*" />
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END ASKING PRICE ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr style="height:2px;">
                              <td style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;width:42px;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;width:11px;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN EXPIRATION DATE ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Ad Expires On&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td style="background-color:#F1FAF1;" width="100%">
                                    <div class="postAdFieldRight">
                            <asp:DropDownList ID="cboExpirationMonth" runat="server" CssClass="standardComboBox"/>
                            <asp:DropDownList ID="cboExpirationDay" runat="server" CssClass="standardComboBox"/>
                                        <a id="dateLaunchLink" href="javascript:void(0);" runat="server"><img alt="Launch Calendar" src="Images/Icon_Calendar_Month.png" border="0"/></a>
                                        <div id="calendarDiv" style="position:absolute;z-index:0px;background-color:#FFFFFF;"></div>
                            <asp:HiddenField ID="txtHiddenExpirationDay" runat="server" />
                            <asp:HiddenField ID="txtHiddenExpirationMonth" runat="server" />
                            <asp:HiddenField ID="txtHiddenDate" runat="server" />
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END AD TITLE ROW -->
                        <tr>
                              <td width="42"><img src="Images/Post_Ad_Area_BL_Corner.jpg"/></td>
                              <td width="300" style="background-image: url(Images/Post_Ad_Area_BBG_Left.jpg);background-repeat:repeat-x;"><img src="Images/Transparent_Pixel.png" height="12" width="30"/></td>
                              <td width="100%" colspan=2 style="background-image: url(Images/Post_Ad_Area_BBG_Right.jpg);background-repeat:repeat-x;"><img src="Images/Transparent_Pixel.png" height="12" width="30"/></td>
                              <td width="11"><img src="Images/Post_Ad_Area_BR_Corner.jpg"/></td>
                        </tr>
                  </table>
                  </td></tr></table>
                  <!-- END STEP 1 SECTION -->
                  </td>
            </tr>
            <tr>
                  <td class="postAdStepCell">
                  <!-- BEGIN STEP 2 SECTION -->
                  <table cellpadding=0 cellspacing=0 style="width:100%"><tr><td>
                  <table cellpadding=0 cellspacing=0 border=0 style="width:100%;">
                        <tr>
                              <td height=0 width="42" rowspan=2><img src="Images/Post_Ad_Area_Step_2.jpg"/></td>
                              <td class="postAdAreaTBGLeft" valign="top" colspan=3><img src="Images/Post_Ad_Title_Add_Images.png"/></td>
                              <td width=11><img src="Images/Post_Ad_Area_TR_Corner.png"/></td>
                        </tr>
                        <!-- BEGIN LOWER TITLE ROW -->
                        <tr height=9>
                              <td style="background-color:#dcefdc;"></td>
                              <td width=2 style="background-color:white;"></td>
                              <td style="background-color:#F1FAF1;" width="100%"><img src="Images/Transparent_Pixel.png" width=1 height=9/></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:red;"></td>
                        </tr>
                        <!-- END LOWER TITLE ROW -->
                        <!-- BEGIN IMAGES ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Images
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                  
                                    <div class="postAdFieldRight" align="left">
                           
                                          <table width="100" cellpadding=0 cellspacing=0 runat="server">
                                                <tr>
                                                      <td align="center" valign="top">
                                                            <!-- BEGIN FIRST IMAGE CELL -->
                                        <asp:Image ID="addImage1" runat="server" ImageUrl="Images/Icon_Image_Placeholder_Active.png" AlternateText="Ad Image #1"/>
                                        <asp:PlaceHolder ID="phImageLink1" runat="server" />
                                                            <!-- END FIRST IMAGE CELL -->
                                                      </td>
                                                      <td><img alt="" src="Images/Transparent_Pixel.png" width="15"/></td>
                                                      <td align="center" valign="top">
                                                            <!-- BEGIN SECOND IMAGE CELL -->
                                                            <asp:Image ID="addImage2" runat="server" ImageUrl="Images/Icon_Image_Placeholder_Inactive.png" AlternateText="Ad Image #2"/>
                                                            <asp:PlaceHolder ID="phImageLink2" runat="server" />
                                                            <!-- END SECOND IMAGE CELL -->
                                                      </td>
                                                      <td><img alt="" src="Images/Transparent_Pixel.png" width="15"/></td>
                                                      <td align="center" valign="top">
                                                            <!-- BEGIN THIRD IMAGE CELL -->
                                                            <asp:Image ID="addImage3" runat="server" ImageUrl="Images/Icon_Image_Placeholder_Inactive.png" AlternateText="Ad Image #3"/>
                                                            <asp:PlaceHolder ID="phImageLink3" runat="server" />
                                                            <!-- END THIRD IMAGE CELL -->
                                                      </td>
                                                      <td><img alt="" src="Images/Transparent_Pixel.png" width="15"/></td>
                                                      <td align="center" valign="top">
                                                            <!-- BEGIN FOURTH IMAGE CELL -->
                                                            <asp:Image ID="addImage4" runat="server" ImageUrl="Images/Icon_Image_Placeholder_Inactive.png" AlternateText="Ad Image #4"/>
                                                            <asp:PlaceHolder ID="phImageLink4" runat="server" />
                                                            <!-- END FOURTH IMAGE CELL -->
                                                      </td>
                                                </tr>
                                          </table>
                                    </div>
                                    
                                    <%-- BEGIN IMAGE FILE LOADER --%>
                                    <div id="imageFileUploadPanel" class="hide" style="padding-left:10px;margin-bottom:10px;">
                                        <asp:FileUpload ID="imageFileUpload" runat="server" style="width:400px;height:23px;color:#666666;"/> <asp:Button ID="btnUpload" runat="server" Text="Upload" Height="23px" OnClick="btnUpload_Click" CausesValidation="false" />
                                    </div>
                                  <%-- END IMAGE FILE LOADER --%>
                                         
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END IMAGES ROW -->
                        <tr>
                              <td width="42"><img src="Images/Post_Ad_Area_BL_Corner.jpg"/></td>
                              <td width="300" style="background-image: url(Images/Post_Ad_Area_BBG_Left.jpg);background-repeat:repeat-x;"><img src="Images/Transparent_Pixel.png" height="12" width="30"/></td>
                              <td width="100%" colspan=2 style="background-image: url(Images/Post_Ad_Area_BBG_Right.jpg);background-repeat:repeat-x;"><img src="Images/Transparent_Pixel.png" height="12" width="30"/></td>
                              <td width="11"><img src="Images/Post_Ad_Area_BR_Corner.jpg"/></td>
                        </tr>
                  </table>
                  </td></tr></table>
                  <!-- END STEP 2 SECTION -->
                  </td>
            </tr>
            <tr>
                  <td class="postAdStepCell">
                  <!-- BEGIN STEP 3 SECTION -->
                  <table cellpadding=0 cellspacing=0 style="width:100%"><tr><td>
                  <table cellpadding=0 cellspacing=0 border=0 style="width:100%;">
                        <tr>
                              <td height=0 width="42" rowspan=2><img src="Images/Post_Ad_Area_Step_3.jpg"/></td>
                              <td class="postAdAreaTBGLeft" valign="top" colspan=3><img src="Images/Post_Ad_Title_Specify_Exchange_Options.png"/></td>
                              <td width=11><img src="Images/Post_Ad_Area_TR_Corner.png"/></td>
                        </tr>
                        <!-- LOWER TITLE ROW -->
                        <tr height=9>
                              <td style="background-color:#dcefdc;"></td>
                              <td width=2 style="background-color:white;"></td>
                              <td style="background-color:#F1FAF1;" width="100%"><img src="Images/Transparent_Pixel.png" width=1 height=9/></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:red;"></td>
                        </tr>
                        <!-- LOWER TITLE ROW -->
                        <!-- BEGIN LOCAL PICKUP ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Local Pickup&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                                        <table border="0" cellpadding="0" cellspacing="0"><tr><td>
                            <asp:RadioButtonList ID="radLocalPickup" runat="server" CssClass="postAdFieldValueRight" RepeatLayout="Table" RepeatDirection="Horizontal">
                                <asp:ListItem Text="Yes&nbsp;&nbsp;" Value="Yes" Selected="True" />
                                <asp:ListItem Text="&nbsp;No&nbsp;&nbsp;" Value="No" Selected="False" />
                            </asp:RadioButtonList>
                            </td><td style="width:100%;">
                                <asp:CustomValidator ID="validatorExchangeRadioButtonsMain"
                                                     runat="server"
                                                     ErrorMessage="Please select 'Yes' for at least 1 exchange option."
                                                     CssClass="validationText"
                                                     SetFocusOnError="true"
                                                     ControlToValidate="radLocalPickup"
                                                     Display="Dynamic"
                                                     ClientValidationFunction="validateExchangeRadioButtons" />
                            </td></tr></table>
                           
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END LOCAL PICKUP ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr height="2">
                              <td width=42 style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN LOCAL PICKUP ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Local Delivery&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                        <asp:RadioButtonList ID="radLocalDelivery" runat="server" CssClass="postAdFieldValueRight" RepeatLayout="Table" RepeatDirection="Horizontal">
                            <asp:ListItem Text="Yes&nbsp;&nbsp;" Value="Yes" Selected="False" />
                            <asp:ListItem Text="&nbsp;No&nbsp;&nbsp;" Value="No" Selected="True" />
                        </asp:RadioButtonList>
                                    <!-- BEGIN DELIVERY OPTIONS TABLE -->
                                    <div id="deliveryOptions" style="margin-top:8px;margin-bottom:5px;" class="hide">
                                    <table width=400 height=100% style="background-color:#dcefdc;" cellpadding=0 cellspacing=0>
                                          <tr>
                                                <td><img src="Images/SubArea_TL_Corner.png"></td>
                                                <td width=100%></td>
                                                <td><img src="Images/SubArea_TR_Corner.png"></td>
                                          </tr>
                                          <tr height="100%">
                                                <td></td>
                                                <td valign="top">
                                                      <div style="margin-bottom:10px;">
                                                          <span style="font-size:11px;font-weight:bold;color:#dc6415;">Where will you deliver?</span>
                                                          <asp:CustomValidator ID="valDeliveryAreaCustom"
                                                                               runat="server"
                                                                               ErrorMessage="Please enter a delivery area."
                                                                               Display="dynamic"
                                                                               ControlToValidate="txtDeliveryArea"
                                                                               CssClass="validationText"
                                                                               SetFocusOnError="true"
                                                                               ClientValidationFunction="validateDeliveryArea"
                                                                               ValidateEmptyText="true" />
                                                      </div>
                                                      <!-- BEGIN INNER DELIVERY OPTIONS TABLE -->
                                                      <table cellpadding=0 cellspacing=0>
                                                            <tr class="deliveryOptionRow">
                                                                  <td>
                                                <asp:RadioButton ID="radLocalDeliveryOptionSpecify" GroupName="LocalDeliveryOption" runat="server" Checked="true"/>
                                                                      <span class="postAdFieldValueRight"><b>Specify Area:</b></span></td>
                                                                  <td width=10></td>
                                                                  <td>
                                                <asp:TextBox ID="txtDeliveryArea" runat="server" CssClass="standardTextField" style="width:200px;"/>
                                                                  </td>
                                                            </tr>
                                                            <tr class="deliveryOptionRow">
                                                                  <td>
                                                                      <asp:RadioButton ID="radLocalDeliveryOptionNegotiable" GroupName="LocalDeliveryOption" runat="server" Checked="false"/>
                                                                      <span class="postAdFieldValueRight"><b>Negotiable</b></span></td>
                                                                  <td width=10></td>
                                                                  <td></td>
                                                            </tr>
                                                      </table>
                                                      <!-- END INNER DELIVERY OPTIONS TABLE -->
                                                 </td>
                                                <td></td>
                                          </tr>
                                          <tr>
                                                <td><img src="Images/SubArea_BL_Corner.png"></td>
                                                <td></td>
                                                <td><img src="Images/SubArea_BR_Corner.png"></td>
                                          </tr>
                                    </table>
                                    </div>
                                    <!-- END DELIVERY OPTIONS TABLE -->
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END LOCAL PICKUP ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr height="2">
                              <td width=42 style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN SHIPPING ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop" >
                                          Shipping&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                                        <!-- BEGIN SHIPPING YES/NO BUTTONS -->
                                        <asp:RadioButtonList ID="radShipping" runat="server" CssClass="postAdFieldValueRight" RepeatLayout="Table" RepeatDirection="Horizontal">
                                <asp:ListItem Text="Yes&nbsp;&nbsp;" Value="Yes" Selected="False" />
                                <asp:ListItem Text="&nbsp;No&nbsp;&nbsp;" Value="No" Selected="True" />
                            </asp:RadioButtonList>
                            <!-- END SHIPPING YES/NO BUTTONS -->
                                          <div id="shippingOptions" style="margin-top:8px;" class="hide">
                                          <!-- BEGIN SHIPPING OPTIONS TABLE -->
                                          <table width=550 height=100% style="background-color:#dcefdc;margin-bottom:10px;" cellpadding=0 cellspacing=0>
                                                <tr>
                                                      <td><img src="Images/SubArea_TL_Corner.png"></td>
                                                      <td width=100%></td>
                                                      <td><img src="Images/SubArea_TR_Corner.png"></td>
                                                </tr>
                                                <tr height="100%">
                                                      <td></td>
                                                      <td valign="top">
                                                            <div style="font-size:11px;font-weight:bold;color:#dc6415;margin-bottom:10px;margin-bottom:10px;">How will you charge for shipping?&nbsp;<span class="postAdAstrisk">*</span></div>
                                                            <!-- BEGIN SHIPPING CHARGE TABLE -->
                                                            <table cellpadding=0 cellspacing=0>
                                                                  <tr class="deliveryOptionRow">
                                                                        <td>
                                                                              <table cellpadding="0" cellspacing="0">
                                                                                    <tr class="shippingOptionRow">
                                                                                          <td>
                                                                                                <div class="postAdFieldValueRight">
                                                                    <asp:RadioButton ID="radFixedRate" GroupName="shippingRate" runat="server" Checked="true" />  <b>Fixed Rate</b>: Same cost to all buyers
                                                                                              </div>
                                                                                          </td>
                                                                                    </tr>
                                                                                    <tr class="shippingOptionRow">
                                                                                          <td>
                                                                                                <div class="postAdFieldValueRight">
                                                                                                    <asp:RadioButton ID="radCalculatedRate" GroupName="shippingRate" runat="server" /> <b>Calculated Rate</b>: Cost varies by buyer location
                                                                                              </div>
                                                                                          </td>
                                                                                    </tr>
                                                                              </table>
                                                                        </td>
                                                                        <td>
                                                                              
                                                                        </td>
                                                                  </tr>
                                                            </table>
                                                            <!-- END SHIPPING CHARGE TABLE -->
                                                      </td>
                                                      <td></td>
                                                </tr>
                                                <tr>
                                                      <td><img alt="" src="Images/SubArea_BL_Corner.png" /></td>
                                                      <td></td>
                                                      <td><img alt="" src="Images/SubArea_BR_Corner.png" /></td>
                                                </tr>
                                          </table>
                                          <table width=550 height=100% style="background-color:#dcefdc;" cellpadding=0 cellspacing=0>
                                                <tr>
                                                      <td><img alt="" src="Images/SubArea_TL_Corner.png" /></td>
                                                      <td width=100%></td>
                                                      <td><img alt="" src="Images/SubArea_TR_Corner.png" /></td>
                                                </tr>
                                                <tr height="100%">
                                                      <td></td>
                                                      <td valign="top">
                                                          <table cellpadding=0 cellspacing=0>
                                                              <tr>
                                                                  <td>
                                                                      <div style="font-size:11px;font-weight:bold;color:#dc6415;margin-bottom:10px;">What types of shipping will you offer?&nbsp;<span class="postAdAstrisk">*</span></div>        
                                                                  </td>
                                                                  <td>
                                                                      <div class="hide" id="servicesErrorMessage" style="font-family:verdana, arial;font-weight:bold;color:red;font-size:11px;margin-bottom:10px;">
                                                                            &nbsp;&nbsp;Please select a value for all services.
                                                                        </div>
                                                                        <div class="hide" id="serviceCostErrorMessage" style="font-family:verdana, arial;font-weight:bold;color:red;font-size:11px;margin-bottom:10px;">
                                                                            &nbsp;&nbsp;Please enter a cost for all services.
                                                                        </div>
                                                                    </td>
                                                              </tr>
                                                          </table>
                                                            
                                                            <!-- BEGIN RESEARCH RATES LINK -->
                                                            
                                                            <!-- END RESEARCH RATES LINK -->
                                                            <!-- BEGIN INNER SHIPPING OPTIONS TABLE -->
                                                            <table cellpadding=0 cellspacing=0 border=0 style="margin-bottom:5px;">
                                                                  <tr>
                                                                        <td>
                                                                              <!-- BEGIN FIRST SERVICE -->
                                                                              <div id="shippingService1" class="show" style="padding-top:2px;padding-bottom:2px;">
                                                                              <table cellpadding="0" cellspacing="0" width=100%>
                                                                                    <tr>
                                                                                          <td>
                                                                <armadillo:ShippingServiceComboBox ID="cboShippingService1" runat="server" CssClass="standardComboBox" InitialItem="-- Select a UPS Service --"/>
                                                                <asp:CustomValidator ID="valShippingService1Custom"
                                                                                     runat="server"
                                                                                     ErrorMessage=""
                                                                                     Display="none"
                                                                                     ClientValidationFunction="validateServices1"
                                                                                     ControlToValidate="cboShippingService1"
                                                                                     SetFocusOnError="true"/>
                                                                                          </td>
                                                                                          <td style="padding-left:10px;">
                                                                                              <div id="serviceCost1" class="show">
                                                                                                    <span class="postAdFieldLabelRight">Cost:&nbsp;&nbsp;$</span>
                                                                    <asp:TextBox ID="txtCost1" runat="server" CssClass="standardTextField" style="margin-left:3px;width:50px;" />
                                                                    <asp:CustomValidator ID="valCost1Custom"
                                                                                     runat="server"
                                                                                     ErrorMessage=""
                                                                                     Display="none"
                                                                                     ControlToValidate="txtCost1"
                                                                                     ClientValidationFunction="validateCost1"
                                                                                     ValidateEmptyText="true"
                                                                                     SetFocusOnError="true"/>
                                                                                                </div>
                                                                                          </td>
                                                                                          <td style="padding-left:10px;">
                                                                                                <input id="freeShippingCheckBox" type="checkbox" style="margin-right:2px;" onclick="freeShippingClicked();"/><span class="postAdFieldValueRight">Free&nbsp;Shipping</span>
                                                                                          </td>
                                                                                    </tr>
                                                                              </table>
                                                                              </div>
                                                                              <!-- END FIRST SERVICE -->
                                                                        </td>
                                                                  </tr>
                                                                  <tr>
                                                                        <td>
                                                                              <!-- BEGIN SECOND SERVICE -->
                                                                              <div id="shippingService2" class="hide" style="padding-top:2px;padding-bottom:2px;">
                                                                              <table cellpadding="0" cellspacing="0" width=100%>
                                                                                    <tr>
                                                                                          <td>
                                                                                                <armadillo:ShippingServiceComboBox ID="cboShippingService2" runat="server" CssClass="standardComboBox" InitialItem="-- Select a UPS Service --"/>
                                                                                                <asp:CustomValidator ID="valShippingService2Custom"
                                                                                     runat="server"
                                                                                     ErrorMessage=""
                                                                                     Display="none"
                                                                                     ControlToValidate="cboShippingService2"
                                                                                     ClientValidationFunction="validateServices2"
                                                                                     SetFocusOnError="true"/>
                                                                                          </td>
                                                                                          <td style="padding-left:10px;">
                                                                                              <div id="serviceCost2" class="show">
                                                                                                    <span class="postAdFieldLabelRight">Cost:&nbsp;&nbsp;$</span>
                                                                                                    <asp:TextBox ID="txtCost2" runat="server" CssClass="standardTextField" style="margin-left:3px;width:50px;" />
                                                                                                    <asp:CustomValidator ID="valCost2Custom"
                                                                                     runat="server"
                                                                                     ErrorMessage=""
                                                                                     Display="none"
                                                                                     ControlToValidate="txtCost2"
                                                                                     ClientValidationFunction="validateCost2"
                                                                                     ValidateEmptyText="true"
                                                                                     SetFocusOnError="true"/>
                                                                                                </div>
                                                                                          </td>
                                                                                          <td style="padding-left:10px;"  width=100>
                                                                                                <a href="javascript:void(0);" class="postAdShippingServiceLink" onclick="removeService(2);">Remove</a>
                                                                                          </td>
                                                                                    </tr>
                                                                              </table>
                                                                              </div>
                                                                              <!-- END SECOND SERVICE -->
                                                                        </td>
                                                                  </tr>
                                                                  <tr>
                                                                        <td>
                                                                              <!-- BEGIN THIRD SERVICE -->
                                                                              <div id="shippingService3" class="hide" style="padding-top:2px;padding-bottom:2px;">
                                                                              <table cellpadding="0" cellspacing="0" width=100%>
                                                                                    <tr>
                                                                                          <td>
                                                                                                <armadillo:ShippingServiceComboBox ID="cboShippingService3" runat="server" CssClass="standardComboBox" InitialItem="-- Select a UPS Service --"/>
                                                                                                <asp:CustomValidator ID="valShippingService3Custom"
                                                                                     runat="server"
                                                                                     ErrorMessage=""
                                                                                     Display="none"
                                                                                     ControlToValidate="cboShippingService3"
                                                                                     ClientValidationFunction="validateServices3"
                                                                                     SetFocusOnError="true"/>
                                                                                          </td>
                                                                                          <td style="padding-left:10px;">
                                                                                              <div id="serviceCost3" class="show">
                                                                                                    <span class="postAdFieldLabelRight">Cost:&nbsp;&nbsp;$</span>
                                                                                                    <asp:TextBox ID="txtCost3" runat="server" CssClass="standardTextField" style="margin-left:3px;width:50px;" />
                                                                                                    <asp:CustomValidator ID="valCost3Custom"
                                                                                     runat="server"
                                                                                     ErrorMessage=""
                                                                                     Display="none"
                                                                                     ControlToValidate="txtCost3"
                                                                                     ClientValidationFunction="validateCost3"
                                                                                     ValidateEmptyText="true"
                                                                                     SetFocusOnError="true"/>
                                                                                                   
                                                                                                </div>
                                                                                          </td>
                                                                                          <td style="padding-left:10px;"  width=100>
                                                                                                <a href="javascript:void(0);" class="postAdShippingServiceLink" onclick="removeService(3);">Remove</a>
                                                                                          </td>
                                                                                    </tr>
                                                                              </table>
                                                                              </div>
                                                                              <!-- END THIRD SERVICE -->
                                                                        </td>
                                                                  </tr>
                                                            </table>
                                                            <div id="addService" class="show">
                                                                  <a href="javascript:void(0);" class="postAdShippingServiceLink"  onclick="adjustServices(true);">Add&nbsp;Service</a>
                                                            </div>
                                                            <!-- END INNER SHIPPING OPTIONS TABLE -->
                                                      </td>
                                                      <td></td>
                                                </tr>
                                                <tr>
                                                      <td><img src="Images/SubArea_BL_Corner.png"></td>
                                                      <td></td>
                                                      <td><img src="Images/SubArea_BR_Corner.png"></td>
                                                </tr>
                                          </table>
                                          <div id="shipmentSizeOptions" class="hide" style="margin-top:10px;">
                                          <table width=550 height=100% style="background-color:#dcefdc;" cellpadding=0 cellspacing=0>
                                                <tr>
                                                      <td><img src="Images/SubArea_TL_Corner.png"></td>
                                                      <td width=100%></td>
                                                      <td><img src="Images/SubArea_TR_Corner.png"></td>
                                                </tr>
                                                <tr height="100%">
                                                      <td></td>
                                                      <td valign="top">
                                                            <div style="font-size:11px;font-weight:bold;color:#dc6415;margin-bottom:10px;margin-bottom:10px;">What size is your shipment?&nbsp;<span class="postAdAstrisk">*</span>                                                                                    
                                                            </div>
                                                            
                                                            <!-- BEGIN SIZE TABLE -->
                                                            <table cellpadding=0 cellspacing=0>
                                                                  <tr >
                                                                        <td>
                                                                              <!-- BEGIN INNER SIZE TABLE -->
                                                                              <table cellpadding=0 cellspacing=0>
                                                                                    <tr class="shippingOptionRow">
                                                                                          <td>
                                                                                                <span class="postAdFieldLabelRight"><b>Package:</b></span>
                                                                                          </td>
                                                                                          <td width=10></td>
                                                                                          <td>
                                                                                                <!-- BEGIN SHIPPING PACKAGE TYPE -->
                                                                <armadillo:ShippingPackageComboBox ID="cboPackage"
                                                                                                   runat="server"
                                                                                                   CausesValidation="false"
                                                                                                   CssClass="standardTextField"
                                                                                                   InitialItem="-- Select Package --"
                                                                                                    />
                                                               
                                                                                                <!-- END SHIPPING PACKAGE TYPE -->
                                                                                          </td>
                                                                                          <td>
                                                                                              <asp:CustomValidator ID="valPackageCustom"
                                                                                     runat="server"
                                                                                     ErrorMessage="Please select a package."
                                                                                     ControlToValidate="cboPackage"
                                                                                     Display="dynamic"
                                                                                     SetFocusOnError="true"
                                                                                     CssClass="validationText"
                                                                                     ClientValidationFunction="validatePackage" />
                                                                                          </td>
                                                                                    </tr>
                                                                                    <tr class="shippingOptionRow">
                                                                                          <td>
                                                                                                <span class="postAdFieldLabelRight"><b>Weight:</b></span>
                                                                                          </td>
                                                                                          <td width=10></td>
                                                                                          <td>
                                                                                                <!-- BEGIN WEIGHT INPUT -->
                                                                <asp:TextBox ID="txtWeight" runat="server" CssClass="standardTextField" style="width:40px;" /> <span class="postAdFieldValueRight">lbs.</span>
                                                                                                <!-- END WEIGHT INPUT -->
                                                                                          </td>
                                                                                          <td>
                                                                                              <asp:CustomValidator ID="valWeightCustom"
                                                                                     runat="server"
                                                                                     ErrorMessage="Please enter a valid weight."
                                                                                     ControlToValidate="txtWeight"
                                                                                     Display="dynamic"
                                                                                     SetFocusOnError="true"
                                                                                     CssClass="validationText"
                                                                                     ValidateEmptyText="true"
                                                                                     ClientValidationFunction="validateWeight" />
                                                               
                                                                                          </td>
                                                                                    </tr>
                                                                                    <tr class="shippingOptionRow">
                                                                                          <td valign="top">
                                                                                                <span class="postAdFieldLabelRight"><b>Dimensions:</b></span>
                                                                                          </td>
                                                                                          <td width=10></td>
                                                                                          <td>
                                                                                                <div class="postAdFieldValueRight">
                                                                                                      <table cellpadding="0" cellspacing="0">
                                                                                                            <tr>
                                                                                                                  <td>
                                                                                                                      <asp:TextBox ID="txtLength" runat="server" CssClass="standardTextField" style="width:40px;"/>
                                                                                                                </td>
                                                                                                                  <td class="postAdFieldValueRight" style="padding-left:3px;padding-right:3px;">in. <span style="color:#dc6415;font-weight:bold;">X</span></td>
                                                                                                                  <td>
                                                                                                                      <asp:TextBox ID="txtWidth" runat="server" CssClass="standardTextField" style="width:40px;"/>
                                                                                                                  </td>
                                                                                                                  <td class="postAdFieldValueRight" style="padding-left:3px;padding-right:3px;">in. <span style="color:#dc6415;font-weight:bold;">X</span></td>
                                                                                                                  <td>
                                                                                                                      <asp:TextBox ID="txtHeight" runat="server" CssClass="standardTextField" style="width:40px;"/>
                                                                                                                  </td>
                                                                                                                  <td class="postAdFieldValueRight" style="padding-left:3px;padding-right:3px;">in.</td>
                                                                                                            </tr>
                                                                                                            <tr>
                                                                                                                  <td class="postAdFieldValueRight"><b>Length</b></td>
                                                                                                                  <td></td>
                                                                                                                  <td class="postAdFieldValueRight"><b>Width</b></td>
                                                                                                                  <td></td>
                                                                                                                  <td class="postAdFieldValueRight"><b>Height</b></td>
                                                                                                                  <td></td>
                                                                                                            </tr>
                                                                                                      </table>
                                                                                                </div>
                                                                                          </td>
                                                                                          <td valign="top">
                                                                <asp:CustomValidator ID="valDimensionCustom"
                                                                                     runat="server"
                                                                                     ErrorMessage="Please enter a valid dimension."
                                                                                     ControlToValidate="txtHeight"
                                                                                     Display="dynamic"
                                                                                     SetFocusOnError="true"
                                                                                     CssClass="validationText"
                                                                                     ValidateEmptyText="true"
                                                                                     ClientValidationFunction="validateDimensions"/>
                                                               
                                                                                          </td>
                                                                                    </tr>
                                                                              </table>
                                                                              <!-- BEGIN INNER SIZE TABLE -->
                                                                        </td>
                                                                        <td>
                                                                              
                                                                        </td>
                                                                  </tr>
                                                            </table>
                                                            <!-- END SIZE TABLE -->
                                                       </td>
                                                      <td></td>
                                                </tr>
                                                <tr>
                                                      <td><img src="Images/SubArea_BL_Corner.png"></td>
                                                      <td></td>
                                                      <td><img src="Images/SubArea_BR_Corner.png"></td>
                                                </tr>
                                          </table>
                                          </div>
                                          <!-- END SHIPPING OPTIONS TABLE -->
                                          </div>
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END SHIPPING ROW -->
                        <tr>
                              <td width="42"><img src="Images/Post_Ad_Area_BL_Corner.jpg"/></td>
                              <td width="300" style="background-image: url(Images/Post_Ad_Area_BBG_Left.jpg);background-repeat:repeat-x;"><img src="Images/Transparent_Pixel.png" height="12" width="30"/></td>
                              <td width="100%" colspan=2 style="background-image: url(Images/Post_Ad_Area_BBG_Right.jpg);background-repeat:repeat-x;"><img src="Images/Transparent_Pixel.png" height="12" width="30"/></td>
                              <td width="11"><img src="Images/Post_Ad_Area_BR_Corner.jpg"/></td>
                        </tr>
                  </table>
                  </td></tr></table>
                  <!-- END STEP 3 SECTION -->
                  </td>
            </tr>
            <tr>
                  <td class="postAdStepCell">
                  <!-- BEGIN STEP 4 SECTION -->
                  <table cellpadding=0 cellspacing=0 style="width:100%;"><tr><td>
                  <table cellpadding=0 cellspacing=0 border=0 style="width:100%">
                        <tr>
                              <td height=0 width="42" rowspan=2><img src="Images/Post_Ad_Area_Step_4.jpg"/></td>
                              <td class="postAdAreaTBGLeft" valign="top" colspan=3><img src="Images/Post_Ad_Title_Enter_Contact_Information.png"/></td>
                              <td width=11><img src="Images/Post_Ad_Area_TR_Corner.png"/></td>
                        </tr>
                        <!-- LOWER TITLE ROW -->
                        <tr height=9>
                              <td style="background-color:#dcefdc;"></td>
                              <td width=2 style="background-color:white;"></td>
                              <td style="background-color:#F1FAF1;" width="100%"><img alt="" src="Images/Transparent_Pixel.png" width="1" height="9" /></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:red;"></td>
                        </tr>
                        <!-- LOWER TITLE ROW -->
                        <!-- BEGIN EMAIL ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Email&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                                          <asp:TextBox ID="txtEmail" runat="server" CssClass="standardTextField" style="width:200px;"/>
                            <asp:RegularExpressionValidator ID="validatorEmailRE"
                                                            runat="server"
                                                            ErrorMessage="Please enter a valid email address."
                                                            ControlToValidate="txtEmail"
                                                            ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                                            SetFocusOnError="true"
                                                            Display="Dynamic"
                                                            Visible="true"
                                                            CssClass="validationText" />
                            <asp:RequiredFieldValidator ID="validatorEmailRequired"
                                                        runat="server"
                                                        ErrorMessage="Please enter your email address."
                                                        ControlToValidate="txtEmail"
                                                        SetFocusOnError="true"
                                                        Display="dynamic"
                                                        Visible="true"
                                                        CssClass="validationText" />
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END EMAIL ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr height="2">
                              <td width=42 style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN PHONE ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Phone<br />
                                          <span style="font-weight:normal;font-size:10px;">(Format: 555-555-5555)</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                                          <asp:TextBox ID="txtPhone" runat="server" CssClass="standardTextField" style="width:80px;"/>
                            <asp:RegularExpressionValidator ID="validatorPhoneRE"
                                                            runat="server"
                                                            ErrorMessage="Please enter a valid phone number (Format: 555-555-5555)."
                                                            SetFocusOnError="true"
                                                            ControlToValidate="txtPhone"
                                                            ValidationExpression="\s*[(]{0,1}\s*\d{3}\s*[-\.)]{0,1}\s*\d{3}\s*[-\.]{0,1}\s*\d{4}\s*"
                                                            CssClass="validationText"/>
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END PHONE ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr height="2">
                              <td width=42 style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN IM ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          IM Handle
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                                          <asp:TextBox ID="txtIMHandle" runat="server" CssClass="standardTextField" style="width:150px;"/>
                                          <select id="cboIMType" class="standardComboBox" runat="server">
                                                <option value="0">-- Select IM Provider --</option>
                                                <option value="1">AOL</option>
                                                <option value="2">ICQ</option>
                                                <option value="3">Windows Messenger</option>
                                          </select>
                            <asp:CustomValidator ID="imValidator"
                                                 runat="server"
                                                 ErrorMessage="Please select your IM provider."
                                                 ControlToValidate="cboIMType"
                                                 CssClass="validationText"
                                                 ClientValidationFunction="validateIM"
                                                 Display="dynamic" />
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END IM ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr height="2">
                              <td width=42 style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN ADDRESS ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Address
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                                          <asp:TextBox ID="txtAddress" runat="server" CssClass="standardTextField" style="width:200px;"/>
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END ADDRESS ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr height="2">
                              <td width=42 style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN CITY ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          City&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                            <asp:TextBox ID="txtCity" runat="server" CssClass="standardTextField" style="width:150px;"/>
                            <asp:RequiredFieldValidator ID="validatorCityRequired"
                                                        runat="server"
                                                        ErrorMessage="Please enter your city."
                                                        ControlToValidate="txtCity"
                                                        SetFocusOnError="true"
                                                        Display="dynamic"
                                                        Visible="true"
                                                        CssClass="validationText" />
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END CITY ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr height="2">
                              <td width=42 style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN STATE ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          State&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                              
                              <%-- BEGIN STATE SELECT MAP UPDATE PANEL --%>
                              
                                      <div class="postAdFieldRight">
                                          <table cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td>
                                            <asp:DropDownList ID="cboState" runat="server" CssClass="standardComboBox" AutoPostBack="false"/>
                                        </td>
                                        <td valign="middle" style="padding-left:10px;">
                                            <a id="launchMapLink" href="javascript:void(0);" onclick="launchMap();"><img alt="" border=0 id="launchMapIcon" src="Images/Icon_Local_Area.png" /></a>
                                            <asp:CompareValidator ID="validatorStateRequired"
                                                   runat="server"
                                                   ErrorMessage="Please select a state."
                                                   CssClass="validationText"
                                                   ControlToValidate="cboState"
                                                   ValueToCompare="0"
                                                   Operator="NotEqual"
                                                   Display="dynamic"
                                                   SetFocusOnError="true"/>
                                        </td>
                                    </tr>
                                </table>
                                      </div>
                                
                            <div id="panelMapCallout" class="hide" style="position:absolute;">
                                <img id="calloutImage" usemap="#calloutMap" src="Images/US_Map_Callout.png" alt="" border=0 />
                                <map id="calloutMap">
                                    <!-- WA --> <area ID="mapAreaWA" shape="polygon" coords="46,24,80,33,74,60,37,55,36,49,31,46,32,26,43,31,46,24" href="javascript:void(0);" onclick="selectState('WA');"/>
                                    <!-- OR --> <area ID="mapAreaOR" shape="polygon" coords="30,46,36,49,37,55,73,59,76,63,69,74,71,77,65,96,17,84,18,81,30,46" href="javascript:void(0);" onclick="selectState('OR');"/>
                                    <!-- ID --> <area ID="mapAreaID" shape="polygon" coords="80,33,86,34,86,49,92,58,91,68,94,67,99,80,110,80,107,104,66,97,71,77,69,74,77,63,74,59,80,33" href="javascript:void(0);" onclick="selectState('ID');"/>
                                    <!-- CA --> <area ID="mapAreaCA" shape="polygon" coords="17,84,45,92,39,120,69,164,71,172,65,185,45,184,45,177,24,159,25,151,19,139,15,118,13,113,14,105,12,97,18,90,17,84" href="javascript:void(0);" onclick="selectState('CA');"/>
                                    <!-- NV --> <area ID="mapAreaNV" shape="polygon" coords="46,92,86,101,75,156,71,155,70,165,39,120,46,92" href="javascript:void(0);" onclick="selectState('NV');"/>
                                    <!-- UT --> <area ID="mapAreaUT" shape="polygon" coords="86,101,106,105,106,114,119,116,114,154,77,148,86,101" href="javascript:void(0);" onclick="selectState('UT');"/>
                                    <!-- AZ --> <area ID="mapAreaAZ" shape="polygon" coords="77,148,114,154,107,206,91,204,64,188,66,185,65,180,68,177,69,174,71,173,69,166,71,154,75,156,77,148" href="javascript:void(0);" onclick="selectState('AZ');"/>
                                    <!-- NM --> <area ID="mapAreaNM" shape="polygon" coords="115,154,159,158,155,205,114,203,113,207,107,206,115,154" href="javascript:void(0);" onclick="selectState('NM');"/>
                                    <!-- CO --> <area ID="mapAreaCO" shape="polygon" coords="119,116,168,121,166,158,114,153,119,116" href="javascript:void(0);" onclick="selectState('CO');"/>
                                    <!-- WY --> <area ID="mapAreaWY" shape="polygon" coords="111,77,157,82,155,120,106,114,111,77" href="javascript:void(0);" onclick="selectState('WY');"/>
                                    <!-- MT --> <area ID="mapAreaMT" shape="polygon" coords="86,34,124,41,161,44,157,82,111,77,98,79,94,67,89,66,93,58,85,48,86,34" href="javascript:void(0);" onclick="selectState('MT');"/>
                                    <!-- ND --> <area ID="mapAreaND" shape="polygon" coords="161,45,204,47,208,75,159,73,161,45" href="javascript:void(0);" onclick="selectState('ND');"/>
                                    <!-- SD --> <area ID="mapAreaSD" shape="polygon" coords="159,73,208,75,208,108,194,103,156,101,159,73" href="javascript:void(0);" onclick="selectState('SD');"/>
                                    <!-- OK --> <area ID="mapAreaOK" shape="polygon" coords="159,159,222,161,223,191,215,189,208,191,179,183,181,164,159,163,159,159" href="javascript:void(0);" onclick="selectState('OK');"/>
                                    <!-- NE --> <area ID="mapAreaNE" shape="polygon" coords="156,101,194,103,208,108,216,131,168,130,168,121,155,119,156,101" href="javascript:void(0);" onclick="selectState('NE');"/>
                                    <!-- KS --> <area ID="mapAreaKS" shape="polygon" coords="169,130,216,131,221,139,222,160,167,159,169,130" href="javascript:void(0);" onclick="selectState('KS');"/>
                                    <!-- TX --> <area ID="mapAreaTX" shape="polygon" coords="159,163,182,164,181,182,195,188,203,191,210,191,217,189,227,193,227,207,231,215,229,228,224,230,219,229,220,232,202,246,198,256,200,265,185,259,182,248,175,240,173,233,167,227,158,226,152,233,141,225,140,218,128,203,155,206,159,163" href="javascript:void(0);" onclick="selectState('TX');"/>
                                    <!-- LA --> <area ID="mapAreaLA" shape="polygon" coords="227,198,250,197,252,204,247,216,262,215,266,225,254,233,245,227,242,229,229,228,232,216,227,207,227,198" href="javascript:void(0);" onclick="selectState('LA');"/>
                                    <!-- AR --> <area ID="mapAreaAR" shape="polygon" coords="222,165,255,163,255,168,259,168,249,191,249,197,227,197,227,192,223,191,222,165" href="javascript:void(0);" onclick="selectState('AR');"/>
                                    <!-- MO --> <area ID="mapAreaMO" shape="polygon" coords="214,126,244,125,244,132,251,140,254,140,253,148,260,153,261,157,264,159,259,168,255,168,255,164,222,165,222,140,214,126" href="javascript:void(0);" onclick="selectState('MO');"/>
                                    <!-- IA --> <area ID="mapAreaIA" shape="polygon" coords="209,98,244,98,246,104,253,112,249,117,246,117,247,122,244,125,214,126,207,107,209,98" href="javascript:void(0);" onclick="selectState('IA');"/>
                                    <!-- MN --> <area ID="mapAreaMN" shape="polygon" coords="204,46,219,46,251,55,235,65,236,74,233,76,233,86,244,94,244,97,208,97,209,81,207,77,206,60,204,56,204,46" href="javascript:void(0);" onclick="selectState('MN');"/>
                                    <!-- WI --> <area ID="mapAreaWI" shape="polygon" coords="237,68,249,69,263,74,269,84,267,105,249,106,244,101,243,94,233,86,233,76,236,73,237,68" href="javascript:void(0);" onclick="selectState('WI');"/>
                                    <!-- MI 1 --> <area ID="mapAreaMI1" shape="polygon" coords="285,73,295,77,304,94,304,100,298,109,277,111,279,105,279,99,276,94,277,83,285,73" href="javascript:void(0);" onclick="selectState('MI');"/>
                                    <!-- MI 2 --> <area ID="mapAreaMI2" shape="polygon" coords="249,67,263,59,260,65,265,65,272,67,282,64,290,69,270,75,267,80,263,73,249,67" href="javascript:void(0);" onclick="selectState('MI');"/>
                                    <!-- IL --> <area ID="mapAreaIL" shape="polygon" coords="250,106,267,106,271,113,273,142,270,153,263,158,260,156,259,152,252,146,254,141,250,140,244,132,244,126,247,121,246,117,252,113,252,110,250,106" href="javascript:void(0);" onclick="selectState('IL');"/>
                                    <!-- IN --> <area ID="mapAreaIN" shape="polygon" coords="271,114,278,111,290,110,293,139,289,139,285,147,282,146,277,150,270,149,270,146,273,141,271,114" href="javascript:void(0);" onclick="selectState('IN');"/>
                                    <!-- OH --> <area ID="mapAreaOH" shape="polygon" coords="291,110,301,110,306,112,319,105,322,125,312,134,312,138,310,140,306,137,303,139,293,134,291,110" href="javascript:void(0);" onclick="selectState('OH');"/>
                                    <!-- KY --> <area ID="mapAreaKY" shape="polygon" coords="263,157,267,156,271,149,285,147,289,139,293,139,292,135,301,138,307,137,310,139,310,143,315,148,304,158,272,159,271,162,263,162,263,157" href="javascript:void(0);" onclick="selectState('KY');"/>
                                    <!-- WV --> <area ID="mapAreaWV" shape="polygon" coords="321,125,330,124,332,128,335,124,340,127,329,141,327,146,318,150,310,143,310,139,312,138,313,133,321,125" href="javascript:void(0);" onclick="selectState('WV');"/>
                                    <!-- VA --> <area ID="mapAreaVA" shape="polygon" coords="306,157,316,148,320,149,328,145,328,140,340,126,351,135,355,136,357,145,360,146,362,149,319,156,306,157" href="javascript:void(0);" onclick="selectState('VA');"/>
                                    <!-- MS --> <area ID="mapAreaMS" shape="polygon" coords="256,178,272,176,272,207,273,220,264,222,261,219,262,215,247,216,248,211,252,204,249,191,256,176" href="javascript:void(0);" onclick="selectState('MS');"/>
                                    <!-- NC --> <area ID="mapAreaNC" shape="polygon" coords="318,156,361,149,362,151,359,154,364,155,359,164,360,165,351,176,346,176,337,170,328,171,325,169,316,169,309,173,299,174,303,168,305,167,315,161,318,156" href="javascript:void(0);" onclick="selectState('NC');"/>
                                    <!-- TN --> <area ID="mapAreaTN" shape="polygon" coords="261,163,271,162,272,160,318,156,312,163,309,163,305,168,302,168,298,174,256,177,261,163" href="javascript:void(0);" onclick="selectState('TN');"/>
                                    <!-- AL --><area ID="mapAreaAL" shape="polygon" coords="272,176,291,175,299,199,298,205,300,212,279,214,282,220,273,220,271,206,272,176" href="javascript:void(0);" onclick="selectState('AL');"/>
                                    <!-- SC --> <area ID="mapAreaSC" shape="polygon" coords="309,173,318,169,327,169,329,171,339,171,346,177,343,181,343,185,331,197,325,189,309,175,309,173" href="javascript:void(0);" onclick="selectState('SC');"/>
                                    <!-- GA --> <area ID="mapAreaGA" shape="polygon" coords="291,175,310,173,310,176,324,188,331,198,327,210,324,210,325,214,302,214,298,206,299,197,291,175" href="javascript:void(0);" onclick="selectState('GA');"/>
                                    <!-- FL --> <area ID="mapAreaFL" shape="polygon" coords="280,214,300,212,302,214,324,213,325,210,329,210,332,221,340,229,340,234,347,245,346,259,342,261,321,238,322,229,309,219,299,224,290,218,282,219,280,214" href="javascript:void(0);" onclick="selectState('FL');"/>
                                    <!-- AK --> <area ID="mapAreaAK" shape="polygon" coords="22,222,28,220,34,212,44,212,48,214,65,215,76,257,81,257,86,261,91,257,103,268,108,268,111,273,104,277,81,261,69,261,64,257,60,259,60,262,31,285,19,288,38,277,37,271,27,269,28,264,22,263,18,255,31,246,30,241,26,243,19,241,18,236,24,232,26,229,22,222" href="javascript:void(0);" onclick="selectState('AK');"/>
                                    <!-- HI --> <area ID="mapAreaHI" shape="polygon" coords="128,253,142,256,175,270,194,270,196,290,156,288,153,276,139,266,129,263,127,258,128,253" href="javascript:void(0);" onclick="selectState('HI');"/>
                                    <!-- PA --> <area ID="mapAreaPA" shape="polygon" coords="319,105,324,102,354,97,359,102,359,110,362,113,356,119,321,124,319,105" href="javascript:void(0);" onclick="selectState('PA');"/>
                                    <!-- ME --> <area ID="mapAreaME" shape="polygon" coords="381,38,390,37,396,51,403,56,391,65,391,68,384,72,382,79,375,60,379,54,379,43,381,38" href="javascript:void(0);" onclick="selectState('ME');"/>
                                    <!-- NY --> <area ID="mapAreaNY" shape="polygon" coords="324,101,330,94,327,91,331,88,339,88,346,83,343,78,351,68,361,67,367,86,368,102,366,104,359,102,354,97,325,103,324,101" href="javascript:void(0);" onclick="selectState('NY');"/>
                                    <!-- MA --> <area ID="mapAreaMA" shape="polygon" coords="367,86,382,82,392,80,392,76,413,76,413,90,380,90,367,94,367,86" href="javascript:void(0);" onclick="selectState('MA');"/>
                                    <!-- VT --> <area ID="mapAreaVT" shape="polygon" coords="335,45,356,45,357,54,367,65,371,64,371,86,367,87,360,67,353,60,335,60,335,45" href="javascript:void(0);" onclick="selectState('VT');"/>
                                    <!-- RI --> <area ID="mapAreaRI" shape="polygon" coords="379,91,413,91,413,104,394,104,393,99,380,96,379,91" href="javascript:void(0);" onclick="selectState('RI');"/>
                                    <!-- NH --> <area ID="mapAreaNH" shape="polygon" coords="348,28,371,28,372,44,368,45,375,61,383,80,380,84,371,86,372,72,360,44,348,44,348,28" href="javascript:void(0);" onclick="selectState('NH');"/>
                                    <!-- CT --> <area ID="mapAreaCT" shape="polygon" coords="368,93,379,91,380,97,378,98,384,104,401,104,400,116,381,116,380,107,374,100,369,102,368,93" href="javascript:void(0);" onclick="selectState('CT');"/>
                                    <!-- NJ --> <area ID="mapAreaNJ" shape="polygon" coords="360,102,366,104,375,103,368,109,368,112,374,116,388,116,388,128,371,127,371,121,367,118,365,124,358,117,363,113,358,109,360,102" href="javascript:void(0);" onclick="selectState('NJ');"/>
                                    <!-- DE --> <area ID="mapAreaDE" shape="polygon" coords="358,120,365,126,386,131,386,129,406,128,407,142,386,142,386,137,363,130,359,130,356,123,358,120" href="javascript:void(0);" onclick="selectState('DE');"/>
                                    <!-- MD --> <area ID="mapAreaMD" shape="polygon" coords="342,121,355,120,360,130,364,130,364,134,379,144,379,142,400,143,400,155,378,155,378,149,350,132,349,128,342,121" href="javascript:void(0);" onclick="selectState('MD');"/>
                                    <!-- DC --> <area ID="mapAreaDC" shape="polygon" coords="336,124,341,122,371,155,389,156,390,168,368,168,368,160,336,124" href="javascript:void(0);" onclick="selectState('DC');"/>
                                    <!-- CLOSE --> <area ID="mapAreaClose" shape="circle" coords="406,13,8" href="javascript:void(0);" onclick="document.getElementById('panelMapCallout').className = 'hide';"/>
                                </map>
                            </div>
                       
                    <%-- END STATE SELECT MAP UPDATE PANEL --%>
                   
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END STATE ROW -->
                        <!-- BEGIN SPACER ROW -->
                        <tr height="2">
                              <td width=42 style="background-image: url(Images/Post_Ad_Area_LBG_Spacer.png);background-repeat:repeat-y;background-position:left;background-color:white;"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG_Spacer.png);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END SPACER ROW -->
                        <!-- BEGIN ZIP ROW -->
                        <tr>
                              <td colspan=2 width=42 class="postAdAreaLeft">
                                    <div class="postAdFieldLabelTop">
                                          Zip Code&nbsp;<span class="postAdAstrisk">*</span>
                                    </div>
                              </td>
                              <td width=2 style="background-color:white;"><img src="Images/Transparent_Pixel.png" width=2 height="10"/></td>
                              <td width="100%" class="postAdAreaRight">
                                    <div class="postAdFieldRight">
                                          <asp:TextBox ID="txtZipCode" runat="server" CssClass="standardTextField" style="width:50px;"/>
                                          <asp:RegularExpressionValidator ID="validatorZipRE"
                                                            runat="server"
                                                            ErrorMessage="Please enter a 5-digit zip code."
                                                            ControlToValidate="txtZipCode"
                                                            ValidationExpression="[\d]{5}"
                                                            SetFocusOnError="true"
                                                            Display="Dynamic"
                                                            Visible="true"
                                                            CssClass="validationText" />
                            <asp:RequiredFieldValidator ID="validatorZipRequired"
                                                        runat="server"
                                                        ErrorMessage="Please enter your zip code."
                                                        ControlToValidate="txtZipCode"
                                                        SetFocusOnError="true"
                                                        Display="dynamic"
                                                        Visible="true"
                                                        CssClass="validationText" />
                                    </div>
                              </td>
                              <td width=11 style="background-image: url(Images/Post_Ad_Area_RBG.jpg);background-repeat:repeat-y;background-position:right;background-color:white;"></td>
                        </tr>
                        <!-- END ZIP ROW -->
                        <tr>
                              <td width="42"><img src="Images/Post_Ad_Area_BL_Corner.jpg"/></td>
                              <td width="300" style="background-image: url(Images/Post_Ad_Area_BBG_Left.jpg);background-repeat:repeat-x;"><img src="Images/Transparent_Pixel.png" height="12" width="30"/></td>
                              <td width="100%" colspan=2 style="background-image: url(Images/Post_Ad_Area_BBG_Right.jpg);background-repeat:repeat-x;"><img src="Images/Transparent_Pixel.png" height="12" width="30"/></td>
                              <td width="11"><img src="Images/Post_Ad_Area_BR_Corner.jpg"/></td>
                        </tr>
                  </table>
                  </td></tr></table>
                  <!-- END STEP 4 SECTION -->
                  <div style="padding-top:15px;padding-left:10px;">
                <asp:ImageButton ID="btnPreview" runat="server" ImageUrl="~/Images/Button_Preview_Ad.png"/>
                <br /><br />
                <asp:Label ID="lblSubmit" runat="server" Visible="false" />
                  </div>
                  </td>
            </tr>
      </table>
    <!-- END MAIN AREA CONTENT -->
   
</asp:Content>


================================================================================
========================== PostAd.aspx.cs ========================================
================================================================================

using System;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using armadillo.util;
using armadillo.data;
using armadillo;

public partial class PostAd : System.Web.UI.Page
{
    private const string IMAGE_PATH_ACTIVE = "Images/Icon_Image_Placeholder_Active.png";
    private const string IMAGE_PATH_INACTIVE = "Images/Icon_Image_Placeholder_Inactive.png";
    private const string INITIAL_ITEM_STATE = "-- Select State --";

    // *** Anything changed here must also be changed in the Javascript code **
    private string[] months = new string[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
    private int[] daysInMonth = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

    protected void Page_Load(object sender, EventArgs e)
    {
        Master.ActiveTab = ArmadilloMasterPage.TAB_POST_AD;
        registerCalendarInitScript();
        registerMapLaunchScript();
        registerShippingPackageSelectScript();
        configureExchangeOptionControls();

        configureImagePanelLinks();
        if (!IsPostBack)
        {
            initStates();
        }

    }

    protected override void OnInit(EventArgs e)
    {
        initComponents();
        base.OnInit(e);
    }

    protected void initComponents()
    {
        btnPreview.Click += new ImageClickEventHandler(this.prevClicked);
        this.Load += new System.EventHandler(this.Page_Load);
    }


    /// <summary>
    /// Adds client side onclick handler calls to webcontrol radio buttons
    /// </summary>
    protected void configureExchangeOptionControls()
    {
        radLocalDelivery.Attributes.Add("onclick", "revalidate('validatorExchangeRadioButtonsMain');adjustDelivery();");
        radLocalDeliveryOptionSpecify.Attributes.Add("onclick", "deliveryAreaChanged();");
        radLocalDeliveryOptionNegotiable.Attributes.Add("onclick", "deliveryAreaChanged();");
        radShipping.Attributes.Add("onclick", "revalidate('validatorExchangeRadioButtonsMain');adjustShipping();");
        radCalculatedRate.Attributes.Add("onclick", "revalidateCosts();rateClicked(true);");
        radFixedRate.Attributes.Add("onclick", "rateClicked(false);");
    }

    /// <summary>
    /// OnLoad (on the client) the EXPIRATION DATE combo boxes need to be populated
    /// </summary>
    protected void registerCalendarInitScript()
    {
        StringBuilder scriptSb = new StringBuilder();
        scriptSb.Append("<script language=\"javascript\" type=\"text/javascript\">\n");
        scriptSb.Append("function initCalendar() {\n");
        scriptSb.Append("initCalendarDropdowns('" + cboExpirationMonth.ClientID + "', '" + cboExpirationDay.ClientID + "');\n");
        scriptSb.Append("}\n");
        scriptSb.Append("initCalendar();\n");
        scriptSb.Append("</script>");
       
        if (!ClientScript.IsStartupScriptRegistered("Init Calendar"))
                ClientScript.RegisterStartupScript(GetType(), "Init Calendar", scriptSb.ToString());

        dateLaunchLink.Attributes.Add("onclick", "launchCalendar('" + txtHiddenDate.ClientID + "', '" + dateLaunchLink.ClientID + "'); return false;");
        cboExpirationMonth.Attributes.Add("onchange", "monthChanged('" + cboExpirationMonth.ClientID + "', '" + cboExpirationDay.ClientID + "');recordHiddenDate();");
        cboExpirationDay.Attributes.Add("onchange", "recordHiddenDate();");
    }

    /// <summary>
    /// Adds the script block that will fire on the click of a given state on the state selection map
    /// </summary>
    protected void registerMapLaunchScript()
    {
        cboPackage.Attributes.Add("onchange", "packageSelected();");
        StringBuilder scriptSb = new StringBuilder();
        scriptSb.Append("<script language=\"javascript\" type=\"text/javascript\">\n");
        scriptSb.Append("function selectState(stateAbbrev) {\n");
        scriptSb.Append("var callout = document.getElementById('panelMapCallout');\n");
        scriptSb.Append("var selectStateCombo = document.getElementById('" + cboState.ClientID + "');\n");
        scriptSb.Append("for (i=0; i < selectStateCombo.options.length; i++){\n");
        scriptSb.Append("if(selectStateCombo.options[i].text == stateAbbrev) {\n");
        scriptSb.Append("selectStateCombo.selectedIndex = i;\n");
        scriptSb.Append("revalidate('validatorStateRequired');\n");
        scriptSb.Append("break;\n");
        scriptSb.Append("}\n");
        scriptSb.Append("}\n");
        scriptSb.Append("callout.className = 'hide';\n");
        scriptSb.Append("}\n");
        scriptSb.Append("</script>");

        if (!ClientScript.IsStartupScriptRegistered("Select State"))
                ClientScript.RegisterStartupScript(GetType(), "Select State", scriptSb.ToString());

    }

    /// <summary>
    /// Creates the script that is fired when the user selects a package from the shipping package drop-down box.  
    /// 1) If the package is a CUSTOM PACKAGE ("My Package"), the dimension fields are cleared and enabled
    /// 2) If the package is a UPS STANDARD PACKAGE (all others), the dimension fields are filled with the appropriate dimensions, where applicable,
    /// and the fields are disabled
    /// </summary>
    protected void registerShippingPackageSelectScript()
    {
        cboPackage.Attributes.Add("onchange", "packageSelected();");
       
        DataSet ds = getPackageDimensionsDataSet();
        if (ds == null) return;

        StringBuilder scriptSb = new StringBuilder();
        scriptSb.Append("<script language=\"javascript\" type=\"text/javascript\">\n");
        scriptSb.Append("   function packageSelected() {\n");
        scriptSb.Append("      var cboPackage = document.getElementById('" + cboPackage.ClientID + "');");
        scriptSb.Append("      var txtLength = document.getElementById('" + txtLength.ClientID + "');");
        scriptSb.Append("      var txtWidth = document.getElementById('" + txtWidth.ClientID + "');");
        scriptSb.Append("      var txtHeight = document.getElementById('" + txtHeight.ClientID + "');");
        scriptSb.Append("      sIndex = cboPackage.selectedIndex;");
        scriptSb.Append("      if(sIndex == 0 || cboPackage.options[sIndex].innerText == 'My Packaging') {");
        scriptSb.Append("         txtLength.disabled = false;");
        scriptSb.Append("         txtWidth.disabled = false;");
        scriptSb.Append("         txtHeight.disabled = false;");
        scriptSb.Append("         txtLength.value = '';");
        scriptSb.Append("         txtWidth.value = '';");
        scriptSb.Append("         txtHeight.value = '';");
        scriptSb.Append("      }else{");
        scriptSb.Append("         txtLength.disabled = true;");
        scriptSb.Append("         txtWidth.disabled = true;");
        scriptSb.Append("         txtHeight.disabled = true;");


        // Assumes the same order as the packages drop-down list
        for (int i = 0; i < ds.Tables["TBL_SHIPPING_PACKAGE_TYPE"].Rows.Count; i++)
        {
            string length = ds.Tables["TBL_SHIPPING_PACKAGE_TYPE"].Rows[i]["LENGTH"].ToString();
            string width = ds.Tables["TBL_SHIPPING_PACKAGE_TYPE"].Rows[i]["WIDTH"].ToString();
            string height = ds.Tables["TBL_SHIPPING_PACKAGE_TYPE"].Rows[i]["HEIGHT"].ToString();

            // Make sure that there are no nulls
            length = (length != null) ? length : "";
            width = (width != null) ? width : "";
            height = (height != null) ? height : "";

            // Loop through and indices and create a separate if statement for each to set LxWxH text boxes
            scriptSb.Append("         if(sIndex == " + (i+1) + ") {");
            scriptSb.Append("           txtLength.value = '" + length + "';");
            scriptSb.Append("           txtWidth.value = '" + width + "';");
            scriptSb.Append("           txtHeight.value = '" + height + "';");
            scriptSb.Append("         }");
        }
        scriptSb.Append("      }");
        scriptSb.Append("   }");
        scriptSb.Append("</script>");


        if (!ClientScript.IsStartupScriptRegistered("Select Shipping Package"))
            ClientScript.RegisterStartupScript(GetType(), "Select Shipping Package", scriptSb.ToString());

    }

    protected DataSet getPackageDimensionsDataSet()
    {
        SqlConnection connection = SQLUtils.openConnection();
        SqlCommand command = new SqlCommand(SQLUtils.SQL_LISTSHIPPINGPACKAGES, connection);
        DataSet ds = SQLUtils.retrieveDataSet(command, "ShippingPackageType", "TBL_SHIPPING_PACKAGE_TYPE");
        connection.Close();

        return ds;
    }

    protected void btnUpload_Click(object sender, EventArgs e)
    {
        int currentImageNumber = countUploadedImages();

        if ((imageFileUpload.PostedFile != null) && (imageFileUpload.PostedFile.ContentLength > 0))
        {
            //All images will be kept in the "Pics" folder
            //But will be uniquely identified by [Milliseconds]_[Session ID].png
            string encodedFileName = (currentImageNumber + 1).ToString() + "_" + DateTime.Now.Millisecond.ToString() + "_" + DateTime.Today.ToString("yyyyMMdd") + "_" + Session.SessionID;
           
            string fullSizeLocalLocation = Server.MapPath("Pics") + "\\" + encodedFileName + "_large.png";
            string fullSizeRemoteLocation = "Pics/" + encodedFileName + "_large.png";

            string thumbnailSizeLocalLocation = Server.MapPath("Pics") + "\\" + encodedFileName + "_thumb.png";
            string thumbnailRemoteLocation = "Pics/" + encodedFileName + "_thumb.png";
                       
            try
            {
                imageFileUpload.PostedFile.SaveAs(fullSizeLocalLocation);

                ImageUtils.createThumbnail(fullSizeLocalLocation, thumbnailSizeLocalLocation, 102, 78);

                // Display the image in the next available Image control
                switch(currentImageNumber + 1)
                {
                    case 1:
                        addImage1.ImageUrl = thumbnailRemoteLocation;
                        addImage2.ImageUrl = IMAGE_PATH_ACTIVE;
                        addImage3.ImageUrl = IMAGE_PATH_INACTIVE;
                        addImage4.ImageUrl = IMAGE_PATH_INACTIVE;
                        break;
                    case 2:
                        addImage2.ImageUrl = thumbnailRemoteLocation;
                        addImage3.ImageUrl = IMAGE_PATH_ACTIVE;
                        addImage4.ImageUrl = IMAGE_PATH_INACTIVE;
                        break;
                    case 3:
                        addImage3.ImageUrl = thumbnailRemoteLocation;
                        addImage4.ImageUrl = IMAGE_PATH_ACTIVE;
                        break;
                    case 4:
                        addImage4.ImageUrl = thumbnailRemoteLocation;
                        break;
                }

                configureImagePanelLinks();
            }
            catch (Exception ex)
            {

            }
        }
        else
        {

        }
    }

    protected int countUploadedImages()
    {
        int uploadedImageCount = 0;
        Image[] images = getPostAdImagesArray();
        for (int i = 0; i < images.Length; i++)
        {
            if (!images[i].ImageUrl.Equals(IMAGE_PATH_ACTIVE) && !images[i].ImageUrl.Equals(IMAGE_PATH_INACTIVE))
            {
                uploadedImageCount++;
            }
        }
        return uploadedImageCount;
    }

    /// <summary>
    /// Based on the number of images currently being displayed,
    /// Configures the links underneath to either be:
    /// "Remove" - If there is an image ther
    /// "Add Image"/"Add Another Image" - If there is no image but an image directly to the left
    /// [Invisible] - If there is no image there and no image directly to the left
    /// </summary>
    private void configureImagePanelLinks()
    {
        Image[] images = getPostAdImagesArray();
        PlaceHolder[] linkPlaceHolders = getPostAdImageLinkPlaceholdersArray();

        for (int i = 0; i < images.Length; i++)
        {
            linkPlaceHolders[i].Controls.Clear();  // Link controls will be re-added to the placeholders as needed
            if (images[i].ImageUrl.Equals(IMAGE_PATH_ACTIVE))
            {
                // Active (Not filled but will be filled if 1 more image is added
                LiteralControl link = new LiteralControl("<a href=\"javascript:void(0);\" class=\"postAdAddImageLink\" onclick=\"toggleVisibility('imageFileUploadPanel');\">Add Image</a>");
                linkPlaceHolders[i].Controls.Add(link);
            }
            else if (!images[i].ImageUrl.Equals(IMAGE_PATH_INACTIVE))
            {
                // Already has an image uploaded to this position
                LinkButton removeLink = new LinkButton();
                removeLink.Text = "Remove";
                removeLink.ID = "btnRemove" + (i + 1).ToString();
                removeLink.CssClass = "postAdAddImageLink";
                removeLink.Click += new EventHandler(removeLink_Click);
                linkPlaceHolders[i].Controls.Add(removeLink);
            }
        } // END FOR
    }

    void removeLink_Click(object sender, EventArgs e)
    {
        LinkButton clickedLinkButton = (LinkButton)sender;
        string id = clickedLinkButton.ID.ToString();

        Image[] images = getPostAdImagesArray();

        int removeNumber = int.Parse(id.Substring(id.Length-1));
        int currentNumberOfImages = countUploadedImages();

        for (int number = 1; number < 4; number++)
        {
            if (number >= removeNumber)
            {
                images[number - 1].ImageUrl = images[number].ImageUrl;
            }
        }

        // Configure the last image
        if (currentNumberOfImages == 4)
        {
            images[3].ImageUrl = IMAGE_PATH_ACTIVE;
        }
        else
        {
            images[3].ImageUrl = IMAGE_PATH_INACTIVE;
        }

        configureImagePanelLinks();        
    }

    /// <summary>
    /// Simply returns an array of the post ad image controls
    /// </summary>
    private Image[] getPostAdImagesArray()
    {
        Image[] images = new Image[4];
        images[0] = addImage1;
        images[1] = addImage2;
        images[2] = addImage3;
        images[3] = addImage4;
        return images;
    }

    /// <summary>
    /// Simply returns an array of the post ad image link placeholders
    /// </summary>
    private PlaceHolder[] getPostAdImageLinkPlaceholdersArray()
    {
        PlaceHolder[] linkPlaceHolders = new PlaceHolder[4];
        linkPlaceHolders[0] = phImageLink1;
        linkPlaceHolders[1] = phImageLink2;
        linkPlaceHolders[2] = phImageLink3;
        linkPlaceHolders[3] = phImageLink4;
        return linkPlaceHolders;
    }


    /// <summary>
    /// Populates the state drop-down list in the contact info section
    /// </summary>
    protected void initStates()
    {
        SqlConnection connection = SQLUtils.openConnection();
        SqlCommand command = new SqlCommand(SQLUtils.SQL_LISTSTATES, connection);
        DataSet ds = SQLUtils.retrieveDataSet(command, "StatesTable", "TBL_STATE");

        // Populate drop-down
        cboState.Items.Add(new ListItem(INITIAL_ITEM_STATE, "0"));
        for (int i = 0; i < ds.Tables["TBL_STATE"].Rows.Count; i++)
        {
            string text = ds.Tables["TBL_STATE"].Rows[i]["ABBREVIATION"].ToString();
            string value = ds.Tables["TBL_STATE"].Rows[i]["ID"].ToString();
            cboState.Items.Add(new ListItem(text, text));
        }
        connection.Close();
    }

    protected void prevClicked(object sender, ImageClickEventArgs e)
    {
        Ad ad = extractAd();
        int result = ad.Sync();
        lblSubmit.Visible = true;
        lblSubmit.Text += "result=" + result.ToString() + "<br>";
        lblSubmit.Text += ad.ToString();
    }

    /// <summary>
    /// Creates an armadillo.data.Ad object populated from the field
    /// values of the current PostAd page instance.
    /// </summary>
    /// <returns>An Ad object representing this page</returns>
    private Ad extractAd()
    {
        Ad postedAd = new Ad();
        postedAd.CategoryID = int.Parse(armCategorySelect.SelectedCategoryId);
        postedAd.Subject = txtAdTitle.Text;
        postedAd.Description = txtAdDescription.InnerText;
        postedAd.AskingPrice = double.Parse(txtPrice.Text);

        int selectedExpirationMonth = int.Parse(txtHiddenExpirationMonth.Value);
        int selectedExpirationDay = int.Parse(txtHiddenExpirationDay.Value);

        // Assumes that the allowed expiration is less than a month or two
        // So, if the month is less than the current month it is in the next year
        // otherwise, it is in the current year
        int selectedExpirationYear = DateTime.Today.Year;

        if (selectedExpirationMonth < DateTime.Today.Month)
            selectedExpirationYear += 1;

        DateTime expirationDate = new DateTime(selectedExpirationYear, selectedExpirationMonth, selectedExpirationDay);

        postedAd.ExpirationDate = expirationDate;
        postedAd.ImagePaths[0] = extractDBImageUrl(addImage1);
        postedAd.ImagePaths[1] = extractDBImageUrl(addImage2);
        postedAd.ImagePaths[2] = extractDBImageUrl(addImage3);
        postedAd.ImagePaths[3] = extractDBImageUrl(addImage4);

        postedAd.LocalPickupOffered = radLocalPickup.Items[0].Selected;
        postedAd.LocalDeliveryOffered = radLocalDelivery.Items[0].Selected;
        postedAd.IsDeliveryAreaSpecified = radLocalDeliveryOptionSpecify.Checked;

        if(postedAd.IsDeliveryAreaSpecified)
            postedAd.DeliveryArea = txtDeliveryArea.Text;

        postedAd.ShippingOffered = radShipping.Items[0].Selected;

        if (postedAd.ShippingOffered)
        {
            postedAd.IsShippingFlatRate = radFixedRate.Checked;
           
            // Add Service #1
            int typeId = int.Parse(cboShippingService1.SelectedValue);
            postedAd.ShippingServices[0] = new ShippingService(typeId, 1);
            if (postedAd.IsShippingFlatRate)
            {
                postedAd.ShippingServices[0].FixedCost = double.Parse(txtCost1.Text);
            }

            // Add Service #2
            // Assumes that if a service is hidden it will be set back to the 0 index
            typeId = int.Parse(cboShippingService2.SelectedValue);
            if (typeId != 0)
            {
                postedAd.ShippingServices[1] = new ShippingService(typeId, 2);
                if (postedAd.IsShippingFlatRate)
                {
                    postedAd.ShippingServices[1].FixedCost = double.Parse(txtCost2.Text);
                }
            }

            // Add Service #3
            // Assumes that if a service is hidden it will be set back to the 0 index
            typeId = int.Parse(cboShippingService3.SelectedValue);
            if (typeId != 0)
            {
                postedAd.ShippingServices[2] = new ShippingService(typeId, 3);
                if (postedAd.IsShippingFlatRate)
                {
                    postedAd.ShippingServices[2].FixedCost = double.Parse(txtCost3.Text);
                }
            }

            // Add Package if the shipping will be at "Calculated Rate"
            if (!postedAd.IsShippingFlatRate)
            {
                int packageTypeId = int.Parse(cboPackage.SelectedValue);
                double weight = double.Parse(txtWeight.Text);

                postedAd.Package = new Package(packageTypeId, weight);

                if (cboPackage.SelectedItem.Text.Equals("My Packaging"))
                {
                    postedAd.Package.Length = double.Parse(txtLength.Text);
                    postedAd.Package.Width = double.Parse(txtWidth.Text);
                    postedAd.Package.Height = double.Parse(txtHeight.Text);
                }
               
            }
        }

        return postedAd;
    }

    private string extractDBImageUrl(Image addImage)
    {
        if (!addImage.ImageUrl.Equals(IMAGE_PATH_ACTIVE) && !addImage.ImageUrl.Equals(IMAGE_PATH_INACTIVE))
            return addImage.ImageUrl;
        else
            return null;
    }
}


[+][-]08/26/07 01:53 PM, ID: 19772205

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/26/07 03:52 PM, ID: 19772543

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/26/07 04:03 PM, ID: 19772576

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/27/07 04:38 PM, ID: 19779403

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/27/07 05:10 PM, ID: 19779505

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/31/07 04:27 PM, ID: 19811927

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/02/07 10:07 AM, ID: 19817521

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Programming for ASP.NET, WebApplications, .NET Framework 2.x
Tags: twice, click, page
Sign Up Now!
Solution Provided By: imateyelectronics
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20090824-EE-VQP-74 / EE_QW_1_20070628