/**************************************************************/
/********** LIST OF PLUGINS INCLUDED HERE *********************/
/****** tooltip, selectmenu, spinner, mousewheel, bmimg *******/
/****** dropdownchecklist *************************************/
/**************************************************************/

/**************************************************************/
/********** LIST OF PLUGINS INCLUDED HERE *********************/
/******* easing, scrollTo, ajaxForm, valid8, marquee **********/
/********shadow animation *************************************/
/**************************************************************/

/*
 * jQuery UI Tooltip @VERSION
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Tooltip
 *
 * Depends:
 *  jquery.ui.core.js
 *  jquery.ui.widget.js
 *  jquery.ui.position.js
 */
(function($) {

var increments = 0;

$.widget("ui.tooltip", {
    options: {
        items: "[title]",
        content: function() {
            return $(this).attr("title");
        },
        position: {
            my: "left center",
            at: "right center",
            offset: "15 0"
        }
    },
    _create: function() {
        var self = this;
        this.tooltip = $("<div></div>")
            .attr("id", "ui-tooltip-" + increments++)
            .attr("role", "tooltip")
            .attr("aria-hidden", "true")
            .addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content")
            .appendTo(document.body)
            .hide();
        this.tooltipContent = $("<div></div>")
            .addClass("ui-tooltip-content")
            .appendTo(this.tooltip);
        this.opacity = this.tooltip.css("opacity");
        this.element
            .bind("focus.tooltip mouseover.tooltip", function(event) {
                self.open( event );
            })
            .bind("blur.tooltip mouseout.tooltip", function(event) {
                self.close( event );
            });
    },
    
    enable: function() {
        this.options.disabled = false;
    },
    
    disable: function() {
        this.options.disabled = true;
    },
    
    _destroy: function() {
        this.tooltip.remove();
    },
    
    widget: function() {
        return this.element.pushStack(this.tooltip.get());
    },
    
    open: function(event) {
        var target = $(event && event.target || this.element).closest(this.options.items);
        // already visible? possible when both focus and mouseover events occur
        if (this.current && this.current[0] == target[0])
            return;
        var self = this;
        this.current = target;
        this.currentTitle = target.attr("title");
        var content = this.options.content.call(target[0], function(response) {
            // IE may instantly serve a cached response, need to give it a chance to finish with _show before that
            setTimeout(function() {
                // ignore async responses that come in after the tooltip is already hidden
                if (self.current == target)
                    self._show(event, target, response);
            }, 13);
        });
        if (content) {
            self._show(event, target, content);
        }
    },
    
    _show: function(event, target, content) {
        if (!content)
            return;
        
        target.attr("title", "");
        
        if (this.options.disabled)
            return;
            
        this.tooltipContent.html(content);
        this.tooltip.css({
            top: 0,
            left: 0
        }).show().position( $.extend({
            of: target
        }, this.options.position )).hide();
        
        this.tooltip.attr("aria-hidden", "false");
        target.attr("aria-describedby", this.tooltip.attr("id"));

        this.tooltip.stop(false, true).fadeIn();

        this._trigger( "open", event );
    },
    
    close: function(event) {
        if (!this.current)
            return;
        
        var current = this.current;
        this.current = null;
        current.attr("title", this.currentTitle);
        
        if (this.options.disabled)
            return;
        
        current.removeAttr("aria-describedby");
        this.tooltip.attr("aria-hidden", "true");
        
        this.tooltip.stop(false, true).fadeOut();
        
        this._trigger( "close", event );
    }
});

$.ui.tooltip.version = "@VERSION";

})(jQuery);

 /*
 * jQuery UI selectmenu
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */

