- function ValidateItem(item, useValLength, message, scrollTo, focus) {
- var aReturn;
- if (useValLength) { aReturn = $('#' + item).val().length > 0; }
- else aReturn = $('#' + item).length > 0;
- if (message && !aReturn) alert(message);
- if (scrollTo && !aReturn) ScrollToPosition(0, scrollTo);
- if (focus && !aReturn) { $('#' + item).focus(); ScrollToElement(item); }
- return aReturn;
- }
-
- function ScrollToElement(item) {
- var el = $.browser.opera ? $("html") : $("html, body");
- var aTop;
- if ($('#' + item).offset())
- aTop = $('#' + item).offset().top;
- else
- aTop = document.getElementById(item).offsetParent.offsetTop;
- alert(aTop);
- el.animate({ scrollTop: aTop }, 'slow');
- }
-
- function ScrollToPosition(x, y) {
- var el = $.browser.opera ? $("html") : $("html, body");
- el.animate({ scrollTop: y }, 'slow');
- }
-
- function validation() {
-
- var aReturn;
- aReturn = ValidateItem("input[type='radio'][name='RentalPropertyType']:checked", false, "Please select a type of property.", 510, null);
- if (!aReturn) return aReturn;
- aReturn = ValidateItem("RentalPropertyAddress", true, "Please enter the property's address.", null, true);
- }