/*
 * jQuery Form Plugin
 * version: 2.24 (10-MAR-2009)
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 */
(function(B){B.fn.ajaxSubmit=function(J){if(!this.length){A("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof J=="function"){J={success:J}}var D=this.attr("action")||window.location.href;D=(D.match(/^([^#]+)/)||[])[1];D=D||"";J=B.extend({url:D,type:this.attr("method")||"GET"},J||{});var O={};this.trigger("form-pre-serialize",[this,J,O]);if(O.veto){A("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(J.beforeSerialize&&J.beforeSerialize(this,J)===false){A("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var K=this.formToArray(J.semantic);if(J.data){J.extraData=J.data;for(var G in J.data){if(J.data[G] instanceof Array){for(var H in J.data[G]){K.push({name:G,value:J.data[G][H]})}}else{K.push({name:G,value:J.data[G]})}}}if(J.beforeSubmit&&J.beforeSubmit(K,this,J)===false){A("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[K,this,J,O]);if(O.veto){A("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var E=B.param(K);if(J.type.toUpperCase()=="GET"){J.url+=(J.url.indexOf("?")>=0?"&":"?")+E;J.data=null}else{J.data=E}var P=this,F=[];if(J.resetForm){F.push(function(){P.resetForm()})}if(J.clearForm){F.push(function(){P.clearForm()})}if(!J.dataType&&J.target){var M=J.success||function(){};F.push(function(Q){B(J.target).html(Q).each(M,arguments)})}else{if(J.success){F.push(J.success)}}J.success=function(T,S){for(var R=0,Q=F.length;R<Q;R++){F[R].apply(J,[T,S,P])}};var C=B("input:file",this).fieldValue();var N=false;for(var I=0;I<C.length;I++){if(C[I]){N=true}}if(J.iframe||N){if(J.closeKeepAlive){B.get(J.closeKeepAlive,L)}else{L()}}else{B.ajax(J)}this.trigger("form-submit-notify",[this,J]);return this;function L(){var S=P[0];if(B(":input[name=submit]",S).length){alert('Error: Form elements must not be named "submit".');return }var R=B.extend({},B.ajaxSettings,J);var e=jQuery.extend(true,{},B.extend(true,{},B.ajaxSettings),R);var T="jqFormIO"+(new Date().getTime());var Z=B('<iframe id="'+T+'" name="'+T+'" src="about:blank" />');var b=Z[0];Z.css({position:"absolute",top:"-1000px",left:"-1000px"});var d={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;Z.attr("src","about:blank")}};var a=R.global;if(a&&!B.active++){B.event.trigger("ajaxStart")}if(a){B.event.trigger("ajaxSend",[d,R])}if(e.beforeSend&&e.beforeSend(d,e)===false){e.global&&jQuery.active--;return }if(d.aborted){return }var c=0;var Y=0;var Q=S.clk;if(Q){var U=Q.name;if(U&&!Q.disabled){J.extraData=J.extraData||{};J.extraData[U]=Q.value;if(Q.type=="image"){J.extraData[name+".x"]=S.clk_x;J.extraData[name+".y"]=S.clk_y}}}setTimeout(function(){var h=P.attr("target"),f=P.attr("action");S.setAttribute("target",T);if(S.getAttribute("method")!="POST"){S.setAttribute("method","POST")}if(S.getAttribute("action")!=R.url){S.setAttribute("action",R.url)}if(!J.skipEncodingOverride){P.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(R.timeout){setTimeout(function(){Y=true;V()},R.timeout)}var g=[];try{if(J.extraData){for(var i in J.extraData){g.push(B('<input type="hidden" name="'+i+'" value="'+J.extraData[i]+'" />').appendTo(S)[0])}}Z.appendTo("body");b.attachEvent?b.attachEvent("onload",V):b.addEventListener("load",V,false);S.submit()}finally{S.setAttribute("action",f);h?S.setAttribute("target",h):P.removeAttr("target");B(g).remove()}},10);var W=0;function V(){if(c++){return }b.detachEvent?b.detachEvent("onload",V):b.removeEventListener("load",V,false);var g=true;try{if(Y){throw"timeout"}var h,j;j=b.contentWindow?b.contentWindow.document:b.contentDocument?b.contentDocument:b.document;if((j.body==null||j.body.innerHTML=="")&&!W){W=1;c--;setTimeout(V,100);return }d.responseText=j.body?j.body.innerHTML:null;d.responseXML=j.XMLDocument?j.XMLDocument:j;d.getResponseHeader=function(k){var l={"content-type":R.dataType};return l[k]};if(R.dataType=="json"||R.dataType=="script"){var f=j.getElementsByTagName("textarea")[0];d.responseText=f?f.value:d.responseText}else{if(R.dataType=="xml"&&!d.responseXML&&d.responseText!=null){d.responseXML=X(d.responseText)}}h=B.httpData(d,R.dataType)}catch(i){g=false;B.handleError(R,d,"error",i)}if(g){R.success(h,"success");if(a){B.event.trigger("ajaxSuccess",[d,R])}}if(a){B.event.trigger("ajaxComplete",[d,R])}if(a&&!--B.active){B.event.trigger("ajaxStop")}if(R.complete){R.complete(d,g?"success":"error")}setTimeout(function(){Z.remove();d.responseXML=null},100)}function X(f,g){if(window.ActiveXObject){g=new ActiveXObject("Microsoft.XMLDOM");g.async="false";g.loadXML(f)}else{g=(new DOMParser()).parseFromString(f,"text/xml")}return(g&&g.documentElement&&g.documentElement.tagName!="parsererror")?g:null}}};B.fn.ajaxForm=function(C){return this.ajaxFormUnbind().bind("submit.form-plugin",function(){B(this).ajaxSubmit(C);return false}).each(function(){B(":submit,input:image",this).bind("click.form-plugin",function(E){var D=this.form;D.clk=this;if(this.type=="image"){if(E.offsetX!=undefined){D.clk_x=E.offsetX;D.clk_y=E.offsetY}else{if(typeof B.fn.offset=="function"){var F=B(this).offset();D.clk_x=E.pageX-F.left;D.clk_y=E.pageY-F.top}else{D.clk_x=E.pageX-this.offsetLeft;D.clk_y=E.pageY-this.offsetTop}}}setTimeout(function(){D.clk=D.clk_x=D.clk_y=null},10)})})};B.fn.ajaxFormUnbind=function(){this.unbind("submit.form-plugin");return this.each(function(){B(":submit,input:image",this).unbind("click.form-plugin")})};B.fn.formToArray=function(N){var M=[];if(this.length==0){return M}var D=this[0];var I=N?D.getElementsByTagName("*"):D.elements;if(!I){return M}for(var J=0,K=I.length;J<K;J++){var E=I[J];var G=E.name;if(!G){continue}if(N&&D.clk&&E.type=="image"){if(!E.disabled&&D.clk==E){M.push({name:G+".x",value:D.clk_x},{name:G+".y",value:D.clk_y})}continue}var O=B.fieldValue(E,true);if(O&&O.constructor==Array){for(var H=0,C=O.length;H<C;H++){M.push({name:G,value:O[H]})}}else{if(O!==null&&typeof O!="undefined"){M.push({name:G,value:O})}}}if(!N&&D.clk){var F=D.getElementsByTagName("input");for(var J=0,K=F.length;J<K;J++){var L=F[J];var G=L.name;if(G&&!L.disabled&&L.type=="image"&&D.clk==L){M.push({name:G+".x",value:D.clk_x},{name:G+".y",value:D.clk_y})}}}return M};B.fn.formSerialize=function(C){return B.param(this.formToArray(C))};B.fn.fieldSerialize=function(D){var C=[];this.each(function(){var H=this.name;if(!H){return }var F=B.fieldValue(this,D);if(F&&F.constructor==Array){for(var G=0,E=F.length;G<E;G++){C.push({name:H,value:F[G]})}}else{if(F!==null&&typeof F!="undefined"){C.push({name:this.name,value:F})}}});return B.param(C)};B.fn.fieldValue=function(G){for(var H=[],E=0,C=this.length;E<C;E++){var F=this[E];var D=B.fieldValue(F,G);if(D===null||typeof D=="undefined"||(D.constructor==Array&&!D.length)){continue}D.constructor==Array?B.merge(H,D):H.push(D)}return H};B.fieldValue=function(D,E){var F=D.name,N=D.type,O=D.tagName.toLowerCase();if(typeof E=="undefined"){E=true}if(E&&(!F||D.disabled||N=="reset"||N=="button"||(N=="checkbox"||N=="radio")&&!D.checked||(N=="submit"||N=="image")&&D.form&&D.form.clk!=D||O=="select"&&D.selectedIndex==-1)){return null}if(O=="select"){var J=D.selectedIndex;if(J<0){return null}var L=[],C=D.options;var H=(N=="select-one");var K=(H?J+1:C.length);for(var G=(H?J:0);G<K;G++){var I=C[G];if(I.selected){var M=I.value;if(!M){M=(I.attributes&&I.attributes.value&&!(I.attributes.value.specified))?I.text:I.value}if(H){return M}L.push(M)}}return L}return D.value};B.fn.clearForm=function(){return this.each(function(){B("input,select,textarea",this).clearFields()})};B.fn.clearFields=B.fn.clearInputs=function(){return this.each(function(){var D=this.type,C=this.tagName.toLowerCase();if(D=="text"||D=="password"||C=="textarea"){this.value=""}else{if(D=="checkbox"||D=="radio"){this.checked=false}else{if(C=="select"){this.selectedIndex=-1}}}})};B.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};B.fn.enable=function(C){if(C==undefined){C=true}return this.each(function(){this.disabled=!C})};B.fn.selected=function(C){if(C==undefined){C=true}return this.each(function(){var D=this.type;if(D=="checkbox"||D=="radio"){this.checked=C}else{if(this.tagName.toLowerCase()=="option"){var E=B(this).parent("select");if(C&&E[0]&&E[0].type=="select-one"){E.find("option").selected(false)}this.selected=C}}})};function A(){if(B.fn.ajaxSubmit.debug&&window.console&&window.console.log){window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""))}}})(jQuery);
/*
 * jQuery Default Value Plugin v1.0
 * Progressive enhancement technique for inital input field values
 * The MIT License
 * Copyright (c) 2007 Paul Campbell (pauljamescampbell.co.uk)
 */
(function(A){A.fn.defaultvalue=function(){var C=this;var B=arguments;var D=0;return(C.each(function(){var E=A(this);var F=B[D];E.val(F).focus(function(){if(E.val()==F){E.val("")}E.blur(function(){if(E.val()==""){E.val(F)}})})}))}})(jQuery);
/*!
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.12 (23-MAY-2011)
 * Requires jQuery v1.3.2 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Authors: Dave Methvin and Mike Alsup
 */

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl.  (default is all corners)
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (yes, it must be pixels).
 */
;(function($) { 

var style = document.createElement('div').style,
    moz = style['MozBorderRadius'] !== undefined,
    webkit = style['WebkitBorderRadius'] !== undefined,
    radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined,
    mode = document.documentMode || 0,
    noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8),

    expr = $.browser.msie && (function() {
        var div = document.createElement('div');
        try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
        catch(e) { return false; }
        return true;
    })();

$.support = $.support || {};
$.support.borderRadius = moz || webkit || radius; // so you can do:  if (!$.support.borderRadius) $('#myDiv').corner();

function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};
function hex2(s) {
    s = parseInt(s).toString(16);
    return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
    while(node) {
        var v = $.css(node,'backgroundColor'), rgb;
        if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
            if (v.indexOf('rgb') >= 0) { 
                rgb = v.match(/\d+/g); 
                return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            return v;
        }
        if (node.nodeName.toLowerCase() == 'html')
            break;
        node = node.parentNode; // keep walking if transparent
    }
    return '#ffffff';
};

function getWidth(fx, i, width) {
    switch(fx) {
    case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
    case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
    case 'sharp':  return width-i;
    case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
    case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
    case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
    case 'curl':   return Math.round(width*(Math.atan(i)));
    case 'tear':   return Math.round(width*(Math.cos(i)));
    case 'wicked': return Math.round(width*(Math.tan(i)));
    case 'long':   return Math.round(width*(Math.sqrt(i)));
    case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
    case 'dogfold':
    case 'dog':    return (i&1) ? (i+1) : width;
    case 'dog2':   return (i&2) ? (i+1) : width;
    case 'dog3':   return (i&3) ? (i+1) : width;
    case 'fray':   return (i%2)*width;
    case 'notch':  return width; 
    case 'bevelfold':
    case 'bevel':  return i+1;
    case 'steep':  return i/2 + 1;
    case 'invsteep':return (width-i)/2+1;
    }
};

$.fn.corner = function(options) {
    // in 1.3+ we can fix mistakes with the ready state
    if (this.length == 0) {
        if (!$.isReady && this.selector) {
            var s = this.selector, c = this.context;
            $(function() {
                $(s,c).corner(options);
            });
        }
        return this;
    }

    return this.each(function(index){
        var $this = $(this),
            // meta values override options
            o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(),
            keep = /keep/.test(o),                       // keep borders?
            cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]),  // corner color
            sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]),  // strip color
            width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10, // corner width
            re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog|invsteep|steep/,
            fx = ((o.match(re)||['round'])[0]),
            fold = /dogfold|bevelfold/.test(o),
            edges = { T:0, B:1 },
            opts = {
                TL:  /top|tl|left/.test(o),       TR:  /top|tr|right/.test(o),
                BL:  /bottom|bl|left/.test(o),    BR:  /bottom|br|right/.test(o)
            },
            // vars used in func later
            strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz;
        
        if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
            opts = { TL:1, TR:1, BL:1, BR:1 };
            
        // support native rounding
        if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
            if (opts.TL)
                $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
            if (opts.TR)
                $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
            if (opts.BL)
                $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
            if (opts.BR)
                $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
            return;
        }
            
        strip = document.createElement('div');
        $(strip).css({
            overflow: 'hidden',
            height: '1px',
            minHeight: '1px',
            fontSize: '1px',
            backgroundColor: sc || 'transparent',
            borderStyle: 'solid'
        });
    
        pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        cssHeight = $(this).outerHeight();

        for (j in edges) {
            bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                d = document.createElement('div');
                $(d).addClass('jquery-corner');
                ds = d.style;

                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if (expr)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    if (expr) {
                        bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                        ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
                    }
                    else
                        ds.width = '100%';
                }
                else {
                    ds.position = 'relative';
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }

                for (i=0; i < width; i++) {
                    w = Math.max(0,getWidth(fx,i, width));
                    e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
                
                if (fold && $.support.boxModel) {
                    if (bot && noBottomFold) continue;
                    for (c in opts) {
                        if (!opts[c]) continue;
                        if (bot && (c == 'TL' || c == 'TR')) continue;
                        if (!bot && (c == 'BL' || c == 'BR')) continue;
                        
                        common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
                        $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
                        switch(c) {
                        case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
                        case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
                        case 'BL': $horz.css({ top: 0, left: 0 }); break;
                        case 'BR': $horz.css({ top: 0, right: 0 }); break;
                        }
                        d.appendChild($horz[0]);
                        
                        var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
                        switch(c) {
                        case 'TL': $vert.css({ left: width }); break;
                        case 'TR': $vert.css({ right: width }); break;
                        case 'BL': $vert.css({ left: width }); break;
                        case 'BR': $vert.css({ right: width }); break;
                        }
                        d.appendChild($vert[0]);
                    }
                }
            }
        }
    });
};

$.fn.uncorner = function() { 
    if (radius || moz || webkit)
        this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
    $('div.jquery-corner', this).remove();
    return this;
};

// expose options
$.fn.corner.defaults = {
    useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
    metaAttr:  'data-corner' // name of meta attribute to use for options
};
    
})(jQuery);