(function($) {

$.widget("ui.selectmenu", {
    _init: function() {
        var self = this, o = this.options;
        
        //quick array of button and menu id's
        this.ids = [this.element.attr('id') + '-' + 'button', this.element.attr('id') + '-' + 'menu'];
        
        //define safe mouseup for future toggling
        this._safemouseup = true;
        
        //create menu button wrapper
        this.newelement = $('<a class="'+ this.widgetBaseClass +' ui-widget ui-state-default ui-corner-all" id="'+this.ids[0]+'" role="button" href="#" aria-haspopup="true" aria-owns="'+this.ids[1]+'"></a>')
            .insertAfter(this.element);
        
        //transfer tabindex
        var tabindex = this.element.attr('tabindex');
        if(tabindex){ this.newelement.attr('tabindex', tabindex); }
        
        //save reference to select in data for ease in calling methods
        this.newelement.data('selectelement', this.element);
        
        //menu icon
        this.selectmenuIcon = $('<span class="'+ this.widgetBaseClass +'-icon ui-icon"></span>')
            .prependTo(this.newelement)
            .addClass( (o.style == "popup")? 'ui-icon-triangle-2-n-s' : 'ui-icon-triangle-1-s' );   

            
        //make associated form label trigger focus
        $('label[for='+this.element.attr('id')+']')
            .attr('for', this.ids[0])
            .bind('click', function(){
                self.newelement[0].focus();
                return false;
            }); 

        //click toggle for menu visibility
        this.newelement
            .bind('mousedown', function(event){
                self._toggle(event);
                //make sure a click won't open/close instantly
                if(o.style == "popup"){
                    self._safemouseup = false;
                    setTimeout(function(){self._safemouseup = true;}, 300);
                }   
                return false;
            })
            .bind('click',function(){
                return false;
            })
            .keydown(function(event){
                var ret = true;
                switch (event.keyCode) {
                    case $.ui.keyCode.ENTER:
                        ret = true;
                        break;
                    case $.ui.keyCode.SPACE:
                        ret = false;
                        self._toggle(event);    
                        break;
                    case $.ui.keyCode.UP:
                    case $.ui.keyCode.LEFT:
                        ret = false;
                        self._moveSelection(-1);
                        break;
                    case $.ui.keyCode.DOWN:
                    case $.ui.keyCode.RIGHT:
                        ret = false;
                        self._moveSelection(1);
                        break;  
                    case $.ui.keyCode.TAB:
                        ret = true;
                        break;  
                    default:
                        ret = false;
                        self._typeAhead(event.keyCode, 'mouseup');
                        break;  
                }
                return ret;
            })
            .bind('mouseover focus', function(){ 
                $(this).addClass(self.widgetBaseClass+'-focus ui-state-hover'); 
            })
            .bind('mouseout blur', function(){  
                $(this).removeClass(self.widgetBaseClass+'-focus ui-state-hover'); 
            });
        
        //document click closes menu
        $(document)
            .mousedown(function(event){
                self.close(event);
            });

        //change event on original selectmenu
        this.element
            .click(function(){ this._refreshValue(); })
            .focus(function(){ this.newelement[0].focus(); });
        
        //create menu portion, append to body
        var cornerClass = (o.style == "dropdown")? " ui-corner-bottom" : " ui-corner-all"
        this.list = $('<ul class="' + self.widgetBaseClass + '-menu ui-widget ui-widget-content'+cornerClass+'" aria-hidden="true" role="listbox" aria-labelledby="'+this.ids[0]+'" id="'+this.ids[1]+'"></ul>').appendTo('body');              
        
        //serialize selectmenu element options  
        var selectOptionData = [];
        this.element
            .find('option')
            .each(function(){
                selectOptionData.push({
                    value: $(this).attr('value'),
                    text: self._formatText(jQuery(this).text()),
                    selected: $(this).attr('selected'),
                    classes: $(this).attr('class'),
                    parentOptGroup: $(this).parent('optgroup').attr('label')
                });
            });     
                
        //active state class is only used in popup style
        var activeClass = (self.options.style == "popup") ? " ui-state-active" : "";
        
        //write li's
        for(var i in selectOptionData){
            var thisLi = $('<li role="presentation"><a href="#" tabindex="-1" role="option" aria-selected="false">'+ selectOptionData[i].text +'</a></li>')
                .data('index',i)
                .addClass(selectOptionData[i].classes)
                .data('optionClasses', selectOptionData[i].classes|| '')
                .mouseup(function(event){
                        if(self._safemouseup){
                            var changed = $(this).data('index') != self._selectedIndex();
                            self.value($(this).data('index'));
                            self.select(event);
                            if(changed){ self.change(event); }
                            self.close(event,true);
                        }
                    return false;
                })
                .click(function(){
                    return false;
                })
                .bind('mouseover focus', function(){ 
                    self._selectedOptionLi().addClass(activeClass); 
                    self._focusedOptionLi().removeClass(self.widgetBaseClass+'-item-focus ui-state-hover'); 
                    $(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover'); 
                })
                .bind('mouseout blur', function(){ 
                    if($(this).is( self._selectedOptionLi() )){ $(this).addClass(activeClass); }
                    $(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover'); 
                });
                
            //optgroup or not...
            if(selectOptionData[i].parentOptGroup){
                var optGroupName = self.widgetBaseClass + '-group-' + selectOptionData[i].parentOptGroup;
                if(this.list.find('li.' + optGroupName).size()){
                    this.list.find('li.' + optGroupName + ':last ul').append(thisLi);
                }
                else{
                    $('<li role="presentation" class="'+self.widgetBaseClass+'-group '+optGroupName+'"><span class="'+self.widgetBaseClass+'-group-label">'+selectOptionData[i].parentOptGroup+'</span><ul></ul></li>')
                        .appendTo(this.list)
                        .find('ul')
                        .append(thisLi);
                }
            }
            else{
                thisLi.appendTo(this.list);
            }
            
            //this allows for using the scrollbar in an overflowed list
            this.list.bind('mousedown mouseup', function(){return false;});
            
            //append icon if option is specified
            if(o.icons){
                for(var j in o.icons){
                    if(thisLi.is(o.icons[j].find)){
                        thisLi
                            .data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon')
                            .addClass(self.widgetBaseClass + '-hasIcon');
                        var iconClass = o.icons[j].icon || "";
                        
                        thisLi
                            .find('a:eq(0)')
                            .prepend('<span class="'+self.widgetBaseClass+'-item-icon ui-icon '+iconClass + '"></span>');
                    }
                }
            }
        }   
        
        //add corners to top and bottom menu items
        this.list.find('li:last').addClass("ui-corner-bottom");
        if(o.style == 'popup'){ this.list.find('li:first').addClass("ui-corner-top"); }
        
        //transfer classes to selectmenu and list
        if(o.transferClasses){
            var transferClasses = this.element.attr('class') || ''; 
            this.newelement.add(this.list).addClass(transferClasses);
        }
        
        //original selectmenu width
        var selectWidth = this.element.width();
        
        //set menu button width
        this.newelement.width( (o.width) ? o.width : selectWidth);
        
        //set menu width to either menuWidth option value, width option value, or select width 
        if(o.style == 'dropdown'){ this.list.width( (o.menuWidth) ? o.menuWidth : ((o.width) ? o.width : selectWidth)); }
        else { this.list.width( (o.menuWidth) ? o.menuWidth : ((o.width) ? o.width - o.handleWidth : selectWidth - o.handleWidth)); }   
        
        //set max height from option 
        if(o.maxHeight && o.maxHeight < this.list.height()){ this.list.height(o.maxHeight); }   
        
        //save reference to actionable li's (not group label li's)
        this._optionLis = this.list.find('li:not(.'+ self.widgetBaseClass +'-group)');
                
        //transfer menu click to menu button
        this.list
            .keydown(function(event){
                var ret = true;
                switch (event.keyCode) {
                    case $.ui.keyCode.UP:
                    case $.ui.keyCode.LEFT:
                        ret = false;
                        self._moveFocus(-1);
                        break;
                    case $.ui.keyCode.DOWN:
                    case $.ui.keyCode.RIGHT:
                        ret = false;
                        self._moveFocus(1);
                        break;  
                    case $.ui.keyCode.HOME:
                        ret = false;
                        self._moveFocus(':first');
                        break;  
                    case $.ui.keyCode.PAGE_UP:
                        ret = false;
                        self._scrollPage('up');
                        break;  
                    case $.ui.keyCode.PAGE_DOWN:
                        ret = false;
                        self._scrollPage('down');
                        break;
                    case $.ui.keyCode.END:
                        ret = false;
                        self._moveFocus(':last');
                        break;          
                    case $.ui.keyCode.ENTER:
                    case $.ui.keyCode.SPACE:
                        ret = false;
                        self.close(event,true);
                        $(event.target).parents('li:eq(0)').trigger('mouseup');
                        break;      
                    case $.ui.keyCode.TAB:
                        ret = true;
                        self.close(event,true);
                        break;  
                    case $.ui.keyCode.ESCAPE:
                        ret = false;
                        self.close(event,true);
                        break;  
                    default:
                        ret = false;
                        self._typeAhead(event.keyCode,'focus');
                        break;      
                }
                return ret;
            });
            
        //selectmenu style
        if(o.style == 'dropdown'){
            this.newelement
                .addClass(self.widgetBaseClass+"-dropdown");
            this.list
                .addClass(self.widgetBaseClass+"-menu-dropdown");   
        }
        else {
            this.newelement
                .addClass(self.widgetBaseClass+"-popup");
            this.list
                .addClass(self.widgetBaseClass+"-menu-popup");  
        }
        
        //append status span to button
        this.newelement.prepend('<span class="'+self.widgetBaseClass+'-status">'+ selectOptionData[this._selectedIndex()].text +'</span>');
        
        //hide original selectmenu element
        this.element.hide();
        
        //transfer disabled state
        if(this.element.attr('disabled') == true){ this.disable(); }
        
        //update value
        this.value(this._selectedIndex());
    },
    destroy: function() {
        this.element.removeData(this.widgetName)
            .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
            .removeAttr('aria-disabled');
    
        //unbind click on label, reset its for attr
        $('label[for='+this.newelement.attr('id')+']')
            .attr('for',this.element.attr('id'))
            .unbind('click');
        this.newelement.remove();
        this.list.remove();
        this.element.show();    
    },
    _typeAhead: function(code, eventType){
        var self = this;
        //define self._prevChar if needed
        if(!self._prevChar){ self._prevChar = ['',0]; }
        var C = String.fromCharCode(code);
        c = C.toLowerCase();
        var focusFound = false;
        function focusOpt(elem, ind){
            focusFound = true;
            $(elem).trigger(eventType);
            self._prevChar[1] = ind;
        };
        this.list.find('li a').each(function(i){    
            if(!focusFound){
                var thisText = $(this).text();
                if( thisText.indexOf(C) == 0 || thisText.indexOf(c) == 0){
                        if(self._prevChar[0] == C){
                            if(self._prevChar[1] < i){ focusOpt(this,i); }  
                        }
                        else{ focusOpt(this,i); }   
                }
            }
        });
        this._prevChar[0] = C;
    },
    _uiHash: function(){
        return {
            value: this.value()
        };
    },
    open: function(event){
        var self = this;
        var disabledStatus = this.newelement.attr("aria-disabled");
        if(disabledStatus != 'true'){
            this._refreshPosition();
            this._closeOthers(event);
            this.newelement
                .addClass('ui-state-active');
            
            this.list
                .appendTo('body')
                .addClass(self.widgetBaseClass + '-open')
                .attr('aria-hidden', false)
                .find('li:not(.'+ self.widgetBaseClass +'-group):eq('+ this._selectedIndex() +') a')[0].focus();    
            if(this.options.style == "dropdown"){ this.newelement.removeClass('ui-corner-all').addClass('ui-corner-top'); } 
            this._refreshPosition();
            this._trigger("open", event, this._uiHash());
        }
    },
    close: function(event, retainFocus){
        if(this.newelement.is('.ui-state-active')){
            this.newelement
                .removeClass('ui-state-active');
            this.list
                .attr('aria-hidden', true)
                .removeClass(this.widgetBaseClass+'-open');
            if(this.options.style == "dropdown"){ this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all'); }
            if(retainFocus){this.newelement[0].focus();}    
            this._trigger("close", event, this._uiHash());
        }
    },
    change: function(event) {
        this.element.trigger('change');
        this._trigger("change", event, this._uiHash());
    },
    select: function(event) {
        this._trigger("select", event, this._uiHash());
    },
    _closeOthers: function(event){
        $('.'+ this.widgetBaseClass +'.ui-state-active').not(this.newelement).each(function(){
            $(this).data('selectelement').selectmenu('close',event);
        });
        $('.'+ this.widgetBaseClass +'.ui-state-hover').trigger('mouseout');
    },
    _toggle: function(event,retainFocus){
        if(this.list.is('.'+ this.widgetBaseClass +'-open')){ this.close(event,retainFocus); }
        else { this.open(event); }
    },
    _formatText: function(text){
        return this.options.format ? this.options.format(text) : text;
    },
    _selectedIndex: function(){
        return this.element[0].selectedIndex;
    },
    _selectedOptionLi: function(){
        return this._optionLis.eq(this._selectedIndex());
    },
    _focusedOptionLi: function(){
        return this.list.find('.'+ this.widgetBaseClass +'-item-focus');
    },
    _moveSelection: function(amt){
        var currIndex = parseInt(this._selectedOptionLi().data('index'), 10);
        var newIndex = currIndex + amt;
        return this._optionLis.eq(newIndex).trigger('mouseup');
    },
    _moveFocus: function(amt){
        if(!isNaN(amt)){
            var currIndex = parseInt(this._focusedOptionLi().data('index'), 10);
            var newIndex = currIndex + amt;
        }
        else { var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10); }
        
        if(newIndex < 0){ newIndex = 0; }
        if(newIndex > this._optionLis.size()-1){
            newIndex =  this._optionLis.size()-1;
        }
        var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
        
        this._focusedOptionLi().find('a:eq(0)').attr('id','');
        this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID)[0].focus();
        this.list.attr('aria-activedescendant', activeID);
    },
    _scrollPage: function(direction){
        var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight());
        numPerPage = (direction == 'up') ? -numPerPage : numPerPage;
        this._moveFocus(numPerPage);
    },
    _setData: function(key, value) {
        this.options[key] = value;
        if (key == 'disabled') {
            this.close();
            this.element
                .add(this.newelement)
                .add(this.list)
                    [value ? 'addClass' : 'removeClass'](
                        this.widgetBaseClass + '-disabled' + ' ' +
                        this.namespace + '-state-disabled')
                    .attr("aria-disabled", value);
        }
    },
    value: function(newValue) {
        if (arguments.length) {
            this.element[0].selectedIndex = newValue;
            this._refreshValue();
            this._refreshPosition();
        }
        return this.element[0].selectedIndex;
    },
    _refreshValue: function() {
        var activeClass = (this.options.style == "popup") ? " ui-state-active" : "";
        var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
        //deselect previous
        this.list
            .find('.'+ this.widgetBaseClass +'-item-selected')
            .removeClass(this.widgetBaseClass + "-item-selected" + activeClass)
            .find('a')
            .attr('aria-selected', 'false')
            .attr('id', '');
        //select new
        this._selectedOptionLi()
            .addClass(this.widgetBaseClass + "-item-selected"+activeClass)
            .find('a')
            .attr('aria-selected', 'true')
            .attr('id', activeID);
            
        //toggle any class brought in from option
        var currentOptionClasses = this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : "";
        var newOptionClasses = this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : "";
        this.newelement
            .removeClass(currentOptionClasses)
            .data('optionClasses', newOptionClasses)
            .addClass( newOptionClasses )
            .find('.'+this.widgetBaseClass+'-status')
            .html( 
                this._selectedOptionLi()
                    .find('a:eq(0)')
                    .html() 
            );
            
        this.list.attr('aria-activedescendant', activeID)
    },
    _refreshPosition: function(){   
        //set left value
        this.list.css('left', this.newelement.offset().left);
        
        //set top value
        var menuTop = this.newelement.offset().top;
        var scrolledAmt = this.list[0].scrollTop;
        this.list.find('li:lt('+this._selectedIndex()+')').each(function(){
            scrolledAmt -= $(this).outerHeight();
        });
        
        if(this.newelement.is('.'+this.widgetBaseClass+'-popup')){
            menuTop+=scrolledAmt; 
            this.list.css('top', menuTop); 
        }   
        else { 
            menuTop += this.newelement.height();
            this.list.css('top', menuTop); 
        }
    }
});

$.extend($.ui.selectmenu, {
    getter: "value",
    version: "@VERSION",
    eventPrefix: "selectmenu",
    defaults: {
        transferClasses: true,
        style: 'popup', 
        width: null, 
        menuWidth: null, 
        handleWidth: 26, 
        maxHeight: null,
        icons: null, 
        format: null
    }
});

})(jQuery);

/* Turkish initialisation for the jQuery UI date picker plugin. */
/* Written by Izzet Emre Erkan (kara@karalamalar.net). */
$(function($){
    $.datepicker.regional['tr'] = {
        closeText: 'kapat',
        prevText: '&#x3c;geri',
        nextText: 'ileri&#x3e',
        currentText: 'bugün',
        monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran',
        'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
        monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz',
        'Tem','Ağu','Eyl','Eki','Kas','Ara'],
        dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],
        dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
        dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
        weekHeader: 'Hf',
        dateFormat: 'dd.mm.yy',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''};
    $.datepicker.setDefaults($.datepicker.regional['tr']);
});

/*
 * jQuery UI Spinner @VERSION
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Spinner
 *
 * Depends:
 *  jquery.ui.core.js
 *  jquery.ui.widget.js
 */
