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(thi
s.prevClic
ked);
this.Load += new System.EventHandler(this.P
age_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="~/Armadill
oMasterPag
e.master" AutoEventWireup="false" CodeFile="PostAd.aspx.cs" Inherits="PostAd" Title="ArmadilloPages | Post Ad" EnableEventValidation="fal
se"%>
<%@ MasterType TypeName="ArmadilloMasterP
age" %>
<%@ Register TagPrefix="armadillo" Assembly="ArmadilloLibrary
" Namespace="armadillo"%>
<%@ Register TagPrefix="armadillo" TagName="CategorySelectCon
trol" Src="~/Controls/CategorySe
lectContro
l.ascx" %>
<asp:Content ID="postAdHeaderContent" ContentPlaceHolderID="mast
erPlaceHol
derHeader"
Runat="Server">
<link href="CSS/Calendar.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="Scripts/Home.js"></sc
ript>
<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
/CalendarP
opup.js"><
/script>
<script language="javascript" type="text/javascript" src="Scripts/CalendarPopup
/AnchorPos
ition.js">
</script>
<script language="javascript" type="text/javascript" src="Scripts/CalendarPopup
/date.js">
</script>
<script language="javascript" type="text/javascript" src="Scripts/CalendarPopup
/PopupWind
ow.js"></s
cript>
<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(getCalendar
Styles());
// 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("Armadill
o");
cal.addDisabledDates(null,
formatDate
(now,"yyyy
-MM-dd"));
cal.addDisabledDates(forma
tDate(late
r,"yyyy-MM
-dd"),null
);
cal.setReturnFunction("reg
isterDate"
);
// Adjust days in feb for leap year
if(isLeapYear(now.getFullY
ear()))
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+mo
nthIndex)%
11];
var daysRemaining = maxDays - daysSoFar;
startDay[monthIndex] = 1;
endDay[monthIndex] = Math.min(daysInSubsequentM
onth, 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(cb
oExpMoCID)
;
var cboExpDay = document.getElementById(cb
oExpDayCID
);
var monthIndex = cboExpMo.selectedIndex;
cboExpDay.options.length = (endDay[monthIndex]-startD
ay[monthIn
dex])+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.Cli
entID %>');
var txtHiddenExpirationMonth = document.getElementById('<
%= txtHiddenExpirationMonth.C
lientID %>');
var cboExpirationDay = document.getElementById('<
%= cboExpirationDay.ClientID %>');
var cboExpirationMonth = document.getElementById('<
%= cboExpirationMonth.ClientI
D %>');
txtHiddenExpirationDay.val
ue = cboExpirationDay.options[c
boExpirati
onDay.sele
ctedIndex]
.value;
txtHiddenExpirationMonth.v
alue = (eval(cboExpirationMonth.o
ptions[cbo
Expiration
Month.sele
ctedIndex]
.value) + 1) + "";
}
function initCalendarDropdowns(cboE
xpMoCID, 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(cb
oExpMoCID)
;
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(hiddenTextC
ID, dateLaunchLinkCID)
{
var dateToSelect = getComboDate();
cal.select(document.getEle
mentById(h
iddenTextC
ID), 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(cb
oExpMoClie
ntID);
var cboExpDay = document.getElementById(cb
oExpDayCli
entID);
// 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].tex
t == months[month])
{
cboExpMo.selectedIndex = i;
// Now the dates must be repopulated
monthChanged(cboExpMoClien
tID, 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].te
xt == 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(cb
oExpMoClie
ntID);
var cboExpDay = document.getElementById(cb
oExpDayCli
entID);
var now = new Date();
var nowMonth = now.getMonth();
var nowDay = now.getDate();
var nowYear = now.getFullYear();
var mo = cboExpMo.options[cboExpMo.
selectedIn
dex].value
;
var day = cboExpDay.options[cboExpDa
y.selected
Index].tex
t;
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 validateExchangeRadioButto
ns(sender,
args)
{
var radLocalPickup = document.getElementsByName
('<%= radLocalPickup.UniqueID %>');
var radLocalDelivery = document.getElementsByName
('<%= radLocalDelivery.UniqueID %>');
var radShipping = document.getElementsByName
('<%= radShipping.UniqueID %>');
args.IsValid = !(radLocalPickup[1].checke
d && radLocalDelivery[1].checke
d && 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(radLocalDe
livery[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(radShippin
g[0].check
ed);
}
/* Disables the specify delivery area text field if the corresponding radio button is not selected */
function deliveryAreaChanged() {
var radLocalDeliveryOptionSpec
ify = document.getElementById('<
%= radLocalDeliveryOptionSpec
ify.Client
ID %>');
var txtDeliveryArea = document.getElementById('<
%= txtDeliveryArea.ClientID %>');
if(radLocalDeliveryOptionS
pecify.che
cked) {
txtDeliveryArea.disabled = false;
} else {
txtDeliveryArea.value = '';
txtDeliveryArea.disabled = true;
}
}
function validateDeliveryArea(sende
r, args) {
var radLocalDelivery = document.getElementsByName
('<%= radLocalDelivery.UniqueID %>');
var radLocalDeliveryOptionSpec
ify = document.getElementById('<
%= radLocalDeliveryOptionSpec
ify.Client
ID %>');
// Validate only if local delivery has been checked
if(radLocalDelivery[0].che
cked && radLocalDeliveryOptionSpec
ify.checke
d) {
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(serviceNumbe
r)
{
var cboShippingService1 = document.getElementById('<
%= cboShippingService1.Client
ID %>');
var cboShippingService2 = document.getElementById('<
%= cboShippingService2.Client
ID %>');
var cboShippingService3 = document.getElementById('<
%= cboShippingService3.Client
ID %>');
// 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.select
edIndex = cboShippingService3.select
edIndex;
txtCost2.value = txtCost3.value;
cboShippingService3.select
edIndex = 0;
txtCost3.value = "";
} else {
cboShippingService2.select
edIndex = 0;
txtCost2.value = "";
}
cboShippingService1.focus(
);
} else { // 3
txtCost3.value = "";
cboShippingService3.select
edIndex = 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.selectedInde
x == 0)
{
args.IsValid = false;
}
else
{
if(cboPackage.options[cboP
ackage.sel
ectedIndex
].innerTex
t != 'My Packaging')
{
// Clears validation error message by dimension boxes, if necessary
revalidate('valDimensionCu
stom');
}
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[cboP
ackage.sel
ectedIndex
].innerTex
t == 'My Packaging')
{
args.IsValid = packageTextFieldIsValid(tx
tLength) &&
packageTextFieldIsValid(tx
tWidth) &&
packageTextFieldIsValid(tx
tHeight);
}
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('s
hippingSer
vice2');
var cboShippingService2 = document.getElementById('<
%= cboShippingService2.Client
ID %>');
args.IsValid = shippingService2.className
== "hide" || (shippingService2.classNam
e == 'show' && cboShippingService2.select
edIndex != 0);
servicesError(args.IsValid
);
} else {
args.IsValid = true;
servicesError(true);
}
}
function validateServices3(sender, args)
{
if(servicesReadyToValidate
()) {
var shippingService3 = document.getElementById('s
hippingSer
vice3');
var cboShippingService3 = document.getElementById('<
%= cboShippingService3.Client
ID %>');
args.IsValid = shippingService3.className
== "hide" || (shippingService3.classNam
e == 'show' && cboShippingService3.select
edIndex != 0);
servicesError(args.IsValid
);
} else {
args.IsValid = true;
servicesError(true);
}
}
function freeShippingClicked() {
var freeShippingCheckBox = document.getElementById('f
reeShippin
gCheckBox'
);
var txtCost1 = document.getElementById('<
%= txtCost1.ClientID %>');
if(freeShippingCheckBox.ch
ecked) {
txtCost1.value = "0.00";
txtCost1.disabled = true;
} else {
txtCost1.value = "";
txtCost1.disabled = false;
}
revalidate('valCost1Custom
');
}
function servicesError(hide) {
var servicesErrorMessage = document.getElementById('s
ervicesErr
orMessage'
);
var serviceCostErrorMessage = document.getElementById('s
erviceCost
ErrorMessa
ge');
// Only hide the error message if all services fields are valid
if(hide && (!servicesReadyToValidate(
) || (allServicesAreValid() && allServiceSelectionsUnique
())))
{
servicesErrorMessage.class
Name = 'hide';
} else {
if(allServiceSelectionsUni
que()) {
servicesErrorMessage.inner
Text = ' Please select a value for all services.';
} else {
servicesErrorMessage.inner
Text = ' 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.class
Name = 'show';
serviceCostErrorMessage.cl
assName = 'hide';
}
}
function serviceCostError(hide, force) {
var serviceCostErrorMessage = document.getElementById('s
erviceCost
ErrorMessa
ge');
var servicesErrorMessage = document.getElementById('s
ervicesErr
orMessage'
);
if(hide && (allServiceCostsAreValid()
|| force)) {
serviceCostErrorMessage.cl
assName = 'hide';
} else {
// Even if a cost is invalid, the service message takes precedence if it is invalid
if((allServicesAreValid() && allServiceSelectionsUnique
()) || servicesErrorMessage.class
Name == "hide") {
serviceCostErrorMessage.cl
assName = 'show';
} else {
serviceCostErrorMessage.cl
assName = '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('s
hippingSer
vice2');
var shippingService3 = document.getElementById('s
hippingSer
vice3');
var cboShippingService1 = document.getElementById('<
%= cboShippingService1.Client
ID %>');
var cboShippingService2 = document.getElementById('<
%= cboShippingService2.Client
ID %>');
var cboShippingService3 = document.getElementById('<
%= cboShippingService3.Client
ID %>');
return cboShippingService1.select
edIndex != 0 &&
(cboShippingService2.selec
tedIndex != 0 || shippingService2.className
== 'hide') &&
(cboShippingService3.selec
tedIndex != 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.Client
ID %>');
var cboShippingService2 = document.getElementById('<
%= cboShippingService2.Client
ID %>');
var cboShippingService3 = document.getElementById('<
%= cboShippingService3.Client
ID %>');
ci1 = cboShippingService1.select
edIndex;
ci2 = cboShippingService2.select
edIndex;
ci3 = cboShippingService3.select
edIndex;
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('s
hippingSer
vice2');
var shippingService3 = document.getElementById('s
hippingSer
vice3');
var txtCost1 = document.getElementById('<
%= txtCost1.ClientID %>');
var txtCost2 = document.getElementById('<
%= txtCost2.ClientID %>');
var txtCost3 = document.getElementById('<
%= txtCost3.ClientID %>');
var serviceCost1 = document.getElementById('s
erviceCost
1');
// 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(txt
Cost1) &&
(costTextFieldIsValid(txtC
ost2) || shippingService2.className
== 'hide') &&
(costTextFieldIsValid(txtC
ost3) || 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('f
reeShippin
gCheckBox'
);
var txtCost1 = document.getElementById('<
%= txtCost1.ClientID %>');
if(servicesReadyToValidate
() && !packageReadyToValidate())
{
if(freeShippingCheckBox.ch
ecked || costTextFieldIsValid(txtCo
st1) ) {
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('s
hippingSer
vice2');
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('s
hippingSer
vice3');
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.check
ed) {
var freeShippingCheckBox = document.getElementById('f
reeShippin
gCheckBox'
);
if(!freeShippingCheckBox.c
hecked) {
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(fi
eld)
{
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.repla
ce(/^\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="mast
erPlaceHol
der" 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="postAdRequiredField
s" style="padding-top:10px;">
<span class="postAdAstrisk">*</s
pan> Required Fields
</div>
<br />
</td>
</tr>
<tr>
<td>
<!-- BEGIN STEP 1 SECTION -->
<table cellpadding="0" cellspacing="0" style="width:100%;"><tr><t
d>
<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_S
tep_1.jpg"
/></td>
<td class="postAdAreaTBGLeft" valign="top" colspan=3><img src="Images/Post_Ad_Title_
Enter_Ad_I
nformation
.png"/></t
d>
<td width=11><img src="Images/Post_Ad_Area_T
R_Corner.p
ng"/></td>
</tr>
<!-- LOWER TITLE ROW -->
<tr height=9>
<td style="background-color:#d
cefdc;"></
td>
<td width=2 style="background-color:wh
ite;"></td
>
<td style="background-color:#F
1FAF1;" width="100%"><img src="Images/Transparent_Pi
xel.png" width=1 height=9/></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:red
;"></td>
</tr>
<!-- LOWER TITLE ROW -->
<tr>
<td colspan=2 width=42 class="postAdAreaLeft">
<div class="postAdFieldLabelTop
">
Category <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td width="100%" class="postAdAreaRight">
<div class="postAdFieldRight">
<armadillo:CategorySelectC
ontrol ID="armCategorySelect" runat="server" InitialItem="-- Select Category --"/>
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END CATEGORIES ROW -->
<!-- BEGIN SPACER ROW -->
<tr style="height:2px;">
<td style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;w
idth:42px;
"></td>
<td></td>
<td></td>
<td></td>
<td style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor: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 <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td style="background-color:#F
1FAF1;" width="100%">
<div class="postAdFieldRight">
<asp:TextBox ID="txtAdTitle" runat="server" CssClass="standardTextFiel
d" Width="400px"/>
<asp:RequiredFieldValidato
r ID="titleValidator"
runat="server"
ErrorMessage="Please enter a title."
ControlToValidate="txtAdTi
tle"
CssClass="validationText"
Display="dynamic"
SetFocusOnError="true" />
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END AD TITLE ROW -->
<!-- BEGIN SPACER ROW -->
<tr style="height:2px;">
<td style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;w
idth:42px;
"></td>
<td></td>
<td></td>
<td></td>
<td style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor: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 <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td style="background-color:#F
1FAF1;" width="100%">
<div class="postAdFieldRight">
<textarea id="txtAdDescription" cols="80" class="standardTextField" style="width:400px;height:
140px;font
-family:ar
ial,verdan
a,sans Serif;" runat="server"></textarea>
<asp:RequiredFieldValidato
r ID="descriptionValidator"
runat="server"
ErrorMessage="Please enter a description."
ControlToValidate="txtAdDe
scription"
CssClass="validationText"
Display="dynamic"
SetFocusOnError="true" />
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END AD DESCRIPTION ROW -->
<!-- BEGIN SPACER ROW -->
<tr style="height:2px;">
<td style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;w
idth:42px;
"></td>
<td></td>
<td></td>
<td></td>
<td style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor:white;
width:11px
;"></td>
</tr>
<!-- END SPACER ROW -->
<!-- BEGIN ASKING PRICE ROW -->
<tr>
<td colspan=2 style="background-image: url(Images/Post_Ad_Area_LB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:left;b
ackground-
color:#dce
fdc;">
<div class="postAdFieldLabelTop
">
Asking Price <sp
an class="postAdAstrisk">*</s
pan>
</div>
</td>
<td style="background-color:wh
ite;width:
2px;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td style="background-color:#F
1FAF1;widt
h:100%;">
<div class="postAdFieldRight">
<span class="postAdFieldLabelRig
ht">$</spa
n> <asp:TextBox ID="txtPrice" runat="server" style="width:90px;" CssClass="standardTextFiel
d"/>
<asp:RequiredFieldValidato
r ID="askingPriceValidator"
runat="server"
ErrorMessage="Please enter an asking price."
ControlToValidate="txtPric
e"
CssClass="validationText"
Display="dynamic"
SetFocusOnError="true" />
<asp:RegularExpressionVali
dator ID="askingPriceValidator2"
runat="server"
ErrorMessage="Please enter a valid price."
ControlToValidate="txtPric
e"
CssClass="validationText"
SetFocusOnError="true"
ValidationExpression="\s*\
$*\s*(?:[\
d]{1,3},[\
d]{3},[\d]
{3}|[\d]{1
,3},[\d]{3
}|[\d]{1,3
}|[\d]{1,1
0})(?:[.][
\d]{2})*\s
*" />
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END ASKING PRICE ROW -->
<!-- BEGIN SPACER ROW -->
<tr style="height:2px;">
<td style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;w
idth:42px;
"></td>
<td></td>
<td></td>
<td></td>
<td style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor: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 <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td style="background-color:#F
1FAF1;" 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
;backgroun
d-color:#F
FFFFF;"></
div>
<asp:HiddenField ID="txtHiddenExpirationDay
" runat="server" />
<asp:HiddenField ID="txtHiddenExpirationMon
th" runat="server" />
<asp:HiddenField ID="txtHiddenDate" runat="server" />
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END AD TITLE ROW -->
<tr>
<td width="42"><img src="Images/Post_Ad_Area_B
L_Corner.j
pg"/></td>
<td width="300" style="background-image: url(Images/Post_Ad_Area_BB
G_Left.jpg
);backgrou
nd-repeat:
repeat-x;"
><img src="Images/Transparent_Pi
xel.png" height="12" width="30"/></td>
<td width="100%" colspan=2 style="background-image: url(Images/Post_Ad_Area_BB
G_Right.jp
g);backgro
und-repeat
:repeat-x;
"><img src="Images/Transparent_Pi
xel.png" height="12" width="30"/></td>
<td width="11"><img src="Images/Post_Ad_Area_B
R_Corner.j
pg"/></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_S
tep_2.jpg"
/></td>
<td class="postAdAreaTBGLeft" valign="top" colspan=3><img src="Images/Post_Ad_Title_
Add_Images
.png"/></t
d>
<td width=11><img src="Images/Post_Ad_Area_T
R_Corner.p
ng"/></td>
</tr>
<!-- BEGIN LOWER TITLE ROW -->
<tr height=9>
<td style="background-color:#d
cefdc;"></
td>
<td width=2 style="background-color:wh
ite;"></td
>
<td style="background-color:#F
1FAF1;" width="100%"><img src="Images/Transparent_Pi
xel.png" width=1 height=9/></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion: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:wh
ite;"><img
src="Images/Transparent_Pi
xel.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_Imag
e_Placehol
der_Active
.png" AlternateText="Ad Image #1"/>
<asp:PlaceHolder ID="phImageLink1" runat="server" />
<!-- END FIRST IMAGE CELL -->
</td>
<td><img alt="" src="Images/Transparent_Pi
xel.png" width="15"/></td>
<td align="center" valign="top">
<!-- BEGIN SECOND IMAGE CELL -->
<asp:Image ID="addImage2" runat="server" ImageUrl="Images/Icon_Imag
e_Placehol
der_Inacti
ve.png" AlternateText="Ad Image #2"/>
<asp:PlaceHolder ID="phImageLink2" runat="server" />
<!-- END SECOND IMAGE CELL -->
</td>
<td><img alt="" src="Images/Transparent_Pi
xel.png" width="15"/></td>
<td align="center" valign="top">
<!-- BEGIN THIRD IMAGE CELL -->
<asp:Image ID="addImage3" runat="server" ImageUrl="Images/Icon_Imag
e_Placehol
der_Inacti
ve.png" AlternateText="Ad Image #3"/>
<asp:PlaceHolder ID="phImageLink3" runat="server" />
<!-- END THIRD IMAGE CELL -->
</td>
<td><img alt="" src="Images/Transparent_Pi
xel.png" width="15"/></td>
<td align="center" valign="top">
<!-- BEGIN FOURTH IMAGE CELL -->
<asp:Image ID="addImage4" runat="server" ImageUrl="Images/Icon_Imag
e_Placehol
der_Inacti
ve.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;m
argin-bott
om: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_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END IMAGES ROW -->
<tr>
<td width="42"><img src="Images/Post_Ad_Area_B
L_Corner.j
pg"/></td>
<td width="300" style="background-image: url(Images/Post_Ad_Area_BB
G_Left.jpg
);backgrou
nd-repeat:
repeat-x;"
><img src="Images/Transparent_Pi
xel.png" height="12" width="30"/></td>
<td width="100%" colspan=2 style="background-image: url(Images/Post_Ad_Area_BB
G_Right.jp
g);backgro
und-repeat
:repeat-x;
"><img src="Images/Transparent_Pi
xel.png" height="12" width="30"/></td>
<td width="11"><img src="Images/Post_Ad_Area_B
R_Corner.j
pg"/></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_S
tep_3.jpg"
/></td>
<td class="postAdAreaTBGLeft" valign="top" colspan=3><img src="Images/Post_Ad_Title_
Specify_Ex
change_Opt
ions.png"/
></td>
<td width=11><img src="Images/Post_Ad_Area_T
R_Corner.p
ng"/></td>
</tr>
<!-- LOWER TITLE ROW -->
<tr height=9>
<td style="background-color:#d
cefdc;"></
td>
<td width=2 style="background-color:wh
ite;"></td
>
<td style="background-color:#F
1FAF1;" width="100%"><img src="Images/Transparent_Pi
xel.png" width=1 height=9/></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion: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 <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.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="postAdFieldValue
Right" RepeatLayout="Table" RepeatDirection="Horizonta
l">
<asp:ListItem Text="Yes " Value="Yes" Selected="True" />
<asp:ListItem Text=" No
" Value="No" Selected="False" />
</asp:RadioButtonList>
</td><td style="width:100%;">
<asp:CustomValidator ID="validatorExchangeRadio
ButtonsMai
n"
runat="server"
ErrorMessage="Please select 'Yes' for at least 1 exchange option."
CssClass="validationText"
SetFocusOnError="true"
ControlToValidate="radLoca
lPickup"
Display="Dynamic"
ClientValidationFunction="
validateEx
changeRadi
oButtons" />
</td></tr></table>
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END LOCAL PICKUP ROW -->
<!-- BEGIN SPACER ROW -->
<tr height="2">
<td width=42 style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;"
></td>
<td></td>
<td></td>
<td></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor:white;
"></td>
</tr>
<!-- END SPACER ROW -->
<!-- BEGIN LOCAL PICKUP ROW -->
<tr>
<td colspan=2 width=42 class="postAdAreaLeft">
<div class="postAdFieldLabelTop
">
Local Delivery <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td width="100%" class="postAdAreaRight">
<div class="postAdFieldRight">
<asp:RadioButtonList ID="radLocalDelivery" runat="server" CssClass="postAdFieldValue
Right" RepeatLayout="Table" RepeatDirection="Horizonta
l">
<asp:ListItem Text="Yes " Value="Yes" Selected="False" />
<asp:ListItem Text=" No
" Value="No" Selected="True" />
</asp:RadioButtonList>
<!-- BEGIN DELIVERY OPTIONS TABLE -->
<div id="deliveryOptions" style="margin-top:8px;marg
in-bottom:
5px;" class="hide">
<table width=400 height=100% style="background-color:#d
cefdc;" cellpadding=0 cellspacing=0>
<tr>
<td><img src="Images/SubArea_TL_Cor
ner.png"><
/td>
<td width=100%></td>
<td><img src="Images/SubArea_TR_Cor
ner.png"><
/td>
</tr>
<tr height="100%">
<td></td>
<td valign="top">
<div style="margin-bottom:10px;
">
<span style="font-size:11px;font
-weight:bo
ld;color:#
dc6415;">W
here will you deliver?</span>
<asp:CustomValidator ID="valDeliveryAreaCustom"
runat="server"
ErrorMessage="Please enter a delivery area."
Display="dynamic"
ControlToValidate="txtDeli
veryArea"
CssClass="validationText"
SetFocusOnError="true"
ClientValidationFunction="
validateDe
liveryArea
"
ValidateEmptyText="true" />
</div>
<!-- BEGIN INNER DELIVERY OPTIONS TABLE -->
<table cellpadding=0 cellspacing=0>
<tr class="deliveryOptionRow">
<td>
<asp:RadioButton ID="radLocalDeliveryOption
Specify" GroupName="LocalDeliveryOp
tion" runat="server" Checked="true"/>
<span class="postAdFieldValueRig
ht"><b>Spe
cify Area:</b></span></td>
<td width=10></td>
<td>
<asp:TextBox ID="txtDeliveryArea" runat="server" CssClass="standardTextFiel
d" style="width:200px;"/>
</td>
</tr>
<tr class="deliveryOptionRow">
<td>
<asp:RadioButton ID="radLocalDeliveryOption
Negotiable
" GroupName="LocalDeliveryOp
tion" runat="server" Checked="false"/>
<span class="postAdFieldValueRig
ht"><b>Neg
otiable</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_Cor
ner.png"><
/td>
<td></td>
<td><img src="Images/SubArea_BR_Cor
ner.png"><
/td>
</tr>
</table>
</div>
<!-- END DELIVERY OPTIONS TABLE -->
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END LOCAL PICKUP ROW -->
<!-- BEGIN SPACER ROW -->
<tr height="2">
<td width=42 style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;"
></td>
<td></td>
<td></td>
<td></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor:white;
"></td>
</tr>
<!-- END SPACER ROW -->
<!-- BEGIN SHIPPING ROW -->
<tr>
<td colspan=2 width=42 class="postAdAreaLeft">
<div class="postAdFieldLabelTop
" >
Shipping <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.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="postAdFieldValue
Right" RepeatLayout="Table" RepeatDirection="Horizonta
l">
<asp:ListItem Text="Yes " Value="Yes" Selected="False" />
<asp:ListItem Text=" No
" 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:#d
cefdc;marg
in-bottom:
10px;" cellpadding=0 cellspacing=0>
<tr>
<td><img src="Images/SubArea_TL_Cor
ner.png"><
/td>
<td width=100%></td>
<td><img src="Images/SubArea_TR_Cor
ner.png"><
/td>
</tr>
<tr height="100%">
<td></td>
<td valign="top">
<div style="font-size:11px;font
-weight:bo
ld;color:#
dc6415;mar
gin-bottom
:10px;marg
in-bottom:
10px;">How
will you charge for shipping? <span class="postAdAstrisk">*</s
pan></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="postAdFieldValueRig
ht">
<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="postAdFieldValueRig
ht">
<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_Cor
ner.png" /></td>
<td></td>
<td><img alt="" src="Images/SubArea_BR_Cor
ner.png" /></td>
</tr>
</table>
<table width=550 height=100% style="background-color:#d
cefdc;" cellpadding=0 cellspacing=0>
<tr>
<td><img alt="" src="Images/SubArea_TL_Cor
ner.png" /></td>
<td width=100%></td>
<td><img alt="" src="Images/SubArea_TR_Cor
ner.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:bo
ld;color:#
dc6415;mar
gin-bottom
:10px;">Wh
at types of shipping will you offer? <span class="postAdAstrisk">*</s
pan></div>
</td>
<td>
<div class="hide" id="servicesErrorMessage" style="font-family:verdana
, arial;font-weight:bold;col
or:red;fon
t-size:11p
x;margin-b
ottom:10px
;">
Please select a value for all services.
</div>
<div class="hide" id="serviceCostErrorMessag
e" style="font-family:verdana
, arial;font-weight:bold;col
or:red;fon
t-size:11p
x;margin-b
ottom:10px
;">
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;pad
ding-botto
m:2px;">
<table cellpadding="0" cellspacing="0" width=100%>
<tr>
<td>
<armadillo:ShippingService
ComboBox ID="cboShippingService1" runat="server" CssClass="standardComboBox
" InitialItem="-- Select a UPS Service --"/>
<asp:CustomValidator ID="valShippingService1Cus
tom"
runat="server"
ErrorMessage=""
Display="none"
ClientValidationFunction="
validateSe
rvices1"
ControlToValidate="cboShip
pingServic
e1"
SetFocusOnError="true"/>
</td>
<td style="padding-left:10px;"
>
<div id="serviceCost1" class="show">
<span class="postAdFieldLabelRig
ht">Cost:&
nbsp; 
;$</span>
<asp:TextBox ID="txtCost1" runat="server" CssClass="standardTextFiel
d" style="margin-left:3px;wid
th:50px;" />
<asp:CustomValidator ID="valCost1Custom"
runat="server"
ErrorMessage=""
Display="none"
ControlToValidate="txtCost
1"
ClientValidationFunction="
validateCo
st1"
ValidateEmptyText="true"
SetFocusOnError="true"/>
</div>
</td>
<td style="padding-left:10px;"
>
<input id="freeShippingCheckBox" type="checkbox" style="margin-right:2px;" onclick="freeShippingClick
ed();"/><s
pan class="postAdFieldValueRig
ht">Free&n
bsp;Shippi
ng</span>
</td>
</tr>
</table>
</div>
<!-- END FIRST SERVICE -->
</td>
</tr>
<tr>
<td>
<!-- BEGIN SECOND SERVICE -->
<div id="shippingService2" class="hide" style="padding-top:2px;pad
ding-botto
m:2px;">
<table cellpadding="0" cellspacing="0" width=100%>
<tr>
<td>
<armadillo:ShippingService
ComboBox ID="cboShippingService2" runat="server" CssClass="standardComboBox
" InitialItem="-- Select a UPS Service --"/>
<asp:CustomValidator ID="valShippingService2Cus
tom"
runat="server"
ErrorMessage=""
Display="none"
ControlToValidate="cboShip
pingServic
e2"
ClientValidationFunction="
validateSe
rvices2"
SetFocusOnError="true"/>
</td>
<td style="padding-left:10px;"
>
<div id="serviceCost2" class="show">
<span class="postAdFieldLabelRig
ht">Cost:&
nbsp; 
;$</span>
<asp:TextBox ID="txtCost2" runat="server" CssClass="standardTextFiel
d" style="margin-left:3px;wid
th:50px;" />
<asp:CustomValidator ID="valCost2Custom"
runat="server"
ErrorMessage=""
Display="none"
ControlToValidate="txtCost
2"
ClientValidationFunction="
validateCo
st2"
ValidateEmptyText="true"
SetFocusOnError="true"/>
</div>
</td>
<td style="padding-left:10px;"
width=100>
<a href="javascript:void(0);"
class="postAdShippingServi
ceLink" 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;pad
ding-botto
m:2px;">
<table cellpadding="0" cellspacing="0" width=100%>
<tr>
<td>
<armadillo:ShippingService
ComboBox ID="cboShippingService3" runat="server" CssClass="standardComboBox
" InitialItem="-- Select a UPS Service --"/>
<asp:CustomValidator ID="valShippingService3Cus
tom"
runat="server"
ErrorMessage=""
Display="none"
ControlToValidate="cboShip
pingServic
e3"
ClientValidationFunction="
validateSe
rvices3"
SetFocusOnError="true"/>
</td>
<td style="padding-left:10px;"
>
<div id="serviceCost3" class="show">
<span class="postAdFieldLabelRig
ht">Cost:&
nbsp; 
;$</span>
<asp:TextBox ID="txtCost3" runat="server" CssClass="standardTextFiel
d" style="margin-left:3px;wid
th:50px;" />
<asp:CustomValidator ID="valCost3Custom"
runat="server"
ErrorMessage=""
Display="none"
ControlToValidate="txtCost
3"
ClientValidationFunction="
validateCo
st3"
ValidateEmptyText="true"
SetFocusOnError="true"/>
</div>
</td>
<td style="padding-left:10px;"
width=100>
<a href="javascript:void(0);"
class="postAdShippingServi
ceLink" 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="postAdShippingServi
ceLink" onclick="adjustServices(tr
ue);">Add&
nbsp;Servi
ce</a>
</div>
<!-- END INNER SHIPPING OPTIONS TABLE -->
</td>
<td></td>
</tr>
<tr>
<td><img src="Images/SubArea_BL_Cor
ner.png"><
/td>
<td></td>
<td><img src="Images/SubArea_BR_Cor
ner.png"><
/td>
</tr>
</table>
<div id="shipmentSizeOptions" class="hide" style="margin-top:10px;">
<table width=550 height=100% style="background-color:#d
cefdc;" cellpadding=0 cellspacing=0>
<tr>
<td><img src="Images/SubArea_TL_Cor
ner.png"><
/td>
<td width=100%></td>
<td><img src="Images/SubArea_TR_Cor
ner.png"><
/td>
</tr>
<tr height="100%">
<td></td>
<td valign="top">
<div style="font-size:11px;font
-weight:bo
ld;color:#
dc6415;mar
gin-bottom
:10px;marg
in-bottom:
10px;">Wha
t size is your shipment? <span class="postAdAstrisk">*</s
pan>
</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="postAdFieldLabelRig
ht"><b>Pac
kage:</b><
/span>
</td>
<td width=10></td>
<td>
<!-- BEGIN SHIPPING PACKAGE TYPE -->
<armadillo:ShippingPackage
ComboBox ID="cboPackage"
runat="server"
CausesValidation="false"
CssClass="standardTextFiel
d"
InitialItem="-- Select Package --"
/>
<!-- END SHIPPING PACKAGE TYPE -->
</td>
<td>
<asp:CustomValidator ID="valPackageCustom"
runat="server"
ErrorMessage="Please select a package."
ControlToValidate="cboPack
age"
Display="dynamic"
SetFocusOnError="true"
CssClass="validationText"
ClientValidationFunction="
validatePa
ckage" />
</td>
</tr>
<tr class="shippingOptionRow">
<td>
<span class="postAdFieldLabelRig
ht"><b>Wei
ght:</b></
span>
</td>
<td width=10></td>
<td>
<!-- BEGIN WEIGHT INPUT -->
<asp:TextBox ID="txtWeight" runat="server" CssClass="standardTextFiel
d" style="width:40px;" /> <span class="postAdFieldValueRig
ht">lbs.</
span>
<!-- END WEIGHT INPUT -->
</td>
<td>
<asp:CustomValidator ID="valWeightCustom"
runat="server"
ErrorMessage="Please enter a valid weight."
ControlToValidate="txtWeig
ht"
Display="dynamic"
SetFocusOnError="true"
CssClass="validationText"
ValidateEmptyText="true"
ClientValidationFunction="
validateWe
ight" />
</td>
</tr>
<tr class="shippingOptionRow">
<td valign="top">
<span class="postAdFieldLabelRig
ht"><b>Dim
ensions:</
b></span>
</td>
<td width=10></td>
<td>
<div class="postAdFieldValueRig
ht">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:TextBox ID="txtLength" runat="server" CssClass="standardTextFiel
d" style="width:40px;"/>
</td>
<td class="postAdFieldValueRig
ht" style="padding-left:3px;pa
dding-righ
t:3px;">in
. <span style="color:#dc6415;font-
weight:bol
d;">X</spa
n></td>
<td>
<asp:TextBox ID="txtWidth" runat="server" CssClass="standardTextFiel
d" style="width:40px;"/>
</td>
<td class="postAdFieldValueRig
ht" style="padding-left:3px;pa
dding-righ
t:3px;">in
. <span style="color:#dc6415;font-
weight:bol
d;">X</spa
n></td>
<td>
<asp:TextBox ID="txtHeight" runat="server" CssClass="standardTextFiel
d" style="width:40px;"/>
</td>
<td class="postAdFieldValueRig
ht" style="padding-left:3px;pa
dding-righ
t:3px;">in
.</td>
</tr>
<tr>
<td class="postAdFieldValueRig
ht"><b>Len
gth</b></t
d>
<td></td>
<td class="postAdFieldValueRig
ht"><b>Wid
th</b></td
>
<td></td>
<td class="postAdFieldValueRig
ht"><b>Hei
ght</b></t
d>
<td></td>
</tr>
</table>
</div>
</td>
<td valign="top">
<asp:CustomValidator ID="valDimensionCustom"
runat="server"
ErrorMessage="Please enter a valid dimension."
ControlToValidate="txtHeig
ht"
Display="dynamic"
SetFocusOnError="true"
CssClass="validationText"
ValidateEmptyText="true"
ClientValidationFunction="
validateDi
mensions"/
>
</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_Cor
ner.png"><
/td>
<td></td>
<td><img src="Images/SubArea_BR_Cor
ner.png"><
/td>
</tr>
</table>
</div>
<!-- END SHIPPING OPTIONS TABLE -->
</div>
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END SHIPPING ROW -->
<tr>
<td width="42"><img src="Images/Post_Ad_Area_B
L_Corner.j
pg"/></td>
<td width="300" style="background-image: url(Images/Post_Ad_Area_BB
G_Left.jpg
);backgrou
nd-repeat:
repeat-x;"
><img src="Images/Transparent_Pi
xel.png" height="12" width="30"/></td>
<td width="100%" colspan=2 style="background-image: url(Images/Post_Ad_Area_BB
G_Right.jp
g);backgro
und-repeat
:repeat-x;
"><img src="Images/Transparent_Pi
xel.png" height="12" width="30"/></td>
<td width="11"><img src="Images/Post_Ad_Area_B
R_Corner.j
pg"/></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><t
d>
<table cellpadding=0 cellspacing=0 border=0 style="width:100%">
<tr>
<td height=0 width="42" rowspan=2><img src="Images/Post_Ad_Area_S
tep_4.jpg"
/></td>
<td class="postAdAreaTBGLeft" valign="top" colspan=3><img src="Images/Post_Ad_Title_
Enter_Cont
act_Inform
ation.png"
/></td>
<td width=11><img src="Images/Post_Ad_Area_T
R_Corner.p
ng"/></td>
</tr>
<!-- LOWER TITLE ROW -->
<tr height=9>
<td style="background-color:#d
cefdc;"></
td>
<td width=2 style="background-color:wh
ite;"></td
>
<td style="background-color:#F
1FAF1;" width="100%"><img alt="" src="Images/Transparent_Pi
xel.png" width="1" height="9" /></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:red
;"></td>
</tr>
<!-- LOWER TITLE ROW -->
<!-- BEGIN EMAIL ROW -->
<tr>
<td colspan=2 width=42 class="postAdAreaLeft">
<div class="postAdFieldLabelTop
">
Email <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td width="100%" class="postAdAreaRight">
<div class="postAdFieldRight">
<asp:TextBox ID="txtEmail" runat="server" CssClass="standardTextFiel
d" style="width:200px;"/>
<asp:RegularExpressionVali
dator ID="validatorEmailRE"
runat="server"
ErrorMessage="Please enter a valid email address."
ControlToValidate="txtEmai
l"
ValidationExpression="\w+(
[-+.]\w+)*
@\w+([-.]\
w+)*\.\w+(
[-.]\w+)*"
SetFocusOnError="true"
Display="Dynamic"
Visible="true"
CssClass="validationText" />
<asp:RequiredFieldValidato
r ID="validatorEmailRequired
"
runat="server"
ErrorMessage="Please enter your email address."
ControlToValidate="txtEmai
l"
SetFocusOnError="true"
Display="dynamic"
Visible="true"
CssClass="validationText" />
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END EMAIL ROW -->
<!-- BEGIN SPACER ROW -->
<tr height="2">
<td width=42 style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;"
></td>
<td></td>
<td></td>
<td></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor: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;">(Fo
rmat: 555-555-5555)</span>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td width="100%" class="postAdAreaRight">
<div class="postAdFieldRight">
<asp:TextBox ID="txtPhone" runat="server" CssClass="standardTextFiel
d" style="width:80px;"/>
<asp:RegularExpressionVali
dator ID="validatorPhoneRE"
runat="server"
ErrorMessage="Please enter a valid phone number (Format: 555-555-5555)."
SetFocusOnError="true"
ControlToValidate="txtPhon
e"
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_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END PHONE ROW -->
<!-- BEGIN SPACER ROW -->
<tr height="2">
<td width=42 style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;"
></td>
<td></td>
<td></td>
<td></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor: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:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td width="100%" class="postAdAreaRight">
<div class="postAdFieldRight">
<asp:TextBox ID="txtIMHandle" runat="server" CssClass="standardTextFiel
d" 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="cboIMTy
pe"
CssClass="validationText"
ClientValidationFunction="
validateIM
"
Display="dynamic" />
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END IM ROW -->
<!-- BEGIN SPACER ROW -->
<tr height="2">
<td width=42 style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;"
></td>
<td></td>
<td></td>
<td></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor: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:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td width="100%" class="postAdAreaRight">
<div class="postAdFieldRight">
<asp:TextBox ID="txtAddress" runat="server" CssClass="standardTextFiel
d" style="width:200px;"/>
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END ADDRESS ROW -->
<!-- BEGIN SPACER ROW -->
<tr height="2">
<td width=42 style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;"
></td>
<td></td>
<td></td>
<td></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor:white;
"></td>
</tr>
<!-- END SPACER ROW -->
<!-- BEGIN CITY ROW -->
<tr>
<td colspan=2 width=42 class="postAdAreaLeft">
<div class="postAdFieldLabelTop
">
City <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td width="100%" class="postAdAreaRight">
<div class="postAdFieldRight">
<asp:TextBox ID="txtCity" runat="server" CssClass="standardTextFiel
d" style="width:150px;"/>
<asp:RequiredFieldValidato
r 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_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END CITY ROW -->
<!-- BEGIN SPACER ROW -->
<tr height="2">
<td width=42 style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;"
></td>
<td></td>
<td></td>
<td></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor:white;
"></td>
</tr>
<!-- END SPACER ROW -->
<!-- BEGIN STATE ROW -->
<tr>
<td colspan=2 width=42 class="postAdAreaLeft">
<div class="postAdFieldLabelTop
">
State <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.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();"><im
g alt="" border=0 id="launchMapIcon" src="Images/Icon_Local_Are
a.png" /></a>
<asp:CompareValidator ID="validatorStateRequired
"
runat="server"
ErrorMessage="Please select a state."
CssClass="validationText"
ControlToValidate="cboStat
e"
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,4
9,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,6
3,69,74,71
,77,65,96,
17,84,18,8
1,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,6
8,94,67,99
,80,110,80
,107,104,6
6,97,71,77
,69,74,77,
63,74,59,8
0,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,18
5,45,184,4
5,177,24,1
59,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,15
6,71,155,7
0,165,39,1
20,46,92" href="javascript:void(0);"
onclick="selectState('NV')
;"/>
<!-- UT --> <area ID="mapAreaUT" shape="polygon" coords="86,101,106,105,106
,114,119,1
16,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,20
4,64,188,6
6,185,65,1
80,68,177,
69,174,71,
173,69,166
,71,154,75
,156,77,14
8" href="javascript:void(0);"
onclick="selectState('AZ')
;"/>
<!-- NM --> <area ID="mapAreaNM" shape="polygon" coords="115,154,159,158,15
5,205,114,
203,113,20
7,107,206,
115,154" href="javascript:void(0);"
onclick="selectState('NM')
;"/>
<!-- CO --> <area ID="mapAreaCO" shape="polygon" coords="119,116,168,121,16
6,158,114,
153,119,11
6" href="javascript:void(0);"
onclick="selectState('CO')
;"/>
<!-- WY --> <area ID="mapAreaWY" shape="polygon" coords="111,77,157,82,155,
120,106,11
4,111,77" href="javascript:void(0);"
onclick="selectState('WY')
;"/>
<!-- MT --> <area ID="mapAreaMT" shape="polygon" coords="86,34,124,41,161,4
4,157,82,1
11,77,98,7
9,94,67,89
,66,93,58,
85,48,86,3
4" 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,10
3,156,101,
159,73" href="javascript:void(0);"
onclick="selectState('SD')
;"/>
<!-- OK --> <area ID="mapAreaOK" shape="polygon" coords="159,159,222,161,22
3,191,215,
189,208,19
1,179,183,
181,164,15
9,163,159,
159" href="javascript:void(0);"
onclick="selectState('OK')
;"/>
<!-- NE --> <area ID="mapAreaNE" shape="polygon" coords="156,101,194,103,20
8,108,216,
131,168,13
0,168,121,
155,119,15
6,101" href="javascript:void(0);"
onclick="selectState('NE')
;"/>
<!-- KS --> <area ID="mapAreaKS" shape="polygon" coords="169,130,216,131,22
1,139,222,
160,167,15
9,169,130"
href="javascript:void(0);"
onclick="selectState('KS')
;"/>
<!-- TX --> <area ID="mapAreaTX" shape="polygon" coords="159,163,182,164,18
1,182,195,
188,203,19
1,210,191,
217,189,22
7,193,227,
207,231,21
5,229,228,
224,230,21
9,229,220,
232,202,24
6,198,256,
200,265,18
5,259,182,
248,175,24
0,173,233,
167,227,15
8,226,152,
233,141,22
5,140,218,
128,203,15
5,206,159,
163" href="javascript:void(0);"
onclick="selectState('TX')
;"/>
<!-- LA --> <area ID="mapAreaLA" shape="polygon" coords="227,198,250,197,25
2,204,247,
216,262,21
5,266,225,
254,233,24
5,227,242,
229,229,22
8,232,216,
227,207,22
7,198" href="javascript:void(0);"
onclick="selectState('LA')
;"/>
<!-- AR --> <area ID="mapAreaAR" shape="polygon" coords="222,165,255,163,25
5,168,259,
168,249,19
1,249,197,
227,197,22
7,192,223,
191,222,16
5" href="javascript:void(0);"
onclick="selectState('AR')
;"/>
<!-- MO --> <area ID="mapAreaMO" shape="polygon" coords="214,126,244,125,24
4,132,251,
140,254,14
0,253,148,
260,153,26
1,157,264,
159,259,16
8,255,168,
255,164,22
2,165,222,
140,214,12
6" href="javascript:void(0);"
onclick="selectState('MO')
;"/>
<!-- IA --> <area ID="mapAreaIA" shape="polygon" coords="209,98,244,98,246,
104,253,11
2,249,117,
246,117,24
7,122,244,
125,214,12
6,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,24
4,97,208,9
7,209,81,2
07,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,24
9,106,244,
101,243,94
,233,86,23
3,76,236,7
3,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,2
77,111,279
,105,279,9
9,276,94,2
77,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,26
7,80,263,7
3,249,67" href="javascript:void(0);"
onclick="selectState('MI')
;"/>
<!-- IL --> <area ID="mapAreaIL" shape="polygon" coords="250,106,267,106,27
1,113,273,
142,270,15
3,263,158,
260,156,25
9,152,252,
146,254,14
1,250,140,
244,132,24
4,126,247,
121,246,11
7,252,113,
252,110,25
0,106" href="javascript:void(0);"
onclick="selectState('IL')
;"/>
<!-- IN --> <area ID="mapAreaIN" shape="polygon" coords="271,114,278,111,29
0,110,293,
139,289,13
9,285,147,
282,146,27
7,150,270,
149,270,14
6,273,141,
271,114" href="javascript:void(0);"
onclick="selectState('IN')
;"/>
<!-- OH --> <area ID="mapAreaOH" shape="polygon" coords="291,110,301,110,30
6,112,319,
105,322,12
5,312,134,
312,138,31
0,140,306,
137,303,13
9,293,134,
291,110" href="javascript:void(0);"
onclick="selectState('OH')
;"/>
<!-- KY --> <area ID="mapAreaKY" shape="polygon" coords="263,157,267,156,27
1,149,285,
147,289,13
9,293,139,
292,135,30
1,138,307,
137,310,13
9,310,143,
315,148,30
4,158,272,
159,271,16
2,263,162,
263,157" href="javascript:void(0);"
onclick="selectState('KY')
;"/>
<!-- WV --> <area ID="mapAreaWV" shape="polygon" coords="321,125,330,124,33
2,128,335,
124,340,12
7,329,141,
327,146,31
8,150,310,
143,310,13
9,312,138,
313,133,32
1,125" href="javascript:void(0);"
onclick="selectState('WV')
;"/>
<!-- VA --> <area ID="mapAreaVA" shape="polygon" coords="306,157,316,148,32
0,149,328,
145,328,14
0,340,126,
351,135,35
5,136,357,
145,360,14
6,362,149,
319,156,30
6,157" href="javascript:void(0);"
onclick="selectState('VA')
;"/>
<!-- MS --> <area ID="mapAreaMS" shape="polygon" coords="256,178,272,176,27
2,207,273,
220,264,22
2,261,219,
262,215,24
7,216,248,
211,252,20
4,249,191,
256,176" href="javascript:void(0);"
onclick="selectState('MS')
;"/>
<!-- NC --> <area ID="mapAreaNC" shape="polygon" coords="318,156,361,149,36
2,151,359,
154,364,15
5,359,164,
360,165,35
1,176,346,
176,337,17
0,328,171,
325,169,31
6,169,309,
173,299,17
4,303,168,
305,167,31
5,161,318,
156" href="javascript:void(0);"
onclick="selectState('NC')
;"/>
<!-- TN --> <area ID="mapAreaTN" shape="polygon" coords="261,163,271,162,27
2,160,318,
156,312,16
3,309,163,
305,168,30
2,168,298,
174,256,17
7,261,163"
href="javascript:void(0);"
onclick="selectState('TN')
;"/>
<!-- AL --><area ID="mapAreaAL" shape="polygon" coords="272,176,291,175,29
9,199,298,
205,300,21
2,279,214,
282,220,27
3,220,271,
206,272,17
6" href="javascript:void(0);"
onclick="selectState('AL')
;"/>
<!-- SC --> <area ID="mapAreaSC" shape="polygon" coords="309,173,318,169,32
7,169,329,
171,339,17
1,346,177,
343,181,34
3,185,331,
197,325,18
9,309,175,
309,173" href="javascript:void(0);"
onclick="selectState('SC')
;"/>
<!-- GA --> <area ID="mapAreaGA" shape="polygon" coords="291,175,310,173,31
0,176,324,
188,331,19
8,327,210,
324,210,32
5,214,302,
214,298,20
6,299,197,
291,175" href="javascript:void(0);"
onclick="selectState('GA')
;"/>
<!-- FL --> <area ID="mapAreaFL" shape="polygon" coords="280,214,300,212,30
2,214,324,
213,325,21
0,329,210,
332,221,34
0,229,340,
234,347,24
5,346,259,
342,261,32
1,238,322,
229,309,21
9,299,224,
290,218,28
2,219,280,
214" href="javascript:void(0);"
onclick="selectState('FL')
;"/>
<!-- AK --> <area ID="mapAreaAK" shape="polygon" coords="22,222,28,220,34,2
12,44,212,
48,214,65,
215,76,257
,81,257,86
,261,91,25
7,103,268,
108,268,11
1,273,104,
277,81,261
,69,261,64
,257,60,25
9,60,262,3
1,285,19,2
88,38,277,
37,271,27,
269,28,264
,22,263,18
,255,31,24
6,30,241,2
6,243,19,2
41,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,17
5,270,194,
270,196,29
0,156,288,
153,276,13
9,266,129,
263,127,25
8,128,253"
href="javascript:void(0);"
onclick="selectState('HI')
;"/>
<!-- PA --> <area ID="mapAreaPA" shape="polygon" coords="319,105,324,102,35
4,97,359,1
02,359,110
,362,113,3
56,119,321
,124,319,1
05" 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,37
5,60,379,5
4,379,43,3
81,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,34
6,83,343,7
8,351,68,3
61,67,367,
86,368,102
,366,104,3
59,102,354
,97,325,10
3,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,36
7,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,35
3,60,335,6
0,335,45" href="javascript:void(0);"
onclick="selectState('VT')
;"/>
<!-- RI --> <area ID="mapAreaRI" shape="polygon" coords="379,91,413,91,413,
104,394,10
4,393,99,3
80,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,37
2,72,360,4
4,348,44,3
48,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,40
1,104,400,
116,381,11
6,380,107,
374,100,36
9,102,368,
93" href="javascript:void(0);"
onclick="selectState('CT')
;"/>
<!-- NJ --> <area ID="mapAreaNJ" shape="polygon" coords="360,102,366,104,37
5,103,368,
109,368,11
2,374,116,
388,116,38
8,128,371,
127,371,12
1,367,118,
365,124,35
8,117,363,
113,358,10
9,360,102"
href="javascript:void(0);"
onclick="selectState('NJ')
;"/>
<!-- DE --> <area ID="mapAreaDE" shape="polygon" coords="358,120,365,126,38
6,131,386,
129,406,12
8,407,142,
386,142,38
6,137,363,
130,359,13
0,356,123,
358,120" href="javascript:void(0);"
onclick="selectState('DE')
;"/>
<!-- MD --> <area ID="mapAreaMD" shape="polygon" coords="342,121,355,120,36
0,130,364,
130,364,13
4,379,144,
379,142,40
0,143,400,
155,378,15
5,378,149,
350,132,34
9,128,342,
121" href="javascript:void(0);"
onclick="selectState('MD')
;"/>
<!-- DC --> <area ID="mapAreaDC" shape="polygon" coords="336,124,341,122,37
1,155,389,
156,390,16
8,368,168,
368,160,33
6,124" href="javascript:void(0);"
onclick="selectState('DC')
;"/>
<!-- CLOSE --> <area ID="mapAreaClose" shape="circle" coords="406,13,8" href="javascript:void(0);"
onclick="document.getEleme
ntById('pa
nelMapCall
out').clas
sName = 'hide';"/>
</map>
</div>
<%-- END STATE SELECT MAP UPDATE PANEL --%>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END STATE ROW -->
<!-- BEGIN SPACER ROW -->
<tr height="2">
<td width=42 style="background-image: url(Images/Post_Ad_Area_LB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:left;back
ground-col
or:white;"
></td>
<td></td>
<td></td>
<td></td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G_Spacer.p
ng);backgr
ound-repea
t:repeat-y
;backgroun
d-position
:right;bac
kground-co
lor:white;
"></td>
</tr>
<!-- END SPACER ROW -->
<!-- BEGIN ZIP ROW -->
<tr>
<td colspan=2 width=42 class="postAdAreaLeft">
<div class="postAdFieldLabelTop
">
Zip Code <span class="postAdAstrisk">*</s
pan>
</div>
</td>
<td width=2 style="background-color:wh
ite;"><img
src="Images/Transparent_Pi
xel.png" width=2 height="10"/></td>
<td width="100%" class="postAdAreaRight">
<div class="postAdFieldRight">
<asp:TextBox ID="txtZipCode" runat="server" CssClass="standardTextFiel
d" style="width:50px;"/>
<asp:RegularExpressionVali
dator ID="validatorZipRE"
runat="server"
ErrorMessage="Please enter a 5-digit zip code."
ControlToValidate="txtZipC
ode"
ValidationExpression="[\d]
{5}"
SetFocusOnError="true"
Display="Dynamic"
Visible="true"
CssClass="validationText" />
<asp:RequiredFieldValidato
r ID="validatorZipRequired"
runat="server"
ErrorMessage="Please enter your zip code."
ControlToValidate="txtZipC
ode"
SetFocusOnError="true"
Display="dynamic"
Visible="true"
CssClass="validationText" />
</div>
</td>
<td width=11 style="background-image: url(Images/Post_Ad_Area_RB
G.jpg);bac
kground-re
peat:repea
t-y;backgr
ound-posit
ion:right;
background
-color:whi
te;"></td>
</tr>
<!-- END ZIP ROW -->
<tr>
<td width="42"><img src="Images/Post_Ad_Area_B
L_Corner.j
pg"/></td>
<td width="300" style="background-image: url(Images/Post_Ad_Area_BB
G_Left.jpg
);backgrou
nd-repeat:
repeat-x;"
><img src="Images/Transparent_Pi
xel.png" height="12" width="30"/></td>
<td width="100%" colspan=2 style="background-image: url(Images/Post_Ad_Area_BB
G_Right.jp
g);backgro
und-repeat
:repeat-x;
"><img src="Images/Transparent_Pi
xel.png" height="12" width="30"/></td>
<td width="11"><img src="Images/Post_Ad_Area_B
R_Corner.j
pg"/></td>
</tr>
</table>
</td></tr></table>
<!-- END STEP 4 SECTION -->
<div style="padding-top:15px;pa
dding-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_Placeho
lder_Activ
e.png";
private const string IMAGE_PATH_INACTIVE = "Images/Icon_Image_Placeho
lder_Inact
ive.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_PO
ST_AD;
registerCalendarInitScript
();
registerMapLaunchScript();
registerShippingPackageSel
ectScript(
);
configureExchangeOptionCon
trols();
configureImagePanelLinks()
;
if (!IsPostBack)
{
initStates();
}
}
protected override void OnInit(EventArgs e)
{
initComponents();
base.OnInit(e);
}
protected void initComponents()
{
btnPreview.Click += new ImageClickEventHandler(thi
s.prevClic
ked);
this.Load += new System.EventHandler(this.P
age_Load);
}
/// <summary>
/// Adds client side onclick handler calls to webcontrol radio buttons
/// </summary>
protected void configureExchangeOptionCon
trols()
{
radLocalDelivery.Attribute
s.Add("onc
lick", "revalidate('validatorExch
angeRadioB
uttonsMain
');adjustD
elivery();
");
radLocalDeliveryOptionSpec
ify.Attrib
utes.Add("
onclick", "deliveryAreaChanged();");
radLocalDeliveryOptionNego
tiable.Att
ributes.Ad
d("onclick
", "deliveryAreaChanged();");
radShipping.Attributes.Add
("onclick"
, "revalidate('validatorExch
angeRadioB
uttonsMain
');adjustS
hipping();
");
radCalculatedRate.Attribut
es.Add("on
click", "revalidateCosts();rateCli
cked(true)
;");
radFixedRate.Attributes.Ad
d("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("initCalen
darDropdow
ns('" + cboExpirationMonth.ClientI
D + "', '" + cboExpirationDay.ClientID + "');\n");
scriptSb.Append("}\n");
scriptSb.Append("initCalen
dar();\n")
;
scriptSb.Append("</script>
");
if (!ClientScript.IsStartupSc
riptRegist
ered("Init
Calendar"))
ClientScript.RegisterStart
upScript(G
etType(), "Init Calendar", scriptSb.ToString());
dateLaunchLink.Attributes.
Add("oncli
ck", "launchCalendar('" + txtHiddenDate.ClientID + "', '" + dateLaunchLink.ClientID + "'); return false;");
cboExpirationMonth.Attribu
tes.Add("o
nchange", "monthChanged('" + cboExpirationMonth.ClientI
D + "', '" + cboExpirationDay.ClientID + "');recordHiddenDate();");
cboExpirationDay.Attribute
s.Add("onc
hange", "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('p
anelMapCal
lout');\n"
);
scriptSb.Append("var selectStateCombo = document.getElementById('"
+ cboState.ClientID + "');\n");
scriptSb.Append("for (i=0; i < selectStateCombo.options.l
ength; i++){\n");
scriptSb.Append("if(select
StateCombo
.options[i
].text == stateAbbrev) {\n");
scriptSb.Append("selectSta
teCombo.se
lectedInde
x = i;\n");
scriptSb.Append("revalidat
e('validat
orStateReq
uired');\n
");
scriptSb.Append("break;\n"
);
scriptSb.Append("}\n");
scriptSb.Append("}\n");
scriptSb.Append("callout.c
lassName = 'hide';\n");
scriptSb.Append("}\n");
scriptSb.Append("</script>
");
if (!ClientScript.IsStartupSc
riptRegist
ered("Sele
ct State"))
ClientScript.RegisterStart
upScript(G
etType(), "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 registerShippingPackageSel
ectScript(
)
{
cboPackage.Attributes.Add(
"onchange"
, "packageSelected();");
DataSet ds = getPackageDimensionsDataSe
t();
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_PA
CKAGE_TYPE
"].Rows.Co
unt; i++)
{
string length = ds.Tables["TBL_SHIPPING_PA
CKAGE_TYPE
"].Rows[i]
["LENGTH"]
.ToString(
);
string width = ds.Tables["TBL_SHIPPING_PA
CKAGE_TYPE
"].Rows[i]
["WIDTH"].
ToString()
;
string height = ds.Tables["TBL_SHIPPING_PA
CKAGE_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.IsStartupSc
riptRegist
ered("Sele
ct Shipping Package"))
ClientScript.RegisterStart
upScript(G
etType(), "Select Shipping Package", scriptSb.ToString());
}
protected DataSet getPackageDimensionsDataSe
t()
{
SqlConnection connection = SQLUtils.openConnection();
SqlCommand command = new SqlCommand(SQLUtils.SQL_LI
STSHIPPING
PACKAGES, connection);
DataSet ds = SQLUtils.retrieveDataSet(c
ommand, "ShippingPackageType", "TBL_SHIPPING_PACKAGE_TYPE
");
connection.Close();
return ds;
}
protected void btnUpload_Click(object sender, EventArgs e)
{
int currentImageNumber = countUploadedImages();
if ((imageFileUpload.PostedFi
le != null) && (imageFileUpload.PostedFil
e.ContentL
ength > 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.T
oString() + "_" + DateTime.Today.ToString("y
yyyMMdd") + "_" + 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(fu
llSizeLoca
lLocation)
;
ImageUtils.createThumbnail
(fullSizeL
ocalLocati
on, 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.Equal
s(IMAGE_PA
TH_ACTIVE)
&& !images[i].ImageUrl.Equals
(IMAGE_PAT
H_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 = getPostAdImageLinkPlacehol
dersArray(
);
for (int i = 0; i < images.Length; i++)
{
linkPlaceHolders[i].Contro
ls.Clear()
; // Link controls will be re-added to the placeholders as needed
if (images[i].ImageUrl.Equals
(IMAGE_PAT
H_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
('imageFil
eUploadPan
el');\">Ad
d Image</a>");
linkPlaceHolders[i].Contro
ls.Add(lin
k);
}
else if (!images[i].ImageUrl.Equal
s(IMAGE_PA
TH_INACTIV
E))
{
// 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_Cl
ick);
linkPlaceHolders[i].Contro
ls.Add(rem
oveLink);
}
} // END FOR
}
void removeLink_Click(object sender, EventArgs e)
{
LinkButton clickedLinkButton = (LinkButton)sender;
string id = clickedLinkButton.ID.ToStr
ing();
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[] getPostAdImageLinkPlacehol
dersArray(
)
{
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_LI
STSTATES, connection);
DataSet ds = SQLUtils.retrieveDataSet(c
ommand, "StatesTable", "TBL_STATE");
// Populate drop-down
cboState.Items.Add(new ListItem(INITIAL_ITEM_STAT
E, "0"));
for (int i = 0; i < ds.Tables["TBL_STATE"].Row
s.Count; i++)
{
string text = ds.Tables["TBL_STATE"].Row
s[i]["ABBR
EVIATION"]
.ToString(
);
string value = ds.Tables["TBL_STATE"].Row
s[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(armCategorySelec
t.Selected
CategoryId
);
postedAd.Subject = txtAdTitle.Text;
postedAd.Description = txtAdDescription.InnerText
;
postedAd.AskingPrice = double.Parse(txtPrice.Text
);
int selectedExpirationMonth = int.Parse(txtHiddenExpirat
ionMonth.V
alue);
int selectedExpirationDay = int.Parse(txtHiddenExpirat
ionDay.Val
ue);
// 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(selectedExpiratio
nYear, selectedExpirationMonth, selectedExpirationDay);
postedAd.ExpirationDate = expirationDate;
postedAd.ImagePaths[0] = extractDBImageUrl(addImage
1);
postedAd.ImagePaths[1] = extractDBImageUrl(addImage
2);
postedAd.ImagePaths[2] = extractDBImageUrl(addImage
3);
postedAd.ImagePaths[3] = extractDBImageUrl(addImage
4);
postedAd.LocalPickupOffere
d = radLocalPickup.Items[0].Se
lected;
postedAd.LocalDeliveryOffe
red = radLocalDelivery.Items[0].
Selected;
postedAd.IsDeliveryAreaSpe
cified = radLocalDeliveryOptionSpec
ify.Checke
d;
if(postedAd.IsDeliveryArea
Specified)
postedAd.DeliveryArea = txtDeliveryArea.Text;
postedAd.ShippingOffered = radShipping.Items[0].Selec
ted;
if (postedAd.ShippingOffered)
{
postedAd.IsShippingFlatRat
e = radFixedRate.Checked;
// Add Service #1
int typeId = int.Parse(cboShippingServi
ce1.Select
edValue);
postedAd.ShippingServices[
0] = new ShippingService(typeId, 1);
if (postedAd.IsShippingFlatRa
te)
{
postedAd.ShippingServices[
0].FixedCo
st = 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(cboShippingServi
ce2.Select
edValue);
if (typeId != 0)
{
postedAd.ShippingServices[
1] = new ShippingService(typeId, 2);
if (postedAd.IsShippingFlatRa
te)
{
postedAd.ShippingServices[
1].FixedCo
st = 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(cboShippingServi
ce3.Select
edValue);
if (typeId != 0)
{
postedAd.ShippingServices[
2] = new ShippingService(typeId, 3);
if (postedAd.IsShippingFlatRa
te)
{
postedAd.ShippingServices[
2].FixedCo
st = double.Parse(txtCost3.Text
);
}
}
// Add Package if the shipping will be at "Calculated Rate"
if (!postedAd.IsShippingFlatR
ate)
{
int packageTypeId = int.Parse(cboPackage.Selec
tedValue);
double weight = double.Parse(txtWeight.Tex
t);
postedAd.Package = new Package(packageTypeId, weight);
if (cboPackage.SelectedItem.T
ext.Equals
("My Packaging"))
{
postedAd.Package.Length = double.Parse(txtLength.Tex
t);
postedAd.Package.Width = double.Parse(txtWidth.Text
);
postedAd.Package.Height = double.Parse(txtHeight.Tex
t);
}
}
}
return postedAd;
}
private string extractDBImageUrl(Image addImage)
{
if (!addImage.ImageUrl.Equals
(IMAGE_PAT
H_ACTIVE) && !addImage.ImageUrl.Equals(
IMAGE_PATH
_INACTIVE)
)
return addImage.ImageUrl;
else
return null;
}
}