﻿$(document).ready(function() {
    // make sure the panes are reset on page load
    managePanes(null);

    $('#FirstName').focus();

    $("input.PhoneMask").mask("999-999-9999");

    $("#aspnetForm").validate({
        rules: {
            FirstName: {
                required: true,
                minlength: 2
            },
            LastName: {
                required: true,
                minlength: 2
            },
            Email: {
                required: true,
                email: true
            },
            Phone: {
                required: true
            },
            UserMessage: {
                required: true,
                minlength: 5
            }
        },
        messages: {
            FirstName: {
                required: "Please enter your first name",
                minlength: "Please enter your valid first name"
            },
            LastName: {
                required: "Please enter your last name",
                minlength: "Please enter your valid last name"
            },
            Email: "Please enter your valid email address",
            Phone: "Please enter your contact phone",
            UserMessage: {
                required: "Please enter your message",
                minlength: "You must leave a longer message than that"
            }
        },
        errorElement: "p",
        errorClass: "errorField",
        errorPlacement: function(error, element) {
            error.insertBefore(element.prev("label"));
        }
    });

    // Bind the ajax form submit
    $("form").bind('submit', function() {
        // Create object and load with form values
        var contactForm = {
            FirstName: $('#FirstName').val(),
            LastName: $('#LastName').val(),
            Email: $('#Email').val(),
            Phone: $('#Phone').val(),
            UserMessage: $('#UserMessage').val(),
            EmailConfirm: $('#EmailConfirm').val(),
            SessionID: $('#SessionID').val(),
            RemoteAddress: $('#RemoteAddress').val(),
            EntryPage: $('#EntryPage').val(),
            Referrer: $('#Referrer').val(),
            SessionID: $('#SessionID').val(),
            RemoteAddress: $('#RemoteAddress').val(),
            EntryPage: $('#EntryPage').val(),
            Referrer: $('#Referrer').val(),
            Browser: browser,
            Platform: osName
        };

        // Convert the object to a json object
        var formData = Sys.Serialization.JavaScriptSerializer.serialize(contactForm);

        // Create an proxy instance and send ajax call
        Proxy = new serviceProxy("/services/formservice.svc/");
        Proxy.invoke("savecontactform", formData, onSuccess, onError);

        // Return false to prevent form postback
        return false;
    });
});

// ajax pre-submit callback
function preRequest(xhr) {
    // trigger the form validation
    return $("form").validate().form();
}

// ajax response callback
function onSuccess(result) {
    //alert(result);
    eval('var z=' + result);

    switch (z.ServiceStatusCode) {
        case 201:
            managePanes("success", null);
            break;
        case 400:
            managePanes("error", z.ServiceMessage);
            break;
        default:
            managePanes("error", null);
            break;
    }
}

// ajax error callback
function onError(error) {
    managePanes("error", error);
}

// ajax complete callback
function onComplete() {

}