(function($) {

$.widget('ui.spinner', {
    defaultElement: "<input>",
    options: {
        incremental: true,
        max: null,
        min: null,
        numberformat: null,
        page: 10,
        step: null,
        value: null
    },
    
    _create: function() {
        this._draw();
        this._markupOptions();
        this._mousewheel();
        this._aria();
    },
    
    _markupOptions: function() {
        var _this = this;
        $.each({
            min: -Number.MAX_VALUE,
            max: Number.MAX_VALUE,
            step: 1
        }, function(attr, defaultValue) {
            if (_this.options[attr] === null) {
                var value = _this.element.attr(attr);
                _this.options[attr] = typeof value == "string" && value.length > 0 ? _this._parse(value) : defaultValue;
            }
        });
        this.value(this.options.value !== null ? this.options.value : this.element.val() || 0);
    },
    
    _draw: function() {
        var self = this,
            options = self.options;

        var uiSpinner = this.uiSpinner = self.element
            .addClass('ui-spinner-input')
            .attr('autocomplete', 'off')
            .wrap(self._uiSpinnerHtml())
            .parent()
                // add buttons
                .append(self._buttonHtml())
                // add behaviours
                .hover(function() {
                    if (!options.disabled) {
                        $(this).addClass('ui-state-hover');
                    }
                    self.hovered = true;
                }, function() {
                    $(this).removeClass('ui-state-hover');
                    self.hovered = false;
                });

        this.element
            .attr( "role", "spinbutton" )
            .bind('keydown.spinner', function(event) {
                if (self.options.disabled) {
                    return;
                }
                if (self._start(event)) {
                    return self._keydown(event);
                }
                return true;
            })
            .bind('keyup.spinner', function(event) {
                if (self.options.disabled) {
                    return;
                }
                if (self.spinning) {
                    self._stop(event);
                    self._change(event);                    
                }
            })
            .bind('focus.spinner', function() {
                uiSpinner.addClass('ui-state-active');
                self.focused = true;
            })
            .bind('blur.spinner', function(event) {
                self.value(self.element.val());
                if (!self.hovered) {
                    uiSpinner.removeClass('ui-state-active');
                }       
                self.focused = false;
            });

        // button bindings
        this.buttons = uiSpinner.find('.ui-spinner-button')
            .attr("tabIndex", -1)
            .button()
            .removeClass("ui-corner-all")
            .bind('mousedown', function(event) {
                if (self.options.disabled) {
                    return;
                }
                if (self._start(event) === false) {
                    return false;
                }
                self._repeat(null, $(this).hasClass('ui-spinner-up') ? 1 : -1, event);
            })
            .bind('mouseup', function(event) {
                if (self.options.disabled) {
                    return;
                }
                if (self.spinning) {
                    self._stop(event);
                    self._change(event);                    
                }
            })
            .bind("mouseenter", function() {
                if (self.options.disabled) {
                    return;
                }
                // button will add ui-state-active if mouse was down while mouseleave and kept down
                if ($(this).hasClass("ui-state-active")) {
                    if (self._start(event) === false) {
                        return false;
                    }
                    self._repeat(null, $(this).hasClass('ui-spinner-up') ? 1 : -1, event);
                }
            })
            .bind("mouseleave", function() {
                if (self.spinning) {
                    self._stop(event);
                    self._change(event);
                }
            });
                    
        // disable spinner if element was already disabled
        if (options.disabled) {
            this.disable();
        }
    },
    
    _keydown: function(event) {
        var o = this.options,
            KEYS = $.ui.keyCode;

        switch (event.keyCode) {
        case KEYS.UP:
            this._repeat(null, 1, event);
            return false;
        case KEYS.DOWN:
            this._repeat(null, -1, event);
            return false;
        case KEYS.PAGE_UP:
            this._repeat(null, this.options.page, event);
            return false;
        case KEYS.PAGE_DOWN:
            this._repeat(null, -this.options.page, event);
            return false;
            
        case KEYS.ENTER:
            this.value(this.element.val());
        }
        
        return true;
    },
    
    _mousewheel: function() {
        // need the delta normalization that mousewheel plugin provides
        if (!$.fn.mousewheel) {
            return;
        }
        var self = this;
        this.element.bind("mousewheel.spinner", function(event, delta) {
            if (self.options.disabled) {
                return;
            }
            if (!self.spinning && !self._start(event)) {
                return false;
            }
            self._spin((delta > 0 ? 1 : -1) * self.options.step, event);
            clearTimeout(self.timeout);
            self.timeout = setTimeout(function() {
                if (self.spinning) {
                    self._stop(event);
                    self._change(event);
                }
            }, 100);
            event.preventDefault();
        });
    },
    
    _uiSpinnerHtml: function() {
        return '<span class="ui-spinner ui-state-default ui-widget ui-widget-content ui-corner-all"></span>';
    },
    
    _buttonHtml: function() {
        return '<a class="ui-spinner-button ui-spinner-up ui-corner-tr"><span class="ui-icon ui-icon-triangle-1-n">&#9650;</span></a>' +
                '<a class="ui-spinner-button ui-spinner-down ui-corner-br"><span class="ui-icon ui-icon-triangle-1-s">&#9660;</span></a>';
    },
    
    _start: function(event) {
        if (!this.spinning && this._trigger('start', event) !== false) {
            if (!this.counter) {
                this.counter = 1;
            }
            this.spinning = true;
            return true;
        }
        return false;
    },
    
    _repeat: function(i, steps, event) {
        var self = this;
        i = i || 500;

        clearTimeout(this.timer);
        this.timer = setTimeout(function() {
            self._repeat(40, steps, event);
        }, i);
        
        self._spin(steps * self.options.step, event);
    },
    
    _spin: function(step, event) {
        if (!this.counter) {
            this.counter = 1;
        }
        
        // TODO refactor, maybe figure out some non-linear math
        var newVal = this.value() + step * (this.options.incremental &&
            this.counter > 20
                ? this.counter > 100
                    ? this.counter > 200
                        ? 100 
                        : 10
                    : 2
                : 1);
        
        if (this._trigger('spin', event, { value: newVal }) !== false) {
            this.value(newVal);
            this.counter++;         
        }
    },
    
    _stop: function(event) {
        this.counter = 0;
        if (this.timer) {
            window.clearTimeout(this.timer);
        }
        this.element[0].focus();
        this.spinning = false;
        this._trigger('stop', event);
    },
    
    _change: function(event) {
        this._trigger('change', event);
    },
    
    _setOption: function(key, value) {
        if (key == 'value') {
            value = this._parse(value);
            if (value < this.options.min) {
                value = this.options.min;
            }
            if (value > this.options.max) {
                value = this.options.max;
            }
        }
        if (key == 'disabled') {
            if (value) {
                this.element.attr("disabled", true);
                this.buttons.button("disable");
            } else {
                this.element.removeAttr("disabled");
                this.buttons.button("enable");
            }
        }
        // TODO see below
        //this._super( "_setOption", key, value );
        $.Widget.prototype._setOption.apply( this, arguments );
    },
    
    _setOptions: function( options ) {
        // TODO _super doesn't handle inheritance with more then one subclass
        // spinner subclass will have spinner as base, calling spinner._setOptions infinitely
        //this._super( "_setOptions", options );
        $.Widget.prototype._setOptions.apply( this, arguments );
        if ( "value" in options ) {
            this._format( this.options.value );
        }
        this._aria();
    },
    
    _aria: function() {
        this.element
            .attr('aria-valuemin', this.options.min)
            .attr('aria-valuemax', this.options.max)
            .attr('aria-valuenow', this.options.value);
    },
    
    _parse: function(val) {
        var input = val;
        if (typeof val == 'string') {
            val = $.global && this.options.numberformat ? $.global.parseFloat(val) : +val;
        }
        return isNaN(val) ? null : val;
    },
    
    _format: function(num) {
        this.element.val( $.global && this.options.numberformat ? $.global.format(num, this.options.numberformat) : num );
    },
        
    destroy: function() {
        this.element
            .removeClass('ui-spinner-input')
            .removeAttr('disabled')
            .removeAttr('autocomplete')
            .removeAttr('role')
            .removeAttr('aria-valuemin')
            .removeAttr('aria-valuemax')
            .removeAttr('aria-valuenow');
        //this._super( "destroy" );
        this.uiSpinner.replaceWith(this.element);
    },
    
    stepUp: function(steps) {
        this._spin((steps || 1) * this.options.step);
    },
    
    stepDown: function(steps) {
        this._spin((steps || 1) * -this.options.step);  
    },
    
    pageUp: function(pages) {
        this.stepUp((pages || 1) * this.options.page);      
    },
    
    pageDown: function(pages) {
        this.stepDown((pages || 1) * this.options.page);        
    },
    
    value: function(newVal) {
        if (!arguments.length) {
            return this._parse(this.element.val());
        }
        this.option('value', newVal);
    },
    
    widget: function() {
        return this.uiSpinner;
    }
});
$.ui.spinner.version = "@VERSION";
})(jQuery);

/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 * Thanks to: Seamus Leahy for adding deltaX and deltaY
 *
 * Version: 3.0.4
 * 
 * Requires: 1.2.2+
 */

(function($) {

var types = ['DOMMouseScroll', 'mousewheel'];

$.event.special.mousewheel = {
    setup: function() {
        if ( this.addEventListener ) {
            for ( var i=types.length; i; ) {
                this.addEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = handler;
        }
    },
    
    teardown: function() {
        if ( this.removeEventListener ) {
            for ( var i=types.length; i; ) {
                this.removeEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = null;
        }
    }
};

$.fn.extend({
    mousewheel: function(fn) {
        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
    },
    
    unmousewheel: function(fn) {
        return this.unbind("mousewheel", fn);
    }
});


function handler(event) {
    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
    event = $.event.fix(orgEvent);
    event.type = "mousewheel";
    
    // Old school scrollwheel delta
    if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
    if ( event.detail     ) { delta = -event.detail/3; }
    
    // New school multidimensional scroll (touchpads) deltas
    deltaY = delta;
    
    // Gecko
    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
        deltaY = 0;
        deltaX = -1*delta;
    }
    
    // Webkit
    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
    
    // Add event and delta to the front of the arguments
    args.unshift(event, delta, deltaX, deltaY);
    
    return $.event.handle.apply(this, args);
}

})(jQuery);


/**
 * @author Alexander Farkas
 * background image animator
 * v. 1.21
 */


(function($) {
    if(!document.defaultView || !document.defaultView.getComputedStyle){ // IE6-IE8
        var oldCurCSS = jQuery.curCSS;
        jQuery.curCSS = function(elem, name, force){
            if(name === 'background-position'){
                name = 'backgroundPosition';
            }
            if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
                return oldCurCSS.apply(this, arguments);
            }
            var style = elem.style;
            if ( !force && style && style[ name ] ){
                return style[ name ];
            }
            return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
        };
    }
    
    var oldAnim = $.fn.animate;
    $.fn.animate = function(prop){
        if('background-position' in prop){
            prop.backgroundPosition = prop['background-position'];
            delete prop['background-position'];
        }
        if('backgroundPosition' in prop){
            prop.backgroundPosition = '('+ prop.backgroundPosition;
        }
        return oldAnim.apply(this, arguments);
    };
    
    function toArray(strg){
        strg = strg.replace(/left|top/g,'0px');
        strg = strg.replace(/right|bottom/g,'100%');
        strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
        var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
        return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
    }
    
    $.fx.step. backgroundPosition = function(fx) {
        if (!fx.bgPosReady) {
            var start = $.curCSS(fx.elem,'backgroundPosition');
            
            if(!start){//FF2 no inline-style fallback
                start = '0px 0px';
            }
            
            start = toArray(start);
            
            fx.start = [start[0],start[2]];
            
            var end = toArray(fx.options.curAnim.backgroundPosition);
            fx.end = [end[0],end[2]];
            
            fx.unit = [end[1],end[3]];
            fx.bgPosReady = true;
        }
        //return;
        var nowPosX = [];
        nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
        nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
        fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

    };
})(jQuery);

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------

