function setFieldRequired(FieldID) { jQuery('#' + FieldID).addClass('form_required'); } function ValidateForm(FormID, showError, errorDialog) { var ret = true; var requiredFields = jQuery('#' + FormID + ' .form_required'); var turnRed = false; var turnBlack = true; requiredFields.each(function(i, v) { switch (v.tagName) { case 'INPUT': if (v.value.trim() == '') { ret = false; turnRed = true; turnBlack = false; //jQuery('#' + v.id).parent().prev().css('color', '#FF0000'); } else { turnRed = false; turnBlack = true; //jQuery('#' + v.id).parent().prev().css('color','#000000'); } break; case 'SELECT': if (v.selectedIndex == 0) { ret = false; turnRed = true; turnBlack = false; //jQuery('#' + v.id).parent().prev().css('color', '#FF0000'); } else { turnRed = false; turnBlack = true; //jQuery('#' + v.id).parent().prev().css('color','#000000'); } break; } if (turnRed) { jQuery("label[for='" + v.id + "']").css('color', '#FF0000'); jQuery("#required_legend").css('color', '#FF0000'); } else if (turnBlack) { jQuery("label[for='" + v.id + "']").css('color', '#000000'); jQuery("#required_legend").css('color', '#FFFFFF'); } }); if (!ret) { //display the error message // var DialogString = '

While our website provides a wealth of information our FREE DVD is still the best way to see how our swimming machines perform.

'; // DialogString += '
'; // DialogString += '' // //DialogString += ''; // DialogString += ''; // DialogString += '' // //DialogString += ''; // DialogString += '
'; var DialogString = '

Oops! In order to send you our FREE DVD we require a few important pieces of information. We\'ve hightlighted the missing pieces in red.

'; DialogString += '
'; //DialogString += ''; DialogString += ''; DialogString += '
'; //DialogString += ''; //DialogString += ''; //DialogString += '' //DialogString += ''; //DialogString += ''; //Dialog.info(DialogString, { windowParameters: {resizable: false, effectOptions: {duration:0.25}, showEffect: Effect.Grow, hideEffect: Effect.Puff, width: 375, height:200, className:"alphacube"}}); //gPopupErrorDialog = Dialog.info(DialogString, { windowParameters: {id:"gPopupErrorDialog", resizable: false, width: 375, height:200, zIndex:3000, className:"alphacube", onShow: function() {jQuery('#gPopupErrorDialog').click(function(){gPopupErrorDialog.close();});}}}); } return ret; }