function managePanes(status, message) {
    var inputPane = $("#FormInputPane");
    var errorPane = $("#FormErrorPane");
    var successPane = $("#FormSuccessPane");

    if (status == "error") {
        inputPane.show();
        if (message != null) {
            errorPane.find("p:first").text(message).end().show();
        } else {
            errorPane.show();
        }
        successPane.hide();
    } else if (status == "success") {
        inputPane.hide();
        errorPane.hide();
        successPane.show();
    } else {
        inputPane.show();
        errorPane.hide();
        successPane.hide();
    }
}
/*
* jQuery Form Plugin
* version: 2.18 (06-JAN-2009)
* @requires jQuery v1.2.2 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.form.js 6061 2009-01-07 01:43:18Z malsup $
*/
; (function($) {

    /*
    Usage Note:  
    -----------
    Do not use both ajaxSubmit and ajaxForm on the same form.  These
    functions are intended to be exclusive.  Use ajaxSubmit if you want
    to bind your own submit handler to the form.  For example,

    $(document).ready(function() {
    $('#myForm').bind('submit', function() {
    $(this).ajaxSubmit({
    target: '#output'
    });
    return false; // <-- important!
    });
    });

    Use ajaxForm when you want the plugin to manage all the event binding
    for you.  For example,

    $(document).ready(function() {
    $('#myForm').ajaxForm({
    target: '#output'
    });
    });
        
    When using ajaxForm, the ajaxSubmit function will be invoked for you
    at the appropriate time.  
    */

    /**
    * ajaxSubmit() provides a mechanism for immediately submitting 
    * an HTML form using AJAX.
    */
    $.fn.ajaxSubmit = function(options) {
        // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
        if (!this.length) {
            log('ajaxSubmit: skipping submit process - no element selected');
            return this;
        }

        if (typeof options == 'function')
            options = { success: options };

        options = $.extend({
            url: this.attr('action') || window.location.toString(),
            type: this.attr('method') || 'GET'
        }, options || {});

        // hook for manipulating the form data before it is extracted;
        // convenient for use with rich editors like tinyMCE or FCKEditor
        var veto = {};
        this.trigger('form-pre-serialize', [this, options, veto]);
        if (veto.veto) {
            log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
            return this;
        }

        // provide opportunity to alter form data before it is serialized
        if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
            log('ajaxSubmit: submit aborted via beforeSerialize callback');
            return this;
        }

        var a = this.formToArray(options.semantic);
        if (options.data) {
            options.extraData = options.data;
            for (var n in options.data) {
                if (options.data[n] instanceof Array) {
                    for (var k in options.data[n])
                        a.push({ name: n, value: options.data[n][k] })
                }
                else
                    a.push({ name: n, value: options.data[n] });
            }
        }

        // give pre-submit callback an opportunity to abort the submit
        if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
            log('ajaxSubmit: submit aborted via beforeSubmit callback');
            return this;
        }

        // fire vetoable 'validate' event
        this.trigger('form-submit-validate', [a, this, options, veto]);
        if (veto.veto) {
            log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
            return this;
        }

        var q = $.param(a);

        if (options.type.toUpperCase() == 'GET') {
            options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
            options.data = null;  // data is null for 'get'
        }
        else
            options.data = q; // data is the query string for 'post'

        var $form = this, callbacks = [];
        if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
        if (options.clearForm) callbacks.push(function() { $form.clearForm(); });

        // perform a load on the target only if dataType is not provided
        if (!options.dataType && options.target) {
            var oldSuccess = options.success || function() { };
            callbacks.push(function(data) {
                $(options.target).html(data).each(oldSuccess, arguments);
            });
        }
        else if (options.success)
            callbacks.push(options.success);

        options.success = function(data, status) {
            for (var i = 0, max = callbacks.length; i < max; i++)
                callbacks[i].apply(options, [data, status, $form]);
        };

        // are there files to upload?
        var files = $('input:file', this).fieldValue();
        var found = false;
        for (var j = 0; j < files.length; j++)
            if (files[j])
            found = true;

        // options.iframe allows user to force iframe mode
        if (options.iframe || found) {
            // hack to fix Safari hang (thanks to Tim Molendijk for this)
            // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
            if ($.browser.safari && options.closeKeepAlive)
                $.get(options.closeKeepAlive, fileUpload);
            else
                fileUpload();
        }
        else
            $.ajax(options);

        // fire 'notify' event
        this.trigger('form-submit-notify', [this, options]);
        return this;


        // private function for handling file uploads (hat tip to YAHOO!)
        function fileUpload() {
            var form = $form[0];

            if ($(':input[name=submit]', form).length) {
                alert('Error: Form elements must not be named "submit".');
                return;
            }

            var opts = $.extend({}, $.ajaxSettings, options);
            var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);

            var id = 'jqFormIO' + (new Date().getTime());
            var $io = $('<iframe id="' + id + '" name="' + id + '" />');
            var io = $io[0];

            if ($.browser.msie || $.browser.opera)
                io.src = 'javascript:false;document.write("");';
            $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });

            var xhr = { // mock object
                aborted: 0,
                responseText: null,
                responseXML: null,
                status: 0,
                statusText: 'n/a',
                getAllResponseHeaders: function() { },
                getResponseHeader: function() { },
                setRequestHeader: function() { },
                abort: function() {
                    this.aborted = 1;
                    $io.attr('src', 'about:blank'); // abort op in progress
                }
            };

            var g = opts.global;
            // trigger ajax global events so that activity/block indicators work like normal
            if (g && !$.active++) $.event.trigger("ajaxStart");
            if (g) $.event.trigger("ajaxSend", [xhr, opts]);

            if (s.beforeSend && s.beforeSend(xhr, s) === false) {
                s.global && jQuery.active--;
                return;
            }
            if (xhr.aborted)
                return;

            var cbInvoked = 0;
            var timedOut = 0;

            // add submitting element to data if we know it
            var sub = form.clk;
            if (sub) {
                var n = sub.name;
                if (n && !sub.disabled) {
                    options.extraData = options.extraData || {};
                    options.extraData[n] = sub.value;
                    if (sub.type == "image") {
                        options.extraData[name + '.x'] = form.clk_x;
                        options.extraData[name + '.y'] = form.clk_y;
                    }
                }
            }

            // take a breath so that pending repaints get some cpu time before the upload starts
            setTimeout(function() {
                // make sure form attrs are set
                var t = $form.attr('target'), a = $form.attr('action');
                $form.attr({
                    target: id,
                    method: 'POST',
                    action: opts.url
                });

                // ie borks in some cases when setting encoding
                if (!options.skipEncodingOverride) {
                    $form.attr({
                        encoding: 'multipart/form-data',
                        enctype: 'multipart/form-data'
                    });
                }

                // support timout
                if (opts.timeout)
                    setTimeout(function() { timedOut = true; cb(); }, opts.timeout);

                // add "extra" data to form if provided in options
                var extraInputs = [];
                try {
                    if (options.extraData)
                        for (var n in options.extraData)
                        extraInputs.push(
                            $('<input type="hidden" name="' + n + '" value="' + options.extraData[n] + '" />')
                                .appendTo(form)[0]);

                    // add iframe to doc and submit the form
                    $io.appendTo('body');
                    io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
                    form.submit();
                }
                finally {
                    // reset attrs and remove "extra" input elements
                    $form.attr('action', a);
                    t ? $form.attr('target', t) : $form.removeAttr('target');
                    $(extraInputs).remove();
                }
            }, 10);

            function cb() {
                if (cbInvoked++) return;

                io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

                var operaHack = 0;
                var ok = true;
                try {
                    if (timedOut) throw 'timeout';
                    // extract the server response from the iframe
                    var data, doc;

                    doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;

                    if (doc.body == null && !operaHack && $.browser.opera) {
                        // In Opera 9.2.x the iframe DOM is not always traversable when
                        // the onload callback fires so we give Opera 100ms to right itself
                        operaHack = 1;
                        cbInvoked--;
                        setTimeout(cb, 100);
                        return;
                    }

                    xhr.responseText = doc.body ? doc.body.innerHTML : null;
                    xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
                    xhr.getResponseHeader = function(header) {
                        var headers = { 'content-type': opts.dataType };
                        return headers[header];
                    };

                    if (opts.dataType == 'json' || opts.dataType == 'script') {
                        var ta = doc.getElementsByTagName('textarea')[0];
                        xhr.responseText = ta ? ta.value : xhr.responseText;
                    }
                    else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
                        xhr.responseXML = toXml(xhr.responseText);
                    }
                    data = $.httpData(xhr, opts.dataType);
                }
                catch (e) {
                    ok = false;
                    $.handleError(opts, xhr, 'error', e);
                }

                // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
                if (ok) {
                    opts.success(data, 'success');
                    if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
                }
                if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
                if (g && ! --$.active) $.event.trigger("ajaxStop");
                if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');

                // clean up
                setTimeout(function() {
                    $io.remove();
                    xhr.responseXML = null;
                }, 100);
            };

            function toXml(s, doc) {
                if (window.ActiveXObject) {
                    doc = new ActiveXObject('Microsoft.XMLDOM');
                    doc.async = 'false';
                    doc.loadXML(s);
                }
                else
                    doc = (new DOMParser()).parseFromString(s, 'text/xml');
                return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
            };
        };
    };

    /**
    * ajaxForm() provides a mechanism for fully automating form submission.
    *
    * The advantages of using this method instead of ajaxSubmit() are:
    *
    * 1: This method will include coordinates for <input type="image" /> elements (if the element
    *    is used to submit the form).
    * 2. This method will include the submit element's name/value data (for the element that was
    *    used to submit the form).
    * 3. This method binds the submit() method to the form for you.
    *
    * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
    * passes the options argument along after properly binding events for submit elements and
    * the form itself.
    */
    $.fn.ajaxForm = function(options) {
        return this.ajaxFormUnbind().bind('submit.form-plugin', function() {
            $(this).ajaxSubmit(options);
            return false;
        }).each(function() {
            // store options in hash
            $(":submit,input:image", this).bind('click.form-plugin', function(e) {
                var form = this.form;
                form.clk = this;
                if (this.type == 'image') {
                    if (e.offsetX != undefined) {
                        form.clk_x = e.offsetX;
                        form.clk_y = e.offsetY;
                    } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
                        var offset = $(this).offset();
                        form.clk_x = e.pageX - offset.left;
                        form.clk_y = e.pageY - offset.top;
                    } else {
                        form.clk_x = e.pageX - this.offsetLeft;
                        form.clk_y = e.pageY - this.offsetTop;
                    }
                }
                // clear form vars
                setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
            });
        });
    };

    // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
    $.fn.ajaxFormUnbind = function() {
        this.unbind('submit.form-plugin');
        return this.each(function() {
            $(":submit,input:image", this).unbind('click.form-plugin');
        });

    };

    /**
    * formToArray() gathers form element data into an array of objects that can
    * be passed to any of the following ajax functions: $.get, $.post, or load.
    * Each object in the array has both a 'name' and 'value' property.  An example of
    * an array for a simple login form might be:
    *
    * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
    *
    * It is this array that is passed to pre-submit callback functions provided to the
    * ajaxSubmit() and ajaxForm() methods.
    */
    $.fn.formToArray = function(semantic) {
        var a = [];
        if (this.length == 0) return a;

        var form = this[0];
        var els = semantic ? form.getElementsByTagName('*') : form.elements;
        if (!els) return a;
        for (var i = 0, max = els.length; i < max; i++) {
            var el = els[i];
            var n = el.name;
            if (!n) continue;

            if (semantic && form.clk && el.type == "image") {
                // handle image inputs on the fly when semantic == true
                if (!el.disabled && form.clk == el)
                    a.push({ name: n + '.x', value: form.clk_x }, { name: n + '.y', value: form.clk_y });
                continue;
            }

            var v = $.fieldValue(el, true);
            if (v && v.constructor == Array) {
                for (var j = 0, jmax = v.length; j < jmax; j++)
                    a.push({ name: n, value: v[j] });
            }
            else if (v !== null && typeof v != 'undefined')
                a.push({ name: n, value: v });
        }

        if (!semantic && form.clk) {
            // input type=='image' are not found in elements array! handle them here
            var inputs = form.getElementsByTagName("input");
            for (var i = 0, max = inputs.length; i < max; i++) {
                var input = inputs[i];
                var n = input.name;
                if (n && !input.disabled && input.type == "image" && form.clk == input)
                    a.push({ name: n + '.x', value: form.clk_x }, { name: n + '.y', value: form.clk_y });
            }
        }
        return a;
    };

    /**
    * Serializes form data into a 'submittable' string. This method will return a string
    * in the format: name1=value1&amp;name2=value2
    */
    $.fn.formSerialize = function(semantic) {
        //hand off to jQuery.param for proper encoding
        return $.param(this.formToArray(semantic));
    };

    /**
    * Serializes all field elements in the jQuery object into a query string.
    * This method will return a string in the format: name1=value1&amp;name2=value2
    */
    $.fn.fieldSerialize = function(successful) {
        var a = [];
        this.each(function() {
            var n = this.name;
            if (!n) return;
            var v = $.fieldValue(this, successful);
            if (v && v.constructor == Array) {
                for (var i = 0, max = v.length; i < max; i++)
                    a.push({ name: n, value: v[i] });
            }
            else if (v !== null && typeof v != 'undefined')
                a.push({ name: this.name, value: v });
        });
        //hand off to jQuery.param for proper encoding
        return $.param(a);
    };

    /**
    * Returns the value(s) of the element in the matched set.  For example, consider the following form:
    *
    *  <form><fieldset>
    *      <input name="A" type="text" />
    *      <input name="A" type="text" />
    *      <input name="B" type="checkbox" value="B1" />
    *      <input name="B" type="checkbox" value="B2"/>
    *      <input name="C" type="radio" value="C1" />
    *      <input name="C" type="radio" value="C2" />
    *  </fieldset></form>
    *
    *  var v = $(':text').fieldValue();
    *  // if no values are entered into the text inputs
    *  v == ['','']
    *  // if values entered into the text inputs are 'foo' and 'bar'
    *  v == ['foo','bar']
    *
    *  var v = $(':checkbox').fieldValue();
    *  // if neither checkbox is checked
    *  v === undefined
    *  // if both checkboxes are checked
    *  v == ['B1', 'B2']
    *
    *  var v = $(':radio').fieldValue();
    *  // if neither radio is checked
    *  v === undefined
    *  // if first radio is checked
    *  v == ['C1']
    *
    * The successful argument controls whether or not the field element must be 'successful'
    * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
    * The default value of the successful argument is true.  If this value is false the value(s)
    * for each element is returned.
    *
    * Note: This method *always* returns an array.  If no valid value can be determined the
    *       array will be empty, otherwise it will contain one or more values.
    */
    $.fn.fieldValue = function(successful) {
        for (var val = [], i = 0, max = this.length; i < max; i++) {
            var el = this[i];
            var v = $.fieldValue(el, successful);
            if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
                continue;
            v.constructor == Array ? $.merge(val, v) : val.push(v);
        }
        return val;
    };

    /**
    * Returns the value of the field element.
    */
    $.fieldValue = function(el, successful) {
        var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
        if (typeof successful == 'undefined') successful = true;

        if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
        (t == 'checkbox' || t == 'radio') && !el.checked ||
        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
        tag == 'select' && el.selectedIndex == -1))
            return null;

        if (tag == 'select') {
            var index = el.selectedIndex;
            if (index < 0) return null;
            var a = [], ops = el.options;
            var one = (t == 'select-one');
            var max = (one ? index + 1 : ops.length);
            for (var i = (one ? index : 0); i < max; i++) {
                var op = ops[i];
                if (op.selected) {
                    // extra pain for IE...
                    var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
                    if (one) return v;
                    a.push(v);
                }
            }
            return a;
        }
        return el.value;
    };

    /**
    * Clears the form data.  Takes the following actions on the form's input fields:
    *  - input text fields will have their 'value' property set to the empty string
    *  - select elements will have their 'selectedIndex' property set to -1
    *  - checkbox and radio inputs will have their 'checked' property set to false
    *  - inputs of type submit, button, reset, and hidden will *not* be effected
    *  - button elements will *not* be effected
    */
    $.fn.clearForm = function() {
        return this.each(function() {
            $('input,select,textarea', this).clearFields();
        });
    };

    /**
    * Clears the selected form elements.
    */
    $.fn.clearFields = $.fn.clearInputs = function() {
        return this.each(function() {
            var t = this.type, tag = this.tagName.toLowerCase();
            if (t == 'text' || t == 'password' || tag == 'textarea')
                this.value = '';
            else if (t == 'checkbox' || t == 'radio')
                this.checked = false;
            else if (tag == 'select')
                this.selectedIndex = -1;
        });
    };

    /**
    * Resets the form data.  Causes all form elements to be reset to their original value.
    */
    $.fn.resetForm = function() {
        return this.each(function() {
            // guard against an input with the name of 'reset'
            // note that IE reports the reset function as an 'object'
            if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
                this.reset();
        });
    };

    /**
    * Enables or disables any matching elements.
    */
    $.fn.enable = function(b) {
        if (b == undefined) b = true;
        return this.each(function() {
            this.disabled = !b
        });
    };

    /**
    * Checks/unchecks any matching checkboxes or radio buttons and
    * selects/deselects and matching option elements.
    */
    $.fn.selected = function(select) {
        if (select == undefined) select = true;
        return this.each(function() {
            var t = this.type;
            if (t == 'checkbox' || t == 'radio')
                this.checked = select;
            else if (this.tagName.toLowerCase() == 'option') {
                var $sel = $(this).parent('select');
                if (select && $sel[0] && $sel[0].type == 'select-one') {
                    // deselect all other options
                    $sel.find('option').selected(false);
                }
                this.selected = select;
            }
        });
    };

    // helper fn for console logging
    // set $.fn.ajaxSubmit.debug to true to enable debug logging
    function log() {
        if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
            window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments, ''));
    };

})(jQuery);