;(function($) {
    /*
    * ui.dropdownchecklist
    *
    * Copyright (c) 2008-2010 Adrian Tosca, Copyright (c) 2010-2011 Ittrium LLC
    * Dual licensed under the MIT (MIT-LICENSE.txt)
    * and GPL (GPL-LICENSE.txt) licenses.
    *
    */
    // The dropdown check list jQuery plugin transforms a regular select html element into a dropdown check list.
    $.widget("ui.dropdownchecklist", {
        // Some globlals
        // $.ui.dropdownchecklist.gLastOpened - keeps track of last opened dropdowncheck list so we can close it
        // $.ui.dropdownchecklist.gIDCounter - simple counter to provide a unique ID as needed
        version: function() {
            alert('DropDownCheckList v1.2qa');
        },      
        // Creates the drop container that keeps the items and appends it to the document
        _appendDropContainer: function( controlItem ) {
            var wrapper = $("<div/>");
            // the container is wrapped in a div
            wrapper.addClass("ui-dropdownchecklist ui-dropdownchecklist-dropcontainer-wrapper");
            wrapper.addClass("ui-widget-content");
            // assign an id
            wrapper.attr("id",controlItem.attr("id") + '-ddw');
            // initially positioned way off screen to prevent it from displaying
            // NOTE absolute position to enable width/height calculation
            wrapper.css({ position: 'absolute', left: "-33000px", top: "-33000px"  });
            
            var container = $("<div/>"); // the actual container
            container.addClass("ui-dropdownchecklist-dropcontainer ui-widget-content");
            container.css("overflow-y", "auto");
            wrapper.append(container);
            
            // insert the dropdown after the master control to try to keep the tab order intact
            // if you just add it to the end, tabbing out of the drop down takes focus off the page
            // @todo 22Sept2010 - check if size calculation is thrown off if the parent of the
            //      selector is hidden.  We may need to add it to the end of the document here, 
            //      calculate the size, and then move it back into proper position???
            //$(document.body).append(wrapper);
            wrapper.insertAfter(controlItem);

            // flag that tells if the drop container is shown or not
            wrapper.isOpen = false;
            return wrapper;
        },
        // Look for browser standard 'open' on a closed selector
        _isDropDownKeyShortcut: function(e,keycode) {
            return e.altKey && ($.ui.keyCode.DOWN == keycode);// Alt + Down Arrow
        },
        // Look for key that will tell us to close the open dropdown
        _isDropDownCloseKey: function(e,keycode) {
            return ($.ui.keyCode.ESCAPE == keycode) || ($.ui.keyCode.ENTER == keycode);
        },
        // Handler to change the active focus based on a keystroke, moving some count of
        // items from the element that has the current focus
        _keyFocusChange: function(target,delta,limitToItems) {
            // Find item with current focus
            var focusables = $(":focusable");
            var index = focusables.index(target);
            if ( index >= 0 ) {
                index += delta;
                if ( limitToItems ) {
                    // Bound change to list of input elements
                    var allCheckboxes = this.dropWrapper.find("input:not([disabled])");
                    var firstIndex = focusables.index(allCheckboxes.get(0));
                    var lastIndex = focusables.index(allCheckboxes.get(allCheckboxes.length-1));
                    if ( index < firstIndex ) {
                        index = lastIndex;
                    } else if ( index > lastIndex ) {
                        index = firstIndex;
                    }
                }
                focusables.get(index).focus();
            }
        },
        // Look for navigation, open, close (wired to keyup)
        _handleKeyboard: function(e) {
            var self = this;
            var keyCode = (e.keyCode || e.which);
            if (!self.dropWrapper.isOpen && self._isDropDownKeyShortcut(e, keyCode)) {
                // Key command to open the dropdown
                e.stopImmediatePropagation();
                self._toggleDropContainer(true);
            } else if (self.dropWrapper.isOpen && self._isDropDownCloseKey(e, keyCode)) {
                // Key command to close the dropdown (but we retain focus in the control)
                e.stopImmediatePropagation();
                self._toggleDropContainer(false);
                self.controlSelector.focus();
            } else if (self.dropWrapper.isOpen 
                    && (e.target.type == 'checkbox')
                    && ((keyCode == $.ui.keyCode.DOWN) || (keyCode == $.ui.keyCode.UP)) ) {
                // Up/Down to cycle throught the open items
                e.stopImmediatePropagation();
                self._keyFocusChange(e.target, (keyCode == $.ui.keyCode.DOWN) ? 1 : -1, true);

            } else if (self.dropWrapper.isOpen && (keyCode == $.ui.keyCode.TAB) ) {
                // I wanted to adjust normal 'tab' processing here, but research indicates
                // that TAB key processing is NOT a cancelable event. You have to use a timer
                // hack to pull the focus back to where you want it after browser tab
                // processing completes.  Not going to work for us.
                //e.stopImmediatePropagation();
                //self._keyFocusChange(e.target, (e.shiftKey) ? -1 : 1, true);
           }
        },
        // Look for change of focus
        _handleFocus: function(e,focusIn,forDropdown) {
            var self = this;
            if (forDropdown && !self.dropWrapper.isOpen) {
                // if the focus changes when the control is NOT open, mark it to show where the focus is/is not
                e.stopImmediatePropagation();
                if (focusIn) {
                    self.controlSelector.addClass("ui-state-hover");
                    if ($.ui.dropdownchecklist.gLastOpened != null) {
                        $.ui.dropdownchecklist.gLastOpened._toggleDropContainer( false );
                    }
                } else {
                    self.controlSelector.removeClass("ui-state-hover");
                }
            } else if (!forDropdown && !focusIn) {
                // The dropdown is open, and an item (NOT the dropdown) has just lost the focus.
                // we really need a reliable method to see who has the focus as we process the blur,
                // but that mechanism does not seem to exist.  Instead we rely on a delay before
                // posting the blur, with a focus event cancelling it before the delay expires.
                if ( e != null ) { e.stopImmediatePropagation(); }
                self.controlSelector.removeClass("ui-state-hover");
                self._toggleDropContainer( false );             
            }
        },
        // Clear the pending change of focus, which keeps us 'in' the control
        _cancelBlur: function(e) {
            var self = this;
            if (self.blurringItem != null) {
                clearTimeout(self.blurringItem);
                self.blurringItem = null;
            } 
        },
        // Creates the control that will replace the source select and appends it to the document
        // The control resembles a regular select with single selection
        _appendControl: function() {
            var self = this, sourceSelect = this.sourceSelect, options = this.options;

            // the control is wrapped in a basic container
            // inline-block at this level seems to give us better size control
            var wrapper = $("<span/>");
            wrapper.addClass("ui-dropdownchecklist ui-dropdownchecklist-selector-wrapper ui-widget-header");
            wrapper.css( { display: "block", cursor: "pointer", overflow: "hidden" } );
            
            // assign an ID 
            var baseID = sourceSelect.attr("id");
            if ((baseID == null) || (baseID == "")) {
                baseID = "ddcl-" + $.ui.dropdownchecklist.gIDCounter++;
            } else {
                baseID = "ddcl-" + baseID;
            }
            wrapper.attr("id",baseID);
            
            // the actual control which you can style
            // inline-block needed to enable 'width' but has interesting problems cross browser
            var control = $("<span/>");
            control.addClass("ui-dropdownchecklist-selector ui-state-default ui-widget-header");
            control.css( { display: "inline-block", overflow: "hidden", 'white-space': 'nowrap'} );
            // Setting a tab index means we are interested in the tab sequence
            var tabIndex = sourceSelect.attr("tabIndex");
            if ( tabIndex == null ) {
                tabIndex = 0;
            } else {
                tabIndex = parseInt(tabIndex);
                if ( tabIndex < 0 ) {
                    tabIndex = 0;
                }
            }
            control.attr("tabIndex", tabIndex);
            control.keyup(function(e) {self._handleKeyboard(e);});
            control.focus(function(e) {self._handleFocus(e,true,true);});
            control.blur(function(e) {self._handleFocus(e,false,true);});
            wrapper.append(control);

            // the optional icon (which is inherently a block) which we can float
            if (options.icon != null) {
                var iconPlacement = (options.icon.placement == null) ? "left" : options.icon.placement;
                var anIcon = $("<div/>");
                anIcon.addClass("ui-icon");
                anIcon.addClass( (options.icon.toOpen != null) ? options.icon.toOpen : "ui-icon-triangle-1-e");
                anIcon.css({ 'float': iconPlacement });
                control.append(anIcon);
            }
            // the text container keeps the control text that is built from the selected (checked) items
            // inline-block needed to prevent long text from wrapping to next line when icon is active
            var textContainer = $("<span/>");
            textContainer.addClass("ui-dropdownchecklist-text");
            textContainer.css( {  display: "inline-block", 'white-space': "nowrap", overflow: "hidden" } );
            control.append(textContainer);

            // add the hover styles to the control
            wrapper.hover(
                function() {
                    if (!self.disabled) {
                        control.addClass("ui-state-hover");
                    }
                }
            ,   function() {
                    if (!self.disabled) {
                        control.removeClass("ui-state-hover");
                    }
                }
            );
            // clicking on the control toggles the drop container
            wrapper.click(function(event) {
                if (!self.disabled) {
                    event.stopImmediatePropagation();
                    self._toggleDropContainer( !self.dropWrapper.isOpen );
                }
            });
            wrapper.insertBefore(sourceSelect);

            // Watch for a window resize and adjust the control if open
            $(window).resize(function() {
                if (!self.disabled && self.dropWrapper.isOpen) {
                    // Reopen yourself to get the position right
                    self._toggleDropContainer(true);
                }
            });       
            return wrapper;
        },
        // Creates a drop item that coresponds to an option element in the source select
        _createDropItem: function(index, tabIndex, value, text, checked, disabled, indent) {
            var self = this, options = this.options, sourceSelect = this.sourceSelect, controlWrapper = this.controlWrapper;
            // the item contains a div that contains a checkbox input and a lable for the text
            // the div
            var item = $("<div/>");
            item.addClass("ui-dropdownchecklist-item");
            item.css({'white-space': "nowrap",'height':"18px"});
            var checkedString = checked ? ' checked="checked"' : '';
            var classString = disabled ? ' class="inactive"' : ' class="active"';
            
            // generated id must be a bit unique to keep from colliding
            var idBase = controlWrapper.attr("id");
            var id = idBase + '-i' + index;
            var checkBox;
            
            // all items start out disabled to keep them out of the tab order
            if (self.isMultiple) { // the checkbox
                checkBox = $('<input disabled type="checkbox" id="' + id + '"' + checkedString + classString + ' tabindex="' + tabIndex + '" />');
            } else { // the radiobutton
                checkBox = $('<input disabled type="radio" id="' + id + '" name="' + idBase + '"' + checkedString + classString + ' tabindex="' + tabIndex + '" />');
            }
            
            if (checkBox.attr('checked') == true)
                item.addClass("ui-state-active");
                
            checkBox = checkBox.attr("index", index).val(value);
            item.append(checkBox);
            
            
            
            // the text
            var label = $("<label for=" + id + "/>");
            label.addClass("ui-dropdownchecklist-text");
            label.css({ cursor: "default" });
            label.text(text);
            label.attr("title",text);
            if (indent) {
                item.addClass("ui-dropdownchecklist-indent");
            }
            item.addClass("ui-state-default");
            if (disabled) {
                item.addClass("ui-state-disabled");
            }
            label.click(function(e) {
                e.stopImmediatePropagation(); 
                //item.click();
                //label.parent().parent().find(".ui-state-active").removeClass("ui-state-active");
                //label.parent().addClass("ui-state-active");
            } );
            item.append(label);
            
            // active items display themselves with hover
            item.hover(
                function(e) {
                    var anItem = $(this);
                    if (!anItem.hasClass("ui-state-disabled")) { anItem.addClass("ui-state-hover"); }
                }
            ,   function(e) {
                    var anItem = $(this);
                    anItem.removeClass("ui-state-hover");
                }
            );
            // clicking on the checkbox synchronizes the source select
            checkBox.click(function(e) {
                var aCheckBox = $(this);
                e.stopImmediatePropagation();
                aCheckBox.parent().parent().find(".ui-state-active").each(function () { 
                    if ($(this).find("input").attr("type") == "radio" || ($(this).find("input").attr("type") == "checkbox" && $(this).find("input").attr("checked") == false))
                        $(this).removeClass("ui-state-active");
                    
                });
                if (aCheckBox.attr("checked"))
                    aCheckBox.parent().addClass("ui-state-active");
                

                if (aCheckBox.hasClass("active") ) {
                    
                    // Active checkboxes take active action
                    self._syncSelected(aCheckBox);
                    self.sourceSelect.trigger("change", 'ddcl_internal');
                    if (!self.isMultiple && options.closeRadioOnClick) {
                        self._toggleDropContainer(false);
                    }
                }
            });
            // we are interested in the focus leaving the check box
            // but we need to detect the focus leaving one check box but
            // entering another. There is no reliable way to detect who
            // received the focus on a blur, so post the blur in the future,
            // knowing we will cancel it if we capture the focus in a timely manner
            // 23Sept2010 - unfortunately, IE 7+ and Chrome like to post a blur
            //              event to the current item with focus when the user
            //              clicks in the scroll bar. So if you have a scrollable
            //              dropdown with focus on an item, clicking in the scroll
            //              will close the drop down.
            //              I have no solution for blur processing at this time.
/*********
            var timerFunction = function(){ 
                // I had a hell of a time getting setTimeout to fire this, do not try to
                // define it within the blur function
                try { self._handleFocus(null,false,false); } catch(ex){ alert('timer failed: '+ex);}
            };
            checkBox.blur(function(e) { 
                self.blurringItem = setTimeout( timerFunction, 200 ); 
            });
            checkBox.focus(function(e) {self._cancelBlur();});
**********/ 
            // check/uncheck the item on clicks on the entire item div
            item.click(function(e) {
                var anItem = $(this);
                e.stopImmediatePropagation();
                if (!anItem.hasClass("ui-state-disabled") ){
                    // check/uncheck the underlying control

                    anItem.parent().children(".ui-dropdownchecklist-item").each(function () {
                        if (($(this).find("input").attr("type") == "checkbox" && $(this).find("input").attr("checked") == false) || $(this).find("input").attr("type") == "radio")
                            $(this).removeClass("ui-state-active");
                    });
                    anItem.toggleClass("ui-state-active");
                    var aCheckBox = anItem.find("input");
                    var checked = aCheckBox.attr("checked");
                    
                    if (aCheckBox.attr("type") == "radio" && aCheckBox.attr("checked") == false)
                        aCheckBox.attr("checked", !checked);

                    if (aCheckBox.attr("type") == "checkbox")
                        aCheckBox.attr("checked", !checked);
                    
                    self._syncSelected(aCheckBox);
                    self.sourceSelect.trigger("change", 'ddcl_internal');
                    if (!checked && !self.isMultiple && options.closeRadioOnClick) {
                        self._toggleDropContainer(false);
                    }
                } else {
                    // retain the focus even if disabled
                    anItem.focus();
                    self._cancelBlur();
                }
            });
            // do not let the focus wander around
            item.focus(function(e) { 
                var anItem = $(this);
                e.stopImmediatePropagation();
            });
            item.keyup(function(e) {self._handleKeyboard(e);});
            return item;
        },
        _createGroupItem: function(text,disabled) {
            var self = this;
            var group = $("<div />");
            group.addClass("ui-dropdownchecklist-group ui-widget-header");
            if (disabled) {
                group.addClass("ui-state-disabled");
            }
            group.css({'white-space': "nowrap"});
            
            var label = $("<span/>");
            label.addClass("ui-dropdownchecklist-text");
            label.css( { cursor: "default" });
            label.text(text);
            group.append(label);
            
            // anything interesting when you click the group???
            group.click(function(e) {
                var aGroup= $(this);
                e.stopImmediatePropagation();
                // retain the focus even if no action is taken
                aGroup.focus();
                self._cancelBlur();
            });
            // do not let the focus wander around
            group.focus(function(e) { 
                var aGroup = $(this);
                e.stopImmediatePropagation();
            });
            return group;
        },
        _createCloseItem: function(text) {
            var self = this;
            var closeItem = $("<div />");
            closeItem.addClass("ui-state-default ui-dropdownchecklist-close ui-dropdownchecklist-item");
            closeItem.css({'white-space': 'nowrap', 'text-align': 'right'});
            
            var label = $("<span/>");
            label.addClass("ui-dropdownchecklist-text");
            label.css({ cursor: "default" });
            label.text(text);
            closeItem.append(label);
            
            // close the control on click
            closeItem.click(function(e) {
                var aGroup= $(this);
                e.stopImmediatePropagation();
                // retain the focus even if no action is taken
                aGroup.focus();
                self._toggleDropContainer( false );
            });
            closeItem.hover(
                function(e) { $(this).addClass("ui-state-hover"); }
            ,   function(e) { $(this).removeClass("ui-state-hover"); }
            );
            // do not let the focus wander around
            closeItem.focus(function(e) { 
                var aGroup = $(this);
                e.stopImmediatePropagation();
            });
            return closeItem;
        },
        // Creates the drop items and appends them to the drop container
        // Also calculates the size needed by the drop container and returns it
        _appendItems: function() {
            var self = this, config = this.options, sourceSelect = this.sourceSelect, dropWrapper = this.dropWrapper;
            var dropContainerDiv = dropWrapper.find(".ui-dropdownchecklist-dropcontainer");
            sourceSelect.children().each(function(index) { // when the select has groups
                var opt = $(this);
                if (opt.is("option")) {
                    self._appendOption(opt, dropContainerDiv, index, false, false);
                } else if (opt.is("optgroup")) {
                    var disabled = opt.attr("disabled");
                    var text = opt.attr("label");
                    if (text != "") {
                        var group = self._createGroupItem(text,disabled);
                        dropContainerDiv.append(group);
                    }
                    self._appendOptions(opt, dropContainerDiv, index, true, disabled);
                }
            });
            if ( config.explicitClose != null ) {
                var closeItem = self._createCloseItem(config.explicitClose);
                dropContainerDiv.append(closeItem);
            }
            var divWidth = dropContainerDiv.outerWidth();
            var divHeight = dropContainerDiv.outerHeight();
            if (divHeight == 0){ // if it fails to render the item height - usually happens when loading via ajax
                var h = 0;
                dropContainerDiv.find(".ui-dropdownchecklist-item").each(function () {
                    h = h + parseInt($(this).css("height")) + 6;
                });
                divHeight = h;
            }
                
            return { width: divWidth, height: divHeight };
        },
        _appendOptions: function(parent, container, parentIndex, indent, forceDisabled) {
            var self = this;
            parent.children("option").each(function(index) {
                var option = $(this);
                var childIndex = (parentIndex + "." + index);
                self._appendOption(option, container, childIndex, indent, forceDisabled);
            });
        },
        _appendOption: function(option, container, index, indent, forceDisabled) {
            var self = this;
            var text = option.text();
            var value = option.val();
            var selected = option.attr("selected");
            var disabled = (forceDisabled || option.attr("disabled"));
            // Use the same tab index as the selector replacement
            var tabIndex = self.controlSelector.attr("tabindex");
            var item = self._createDropItem(index, tabIndex, value, text, selected, disabled, indent);
            container.append(item);
        },
        // Synchronizes the items checked and the source select
        // When firstItemChecksAll option is active also synchronizes the checked items
        // senderCheckbox parameters is the checkbox input that generated the synchronization
        _syncSelected: function(senderCheckbox) {
            var self = this, options = this.options, sourceSelect = this.sourceSelect, dropWrapper = this.dropWrapper;
            var selectOptions = sourceSelect.get(0).options;
            var allCheckboxes = dropWrapper.find("input.active");
            if (options.firstItemChecksAll) {
                if ((senderCheckbox == null) && $(selectOptions[0]).attr("selected") ) {
                    // Initialization call with first item active so force all to be active
                    allCheckboxes.attr("checked", true);
                } else if ((senderCheckbox != null) && (senderCheckbox.attr("index") == 0)) {
                    // Check all checkboxes if the first one is checked
                    allCheckboxes.attr("checked", senderCheckbox.attr("checked"));
                } else  {
                    // check the first checkbox if all the other checkboxes are checked
                    var allChecked = true;
                    var firstCheckbox = null;
                    allCheckboxes.each(function(index) {
                        if (index > 0) {
                            var checked = $(this).attr("checked");
                            if (!checked) { allChecked = false; }
                        } else {
                            firstCheckbox = $(this);
                        }
                    });
                    if ( firstCheckbox != null ) {
                        firstCheckbox.attr("checked", allChecked );
                    }
                }
            }
            // do the actual synch with the source select
            allCheckboxes = dropWrapper.find("input");
            allCheckboxes.each(function(index) {
                if($(this).attr("checked") == true)
                    $(this).parent().addClass("ui-state-active");
                else
                    $(this).parent().removeClass("ui-state-active");
                    
                $(selectOptions[index]).attr("selected", $(this).attr("checked"));
            });
            // update the text shown in the control
            self._updateControlText();
            
            // Ensure the focus stays pointing where the user is working
            if ( senderCheckbox != null) { senderCheckbox.focus(); }
        },
        _sourceSelectChangeHandler: function(event) {
            var self = this, dropWrapper = this.dropWrapper;
            dropWrapper.find("input").val(self.sourceSelect.val());

            // update the text shown in the control
            self._updateControlText();
        },
        // Updates the text shown in the control depending on the checked (selected) items
        _updateControlText: function() {
            var self = this, sourceSelect = this.sourceSelect, options = this.options, controlWrapper = this.controlWrapper;
            var firstOption = sourceSelect.find("option:first");
            var selectOptions = sourceSelect.find("option");
            var text = self._formatText(selectOptions, options.firstItemChecksAll, firstOption);
            var controlLabel = controlWrapper.find(".ui-dropdownchecklist-text");
            controlLabel.html(text);
            controlLabel.attr("title", text);
        },
        // Formats the text that is shown in the control
        _formatText: function(selectOptions, firstItemChecksAll, firstOption) {
            var text;
            if ( $.isFunction(this.options.textFormatFunction) ) {
                // let the callback do the formatting, but do not allow it to fail
                try {
                    text = this.options.textFormatFunction(selectOptions);
                } catch(ex) {
                    alert( 'textFormatFunction failed: ' + ex );
                }
            } else if (firstItemChecksAll && (firstOption != null) && firstOption.attr("selected")) {
                // just set the text from the first item
                text = firstOption.text();
            } else {
                // concatenate the text from the checked items
                text = "";
                selectOptions.each(function() {
                    if ($(this).attr("selected")) {
                        if ( text != "" ) { text += ", "; }
                        text += $(this).text();
                    }
                });
                if ( text == "" ) {
                    text = (this.options.emptyText != null) ? this.options.emptyText : "&nbsp;";
                }
            }
            return text;
        },
        // Shows and hides the drop container
        _toggleDropContainer: function( makeOpen ) {
            var self = this;
            // hides the last shown drop container
            var hide = function(instance) {
                if ((instance != null) && instance.dropWrapper.isOpen ){
                    instance.dropWrapper.isOpen = false;
                    $.ui.dropdownchecklist.gLastOpened = null;

                    var config = instance.options;
                    instance.dropWrapper.css({
                        top: "-33000px",
                        left: "-33000px"
                    });
                    var aControl = instance.controlSelector;
                    aControl.removeClass("ui-state-active");
                    aControl.removeClass("ui-state-hover");

                    var anIcon = instance.controlWrapper.find(".ui-icon");
                    if ( anIcon.length > 0 ) {
                        anIcon.removeClass( (config.icon.toClose != null) ? config.icon.toClose : "ui-icon-triangle-1-s");
                        anIcon.addClass( (config.icon.toOpen != null) ? config.icon.toOpen : "ui-icon-triangle-1-e");
                    }
                    $(document).unbind("click", hide);
                    
                    // keep the items out of the tab order by disabling them
                    instance.dropWrapper.find("input.active").attr("disabled","disabled");
                    
                    // the following blur just does not fire???  because it is hidden???  because it does not have focus???
                    //instance.sourceSelect.trigger("blur");
                    //instance.sourceSelect.triggerHandler("blur");
                    if($.isFunction(config.onComplete)) { try {
                        config.onComplete.call(instance,instance.sourceSelect.get(0));
                    } catch(ex) {
                        alert( 'callback failed: ' + ex );
                    }}
                }
            };
            // shows the given drop container instance
            var show = function(instance) {
                if ( !instance.dropWrapper.isOpen ) {
                    instance.dropWrapper.isOpen = true;
                    $.ui.dropdownchecklist.gLastOpened = instance;

                    var config = instance.options;
/**** Issue127 (and the like) to correct positioning when parent element is relative
 ****   This positioning only worked with simple, non-relative parent position
                    instance.dropWrapper.css({
                        top: instance.controlWrapper.offset().top + instance.controlWrapper.outerHeight() + "px",
                        left: instance.controlWrapper.offset().left + "px"
                    });
****/
                    if ((config.positionHow == null) || (config.positionHow == 'absolute')) {
                        /** Floats above subsequent content, but does NOT scroll */
                        instance.dropWrapper.css({
                            position: 'absolute'
                        ,   top: instance.controlWrapper.position().top + instance.controlWrapper.outerHeight() + "px"
                        ,   left: instance.controlWrapper.position().left + "px"
                        });
                    } else if (config.positionHow == 'relative') {
                        /** Scrolls with the parent but does NOT float above subsequent content */
                        instance.dropWrapper.css({
                            position: 'relative'
                        ,   top: "0px"
                        ,   left: "0px"
                        });
                    }
                    var ancestorsZIndexes = instance.controlWrapper.parents().map(
                        function() {
                            var zIndex = $(this).css("z-index");
                            return isNaN(zIndex) ? 0 : zIndex; }
                        ).get();
                    var parentZIndex = Math.max.apply(Math, ancestorsZIndexes);
                    if (parentZIndex > 0) {
                        instance.dropWrapper.css({
                            zIndex: (parentZIndex+1)
                        });
                    }
                    var aControl = instance.controlSelector;
                    aControl.addClass("ui-state-active");
                    aControl.removeClass("ui-state-hover");
                    
                    var anIcon = instance.controlWrapper.find(".ui-icon");
                    if ( anIcon.length > 0 ) {
                        anIcon.removeClass( (config.icon.toOpen != null) ? config.icon.toOpen : "ui-icon-triangle-1-e");
                        anIcon.addClass( (config.icon.toClose != null) ? config.icon.toClose : "ui-icon-triangle-1-s");
                    }
                    $(document).bind("click", function(e) {hide(instance);} );
                    
                    // insert the items back into the tab order by enabling all active ones
                    var activeItems = instance.dropWrapper.find("input.active");
                    activeItems.removeAttr("disabled");
                    
                    // we want the focus on the first active input item
                    var firstActiveItem = activeItems.get(0);
                    if ( firstActiveItem != null ) {
                        firstActiveItem.focus();
                    }
                }
            };
            if ( makeOpen ) {
                hide($.ui.dropdownchecklist.gLastOpened);
                show(self);
            } else {
                hide(self);
            }
        },
        // Set the size of the control and of the drop container
        _setSize: function(dropCalculatedSize) {
            var options = this.options, dropWrapper = this.dropWrapper, controlWrapper = this.controlWrapper;
            // use the width from config options if set, otherwise set the same width as the drop container
            var controlWidth = dropCalculatedSize.width;
            if (options.width != null) {
                controlWidth = parseInt(options.width);
            } else if (options.minWidth != null) {
                var minWidth = parseInt(options.minWidth);
                // if the width is too small (usually when there are no items) set a minimum width
                if (controlWidth < minWidth) {
                    controlWidth = minWidth;
                }
            }
            var control = this.controlSelector;
            control.css({ width: controlWidth + "px" });
            controlWrapper.css({ width: controlWidth + 4 + "px" }); // * added to resize wrapper with display: "block" style to render properly
            // if we size the text, then Firefox places icons to the right properly
            // and we do not wrap on long lines
            var controlText = control.find(".ui-dropdownchecklist-text");
            var controlIcon = control.find(".ui-icon");
            if ( controlIcon != null ) {
                // Must be an inner/outer/border problem, but IE6 needs an extra bit of space,
                // otherwise you can get text pushed down into a second line when icons are active
                controlWidth -= (controlIcon.outerWidth() + 4);
                controlText.css( { width: (controlWidth) + "px" } );
            }
            // Account for padding, borders, etc
            controlWidth = controlWrapper.outerWidth();
            
            // the drop container height can be set from options
            var maxDropHeight = (options.maxDropHeight != null)
                                ? parseInt(options.maxDropHeight)
                                : -1;
            var dropHeight = ((maxDropHeight > 0) && (dropCalculatedSize.height > maxDropHeight))
                                ? maxDropHeight 
                                : dropCalculatedSize.height;
            
            // ensure the drop container is not less than the control width (would be ugly)
            var dropWidth = dropCalculatedSize.width < controlWidth ? controlWidth : dropCalculatedSize.width;
            
            $(dropWrapper).css({
                height: dropHeight + "px",
                width: dropWidth-2 + "px" // -2 for border fix
            });
            dropWrapper.find(".ui-dropdownchecklist-dropcontainer").css({
                height: dropHeight + "px"
            });
        },
        // Initializes the plugin
        _init: function() {
            var self = this, options = this.options;
            if ($.ui.dropdownchecklist.gIDCounter == null) {
                $.ui.dropdownchecklist.gIDCounter = 1;
            }
            // item blurring relies on a cancelable timer
            self.blurringItem = null;

            // sourceSelect is the select on which the plugin is applied
            var sourceSelect = self.element;
            self.initialDisplay = sourceSelect.css("display");
            sourceSelect.css("display", "none");
            self.initialMultiple = sourceSelect.attr("multiple");
            self.isMultiple = self.initialMultiple;
            if (options.forceMultiple != null) { self.isMultiple = options.forceMultiple; }
            sourceSelect.attr("multiple", true);
            self.sourceSelect = sourceSelect;

            // append the control that resembles a single selection select
            var controlWrapper = self._appendControl();
            self.controlWrapper = controlWrapper;
            self.controlSelector = controlWrapper.find(".ui-dropdownchecklist-selector");

            // create the drop container where the items are shown
            var dropWrapper = self._appendDropContainer(controlWrapper);
            self.dropWrapper = dropWrapper;

            // append the items from the source select element
            var dropCalculatedSize = self._appendItems();

            // updates the text shown in the control
            self._updateControlText(controlWrapper, dropWrapper, sourceSelect);

            // set the sizes of control and drop container
            self._setSize(dropCalculatedSize);
            
            // look for possible auto-check needed on first item
            if ( options.firstItemChecksAll ) {
                self._syncSelected(null);
            }
            // BGIFrame for IE6
            if (options.bgiframe && typeof self.dropWrapper.bgiframe == "function") {
                self.dropWrapper.bgiframe();
            }
            // listen for change events on the source select element
            // ensure we avoid processing internally triggered changes
            self.sourceSelect.change(function(event, eventName) {
                if (eventName != 'ddcl_internal') {
                    self._sourceSelectChangeHandler(event);
                }
            });
            $(".ui-dropdownchecklist").disableSelection();
        },
        // Refresh the disable and check state from the underlying control
        _refreshOption: function(item,disabled,selected) {
            var aParent = item.parent();
            // account for enabled/disabled
            if ( disabled ) {
                item.attr("disabled","disabled");
                item.removeClass("active");
                item.addClass("inactive");
                aParent.addClass("ui-state-disabled");
            } else {
                item.removeAttr("disabled");
                item.removeClass("inactive");
                item.addClass("active");
                aParent.removeClass("ui-state-disabled");
            }
            // adjust the checkbox state
            item.attr("checked",selected);
        },
        _refreshGroup: function(group,disabled) {
            if ( disabled ) {
                group.addClass("ui-state-disabled");
            } else {
                group.removeClass("ui-state-disabled");
            }
        },
        // External command to explicitly close the dropdown
        close: function() {
            this._toggleDropContainer(false);
        },
        // External command to refresh the ddcl from the underlying selector
        refresh: function() {
            var self = this, sourceSelect = this.sourceSelect, dropWrapper = this.dropWrapper;
           
            var allCheckBoxes = dropWrapper.find("input");
            var allGroups = dropWrapper.find(".ui-dropdownchecklist-group");
            
            var groupCount = 0;
            var optionCount = 0;
            sourceSelect.children().each(function(index) {
                var opt = $(this);
                
                var disabled = opt.attr("disabled");
                if (opt.is("option")) {
                    var selected = opt.attr("selected");
                    var anItem = $(allCheckBoxes[optionCount]);
                    self._refreshOption(anItem, disabled, selected);
                    optionCount += 1;
                } else if (opt.is("optgroup")) {
                    var text = opt.attr("label");
                    if (text != "") {
                        var aGroup = $(allGroups[groupCount]);
                        self._refreshGroup(aGroup, disabled);
                        groupCount += 1;
                    }
                    opt.children("option").each(function(subindex) {
                        var subopt = $(this);
                        var subdisabled = (disabled || subopt.attr("disabled"));
                        var selected = subopt.attr("selected");
                        var subItem = $(allCheckBoxes[optionCount + subindex]);
                        self._refreshOption(subItem, subdisabled, selected );
                    });
                }
            });
            // update the text shown in the control
            self._updateControlText();
        },
        // External command to enable the ddcl control
        enable: function() {
            this.controlSelector.removeClass("ui-state-disabled");
            this.disabled = false;
        },
        // External command to disable the ddcl control
        disable: function() {
            this.controlSelector.addClass("ui-state-disabled");
            this.disabled = true;
        },
        // External command to destroy all traces of the ddcl control
        destroy: function() {
            $.Widget.prototype.destroy.apply(this, arguments);
            this.sourceSelect.css("display", this.initialDisplay);
            this.sourceSelect.attr("multiple", this.initialMultiple);
            this.controlWrapper.unbind().remove();
            this.dropWrapper.remove();
        }
    });

    $.extend($.ui.dropdownchecklist, {
        defaults: {
            width: null,
            maxDropHeight: null,
            firstItemChecksAll: false,
            closeRadioOnClick: false,
            minWidth: 50,
            positionHow: 'absolute',
            bgiframe: false,
            explicitClose: null
        }
    });

})(jQuery);