/*
Stylish Select 0.4.1 - $ plugin to replace a select drop down box with a stylable unordered list
http://scottdarby.com/
 
Requires: jQuery 1.3 or newer
 
Contributions from Justin Beasley: http://www.harvest.org/ & Anatoly Ressin: http://www.artazor.lv/
 
Dual licensed under the MIT and GPL licenses.
 
*/
(function(a){a("html").addClass("stylish-select");Array.prototype.indexOf=function(c,d){for(var b=(d||0);b<this.length;b++){if(this[b]==c){return b}}};a.fn.extend({getSetSSValue:function(b){if(b){a(this).val(b).change();return this}else{return a(this).find(":selected").val()}},resetSS:function(){var b=a(this).data("ssOpts");$this=a(this);$this.next().remove();$this.unbind(".sSelect").sSelect(b)}});a.fn.sSelect=function(b){return this.each(function(){var i={defaultText:"Please select",animationSpeed:0,ddMaxHeight:""};var l=a.extend(i,b),e=a(this),j=a('<div class="selectedTxt"></div>'),r=a('<div class="newListSelected" tabindex="0"></div>'),z=a('<ul class="newList"></ul>'),t=-1,d=-1,m=[],w=false,v=false,x;a(this).data("ssOpts",b);r.insertAfter(e);j.prependTo(r);z.appendTo(r);e.hide();j.data("ssReRender",!j.is(":visible"));if(e.children("optgroup").length==0){e.children().each(function(B){var C=a(this).text();var A=a(this).val();m.push(C.charAt(0).toLowerCase());if(a(this).attr("selected")==true){l.defaultText=C;d=B}z.append(a('<li><a href="JavaScript:void(0);">'+C+"</a></li>").data("key",A))});x=z.children().children()}else{e.children("optgroup").each(function(){var A=a(this).attr("label"),C=a('<li class="newListOptionTitle">'+A+"</li>");C.appendTo(z);var B=a("<ul></ul>");B.appendTo(C);a(this).children().each(function(){++t;var E=a(this).text();var D=a(this).val();m.push(E.charAt(0).toLowerCase());if(a(this).attr("selected")==true){l.defaultText=E;d=t}B.append(a('<li><a href="JavaScript:void(0);">'+E+"</a></li>").data("key",D))})});x=z.find("ul li a")}var o=z.height(),n=r.height(),y=x.length;if(d!=-1){h(d,true)}else{j.text(l.defaultText)}function p(){var B=r.offset().top,A=jQuery(window).height(),C=jQuery(window).scrollTop();if(o>parseInt(l.ddMaxHeight)){o=parseInt(l.ddMaxHeight)}B=B-C;if(B+o>=A){z.css({top:"-"+o+"px",height:o});e.onTop=true}else{z.css({top:n+"px",height:o});e.onTop=false}}p();a(window).bind("resize.sSelect",function(){p()});a(window).bind("scroll.sSelect",function(){p()});function s(){r.css("position","relative")}function c(){r.css("position","static")}j.bind("click.sSelect",function(A){A.stopPropagation();if(a(this).data("ssReRender")){o=z.height("").height();n=r.height();a(this).data("ssReRender",false);p()}a(".newList").not(a(this).next()).hide().parent().removeClass("newListSelFocus");z.toggle();s();x.eq(d).focus()});x.bind("click.sSelect",function(B){var A=a(B.target);d=x.index(A);v=true;h(d);z.hide();r.css("position","static")});x.bind("mouseenter.sSelect",function(B){var A=a(B.target);A.addClass("newListHover")}).bind("mouseleave.sSelect",function(B){var A=a(B.target);A.removeClass("newListHover")});function h(A,D){x.removeClass("hiLite").eq(A).addClass("hiLite");if(z.is(":visible")){x.eq(A).focus()}var C=x.eq(A).text();var B=x.eq(A).parent().data("key");if(D==true){e.val(B);j.text(C);return false}e.val(B);e.change();j.text(C)}e.bind("change.sSelect",function(A){$targetInput=a(A.target);if(v==true){v=false;return false}$currentOpt=$targetInput.find(":selected");d=$targetInput.find("option").index($currentOpt);h(d,true)});function q(A){a(A).unbind("keydown.sSelect").bind("keydown.sSelect",function(D){var C=D.which;v=true;switch(C){case 40:case 39:u();return false;break;case 38:case 37:k();return false;break;case 33:case 36:g();return false;break;case 34:case 35:f();return false;break;case 13:case 27:z.hide();c();return false;break}keyPressed=String.fromCharCode(C).toLowerCase();var B=m.indexOf(keyPressed);if(typeof B!="undefined"){++d;d=m.indexOf(keyPressed,d);if(d==-1||d==null||w!=keyPressed){d=m.indexOf(keyPressed)}h(d);w=keyPressed;return false}})}function u(){if(d<(y-1)){++d;h(d)}}function k(){if(d>0){--d;h(d)}}function g(){d=0;h(d)}function f(){d=y-1;h(d)}r.bind("click.sSelect",function(){q(this)});r.bind("focus.sSelect",function(){a(this).addClass("newListSelFocus");q(this)});r.bind("blur.sSelect",function(){a(this).removeClass("newListSelFocus")});a("body").bind("click.sSelect",function(){r.removeClass("newListSelFocus");z.hide();c()});j.bind("mouseenter.sSelect",function(B){var A=a(B.target);A.parent().addClass("newListSelHover")}).bind("mouseleave.sSelect",function(B){var A=a(B.target);A.parent().removeClass("newListSelHover")});z.css("left","0").hide()})}})(jQuery);