jQuery.fn.uniform = function(settings) {
    settings = jQuery.extend({
        valid_class: 'valid',
        invalid_class: 'invalid',
        focused_class: 'focused',
        holder_class: 'ctrlHolder',
        field_selector: 'input, select, textarea'
    }, settings);

    return this.each(function() {
        var form = jQuery(this);

        // Focus specific control holder
        var focusControlHolder = function(element) {
            var parent = element.parent();

            while (typeof (parent) == 'object') {
                if (parent) {
                    if (parent[0] && (parent[0].className.indexOf(settings.holder_class) >= 0)) {
                        parent.addClass(settings.focused_class);
                        return;
                    } // if
                } // if
                parent = jQuery(parent.parent());
            } // while
        };

        // Select form fields and attach them higlighter functionality
        form.find(settings.field_selector).focus(function() {
            form.find('.' + settings.focused_class).removeClass(settings.focused_class);
            focusControlHolder(jQuery(this));
        }).blur(function() {
            form.find('.' + settings.focused_class).removeClass(settings.focused_class);
        });
    });
};

// Auto set on page load...
$(document).ready(function() {
    jQuery('div.uniForm').uniform();
});
/*
 * jQuery validation plug-in 1.5.2
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.validate.js 6243 2009-02-19 11:40:49Z joern.zaefferer $
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.H($.2M,{1E:7(c){l(!6.F){c&&c.2j&&2X.1y&&1y.4Z("3p 2C, 4B\'t 1E, 6d 3p");8}p b=$.15(6[0],\'v\');l(b){8 b}b=29 $.v(c,6[0]);$.15(6[0],\'v\',b);l(b.q.3v){6.4J("21, 4E").1q(".4x").4t(7(){b.37=w});6.32(7(a){l(b.q.2j)a.5Y();7 28(){l(b.q.3Y){b.q.3Y.Z(b,b.Y);8 I}8 w}l(b.37){b.37=I;8 28()}l(b.J()){l(b.18){b.1u=w;8 I}8 28()}19{b.2k();8 I}})}8 b},N:7(){l($(6[0]).2L(\'J\')){8 6.1E().J()}19{p b=I;p a=$(6[0].J).1E();6.P(7(){b|=a.M(6)});8 b}},4L:7(c){p d={},$M=6;$.P(c.1I(/\\s/),7(a,b){d[b]=$M.1H(b);$M.4H(b)});8 d},1c:7(h,k){p f=6[0];l(h){p i=$.15(f.J,\'v\').q;p d=i.1c;p c=$.v.2u(f);2r(h){1e"1h":$.H(c,$.v.1S(k));d[f.u]=c;l(k.L)i.L[f.u]=$.H(i.L[f.u],k.L);33;1e"63":l(!k){R d[f.u];8 c}p e={};$.P(k.1I(/\\s/),7(a,b){e[b]=c[b];R c[b]});8 e}}p g=$.v.4a($.H({},$.v.47(f),$.v.43(f),$.v.3Z(f),$.v.2u(f)),f);l(g.13){p j=g.13;R g.13;g=$.H({13:j},g)}8 g}});$.H($.5C[":"],{5z:7(a){8!$.1k(a.U)},5q:7(a){8!!$.1k(a.U)},5o:7(a){8!a.3O}});$.1d=7(c,b){l(S.F==1)8 7(){p a=$.3J(S);a.5c(c);8 $.1d.1G(6,a)};l(S.F>2&&b.2l!=3C){b=$.3J(S).4V(1)}l(b.2l!=3C){b=[b]}$.P(b,7(i,n){c=c.2K(29 3A("\\\\{"+i+"\\\\}","g"),n)});8 c};$.v=7(b,a){6.q=$.H({},$.v.2J,b);6.Y=a;6.3x()};$.H($.v,{2J:{L:{},22:{},1c:{},1a:"3s",2H:"4K",2k:w,3n:$([]),2E:$([]),3v:w,3m:[],3l:I,4I:7(a){6.3k=a;l(6.q.4G&&!6.4F){6.q.1O&&6.q.1O.Z(6,a,6.q.1a);6.1P(a).2y()}},4D:7(a){l(!6.1w(a)&&(a.u 11 6.1l||!6.G(a))){6.M(a)}},4w:7(a){l(a.u 11 6.1l||a==6.3b){6.M(a)}},4u:7(a){l(a.u 11 6.1l)6.M(a)},2s:7(a,b){$(a).2q(b)},1O:7(a,b){$(a).39(b)}},6k:7(a){$.H($.v.2J,a)},L:{13:"6h 4p 2L 13.",1T:"K 35 6 4p.",1U:"K O a N 1U 6b.",1x:"K O a N 65.",1n:"K O a N 1n.",1X:"K O a N 1n (62).",1Y:"4e 4c 4b 30 5W�5U 5S 30.",1A:"K O a N 1A.",27:"4e 4c 4b 5Q 5O 30.",1N:"K O 5L 1N",2g:"K O a N 5I 5G 1A.",3W:"K O 3V 5A U 5y.",3T:"K O a U 5u a N 5t.",16:$.1d("K O 3Q 5p 2R {0} 2Q."),1v:$.1d("K O 5n 5m {0} 2Q."),2d:$.1d("K O a U 3L {0} 40 {1} 2Q 5i."),2a:$.1d("K O a U 3L {0} 40 {1}."),1t:$.1d("K O a U 5d 2R 3I 3H 48 {0}."),1B:$.1d("K O a U 56 2R 3I 3H 48 {0}.")},3G:I,53:{3x:7(){6.2h=$(6.q.2E);6.4i=6.2h.F&&6.2h||$(6.Y);6.2p=$(6.q.3n).1h(6.q.2E);6.1l={};6.4X={};6.18=0;6.1g={};6.1b={};6.1V();p f=(6.22={});$.P(6.q.22,7(d,c){$.P(c.1I(/\\s/),7(a,b){f[b]=d})});p e=6.q.1c;$.P(e,7(b,a){e[b]=$.v.1S(a)});7 1D(a){p b=$.15(6[0].J,"v");b.q["3B"+a.1p]&&b.q["3B"+a.1p].Z(b,6[0])}$(6.Y).1D("3z 3y 4P",":2I, :4O, :4N, 23, 4M",1D).1D("4t",":3u, :3t",1D);l(6.q.3r)$(6.Y).3q("1b-J.1E",6.q.3r)},J:7(){6.3o();$.H(6.1l,6.1r);6.1b=$.H({},6.1r);l(!6.N())$(6.Y).2G("1b-J",[6]);6.1j();8 6.N()},3o:7(){6.2F();Q(p i=0,14=(6.24=6.14());14[i];i++){6.26(14[i])}8 6.N()},M:7(a){a=6.2D(a);6.3b=a;6.3a(a);6.24=$(a);p b=6.26(a);l(b){R 6.1b[a.u]}19{6.1b[a.u]=w}l(!6.3F()){6.12=6.12.1h(6.2p)}6.1j();8 b},1j:7(b){l(b){$.H(6.1r,b);6.T=[];Q(p c 11 b){6.T.20({1f:b[c],M:6.1Z(c)[0]})}6.1m=$.3j(6.1m,7(a){8!(a.u 11 b)})}6.q.1j?6.q.1j.Z(6,6.1r,6.T):6.3i()},2B:7(){l($.2M.2B)$(6.Y).2B();6.1l={};6.2F();6.2A();6.14().39(6.q.1a)},3F:7(){8 6.2e(6.1b)},2e:7(a){p b=0;Q(p i 11 a)b++;8 b},2A:7(){6.2z(6.12).2y()},N:7(){8 6.3h()==0},3h:7(){8 6.T.F},2k:7(){l(6.q.2k){3g{$(6.3f()||6.T.F&&6.T[0].M||[]).1q(":4C").3e()}3d(e){}}},3f:7(){p a=6.3k;8 a&&$.3j(6.T,7(n){8 n.M.u==a.u}).F==1&&a},14:7(){p a=6,2x={};8 $([]).1h(6.Y.14).1q(":21").1F(":32, :1V, :4A, [4z]").1F(6.q.3m).1q(7(){!6.u&&a.q.2j&&2X.1y&&1y.3s("%o 4y 3Q u 4v",6);l(6.u 11 2x||!a.2e($(6).1c()))8 I;2x[6.u]=w;8 w})},2D:7(a){8 $(a)[0]},2v:7(){8 $(6.q.2H+"."+6.q.1a,6.4i)},1V:7(){6.1m=[];6.T=[];6.1r={};6.1i=$([]);6.12=$([]);6.1u=I;6.24=$([])},2F:7(){6.1V();6.12=6.2v().1h(6.2p)},3a:7(a){6.1V();6.12=6.1P(a)},26:7(d){d=6.2D(d);l(6.1w(d)){d=6.1Z(d.u)[0]}p a=$(d).1c();p c=I;Q(V 11 a){p b={V:V,2t:a[V]};3g{p f=$.v.1Q[V].Z(6,d.U.2K(/\\r/g,""),d,b.2t);l(f=="1R-1W"){c=w;6m}c=I;l(f=="1g"){6.12=6.12.1F(6.1P(d));8}l(!f){6.4s(d,b);8 I}}3d(e){6.q.2j&&2X.1y&&1y.6l("6j 6i 6g 6f M "+d.4q+", 26 3V \'"+b.V+"\' V");6e e;}}l(c)8;l(6.2e(a))6.1m.20(d);8 w},4o:7(a,b){l(!$.1C)8;p c=6.q.36?$(a).1C()[6.q.36]:$(a).1C();8 c&&c.L&&c.L[b]},4n:7(a,b){p m=6.q.L[a];8 m&&(m.2l==4m?m:m[b])},4l:7(){Q(p i=0;i<S.F;i++){l(S[i]!==2o)8 S[i]}8 2o},2n:7(a,b){8 6.4l(6.4n(a.u,b),6.4o(a,b),!6.q.3l&&a.6c||2o,$.v.L[b],"<4k>69: 68 1f 67 Q "+a.u+"</4k>")},4s:7(b,a){p c=6.2n(b,a.V);l(17 c=="7")c=c.Z(6,a.2t,b);6.T.20({1f:c,M:b});6.1r[b.u]=c;6.1l[b.u]=c},2z:7(a){l(6.q.2m)a=a.1h(a.64(6.q.2m));8 a},3i:7(){Q(p i=0;6.T[i];i++){p a=6.T[i];6.q.2s&&6.q.2s.Z(6,a.M,6.q.1a);6.2w(a.M,a.1f)}l(6.T.F){6.1i=6.1i.1h(6.2p)}l(6.q.1o){Q(p i=0;6.1m[i];i++){6.2w(6.1m[i])}}l(6.q.1O){Q(p i=0,14=6.4j();14[i];i++){6.q.1O.Z(6,14[i],6.q.1a)}}6.12=6.12.1F(6.1i);6.2A();6.2z(6.1i).4h()},4j:7(){8 6.24.1F(6.3c())},3c:7(){8 $(6.T).4g(7(){8 6.M})},2w:7(a,c){p b=6.1P(a);l(b.F){b.39().2q(6.q.1a);b.1H("4f")&&b.4d(c)}19{b=$("<"+6.q.2H+"/>").1H({"Q":6.31(a),4f:w}).2q(6.q.1a).4d(c||"");l(6.q.2m){b=b.2y().4h().61("<"+6.q.2m+"/>").60()}l(!6.2h.5Z(b).F)6.q.3w?6.q.3w(b,$(a)):b.5X(a)}l(!c&&6.q.1o){b.2I("");17 6.q.1o=="1s"?b.2q(6.q.1o):6.q.1o(b)}6.1i=6.1i.1h(b)},1P:7(a){8 6.2v().1q("[Q=\'"+6.31(a)+"\']")},31:7(a){8 6.22[a.u]||(6.1w(a)?a.u:a.4q||a.u)},1w:7(a){8/3u|3t/i.X(a.1p)},1Z:7(d){p c=6.Y;8 $(5V.5T(d)).4g(7(a,b){8 b.J==c&&b.u==d&&b||49})},1J:7(a,b){2r(b.3D.46()){1e\'23\':8 $("45:2C",b).F;1e\'21\':l(6.1w(b))8 6.1Z(b.u).1q(\':3O\').F}8 a.F},44:7(b,a){8 6.2O[17 b]?6.2O[17 b](b,a):w},2O:{"5P":7(b,a){8 b},"1s":7(b,a){8!!$(b,a.J).F},"7":7(b,a){8 b(a)}},G:7(a){8!$.v.1Q.13.Z(6,$.1k(a.U),a)&&"1R-1W"},42:7(a){l(!6.1g[a.u]){6.18++;6.1g[a.u]=w}},41:7(a,b){6.18--;l(6.18<0)6.18=0;R 6.1g[a.u];l(b&&6.18==0&&6.1u&&6.J()){$(6.Y).32()}19 l(!b&&6.18==0&&6.1u){$(6.Y).2G("1b-J",[6])}},2c:7(a){8 $.15(a,"2c")||$.15(a,"2c",5M={2Z:49,N:w,1f:6.2n(a,"1T")})}},1K:{13:{13:w},1U:{1U:w},1x:{1x:w},1n:{1n:w},1X:{1X:w},1Y:{1Y:w},1A:{1A:w},27:{27:w},1N:{1N:w},2g:{2g:w}},3E:7(a,b){a.2l==4m?6.1K[a]=b:$.H(6.1K,a)},43:7(b){p a={};p c=$(b).1H(\'5K\');c&&$.P(c.1I(\' \'),7(){l(6 11 $.v.1K){$.H(a,$.v.1K[6])}});8 a},3Z:7(c){p a={};p d=$(c);Q(V 11 $.v.1Q){p b=d.1H(V);l(b){a[V]=b}}l(a.16&&/-1|5J|5H/.X(a.16)){R a.16}8 a},47:7(a){l(!$.1C)8{};p b=$.15(a.J,\'v\').q.36;8 b?$(a).1C()[b]:$(a).1C()},2u:7(b){p a={};p c=$.15(b.J,\'v\');l(c.q.1c){a=$.v.1S(c.q.1c[b.u])||{}}8 a},4a:7(d,e){$.P(d,7(c,b){l(b===I){R d[c];8}l(b.2Y||b.2f){p a=w;2r(17 b.2f){1e"1s":a=!!$(b.2f,e.J).F;33;1e"7":a=b.2f.Z(e,e);33}l(a){d[c]=b.2Y!==2o?b.2Y:w}19{R d[c]}}});$.P(d,7(a,b){d[a]=$.5E(b)?b(e):b});$.P([\'1v\',\'16\',\'1B\',\'1t\'],7(){l(d[6]){d[6]=2W(d[6])}});$.P([\'2d\',\'2a\'],7(){l(d[6]){d[6]=[2W(d[6][0]),2W(d[6][1])]}});l($.v.3G){l(d.1B&&d.1t){d.2a=[d.1B,d.1t];R d.1B;R d.1t}l(d.1v&&d.16){d.2d=[d.1v,d.16];R d.1v;R d.16}}l(d.L){R d.L}8 d},1S:7(a){l(17 a=="1s"){p b={};$.P(a.1I(/\\s/),7(){b[6]=w});a=b}8 a},5D:7(c,a,b){$.v.1Q[c]=a;$.v.L[c]=b;l(a.F<3){$.v.3E(c,$.v.1S(c))}},1Q:{13:7(b,c,a){l(!6.44(a,c))8"1R-1W";2r(c.3D.46()){1e\'23\':p d=$("45:2C",c);8 d.F>0&&(c.1p=="23-5B"||($.2V.2P&&!(d[0].5x[\'U\'].5w)?d[0].2I:d[0].U).F>0);1e\'21\':l(6.1w(c))8 6.1J(b,c)>0;5v:8 $.1k(b).F>0}},1T:7(e,h,d){l(6.G(h))8"1R-1W";p g=6.2c(h);l(!6.q.L[h.u])6.q.L[h.u]={};6.q.L[h.u].1T=17 g.1f=="7"?g.1f(e):g.1f;d=17 d=="1s"&&{1x:d}||d;l(g.2Z!==e){g.2Z=e;p i=6;6.42(h);p f={};f[h.u]=e;$.2T($.H(w,{1x:d,3S:"2S",3R:"1E"+h.u,5s:"5r",15:f,1o:7(a){l(a){p b=i.1u;i.3a(h);i.1u=b;i.1m.20(h);i.1j()}19{p c={};c[h.u]=a||i.2n(h,"1T");i.1j(c)}g.N=a;i.41(h,a)}},d));8"1g"}19 l(6.1g[h.u]){8"1g"}8 g.N},1v:7(b,c,a){8 6.G(c)||6.1J($.1k(b),c)>=a},16:7(b,c,a){8 6.G(c)||6.1J($.1k(b),c)<=a},2d:7(b,d,a){p c=6.1J($.1k(b),d);8 6.G(d)||(c>=a[0]&&c<=a[1])},1B:7(b,c,a){8 6.G(c)||b>=a},1t:7(b,c,a){8 6.G(c)||b<=a},2a:7(b,c,a){8 6.G(c)||(b>=a[0]&&b<=a[1])},1U:7(a,b){8 6.G(b)||/^((([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^W`{\\|}~]|[\\C-\\A\\B-\\E\\x-\\y])+(\\.([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^W`{\\|}~]|[\\C-\\A\\B-\\E\\x-\\y])+)*)|((\\3P)((((\\2b|\\1M)*(\\2U\\3U))?(\\2b|\\1M)+)?(([\\3X-\\5F\\3N\\3M\\5l-\\5k\\3K]|\\5j|[\\5h-\\5N]|[\\5g-\\5f]|[\\C-\\A\\B-\\E\\x-\\y])|(\\\\([\\3X-\\1M\\3N\\3M\\2U-\\3K]|[\\C-\\A\\B-\\E\\x-\\y]))))*(((\\2b|\\1M)*(\\2U\\3U))?(\\2b|\\1M)+)?(\\3P)))@((([a-z]|\\d|[\\C-\\A\\B-\\E\\x-\\y])|(([a-z]|\\d|[\\C-\\A\\B-\\E\\x-\\y])([a-z]|\\d|-|\\.|W|~|[\\C-\\A\\B-\\E\\x-\\y])*([a-z]|\\d|[\\C-\\A\\B-\\E\\x-\\y])))\\.)+(([a-z]|[\\C-\\A\\B-\\E\\x-\\y])|(([a-z]|[\\C-\\A\\B-\\E\\x-\\y])([a-z]|\\d|-|\\.|W|~|[\\C-\\A\\B-\\E\\x-\\y])*([a-z]|[\\C-\\A\\B-\\E\\x-\\y])))\\.?$/i.X(a)},1x:7(a,b){8 6.G(b)||/^(5e?|5R):\\/\\/(((([a-z]|\\d|-|\\.|W|~|[\\C-\\A\\B-\\E\\x-\\y])|(%[\\1L-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\C-\\A\\B-\\E\\x-\\y])|(([a-z]|\\d|[\\C-\\A\\B-\\E\\x-\\y])([a-z]|\\d|-|\\.|W|~|[\\C-\\A\\B-\\E\\x-\\y])*([a-z]|\\d|[\\C-\\A\\B-\\E\\x-\\y])))\\.)+(([a-z]|[\\C-\\A\\B-\\E\\x-\\y])|(([a-z]|[\\C-\\A\\B-\\E\\x-\\y])([a-z]|\\d|-|\\.|W|~|[\\C-\\A\\B-\\E\\x-\\y])*([a-z]|[\\C-\\A\\B-\\E\\x-\\y])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|W|~|[\\C-\\A\\B-\\E\\x-\\y])|(%[\\1L-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|W|~|[\\C-\\A\\B-\\E\\x-\\y])|(%[\\1L-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|W|~|[\\C-\\A\\B-\\E\\x-\\y])|(%[\\1L-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|[\\5b-\\5a]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|W|~|[\\C-\\A\\B-\\E\\x-\\y])|(%[\\1L-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i.X(a)},1n:7(a,b){8 6.G(b)||!/59|58/.X(29 57(a))},1X:7(a,b){8 6.G(b)||/^\\d{4}[\\/-]\\d{1,2}[\\/-]\\d{1,2}$/.X(a)},1Y:7(a,b){8 6.G(b)||/^\\d\\d?\\.\\d\\d?\\.\\d\\d\\d?\\d?$/.X(a)},1A:7(a,b){8 6.G(b)||/^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.X(a)},27:7(a,b){8 6.G(b)||/^-?(?:\\d+|\\d{1,3}(?:\\.\\d{3})+)(?:,\\d+)?$/.X(a)},1N:7(a,b){8 6.G(b)||/^\\d+$/.X(a)},2g:7(b,e){l(6.G(e))8"1R-1W";l(/[^0-9-]+/.X(b))8 I;p a=0,d=0,2i=I;b=b.2K(/\\D/g,"");Q(n=b.F-1;n>=0;n--){p c=b.55(n);p d=54(c,10);l(2i){l((d*=2)>9)d-=9}a+=d;2i=!2i}8(a%10)==0},3T:7(b,c,a){a=17 a=="1s"?a:"66|52?g|51";8 6.G(c)||b.50(29 3A(".("+a+")$","i"))},3W:7(b,c,a){8 b==$(a).6a()}}})})(2N);(7($){p c=$.2T;p d={};$.2T=7(a){a=$.H(a,$.H({},$.4Y,a));p b=a.3R;l(a.3S=="2S"){l(d[b]){d[b].2S()}8(d[b]=c.1G(6,S))}8 c.1G(6,S)}})(2N);(7($){$.P({3e:\'3z\',4W:\'3y\'},7(b,a){$.1z.34[a]={4U:7(){l($.2V.2P)8 I;6.4T(b,$.1z.34[a].38,w)},4S:7(){l($.2V.2P)8 I;6.4R(b,$.1z.34[a].38,w)},38:7(e){S[0]=$.1z.35(e);S[0].1p=a;8 $.1z.28.1G(6,S)}}});$.H($.2M,{1D:7(d,e,c){8 6.3q(d,7(a){p b=$(a.4r);l(b.2L(e)){8 c.1G(b,S)}})},4Q:7(a,b){8 6.2G(a,[$.1z.35({1p:a,4r:b})])}})})(2N);',62,395,'||||||this|function|return|||||||||||||if||||var|settings||||name|validator|true|uFDF0|uFFEF||uD7FF|uF900|u00A0||uFDCF|length|optional|extend|false|form|Please|messages|element|valid|enter|each|for|delete|arguments|errorList|value|method|_|test|currentForm|call||in|toHide|required|elements|data|maxlength|typeof|pendingRequest|else|errorClass|invalid|rules|format|case|message|pending|add|toShow|showErrors|trim|submitted|successList|date|success|type|filter|errorMap|string|max|formSubmitted|minlength|checkable|url|console|event|number|min|metadata|delegate|validate|not|apply|attr|split|getLength|classRuleSettings|da|x09|digits|unhighlight|errorsFor|methods|dependency|normalizeRule|remote|email|reset|mismatch|dateISO|dateDE|findByName|push|input|groups|select|currentElements||check|numberDE|handle|new|range|x20|previousValue|rangelength|objectLength|depends|creditcard|labelContainer|bEven|debug|focusInvalid|constructor|wrapper|defaultMessage|undefined|containers|addClass|switch|highlight|parameters|staticRules|errors|showLabel|rulesCache|hide|addWrapper|hideErrors|resetForm|selected|clean|errorLabelContainer|prepareForm|triggerHandler|errorElement|text|defaults|replace|is|fn|jQuery|dependTypes|msie|characters|than|abort|ajax|x0d|browser|Number|window|param|old|ein|idOrName|submit|break|special|fix|meta|cancelSubmit|handler|removeClass|prepareElement|lastElement|invalidElements|catch|focus|findLastActive|try|size|defaultShowErrors|grep|lastActive|ignoreTitle|ignore|errorContainer|checkForm|nothing|bind|invalidHandler|error|checkbox|radio|onsubmit|errorPlacement|init|focusout|focusin|RegExp|on|Array|nodeName|addClassRules|numberOfInvalids|autoCreateRanges|equal|or|makeArray|x7f|between|x0c|x0b|checked|x22|no|port|mode|accept|x0a|the|equalTo|x01|submitHandler|attributeRules|and|stopRequest|startRequest|classRules|depend|option|toLowerCase|metadataRules|to|null|normalizeRules|Sie|geben|html|Bitte|generated|map|show|errorContext|validElements|strong|findDefined|String|customMessage|customMetaMessage|field|id|target|formatAndAdd|click|onclick|assigned|onkeyup|cancel|has|disabled|image|can|visible|onfocusout|button|blockFocusCleanup|focusCleanup|removeAttr|onfocusin|find|label|removeAttrs|textarea|file|password|keyup|triggerEvent|removeEventListener|teardown|addEventListener|setup|slice|blur|valueCache|ajaxSettings|warn|match|gif|jpe|prototype|parseInt|charAt|greater|Date|NaN|Invalid|uF8FF|uE000|unshift|less|https|x7e|x5d|x23|long|x21|x1f|x0e|least|at|unchecked|more|filled|json|dataType|extension|with|default|specified|attributes|again|blank|same|multiple|expr|addMethod|isFunction|x08|card|524288|credit|2147483647|class|only|previous|x5b|Nummer|boolean|eine|ftp|Datum|getElementsByName|ltiges|document|g�|insertAfter|preventDefault|append|parent|wrap|ISO|remove|parents|URL|png|defined|No|Warning|val|address|title|returning|throw|checking|when|This|occured|exception|setDefaults|log|continue'.split('|'),0,{}))
jQuery.validator.addMethod("maxWords", function(value, element, params) { 
    return this.optional(element) || value.match(/\b\w+\b/g).length < params; 
}, "Please enter {0} words or less."); 
 
jQuery.validator.addMethod("minWords", function(value, element, params) { 
    return this.optional(element) || value.match(/\b\w+\b/g).length >= params; 
}, "Please enter at least {0} words."); 
 
jQuery.validator.addMethod("rangeWords", function(value, element, params) { 
    return this.optional(element) || value.match(/\b\w+\b/g).length >= params[0] && value.match(/bw+b/g).length < params[1]; 
}, "Please enter between {0} and {1} words.");

jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
	return this.optional(element) || /^[a-z-.,()'\"\s]+$/i.test(value);
}, "Letters or punctuation only please");  

jQuery.validator.addMethod("alphanumeric", function(value, element) {
	return this.optional(element) || /^\w+$/i.test(value);
}, "Letters, numbers, spaces or underscores only please");  

jQuery.validator.addMethod("lettersonly", function(value, element) {
	return this.optional(element) || /^[a-z]+$/i.test(value);
}, "Letters only please"); 

jQuery.validator.addMethod("nowhitespace", function(value, element) {
	return this.optional(element) || /^\S+$/i.test(value);
}, "No white space please"); 

jQuery.validator.addMethod("ziprange", function(value, element) {
	return this.optional(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value);
}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");

/**
* Return true, if the value is a valid vehicle identification number (VIN).
*
* Works with all kind of text inputs.
*
* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
* @desc Declares a required input element whose value must be a valid vehicle identification number.
*
* @name jQuery.validator.methods.vinUS
* @type Boolean
* @cat Plugins/Validate/Methods
*/ 
jQuery.validator.addMethod(
	"vinUS",
	function(v){
		if (v.length != 17)
			return false;
		var i, n, d, f, cd, cdv;
		var LL    = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
		var VL    = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
		var FL    = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
		var rs    = 0;
		for(i = 0; i < 17; i++){
		    f = FL[i];
		    d = v.slice(i,i+1);
		    if(i == 8){
		        cdv = d;
		    }
		    if(!isNaN(d)){
		        d *= f;
		    }
		    else{
		        for(n = 0; n < LL.length; n++){
		            if(d.toUpperCase() === LL[n]){
		                d = VL[n];
		                d *= f;
		                if(isNaN(cdv) && n == 8){
		                    cdv = LL[n];
		                }
		                break;
		            }
		        }
		    }
		    rs += d;
		}
		cd = rs % 11;
		if(cd == 10){cd = "X";}
		if(cd == cdv){return true;}
		return false; 
	},
	"The specified vehicle identification number (VIN) is invalid."
);