/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
    def: 'easeOutQuad',
    swing: function (x, t, b, c, d) {
        //alert(jQuery.easing.default);
        return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
    },
    easeInQuad: function (x, t, b, c, d) {
        return c*(t/=d)*t + b;
    },
    easeOutQuad: function (x, t, b, c, d) {
        return -c *(t/=d)*(t-2) + b;
    },
    easeInOutQuad: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t + b;
        return -c/2 * ((--t)*(t-2) - 1) + b;
    },
    easeInCubic: function (x, t, b, c, d) {
        return c*(t/=d)*t*t + b;
    },
    easeOutCubic: function (x, t, b, c, d) {
        return c*((t=t/d-1)*t*t + 1) + b;
    },
    easeInOutCubic: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t + b;
        return c/2*((t-=2)*t*t + 2) + b;
    },
    easeInQuart: function (x, t, b, c, d) {
        return c*(t/=d)*t*t*t + b;
    },
    easeOutQuart: function (x, t, b, c, d) {
        return -c * ((t=t/d-1)*t*t*t - 1) + b;
    },
    easeInOutQuart: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
        return -c/2 * ((t-=2)*t*t*t - 2) + b;
    },
    easeInQuint: function (x, t, b, c, d) {
        return c*(t/=d)*t*t*t*t + b;
    },
    easeOutQuint: function (x, t, b, c, d) {
        return c*((t=t/d-1)*t*t*t*t + 1) + b;
    },
    easeInOutQuint: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
        return c/2*((t-=2)*t*t*t*t + 2) + b;
    },
    easeInSine: function (x, t, b, c, d) {
        return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
    },
    easeOutSine: function (x, t, b, c, d) {
        return c * Math.sin(t/d * (Math.PI/2)) + b;
    },
    easeInOutSine: function (x, t, b, c, d) {
        return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
    },
    easeInExpo: function (x, t, b, c, d) {
        return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
    },
    easeOutExpo: function (x, t, b, c, d) {
        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
    },
    easeInOutExpo: function (x, t, b, c, d) {
        if (t==0) return b;
        if (t==d) return b+c;
        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
    },
    easeInCirc: function (x, t, b, c, d) {
        return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
    },
    easeOutCirc: function (x, t, b, c, d) {
        return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
    },
    easeInOutCirc: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
        return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
    },
    easeInElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
    },
    easeOutElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
    },
    easeInOutElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
        return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
    },
    easeInBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c*(t/=d)*t*((s+1)*t - s) + b;
    },
    easeOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
    },
    easeInOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158; 
        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
    },
    easeInBounce: function (x, t, b, c, d) {
        return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
    },
    easeOutBounce: function (x, t, b, c, d) {
        if ((t/=d) < (1/2.75)) {
            return c*(7.5625*t*t) + b;
        } else if (t < (2/2.75)) {
            return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
        } else if (t < (2.5/2.75)) {
            return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
        } else {
            return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
        }
    },
    easeInOutBounce: function (x, t, b, c, d) {
        if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
        return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
    }
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
 
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------


