﻿
window.addEvent('load', function(e) {

    if ($('RegionID')) {
        $('RegionID').setStyle('display', 'none');
        $('CountyID').setStyle('display', 'none');

        $('LocationID').addEvent('change', function(e) {

            var retHTML = '';
            var selid = $('LocationID').options[this.selectedIndex].value;

            if (selid == '' || selid == '0') {
                $('RegionID').setStyle('display', 'none');
                $('CountyID').setStyle('display', 'none');
            }
            else {
                $('RegionID').setStyle('display', 'block');
                urlInd = "/home/getlocationhtml.asp?locid=" + selid + '&id=RegionID&type=region';
                new Request.HTML({
                    "url": urlInd,
                    "onRequest": function() {
                        $("RegionID").set("html", "<option selected=\"selected\">loading....</option>");
                    },
                    "onSuccess": function(nl, el, hutmull) {
                        $("RegionID").set("html", hutmull);

                        if (cb) return cb();
                    }
                }).get();
            }
        });


        $('RegionID').addEvent('change', function(e) {

            var retHTML = '';
            var selid = $('RegionID').options[this.selectedIndex].value;

            if (selid == '' || selid == '0') {
                $('CountyID').setStyle('display', 'none');
            }
            else {
                $('CountyID').setStyle('display', 'block');
                urlInd = "/home/getlocationhtml.asp?locid=" + selid + '&id=CountyID&type=county';
                new Request.HTML({
                    "url": urlInd,
                    "onRequest": function() {
                        $("CountyID").set("html", "<option selected=\"selected\">loading....</option>");
                    },
                    "onSuccess": function(nl, el, hutmull) {
                        $("CountyID").set("html", hutmull);

                        if (cb) return cb();
                    }
                }).get();
            }
        });

    }
});



function doMail(name, server, displayText) {
    document.write("<A href='mailto:" + name + String.fromCharCode(75 - 11) + server + "' >");
    document.write(displayText);
    document.write("</A>");
}
function pageup(e) {
    UAGENT = navigator.userAgent.toUpperCase();
    if (UAGENT.indexOf("MSIE") >= 0) { posi = event.y; }
    else { posi = e.pageY; }
    moveObje(posi);
}
function moveObje(position) {
    move = position / 15;
    point = parseInt(position - move);
    scrollTo(0, point);
    if (point > 0) { setTimeout("moveObje(point)", 15); }
}
function printWindow() {
    bV = parseInt(navigator.appVersion);
    if (bV >= 4) window.print();
}