/**
  * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
  *
  * @example jQuery.validator.methods.date("01/01/1900")
  * @result true
  *
  * @example jQuery.validator.methods.date("01/13/1990")
  * @result false
  *
  * @example jQuery.validator.methods.date("01.01.1900")
  * @result false
  *
  * @example <input name="pippo" class="{dateITA:true}" />
  * @desc Declares an optional input element whose value must be a valid date.
  *
  * @name jQuery.validator.methods.dateITA
  * @type Boolean
  * @cat Plugins/Validate/Methods
  */
jQuery.validator.addMethod(
	"dateITA",
	function(value, element) {
		var check = false;
		var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/
		if( re.test(value)){
			var adata = value.split('/');
			var gg = parseInt(adata[0],10);
			var mm = parseInt(adata[1],10);
			var aaaa = parseInt(adata[2],10);
			var xdata = new Date(aaaa,mm-1,gg);
			if ( ( xdata.getFullYear() == aaaa ) && ( xdata.getMonth () == mm - 1 ) && ( xdata.getDate() == gg ) )
				check = true;
			else
				check = false;
		} else
			check = false;
		return this.optional(element) || check;
	}, 
	"Please enter a correct date"
);

/**
 * matches US phone number format 
 * 
 * where the area code may not start with 1 and the prefix may not start with 1 
 * allows '-' or ' ' as a separator and allows parens around area code 
 * some people may want to put a '1' in front of their number 
 * 
 * 1(212)-999-2345
 * or
 * 212 999 2344
 * or
 * 212-999-0983
 * 
 * but not
 * 111-123-5434
 * and not
 * 212 123 4567
 */