/*!
 * jQuery Form Plugin
 * version: 2.63 (29-JAN-2011)
 * @requires jQuery v1.3.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
 */
;(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(e) {
            e.preventDefault(); // <-- important
            $(this).ajaxSubmit({
                target: '#output'
            });
        });
    });

    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 };
    }

    var action = this.attr('action');
    var url = (typeof action === 'string') ? $.trim(action) : '';
    if (url) {
        // clean url (don't include hash vaue)
        url = (url.match(/^([^#]+)/)||[])[1];
    }
    url = url || window.location.href || '';

    options = $.extend(true, {
        url:  url,
        type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
        iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
    }, 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 n,v,a = this.formToArray(options.semantic);
    if (options.data) {
        options.extraData = options.data;
        for (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 {
                v = options.data[n];
                v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
                a.push( { name: n, value: v } );
            }
        }
    }

    // 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) {
            var fn = options.replaceTarget ? 'replaceWith' : 'html';
            $(options.target)[fn](data).each(oldSuccess, arguments);
        });
    }
    else if (options.success) {
        callbacks.push(options.success);
    }

    options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
        var context = options.context || options;   // jQuery 1.4+ supports scope context
        for (var i=0, max=callbacks.length; i < max; i++) {
            callbacks[i].apply(context, [data, status, xhr || $form, $form]);
        }
    };

    // are there files to upload?
    var fileInputs = $('input:file', this).length > 0;
    var mp = 'multipart/form-data';
    var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);

    // options.iframe allows user to force iframe mode
    // 06-NOV-09: now defaulting to iframe mode if file input is detected
   if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
       // hack to fix Safari hang (thanks to Tim Molendijk for this)
       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
       if (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],:input[id=submit]', form).length) {
            // if there is an input with a name or id of 'submit' then we won't be
            // able to invoke the submit fn on the form (at least not x-browser)
            alert('Error: Form elements must not have name or id of "submit".');
            return;
        }

        var s = $.extend(true, {}, $.ajaxSettings, options);
        s.context = s.context || s;
        var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
        var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
        var io = $io[0];

        $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', s.iframeSrc); // abort op in progress
            }
        };

        var g = s.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, s]);
        }

        if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
            if (s.global) {
                $.active--;
            }
            return;
        }
        if (xhr.aborted) {
            return;
        }

        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) {
                s.extraData = s.extraData || {};
                s.extraData[n] = sub.value;
                if (sub.type == "image") {
                    s.extraData[n+'.x'] = form.clk_x;
                    s.extraData[n+'.y'] = form.clk_y;
                }
            }
        }

        // take a breath so that pending repaints get some cpu time before the upload starts
        function doSubmit() {
            // make sure form attrs are set
            var t = $form.attr('target'), a = $form.attr('action');

            // update form attrs in IE friendly way
            form.setAttribute('target',id);
            if (form.getAttribute('method') != 'POST') {
                form.setAttribute('method', 'POST');
            }
            if (form.getAttribute('action') != s.url) {
                form.setAttribute('action', s.url);
            }

            // ie borks in some cases when setting encoding
            if (! s.skipEncodingOverride) {
                $form.attr({
                    encoding: 'multipart/form-data',
                    enctype:  'multipart/form-data'
                });
            }

            // support timout
            if (s.timeout) {
                setTimeout(function() { timedOut = true; cb(); }, s.timeout);
            }

            // add "extra" data to form if provided in options
            var extraInputs = [];
            try {
                if (s.extraData) {
                    for (var n in s.extraData) {
                        extraInputs.push(
                            $('<input type="hidden" name="'+n+'" value="'+s.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.setAttribute('action',a);
                if(t) {
                    form.setAttribute('target', t);
                } else {
                    $form.removeAttr('target');
                }
                $(extraInputs).remove();
            }
        }

        if (s.forceSync) {
            doSubmit();
        }
        else {
            setTimeout(doSubmit, 10); // this lets dom updates render
        }

        var data, doc, domCheckCount = 50;

        function cb() {
            doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
            if (!doc || doc.location.href == s.iframeSrc) {
                // response not received yet
                return;
            }
            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

            var ok = true;
            try {
                if (timedOut) {
                    throw 'timeout';
                }

                var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
                log('isXml='+isXml);
                if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
                    if (--domCheckCount) {
                        // in some browsers (Opera) the iframe DOM is not always traversable when
                        // the onload callback fires, so we loop a bit to accommodate
                        log('requeing onLoad callback, DOM not available');
                        setTimeout(cb, 250);
                        return;
                    }
                    // let this fall through because server response could be an empty document
                    //log('Could not access iframe DOM after mutiple tries.');
                    //throw 'DOMException: not available';
                }

                //log('response detected');
                xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
                xhr.getResponseHeader = function(header){
                    var headers = {'content-type': s.dataType};
                    return headers[header];
                };

                var scr = /(json|script)/.test(s.dataType);
                if (scr || s.textarea) {
                    // see if user embedded response in textarea
                    var ta = doc.getElementsByTagName('textarea')[0];
                    if (ta) {
                        xhr.responseText = ta.value;
                    }
                    else if (scr) {
                        // account for browsers injecting pre around json response
                        var pre = doc.getElementsByTagName('pre')[0];
                        var b = doc.getElementsByTagName('body')[0];
                        if (pre) {
                            xhr.responseText = pre.textContent;
                        }
                        else if (b) {
                            xhr.responseText = b.innerHTML;
                        }
                    }
                }
                else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
                    xhr.responseXML = toXml(xhr.responseText);
                }

                data = httpData(xhr, s.dataType, s);
            }
            catch(e){
                log('error caught:',e);
                ok = false;
                xhr.error = e;
                s.error.call(s.context, xhr, 'error', e);
                g && $.event.trigger("ajaxError", [xhr, s, e]);
            }

            if (xhr.aborted) {
                log('upload aborted');
                ok = false;
            }

            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
            if (ok) {
                s.success.call(s.context, data, 'success', xhr);
                g && $.event.trigger("ajaxSuccess", [xhr, s]);
            }

            g && $.event.trigger("ajaxComplete", [xhr, s]);

            if (g && ! --$.active) {
                $.event.trigger("ajaxStop");
            }

            s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');

            // clean up
            setTimeout(function() {
                $io.removeData('form-plugin-onload');
                $io.remove();
                xhr.responseXML = null;
            }, 100);
        }

        var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
            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.nodeName != 'parsererror') ? doc : null;
        };
        var parseJSON = $.parseJSON || function(s) {
            return window['eval']('(' + s + ')');
        };

        var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
            var ct = xhr.getResponseHeader('content-type') || '',
                xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
                data = xml ? xhr.responseXML : xhr.responseText;

            if (xml && data.documentElement.nodeName === 'parsererror') {
                $.error && $.error('parsererror');
            }
            if (s && s.dataFilter) {
                data = s.dataFilter(data, type);
            }
            if (typeof data === 'string') {
                if (type === 'json' || !type && ct.indexOf('json') >= 0) {
                    data = parseJSON(data);
                } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
                    $.globalEval(data);
                }
            }
            return data;
        };
    }
};

/**
 * 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) {
    // in jQuery 1.3+ we can fix mistakes with the ready state
    if (this.length === 0) {
        var o = { s: this.selector, c: this.context };
        if (!$.isReady && o.s) {
            log('DOM not ready, queuing ajaxForm');
            $(function() {
                $(o.s,o.c).ajaxForm(options);
            });
            return this;
        }
        // is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
        log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
        return this;
    }

    return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
        if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
            e.preventDefault();
            $(this).ajaxSubmit(options);
        }
    }).bind('click.form-plugin', function(e) {
        var target = e.target;
        var $el = $(target);
        if (!($el.is(":submit,input:image"))) {
            // is this a child element of the submit el?  (ex: a span within a button)
            var t = $el.closest(':submit');
            if (t.length == 0) {
                return;
            }
            target = t[0];
        }
        var form = this;
        form.clk = target;
        if (target.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 = $el.offset();
                form.clk_x = e.pageX - offset.left;
                form.clk_y = e.pageY - offset.top;
            } else {
                form.clk_x = e.pageX - target.offsetLeft;
                form.clk_y = e.pageY - target.offsetTop;
            }
        }
        // clear form vars
        setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
    });
};

// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
    return this.unbind('submit.form-plugin 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;
    }

    var i,j,n,v,el,max,jmax;
    for(i=0, max=els.length; i < max; i++) {
        el = els[i];
        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, value: $(el).val()});
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
            }
            continue;
        }

        v = $.fieldValue(el, true);
        if (v && v.constructor == Array) {
            for(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 it here
        var $input = $(form.clk), input = $input[0];
        n = input.name;
        if (n && !input.disabled && input.type == 'image') {
            a.push({name: n, value: $input.val()});
            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 (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) {
                var v = op.value;
                if (!v) { // extra pain for IE...
                    v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
                }
                if (one) {
                    return v;
                }
                a.push(v);
            }
        }
        return a;
    }
    return $(el).val();
};

/**
 * 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) {
        var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
        if (window.console && window.console.log) {
            window.console.log(msg);
        }
        else if (window.opera && window.opera.postError) {
            window.opera.postError(msg);
        }
    }
};

})(jQuery);

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------


/**
*   @name                           Valid8
*   @descripton                     An input field validation plugin for Jquery
*   @version                        1.3
*   @requires                       Jquery 1.3.2+
*
*   @author                         Jan Jarfalk
*   @author-email                   jan.jarfalk@unwrongest.com
*   @author-website                 http://www.unwrongest.com
*
*   @licens                         MIT License - http://www.opensource.org/licenses/mit-license.php
*/

(function($){ 
     $.fn.extend({
        
         valid8: function(options) {        
            return this.each(function(){
                
                $(this).data('valid', false);
                
                var defaultOptions = {
                    regularExpressions: [],
                    ajaxRequests: [],
                    jsFunctions: [],
                    validationEvents: ['keyup','blur','change'],
                    validationFrequency: 1000,
                    values: null,
                    defaultErrorMessage: '← Bu alanın seçilmesi/doldurulması zorunludur.'
                };
                
                if(typeof options == 'string')
                    defaultOptions.defaultErrorMessage = options;
                    
                if(this.type == 'checkbox'){
                    defaultOptions.regularExpressions = [{expression: /^true$/, errormessage: defaultOptions.defaultErrorMessage}];
                    defaultOptions.validationEvents = ['click'];
                } else
                    defaultOptions.regularExpressions = [{expression: /^.+$/, errormessage: defaultOptions.defaultErrorMessage}];
                
                $(this).data('settings', $.extend(defaultOptions, options));
                
                initialize(this);
                
                                
            });
        },
        
        isValid: function(){
            var valid = true;
            this.each(function() {
                validate(this);
                if($(this).data('valid') == false)
                    valid = false;
            });
            return valid;
        }
        
    });
    
    function initializeDataObject(el){
        $(el).data('loadings', new Array());
        $(el).data('errors', new Array());
        $(el).data('valids', new Array());
        $(el).data('keypressTimer', null);
    }
    
    function initialize(el) {
        initializeDataObject(el);
        /*if($(el).attr('value').length > 0 && el.type != 'checkbox')
            validate(el);*/

        activate(el);
    };
    
    function activate(el) {
        var events = $(el).data('settings').validationEvents;
        if(typeof events == 'string')
            $(el)[events](function (e){ handleEvent(e, el); });
        else {
            $.each(events, function(i, event){
                $(el)[event](function (e){ handleEvent(e, el); });
            });
        }
    };
    
    function validate(el) {
        // Dispose old errors and valids
        initializeDataObject(el);

        var value;

        // Handle checkbox
        if(el.type == 'checkbox')
            value = el.checked.toString();
        else
            value = el.value;
                
        regexpValidation(value.replace(/^[ \t]+|[ \t]+$/,''),el);
    };
    
    function regexpValidation(value, el){
        
        $.each($(el).data('settings').regularExpressions, function(i, validator){
            if(!validator.expression.test(value))
                $(el).data('errors')[$(el).data('errors').length] = validator.errormessage;
            else if(validator.validmessage)
                $(el).data('valids')[$(el).data('valids').length] = validator.validmessage;
        });
        
        if($(el).data('errors').length > 0)
            onEvent(el,'error',false);
        else if($(el).data('settings').jsFunctions.length > 0) {
            functionValidation(value, el);
        }
        else if($(el).data('settings').ajaxRequests.length > 0){
            fileValidation(value, el);
        }
        else {
            onEvent(el,'valid',true);
        }
                        
    };
    
    function functionValidation(value, el){
            
        $.each($(el).data('settings').jsFunctions, function(i, validator){
            
            var v;
            if(validator.values){
                if(typeof validator.values == 'function')
                    v = validator.values();
            }
            
            var values = v || value;
            
            handleLoading(el, validator);
            
            if(validator['function'](values).valid)
                $(el).data('valids')[$(el).data('valids').length] = validator['function'](values).message;
            else
                $(el).data('errors')[$(el).data('errors').length] = validator['function'](values).message;  
        });
        
        if($(el).data('errors').length > 0)
            onEvent(el,'error',false);
        else if($(el).data('settings').ajaxRequests.length > 0) {
            fileValidation(value, el);
        }
        else {
            onEvent(el,'valid',true);
        }
    };
    
    function fileValidation(value, el){
    

        $.each($(el).data('settings').ajaxRequests, function(i, validator){
            
            var v;
            if(validator.values){
                if(typeof validator.values == 'function')
                    v = validator.values();
            }
            
            var values = v || {value: value};
            
            handleLoading(el, validator);
            
            $.post(validator.url, values,
              function(data, textStatus){
                if(data.valid) {
                    $(el).data('valids')[$(el).data('valids').length] = data.message || validator.validmessage || "";
                } else {
                    $(el).data('errors')[$(el).data('errors').length] = data.message || validator.errormessage || "";
                }
                    if($(el).data('errors').length > 0)
                        onEvent(el,'error',false);
                    else {
                        onEvent(el,'valid',true);
                    }
              }, "json");
        });
        
    };
    
    function handleEvent(e, el){
        if(e.keyCode && $(el).attr('value').length > 0) {
            clearTimeout($(el).data('keypressTimer'));
            $(el).data('keypressTimer',setTimeout(function() {
                validate(el);
            }, $(el).data('settings').validationFrequency));
        }
        else if(e.keyCode && $(el).attr('value').length <= 0)
            return false;
        else {
            validate(el);
        }
    };
    
    function handleLoading(el, validator) {
        if(validator.loadingmessage){
            $(el).data('loadings')[$(el).data('loadings').length] = validator.loadingmessage;
            onEvent(el,'loading',false);
        }
    };
    
    function onEvent(el, event, valid) {
        
        var capitalizedEvent = event.substring(0,1).toUpperCase() + event.substring(1,event.length),
            messages = $(el).data(event+'s');
        
        $(el).data(event, valid);
        
        setStatus(el, event);
        setParentClass(el,event);
        setMessage(messages,el);
        
        $(el).trigger(event,[messages,el,event]);
    }
    
    function setParentClass(el,className) {
        var parent = $(el).parent();
        parent[0].className = (parent[0].className.replace(/(^\s|(\s*(loading|error|valid)))/g,'') + ' ' + className).replace(/^\s/,'');
    }
    
    function setMessage(messages,el) {
        var parent = $(el).parent();
        var elementId = el.id + "ValidationMessage";
        var elementClass = 'ui-state-error';        
        if(!$('#'+elementId).length > 0){
            parent.append('<div id="' + elementId + '" class="' + elementClass + ' valid8error"></div>');
        }
    
        $('#'+elementId).html("");
        $('#'+elementId).text(messages[0]);
    };
    
    function setStatus(el, status){
        if(status == 'valid'){
            $(el).data('valid', true);
        } else if (status == 'error') {
            $(el).data('valid', false);
        }
    };
    
})(jQuery);

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/**
* author Remy Sharp
* url http://remysharp.com/tag/marquee
*/