jQuery.validator.addMethod("phone", function(phone_number, element) {
    phone_number = phone_number.replace(/\s+/g, ""); 
	return this.optional(element) || phone_number.length > 9 &&
		phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
}, "Please specify a valid phone number");

// TODO check if value starts with <, otherwise don't try stripping anything
jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
	return jQuery(value).text().length >= param;
}, jQuery.format("Please enter at least {0} characters"));

// same as email, but TLD is optional
jQuery.validator.addMethod("email2", function(value, element, param) {
	return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); 
}, jQuery.validator.messages.email);

// same as url, but TLD is optional
jQuery.validator.addMethod("url2", function(value, element, param) {
	return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); 
}, jQuery.validator.messages.url);

/*
Masked Input plugin for jQuery
Copyright (c) 2007-2009 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) 
Version: 1.2.2 (03/09/2009 22:39:06)
*/
(function(a) { var c = (a.browser.msie ? "paste" : "input") + ".mask"; var b = (window.orientation != undefined); a.mask = { definitions: { "9": "[0-9]", a: "[A-Za-z]", "*": "[A-Za-z0-9]"} }; a.fn.extend({ caret: function(e, f) { if (this.length == 0) { return } if (typeof e == "number") { f = (typeof f == "number") ? f : e; return this.each(function() { if (this.setSelectionRange) { this.focus(); this.setSelectionRange(e, f) } else { if (this.createTextRange) { var g = this.createTextRange(); g.collapse(true); g.moveEnd("character", f); g.moveStart("character", e); g.select() } } }) } else { if (this[0].setSelectionRange) { e = this[0].selectionStart; f = this[0].selectionEnd } else { if (document.selection && document.selection.createRange) { var d = document.selection.createRange(); e = 0 - d.duplicate().moveStart("character", -100000); f = e + d.text.length } } return { begin: e, end: f} } }, unmask: function() { return this.trigger("unmask") }, mask: function(j, d) { if (!j && this.length > 0) { var f = a(this[0]); var g = f.data("tests"); return a.map(f.data("buffer"), function(l, m) { return g[m] ? l : null }).join("") } d = a.extend({ placeholder: "_", completed: null }, d); var k = a.mask.definitions; var g = []; var e = j.length; var i = null; var h = j.length; a.each(j.split(""), function(m, l) { if (l == "?") { h--; e = m } else { if (k[l]) { g.push(new RegExp(k[l])); if (i == null) { i = g.length - 1 } } else { g.push(null) } } }); return this.each(function() { var r = a(this); var m = a.map(j.split(""), function(x, y) { if (x != "?") { return k[x] ? d.placeholder : x } }); var n = false; var q = r.val(); r.data("buffer", m).data("tests", g); function v(x) { while (++x <= h && !g[x]) { } return x } function t(x) { while (!g[x] && --x >= 0) { } for (var y = x; y < h; y++) { if (g[y]) { m[y] = d.placeholder; var z = v(y); if (z < h && g[y].test(m[z])) { m[y] = m[z] } else { break } } } s(); r.caret(Math.max(i, x)) } function u(y) { for (var A = y, z = d.placeholder; A < h; A++) { if (g[A]) { var B = v(A); var x = m[A]; m[A] = z; if (B < h && g[B].test(x)) { z = x } else { break } } } } function l(y) { var x = a(this).caret(); var z = y.keyCode; n = (z < 16 || (z > 16 && z < 32) || (z > 32 && z < 41)); if ((x.begin - x.end) != 0 && (!n || z == 8 || z == 46)) { w(x.begin, x.end) } if (z == 8 || z == 46 || (b && z == 127)) { t(x.begin + (z == 46 ? 0 : -1)); return false } else { if (z == 27) { r.val(q); r.caret(0, p()); return false } } } function o(B) { if (n) { n = false; return (B.keyCode == 8) ? false : null } B = B || window.event; var C = B.charCode || B.keyCode || B.which; var z = a(this).caret(); if (B.ctrlKey || B.altKey || B.metaKey) { return true } else { if ((C >= 32 && C <= 125) || C > 186) { var x = v(z.begin - 1); if (x < h) { var A = String.fromCharCode(C); if (g[x].test(A)) { u(x); m[x] = A; s(); var y = v(x); a(this).caret(y); if (d.completed && y == h) { d.completed.call(r) } } } } } return false } function w(x, y) { for (var z = x; z < y && z < h; z++) { if (g[z]) { m[z] = d.placeholder } } } function s() { return r.val(m.join("")).val() } function p(y) { var z = r.val(); var C = -1; for (var B = 0, x = 0; B < h; B++) { if (g[B]) { m[B] = d.placeholder; while (x++ < z.length) { var A = z.charAt(x - 1); if (g[B].test(A)) { m[B] = A; C = B; break } } if (x > z.length) { break } } else { if (m[B] == z[x] && B != e) { x++; C = B } } } if (!y && C + 1 < e) { r.val(""); w(0, h) } else { if (y || C + 1 >= e) { s(); if (!y) { r.val(r.val().substring(0, C + 1)) } } } return (e ? B : i) } if (!r.attr("readonly")) { r.one("unmask", function() { r.unbind(".mask").removeData("buffer").removeData("tests") }).bind("focus.mask", function() { q = r.val(); var x = p(); s(); setTimeout(function() { if (x == j.length) { r.caret(0, x) } else { r.caret(x) } }, 0) }).bind("blur.mask", function() { p(); if (r.val() != q) { r.change() } }).bind("keydown.mask", l).bind("keypress.mask", o).bind(c, function() { setTimeout(function() { r.caret(p(true)) }, 0) }) } p() }) } }) })(jQuery);
/*
* jQuery blockUI plugin
* Version 2.20 (19-MAY-2009)
* @requires jQuery v1.2.3 or later
*
* Examples at: http://malsup.com/jquery/block/
* Copyright (c) 2007-2008 M. Alsup
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
*/

; (function($) {

    if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
        alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);
        return;
    }

    $.fn._fadeIn = $.fn.fadeIn;

    var setExpr = (function() {
        if (!$.browser.msie) return false;
        var div = document.createElement('div');
        try { div.style.setExpression('width', '0+0'); }
        catch (e) { return false; }
        return true;
    })();


    // global $ methods for blocking/unblocking the entire page
    $.blockUI = function(opts) { install(window, opts); };
    $.unblockUI = function(opts) { remove(window, opts); };

    // convenience method for quick growl-like notifications  (http://www.google.com/search?q=growl)
    $.growlUI = function(title, message, timeout, onClose) {
        var $m = $('<div class="growlUI"></div>');
        if (title) $m.append('<h1>' + title + '</h1>');
        if (message) $m.append('<h2>' + message + '</h2>');
        if (timeout == undefined) timeout = 3000;
        $.blockUI({
            message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
            timeout: timeout, showOverlay: false,
            onUnblock: onClose,
            css: $.blockUI.defaults.growlCSS
        });
    };

    // plugin method for blocking element content
    $.fn.block = function(opts) {
        return this.unblock({ fadeOut: 0 }).each(function() {
            if ($.css(this, 'position') == 'static')
                this.style.position = 'relative';
            if ($.browser.msie)
                this.style.zoom = 1; // force 'hasLayout'
            install(this, opts);
        });
    };

    // plugin method for unblocking element content
    $.fn.unblock = function(opts) {
        return this.each(function() {
            remove(this, opts);
        });
    };

    $.blockUI.version = 2.20; // 2nd generation blocking at no extra cost!

    // override these in your code to change the default behavior and style
    $.blockUI.defaults = {
        // message displayed when blocking (use null for no message)
        message: '<h1>Please wait...</h1>',

        // styles for the message when blocking; if you wish to disable
        // these and use an external stylesheet then do this in your code:
        // $.blockUI.defaults.css = {};
        css: {
            padding: 0,
            margin: 0,
            width: '30%',
            top: '40%',
            left: '35%',
            textAlign: 'center',
            color: '#000',
            border: '3px solid #aaa',
            backgroundColor: '#fff',
            cursor: 'wait'
        },

        // styles for the overlay
        overlayCSS: {
            backgroundColor: '#000',
            opacity: 0.6,
            cursor: 'wait'
        },

        // styles applied when using $.growlUI
        growlCSS: {
            width: '350px',
            top: '10px',
            left: '',
            right: '10px',
            border: 'none',
            padding: '5px',
            opacity: 0.6,
            cursor: null,
            color: '#fff',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px'
        },

        // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
        // (hat tip to Jorge H. N. de Vasconcelos)
        iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',

        // force usage of iframe in non-IE browsers (handy for blocking applets)
        forceIframe: false,

        // z-index for the blocking overlay
        baseZ: 1000,

        // set these to true to have the message automatically centered
        centerX: true, // <-- only effects element blocking (page block controlled via css above)
        centerY: true,

        // allow body element to be stetched in ie6; this makes blocking look better
        // on "short" pages.  disable if you wish to prevent changes to the body height
        allowBodyStretch: true,

        // enable if you want key and mouse events to be disabled for content that is blocked
        bindEvents: true,

        // be default blockUI will supress tab navigation from leaving blocking content
        // (if bindEvents is true)
        constrainTabKey: true,

        // fadeIn time in millis; set to 0 to disable fadeIn on block
        fadeIn: 200,

        // fadeOut time in millis; set to 0 to disable fadeOut on unblock
        fadeOut: 400,

        // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
        timeout: 0,

        // disable if you don't want to show the overlay
        showOverlay: true,

        // if true, focus will be placed in the first available input field when
        // page blocking
        focusInput: true,

        // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
        applyPlatformOpacityRules: true,

        // callback method invoked when unblocking has completed; the callback is
        // passed the element that has been unblocked (which is the window object for page
        // blocks) and the options that were passed to the unblock call:
        //     onUnblock(element, options)
        onUnblock: null,

        // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
        quirksmodeOffsetHack: 4
    };

    // private data and functions follow...

    var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent);
    var pageBlock = null;
    var pageBlockEls = [];

    function install(el, opts) {
        var full = (el == window);
        var msg = opts && opts.message !== undefined ? opts.message : undefined;
        opts = $.extend({}, $.blockUI.defaults, opts || {});
        opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
        var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
        msg = msg === undefined ? opts.message : msg;

        // remove the current block (if there is one)
        if (full && pageBlock)
            remove(window, { fadeOut: 0 });

        // if an existing element is being used as the blocking content then we capture
        // its current place in the DOM (and current display style) so we can restore
        // it when we unblock
        if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
            var node = msg.jquery ? msg[0] : msg;
            var data = {};
            $(el).data('blockUI.history', data);
            data.el = node;
            data.parent = node.parentNode;
            data.display = node.style.display;
            data.position = node.style.position;
            if (data.parent)
                data.parent.removeChild(node);
        }

        var z = opts.baseZ;

        // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
        // layer1 is the iframe layer which is used to supress bleed through of underlying content
        // layer2 is the overlay layer which has opacity and a wait cursor (by default)
        // layer3 is the message content that is displayed while blocking

        var lyr1 = ($.browser.msie || opts.forceIframe)
    	? $('<iframe class="blockUI" style="z-index:' + (z++) + ';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="' + opts.iframeSrc + '"></iframe>')
        : $('<div class="blockUI" style="display:none"></div>');
        var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:' + (z++) + ';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
        var lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:' + z + ';display:none;position:fixed"></div>')
                    : $('<div class="blockUI blockMsg blockElement" style="z-index:' + z + ';display:none;position:absolute"></div>');

        // if we have a message, style it
        if (msg)
            lyr3.css(css);

        // style the overlay
        if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
            lyr2.css(opts.overlayCSS);
        lyr2.css('position', full ? 'fixed' : 'absolute');

        // make iframe layer transparent in IE
        if ($.browser.msie || opts.forceIframe)
            lyr1.css('opacity', 0.0);

        $([lyr1[0], lyr2[0], lyr3[0]]).appendTo(full ? 'body' : el);

        // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
        var expr = $.browser.msie && ($.browser.version < 8 || !$.boxModel) && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
        if (ie6 || (expr && setExpr)) {
            // give body 100% height
            if (full && opts.allowBodyStretch && $.boxModel)
                $('html,body').css('height', '100%');

            // fix ie6 issue when blocked element has a border width
            if ((ie6 || !$.boxModel) && !full) {
                var t = sz(el, 'borderTopWidth'), l = sz(el, 'borderLeftWidth');
                var fixT = t ? '(0 - ' + t + ')' : 0;
                var fixL = l ? '(0 - ' + l + ')' : 0;
            }

            // simulate fixed position
            $.each([lyr1, lyr2, lyr3], function(i, o) {
                var s = o[0].style;
                s.position = 'absolute';
                if (i < 2) {
                    full ? s.setExpression('height', 'Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:' + opts.quirksmodeOffsetHack + ') + "px"')
                     : s.setExpression('height', 'this.parentNode.offsetHeight + "px"');
                    full ? s.setExpression('width', 'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
                     : s.setExpression('width', 'this.parentNode.offsetWidth + "px"');
                    if (fixL) s.setExpression('left', fixL);
                    if (fixT) s.setExpression('top', fixT);
                }
                else if (opts.centerY) {
                    if (full) s.setExpression('top', '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
                    s.marginTop = 0;
                }
                else if (!opts.centerY && full) {
                    var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
                    var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + ' + top + ') + "px"';
                    s.setExpression('top', expression);
                }
            });
        }

        // show the message
        if (msg) {
            lyr3.append(msg);
            if (msg.jquery || msg.nodeType)
                $(msg).show();
        }

        if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
            lyr1.show(); // opacity is zero
        if (opts.fadeIn) {
            if (opts.showOverlay)
                lyr2._fadeIn(opts.fadeIn);
            if (msg)
                lyr3.fadeIn(opts.fadeIn);
        }
        else {
            if (opts.showOverlay)
                lyr2.show();
            if (msg)
                lyr3.show();
        }

        // bind key and mouse events
        bind(1, el, opts);

        if (full) {
            pageBlock = lyr3[0];
            pageBlockEls = $(':input:enabled:visible', pageBlock);
            if (opts.focusInput)
                setTimeout(focus, 20);
        }
        else
            center(lyr3[0], opts.centerX, opts.centerY);

        if (opts.timeout) {
            // auto-unblock
            var to = setTimeout(function() {
                full ? $.unblockUI(opts) : $(el).unblock(opts);
            }, opts.timeout);
            $(el).data('blockUI.timeout', to);
        }
    };

    // remove the block
    function remove(el, opts) {
        var full = el == window;
        var $el = $(el);
        var data = $el.data('blockUI.history');
        var to = $el.data('blockUI.timeout');
        if (to) {
            clearTimeout(to);
            $el.removeData('blockUI.timeout');
        }
        opts = $.extend({}, $.blockUI.defaults, opts || {});
        bind(0, el, opts); // unbind events
        var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el);

        if (full)
            pageBlock = pageBlockEls = null;

        if (opts.fadeOut) {
            els.fadeOut(opts.fadeOut);
            setTimeout(function() { reset(els, data, opts, el); }, opts.fadeOut);
        }
        else
            reset(els, data, opts, el);
    };

    // move blocking element back into the DOM where it started
    function reset(els, data, opts, el) {
        els.each(function(i, o) {
            // remove via DOM calls so we don't lose event handlers
            if (this.parentNode)
                this.parentNode.removeChild(this);
        });

        if (data && data.el) {
            data.el.style.display = data.display;
            data.el.style.position = data.position;
            if (data.parent)
                data.parent.appendChild(data.el);
            $(data.el).removeData('blockUI.history');
        }

        if (typeof opts.onUnblock == 'function')
            opts.onUnblock(el, opts);
    };

    // bind/unbind the handler
    function bind(b, el, opts) {
        var full = el == window, $el = $(el);

        // don't bother unbinding if there is nothing to unbind
        if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
            return;
        if (!full)
            $el.data('blockUI.isBlocked', b);

        // don't bind events when overlay is not in use or if bindEvents is false
        if (!opts.bindEvents || (b && !opts.showOverlay))
            return;

        // bind anchors and inputs for mouse and key events
        var events = 'mousedown mouseup keydown keypress';
        b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);

        // former impl...
        //    var $e = $('a,:input');
        //    b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
    };

    // event handler to suppress keyboard/mouse events when blocking
    function handler(e) {
        // allow tab navigation (conditionally)
        if (e.keyCode && e.keyCode == 9) {
            if (pageBlock && e.data.constrainTabKey) {
                var els = pageBlockEls;
                var fwd = !e.shiftKey && e.target == els[els.length - 1];
                var back = e.shiftKey && e.target == els[0];
                if (fwd || back) {
                    setTimeout(function() { focus(back) }, 10);
                    return false;
                }
            }
        }
        // allow events within the message content
        if ($(e.target).parents('div.blockMsg').length > 0)
            return true;

        // allow events for content that is not being blocked
        return $(e.target).parents().children().filter('div.blockUI').length == 0;
    };

    function focus(back) {
        if (!pageBlockEls)
            return;
        var e = pageBlockEls[back === true ? pageBlockEls.length - 1 : 0];
        if (e)
            e.focus();
    };

    function center(el, x, y) {
        var p = el.parentNode, s = el.style;
        var l = ((p.offsetWidth - el.offsetWidth) / 2) - sz(p, 'borderLeftWidth');
        var t = ((p.offsetHeight - el.offsetHeight) / 2) - sz(p, 'borderTopWidth');
        if (x) s.left = l > 0 ? (l + 'px') : '0';
        if (y) s.top = t > 0 ? (t + 'px') : '0';
    };

    function sz(el, p) {
        return parseInt($.css(el, p)) || 0;
    };

})(jQuery);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();