(function ($) {
    $.fn.marquee = function (klass) {
        var newMarquee = [],
            last = this.length;

        // works out the left or right hand reset position, based on scroll
        // behavior, current direction and new direction
        function getReset(newDir, marqueeRedux, marqueeState) {
            var behavior = marqueeState.behavior, width = marqueeState.width, dir = marqueeState.dir;
            var r = 0;
            if (behavior == 'alternate') {
                r = newDir == 1 ? marqueeRedux[marqueeState.widthAxis] - (width*2) : width;
            } else if (behavior == 'slide') {
                if (newDir == -1) {
                    r = dir == -1 ? marqueeRedux[marqueeState.widthAxis] : width;
                } else {
                    r = dir == -1 ? marqueeRedux[marqueeState.widthAxis] - (width*2) : 0;
                }
            } else {
                r = newDir == -1 ? marqueeRedux[marqueeState.widthAxis] : 0;
            }
            return r;
        }

        // single "thread" animation
        function animateMarquee() {
            var i = newMarquee.length,
                marqueeRedux = null,
                $marqueeRedux = null,
                marqueeState = {},
                newMarqueeList = [],
                hitedge = false;
                
            while (i--) {
                marqueeRedux = newMarquee[i];
                $marqueeRedux = $(marqueeRedux);
                marqueeState = $marqueeRedux.data('marqueeState');
                
                if ($marqueeRedux.data('paused') !== true) {
                    // TODO read scrollamount, dir, behavior, loops and last from data
                    marqueeRedux[marqueeState.axis] += (marqueeState.scrollamount * marqueeState.dir);

                    // only true if it's hit the end
                    hitedge = marqueeState.dir == -1 ? marqueeRedux[marqueeState.axis] <= getReset(marqueeState.dir * -1, marqueeRedux, marqueeState) : marqueeRedux[marqueeState.axis] >= getReset(marqueeState.dir * -1, marqueeRedux, marqueeState);
                    
                    if ((marqueeState.behavior == 'scroll' && marqueeState.last == marqueeRedux[marqueeState.axis]) || (marqueeState.behavior == 'alternate' && hitedge && marqueeState.last != -1) || (marqueeState.behavior == 'slide' && hitedge && marqueeState.last != -1)) {                        
                        if (marqueeState.behavior == 'alternate') {
                            marqueeState.dir *= -1; // flip
                        }
                        marqueeState.last = -1;

                        $marqueeRedux.trigger('stop');

                        marqueeState.loops--;
                        if (marqueeState.loops === 0) {
                            if (marqueeState.behavior != 'slide') {
                                marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
                            } else {
                                // corrects the position
                                marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir * -1, marqueeRedux, marqueeState);
                            }

                            $marqueeRedux.trigger('end');
                        } else {
                            // keep this marquee going
                            newMarqueeList.push(marqueeRedux);
                            $marqueeRedux.trigger('start');
                            marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
                        }
                    } else {
                        newMarqueeList.push(marqueeRedux);
                    }
                    marqueeState.last = marqueeRedux[marqueeState.axis];

                    // store updated state only if we ran an animation
                    $marqueeRedux.data('marqueeState', marqueeState);
                } else {
                    // even though it's paused, keep it in the list
                    newMarqueeList.push(marqueeRedux);                    
                }
            }

            newMarquee = newMarqueeList;
            
            if (newMarquee.length) {
                setTimeout(animateMarquee, 25);
            }            
        }
        
        // TODO consider whether using .html() in the wrapping process could lead to loosing predefined events...
        this.each(function (i) {
            var $marquee = $(this),
                width = $marquee.attr('width') || $marquee.width(),
                height = $marquee.attr('height') || $marquee.height(),
                $marqueeRedux = $marquee.after('<div ' + (klass ? 'class="' + klass + '" ' : '') + 'style="display: block-inline; width: ' + width + 'px; height: ' + height + 'px; overflow: hidden;"><div style="float: left; white-space: nowrap;">' + $marquee.html() + '</div></div>').next(),
                marqueeRedux = $marqueeRedux.get(0),
                hitedge = 0,
                direction = ($marquee.attr('direction') || 'left').toLowerCase(),
                marqueeState = {
                    dir : /down|right/.test(direction) ? -1 : 1,
                    axis : /left|right/.test(direction) ? 'scrollLeft' : 'scrollTop',
                    widthAxis : /left|right/.test(direction) ? 'scrollWidth' : 'scrollHeight',
                    last : -1,
                    loops : $marquee.attr('loop') || -1,
                    scrollamount : $marquee.attr('scrollamount') || this.scrollAmount || 2,
                    behavior : ($marquee.attr('behavior') || 'scroll').toLowerCase(),
                    width : /left|right/.test(direction) ? width : height
                };
            
            // corrects a bug in Firefox - the default loops for slide is -1
            if ($marquee.attr('loop') == -1 && marqueeState.behavior == 'slide') {
                marqueeState.loops = 1;
            }

            $marquee.remove();
            
            // add padding
            if (/left|right/.test(direction)) {
                $marqueeRedux.find('> div').css('padding', '0 ' + width + 'px');
            } else {
                $marqueeRedux.find('> div').css('padding', height + 'px 0');
            }
            
            // events
            $marqueeRedux.bind('stop', function () {
                $marqueeRedux.data('paused', true);
            }).bind('pause', function () {
                $marqueeRedux.data('paused', true);
            }).bind('start', function () {
                $marqueeRedux.data('paused', false);
            }).bind('unpause', function () {
                $marqueeRedux.data('paused', false);
            }).data('marqueeState', marqueeState); // finally: store the state
            
            // todo - rerender event allowing us to do an ajax hit and redraw the marquee

            newMarquee.push(marqueeRedux);

            marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
            $marqueeRedux.trigger('start');
            
            // on the very last marquee, trigger the animation
            if (i+1 == last) {
                animateMarquee();
            }
        });            

        return $(newMarquee);
    };
}(jQuery));

/*!
 * Shadow animation jQuery-plugin 1.5
 * http://www.bitstorm.org/jquery/shadow-animation/
 * Copyright 2011 Edwin Martin <edwin@bitstorm.org>
 * Contributors: Mark Carver, Xavier Lepretre
 * Released under the MIT and GPL licenses.
 */
jQuery(function(e,i){function j(){var a=e("script:first"),b=a.css("color"),c=false;if(/^rgba/.test(b))c=true;else try{c=b!=a.css("color","rgba(0, 0, 0, 0.5)").css("color");a.css("color",b)}catch(d){}return c}function k(a,b,c){var d=[];a.c&&d.push("inset");typeof b.left!="undefined"&&d.push(parseInt(a.left+c*(b.left-a.left),10)+"px "+parseInt(a.top+c*(b.top-a.top),10)+"px");typeof b.blur!="undefined"&&d.push(parseInt(a.blur+c*(b.blur-a.blur),10)+"px");typeof b.a!="undefined"&&d.push(parseInt(a.a+c*
(b.a-a.a),10)+"px");if(typeof b.color!="undefined"){var g="rgb"+(e.support.rgba?"a":"")+"("+parseInt(a.color[0]+c*(b.color[0]-a.color[0]),10)+","+parseInt(a.color[1]+c*(b.color[1]-a.color[1]),10)+","+parseInt(a.color[2]+c*(b.color[2]-a.color[2]),10);if(e.support.rgba)g+=","+parseFloat(a.color[3]+c*(b.color[3]-a.color[3]));g+=")";d.push(g)}return d.join(" ")}function h(a){var b,c,d={};if(b=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(a))c=[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],
16),1];else if(b=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(a))c=[parseInt(b[1],16)*17,parseInt(b[2],16)*17,parseInt(b[3],16)*17,1];else if(b=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(a))c=[parseInt(b[1],10),parseInt(b[2],10),parseInt(b[3],10),1];else if(b=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([01\.]*)\s*\)/.exec(a))c=[parseInt(b[1],10),parseInt(b[2],10),parseInt(b[3],10),parseFloat(b[4])];d=(b=/(-?[0-9]+)(?:px)?\s+(-?[0-9]+)(?:px)?(?:\s+(-?[0-9]+)(?:px)?)?(?:\s+(-?[0-9]+)(?:px)?)?/.exec(a))?
{left:parseInt(b[1],10),top:parseInt(b[2],10),blur:b[3]?parseInt(b[3],10):0,a:b[4]?parseInt(b[4],10):0}:{left:0,top:0,blur:0,a:0};d.c=/inset/.test(a);d.color=c;return d}e.extend(true,e,{support:{rgba:j()}});var f;e.each(["boxShadow","MozBoxShadow","WebkitBoxShadow"],function(a,b){a=e("html").css(b);if(typeof a=="string"&&a!=""){f=b;return false}});if(f)e.fx.step.boxShadow=function(a){if(!a.init){a.b=h(e(a.elem).css(f));a.end=e.extend({},a.b,h(a.options.curAnim.boxShadow));if(a.b.color==i)a.b.color=
a.end.color||[0,0,0];a.init=true}a.elem.style[f]=k(a.b,a.end,a.pos)}});

