function delContactVal(obj){
    try {
        if ($(obj).val() == $('#' + $(obj).attr('id') + 'Hidden').val()) {
            $(obj).val('');
        }
    } 
    catch (e) {
    }
}

function reContactVal(obj){
    try {
        if ($(obj).attr('id') == 'email' && (!corrEmail.test($(obj).val()))) {
            $(obj).val($('#' + $(obj).attr('id') + 'Hidden').val());
        }
        else if ($(obj).val() == '') {
            $(obj).val($('#' + $(obj).attr('id') + 'Hidden').val());
        }
    } 
    catch (e) {
    }galleryImageDescriptionContainer
}

/**
*   Bibliotek funkcji JS dla FlexiWeb
*
*/

function init() {
    obj=document.getElementsByTagName('a');
    if(obj) {
        for(i=0;i<obj.length;i++){
            //alert(obj[i].href);
            //obj[i].onfocus = new Function("return false");
            if(obj.addEventListener)
                obj.addEventListener('focus',blur());
            else if(obj.attachEvent)
                obj.attachEvent('onfocus',blur());
            else
                obj.onfocus=blur;
        }
    }
}

function setCookie(name, value, expires, path, domain, secure){
//ustawia cookie
    var d=new Date();
    dat=new Date(d.getTime() + expires*1000);
    var cookieString = name + "=" +escape(value) + 
        ((expires) ? ";expires="+dat : "") +
               ( (path) ? ";path=" + path : "") +
               ( (domain) ? ";domain=" + domain : "") +
               ( (secure) ? ";secure" : "");
        document.cookie = cookieString;
    }

function getCookie(name){
//pobiera cookie
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
    }

function delCookie(name,path,domain) {
//usuwa cookie
       if (getCookie(name)) document.cookie = name + "=" +
      ( (path) ? ";path=" + path : "") +
      ( (domain) ? ";domain=" + domain : "") +
      ";expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function create_pass(id_source, id_target) {
// pobiera string z id_source, hashuje z id sesji, zapisuje do id_target
    var hashed_pass = hex_sha1(document.getElementById(id_source).value);
    var sesid       = getCookie('SID');
    document.getElementById(id_target).value = hex_sha1(sesid+hashed_pass);
}

function email_decoding(fun)
/*
* Funkcja wyszukuje na calej stronie zakodowane adresy e-mail w znacznikach <span class="email_conv"></span>
* Nastepnie kazdy zakodowany adres poddaje obrobce funkcja o nazwie zawartej w parametrze fun.
* Funkcja fun musi przyjmowac jako parametr string bedacy zakodowanym adresem e-mail i zwraca string bedacy adresem odkodowanym.
*/
{
    if(fun==undefined)
        fun="toAscii";

    var i,
        span=document.getElementsByTagName('span');

    for(i=0;i<span.length;i++)
        if(span[i].className.match(/(^|\s)email_conv(\s|$)/))
        {
            span[i].innerHTML=eval(fun+"('"+span[i].innerHTML+"');");
                span[i].style.display='inline';
        }
}

function toAscii(code)
/*
* Funkcja zamienia kodowany (funkcja php toPseudoAscii()) e-mail z parametru code na odkodowany w encjach html, a na koncu go zwraca.
*/
{
    decode="";
    for(var j=0;j<code.length;j+=3)
        decode=decode+"&#"+code.substr(j,3)+";";
    return decode;
}

function openPopupWindow(id,w_href,w_width,w_height)
{
    window.open(w_href,'Image_'+id, 'scrollbars=yes,menubar=no,status=no,location=no,top=200,left=200,width='+(w_width+20)+',height='+(w_height+20));
}

show_block = function (block_id) {
    if (obj = document.getElementById(block_id)) {
        obj.style.display= 'block';
    } 
}

show_linear = function (block_id) {
    if (obj = document.getElementById(block_id)) {
        obj.style.display= 'inline';
    }
}

hide_block = function (block_id) {
    if (obj = document.getElementById(block_id)) {
        obj.style.display= 'none';
    }
    
}

/* wysyĹ�a formularz o podanym id */
function submitForm(id) {
    var form;
    if(form = document.getElementById(id)) {
        form.submit();
    }
}

function changeRadioUrl(radio_id) {
     if (obj2 = document.getElementById(radio_id)) {
            var radios = obj2.getElementsByTagName('input');
        for(i = 0; i < radios.length; i++) {          
          if(radios[i].checked) {
            radioValue = radios[i].value;  
          }
      }
          window.location = radioValue;
     }
}

function changeUrl(selectId) {
  var selectObj;
  if (selectObj = document.getElementById(selectId)) {
    location.href = selectObj.options[selectObj.selectedIndex].value;
  }
}

function openPopUp(url,windowName)
{
    window.open(url,windowName,'scrollbars=yes,menubar=no,status=no,location=no,top=50,left=50,width=760,height=500,resizable=no');
}

window.onload = function() {
    email_decoding();
}


/* przeĹ�Ä�czanie wyĹ�wietlania elemantu blokowego */
function changeDisplayBlock(id) {
    var block;
    if(block = document.getElementById(id)) {
        if(block.style.display != 'block') {
            block.style.display = 'block';
        } else {
            block.style.display = 'none';
        }
    }
}

/* zastÄ�puje podanÄ� wartoĹ�Ä� inputa nowÄ� wartoĹ�Ä�iÄ�, jeĹ�li podana jest gwazdka, to zastÄ�puje kaĹźdÄ� wartoĹ�Ä� */
function replaceInputValue(id, valueToReplace, newValue) {
    var input;
    if(input = document.getElementById(id)) {
        if(valueToReplace == '*') {
            input.value = '';
        } else {
            if(input.value == valueToReplace) {
                input.value = newValue;
            }
        }
    }
}

function showArticleIntro() {
    $('#articleContentBox').hide();
    $('#articleIntroBox').show();
    $('#articleIntroTab').addClass('selected');
    $('#articleContentTab').removeClass('selected');
} 

function showArticleContent() {
    $('#articleContentBox').show();
    $('#articleIntroBox').hide();
    $('#articleIntroTab').removeClass('selected');
    $('#articleContentTab').addClass('selected');
}
function show_image(url, desc) {
    if (url == '') {
        $('#galleryImageDescription').html(desc);
        $(".sideDependentMenu ul").animate({ 
            marginTop: "0"
        }, 2000, "swing");
        var height = $(".galleryImageDescriptionContainer").height();
        $(".galleryImageDescriptionContainer").css("marginTop", -height);
        $(".galleryImageDescriptionContainer").css("display", "block");
        $(".galleryImageDescriptionContainer").show("slow");
        return false;
    }
    
    $(function () {
        $(".galleryImageDescriptionContainer").hide( function() {
            var img = new Image();
            $(img).load(function () {
                $('#bannerBox').hide();
                $('#bannerBox').empty();
                $('#bannerBox').append(this);
                $('#bannerBox').fadeIn("slow");
                $('#galleryImageDescription').html(desc);
                $('.pre').hide();
                $('.start').hide();          
                $(".sideDependentMenu ul").animate({ 
                    marginTop: "0"
                }, 2000, "swing");
                var height = $(".galleryImageDescriptionContainer").height();
                $(".galleryImageDescriptionContainer").css("marginTop", -height);
                $(".galleryImageDescriptionContainer").show("slow");
            })
            .error(function () {})
            .attr('src', url);
        });
    });
}

function show_banner(url) {
    $(function () {
        var img = new Image();
        $(img).load(function () {
            $('#bannerBox').hide();
            $('#bannerBox').empty();
            $('#bannerBox').append(this);
            $('#bannerBox').fadeIn("slow");
            $(".pre").hide();
            $('.startmain').hide();
            $(".sideDependentMenu ul").animate({ 
                    marginTop: "0"
                }, 2000, "swing");
        })
        .error(function () {})
        .attr('src', url);    
    });
}

function showhideForm() {
    document.getElementById('tNewsletterForm').style.display = (document.getElementById('tNewsletterForm').style.display == 'none')?'block':'none';
    document.getElementById('tMainSite').style.display = (document.getElementById('tMainSite').style.display == 'none')?'block':'none';
    document.getElementById('tContact').style.display = (document.getElementById('tContact').style.display == 'none')?'block':'none';
    document.getElementById('tSiteMap').style.display = (document.getElementById('tSiteMap').style.display == 'none')?'block':'none';
    document.getElementById('tNewsletter').style.display = (document.getElementById('tNewsletter').style.display == 'none')?'block':'none';
}

var inpVal = '';
var corrEmail=/^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i;

function delInputVal()
{
    if(!corrEmail.test(document.getElementById('userEmail').value))
    {
        inpVal = document.getElementById('userEmail').value;
        document.getElementById('userEmail').value = '';
    }
}

function reInputVal()
{
    if(!corrEmail.test(document.getElementById('userEmail').value))
        document.getElementById('userEmail').value = inpVal;
}



/*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 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.
 *
 * Version: 3.0.2
 * 
 * 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 args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true;
    
    event = $.event.fix(event || window.event);
    event.type = "mousewheel";
    
    if ( event.wheelDelta ) delta = event.wheelDelta/120;
    if ( event.detail     ) delta = -event.detail/3;
    
    // Add events and delta to the front of the arguments
    args.unshift(event, delta);

    return $.event.handle.apply(this, args);
}

})(jQuery);

/* Copyright (c) 2006 Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * See http://kelvinluck.com/assets/jquery/jScrollPane/
 * $Id: jScrollPane.js 33 2008-12-10 22:55:28Z kelvin.luck $
 */

/**
 * Replace the vertical scroll bars on any matched elements with a fancy
 * styleable (via CSS) version. With JS disabled the elements will
 * gracefully degrade to the browsers own implementation of overflow:auto.
 * If the mousewheel plugin has been included on the page then the scrollable areas will also
 * respond to the mouse wheel.
 *
 * @example jQuery(".scroll-pane").jScrollPane();
 *
 * @name jScrollPane
 * @type jQuery
 * @param Object    settings    hash with options, described below.
 *                              scrollbarWidth  -   The width of the generated scrollbar in pixels
 *                              scrollbarMargin -   The amount of space to leave on the side of the scrollbar in pixels
 *                              wheelSpeed      -   The speed the pane will scroll in response to the mouse wheel in pixels
 *                              showArrows      -   Whether to display arrows for the user to scroll with
 *                              arrowSize       -   The height of the arrow buttons if showArrows=true
 *                              animateTo       -   Whether to animate when calling scrollTo and scrollBy
 *                              dragMinHeight   -   The minimum height to allow the drag bar to be
 *                              dragMaxHeight   -   The maximum height to allow the drag bar to be
 *                              animateInterval -   The interval in milliseconds to update an animating scrollPane (default 100)
 *                              animateStep     -   The amount to divide the remaining scroll distance by when animating (default 3)
 *                              maintainPosition-   Whether you want the contents of the scroll pane to maintain it's position when you re-initialise it - so it doesn't scroll as you add more content (default true)
 *                              scrollbarOnLeft -   Display the scrollbar on the left side?  (needs stylesheet changes, see examples.html)
 *                              reinitialiseOnImageLoad - Whether the jScrollPane should automatically re-initialise itself when any contained images are loaded
 * @return jQuery
 * @cat Plugins/jScrollPane
 * @author Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
 */

(function($) {

$.jScrollPane = {
    active : []
};
$.fn.jScrollPane = function(settings)
{
    settings = $.extend({}, $.fn.jScrollPane.defaults, settings);

    var rf = function() { return false; };
    
    return this.each(
        function()
        {
            var $this = $(this);
            // Switch the element's overflow to hidden to ensure we get the size of the element without the scrollbars [http://plugins.jquery.com/node/1208]
            $this.css('overflow', 'hidden');
            var paneEle = this;
            
            if ($(this).parent().is('.jScrollPaneContainer')) {
                var currentScrollPosition = settings.maintainPosition ? $this.position().top : 0;
                var $c = $(this).parent();
                var paneWidth = $c.innerWidth();
                var paneHeight = $c.outerHeight();
                var trackHeight = paneHeight;
                $('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown', $c).remove();
                $this.css({'top':0});
            } else {
                var currentScrollPosition = 0;
                this.originalPadding = $this.css('paddingTop') + ' ' + $this.css('paddingRight') + ' ' + $this.css('paddingBottom') + ' ' + $this.css('paddingLeft');
                this.originalSidePaddingTotal = (parseInt($this.css('paddingLeft')) || 0) + (parseInt($this.css('paddingRight')) || 0);
                var paneWidth = $this.innerWidth();
                var paneHeight = $this.innerHeight();
                var trackHeight = paneHeight;
                $this.wrap(
                    $('<div></div>').attr(
                        {'className':'jScrollPaneContainer'}
                    ).css(
                        {
                            'height':paneHeight+'px', 
                            'width':paneWidth+'px'
                        }
                    )
                );
                // deal with text size changes (if the jquery.em plugin is included)
                // and re-initialise the scrollPane so the track maintains the
                // correct size
                $(document).bind(
                    'emchange', 
                    function(e, cur, prev)
                    {
                        $this.jScrollPane(settings);
                    }
                );
                
            }
            
            if (settings.reinitialiseOnImageLoad) {
                // code inspired by jquery.onImagesLoad: http://plugins.jquery.com/project/onImagesLoad
                // except we re-initialise the scroll pane when each image loads so that the scroll pane is always up to size...
                // TODO: Do I even need to store it in $.data? Is a local variable here the same since I don't pass the reinitialiseOnImageLoad when I re-initialise?
                var $imagesToLoad = $.data(paneEle, 'jScrollPaneImagesToLoad') || $('img', $this);
                var loadedImages = [];
                
                if ($imagesToLoad.length) {
                    $imagesToLoad.each(function(i, val) {
                        $(this).bind('load', function() {
                            if($.inArray(i, loadedImages) == -1){ //don't double count images
                                loadedImages.push(val); //keep a record of images we've seen
                                $imagesToLoad = $.grep($imagesToLoad, function(n, i) {
                                    return n != val;
                                });
                                $.data(paneEle, 'jScrollPaneImagesToLoad', $imagesToLoad);
                                settings.reinitialiseOnImageLoad = false;
                                $this.jScrollPane(settings); // re-initialise
                            }
                        }).each(function(i, val) {
                            if(this.complete || this.complete===undefined) { 
                                //needed for potential cached images
                                this.src = this.src; 
                            } 
                        });
                    });
                };
            }

            var p = this.originalSidePaddingTotal;
            
            var cssToApply = {
                'height':'auto',
                'width':paneWidth - settings.scrollbarWidth - settings.scrollbarMargin - p + 'px'
            }

            if(settings.scrollbarOnLeft) {
                cssToApply.paddingLeft = settings.scrollbarMargin + settings.scrollbarWidth + 'px';
            } else {
                cssToApply.paddingRight = settings.scrollbarMargin + 'px';
            }

            $this.css(cssToApply);

            var contentHeight = $this.outerHeight();
            var percentInView = paneHeight / contentHeight;

            if (percentInView < .99) {
                var $container = $this.parent();
                $container.append(
                    $('<div></div>').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append(
                        $('<div></div>').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append(
                            $('<div></div>').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),
                            $('<div></div>').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'})
                        )
                    )
                );
                
                var $track = $('>.jScrollPaneTrack', $container);
                var $drag = $('>.jScrollPaneTrack .jScrollPaneDrag', $container);
                
                if (settings.showArrows) {
                    
                    var currentArrowButton;
                    var currentArrowDirection;
                    var currentArrowInterval;
                    var currentArrowInc;
                    var whileArrowButtonDown = function()
                    {
                        if (currentArrowInc > 4 || currentArrowInc%4==0) {
                            positionDrag(dragPosition + currentArrowDirection * mouseWheelMultiplier);
                        }
                        currentArrowInc ++;
                    };
                    var onArrowMouseUp = function(event)
                    {
                        $('html').unbind('mouseup', onArrowMouseUp);
                        currentArrowButton.removeClass('jScrollActiveArrowButton');
                        clearInterval(currentArrowInterval);
                    };
                    var onArrowMouseDown = function() {
                        $('html').bind('mouseup', onArrowMouseUp);
                        currentArrowButton.addClass('jScrollActiveArrowButton');
                        currentArrowInc = 0;
                        whileArrowButtonDown();
                        currentArrowInterval = setInterval(whileArrowButtonDown, 100);
                    };
                    $container
                        .append(
                            $('<a></a>')
                                .attr({'href':'javascript:;', 'className':'jScrollArrowUp'})
                                .css({'width':settings.scrollbarWidth+'px'})
                                .html('Scroll up')
                                .bind('mousedown', function()
                                {
                                    currentArrowButton = $(this);
                                    currentArrowDirection = -1;
                                    onArrowMouseDown();
                                    this.blur();
                                    return false;
                                })
                                .bind('click', rf),
                            $('<a></a>')
                                .attr({'href':'javascript:;', 'className':'jScrollArrowDown'})
                                .css({'width':settings.scrollbarWidth+'px'})
                                .html('Scroll down')
                                .bind('mousedown', function()
                                {
                                    currentArrowButton = $(this);
                                    currentArrowDirection = 1;
                                    onArrowMouseDown();
                                    this.blur();
                                    return false;
                                })
                                .bind('click', rf)
                        );
                    var $upArrow = $('>.jScrollArrowUp', $container);
                    var $downArrow = $('>.jScrollArrowDown', $container);
                    if (settings.arrowSize) {
                        trackHeight = paneHeight - settings.arrowSize - settings.arrowSize;
                        $track
                            .css({'height': trackHeight+'px', top:settings.arrowSize+'px'})
                    } else {
                        var topArrowHeight = $upArrow.height();
                        settings.arrowSize = topArrowHeight;
                        trackHeight = paneHeight - topArrowHeight - $downArrow.height();
                        $track
                            .css({'height': trackHeight+'px', top:topArrowHeight+'px'})
                    }
                }
                
                var $pane = $(this).css({'position':'absolute', 'overflow':'visible'});
                
                var currentOffset;
                var maxY;
                var mouseWheelMultiplier;
                // store this in a seperate variable so we can keep track more accurately than just updating the css property..
                var dragPosition = 0;
                var dragMiddle = percentInView*paneHeight/2;
                
                // pos function borrowed from tooltip plugin and adapted...
                var getPos = function (event, c) {
                    var p = c == 'X' ? 'Left' : 'Top';
                    return event['page' + c] || (event['client' + c] + (document.documentElement['scroll' + p] || document.body['scroll' + p])) || 0;
                };
                
                var ignoreNativeDrag = function() { return false; };
                
                var initDrag = function()
                {
                    ceaseAnimation();
                    currentOffset = $drag.offset(false);
                    currentOffset.top -= dragPosition;
                    maxY = trackHeight - $drag[0].offsetHeight;
                    mouseWheelMultiplier = 2 * settings.wheelSpeed * maxY / contentHeight;
                };
                
                var onStartDrag = function(event)
                {
                    initDrag();
                    dragMiddle = getPos(event, 'Y') - dragPosition - currentOffset.top;
                    $('html').bind('mouseup', onStopDrag).bind('mousemove', updateScroll);
                    if ($.browser.msie) {
                        $('html').bind('dragstart', ignoreNativeDrag).bind('selectstart', ignoreNativeDrag);
                    }
                    return false;
                };
                var onStopDrag = function()
                {
                    $('html').unbind('mouseup', onStopDrag).unbind('mousemove', updateScroll);
                    dragMiddle = percentInView*paneHeight/2;
                    if ($.browser.msie) {
                        $('html').unbind('dragstart', ignoreNativeDrag).unbind('selectstart', ignoreNativeDrag);
                    }
                };
                var positionDrag = function(destY)
                {
                    destY = destY < 0 ? 0 : (destY > maxY ? maxY : destY);
                    dragPosition = destY;
                    $drag.css({'top':destY+'px'});
                    var p = destY / maxY;
                    $pane.css({'top':((paneHeight-contentHeight)*p) + 'px'});
                    $this.trigger('scroll');
                    if (settings.showArrows) {
                        $upArrow[destY == 0 ? 'addClass' : 'removeClass']('disabled');
                        $downArrow[destY == maxY ? 'addClass' : 'removeClass']('disabled');
                    }
                };
                var updateScroll = function(e)
                {
                    positionDrag(getPos(e, 'Y') - currentOffset.top - dragMiddle);
                };
                
                var dragH = Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2), settings.dragMaxHeight), settings.dragMinHeight);
                
                $drag.css(
                    {'height':dragH+'px'}
                ).bind('mousedown', onStartDrag);
                
                var trackScrollInterval;
                var trackScrollInc;
                var trackScrollMousePos;
                var doTrackScroll = function()
                {
                    if (trackScrollInc > 8 || trackScrollInc%4==0) {
                        positionDrag((dragPosition - ((dragPosition - trackScrollMousePos) / 2)));
                    }
                    trackScrollInc ++;
                };
                var onStopTrackClick = function()
                {
                    clearInterval(trackScrollInterval);
                    $('html').unbind('mouseup', onStopTrackClick).unbind('mousemove', onTrackMouseMove);
                };
                var onTrackMouseMove = function(event)
                {
                    trackScrollMousePos = getPos(event, 'Y') - currentOffset.top - dragMiddle;
                };
                var onTrackClick = function(event)
                {
                    initDrag();
                    onTrackMouseMove(event);
                    trackScrollInc = 0;
                    $('html').bind('mouseup', onStopTrackClick).bind('mousemove', onTrackMouseMove);
                    trackScrollInterval = setInterval(doTrackScroll, 100);
                    doTrackScroll();
                };
                
                $track.bind('mousedown', onTrackClick);
                
                $container.bind(
                    'mousewheel',
                    function (event, delta) {
                        initDrag();
                        ceaseAnimation();
                        var d = dragPosition;
                        positionDrag(dragPosition - delta * mouseWheelMultiplier);
                        var dragOccured = d != dragPosition;
                        return !dragOccured;
                    }
                );

                var _animateToPosition;
                var _animateToInterval;
                function animateToPosition()
                {
                    var diff = (_animateToPosition - dragPosition) / settings.animateStep;
                    if (diff > 1 || diff < -1) {
                        positionDrag(dragPosition + diff);
                    } else {
                        positionDrag(_animateToPosition);
                        ceaseAnimation();
                    }
                }
                var ceaseAnimation = function()
                {
                    if (_animateToInterval) {
                        clearInterval(_animateToInterval);
                        delete _animateToPosition;
                    }
                };
                var scrollTo = function(pos, preventAni)
                {
                    if (typeof pos == "string") {
                        $e = $(pos, $this);
                        if (!$e.length) return;
                        pos = $e.offset().top - $this.offset().top;
                    }
                    $container.scrollTop(0);
                    ceaseAnimation();
                    var destDragPosition = -pos/(paneHeight-contentHeight) * maxY;
                    if (preventAni || !settings.animateTo) {
                        positionDrag(destDragPosition);
                    } else {
                        _animateToPosition = destDragPosition;
                        _animateToInterval = setInterval(animateToPosition, settings.animateInterval);
                    }
                };
                $this[0].scrollTo = scrollTo;
                
                $this[0].scrollBy = function(delta)
                {
                    var currentPos = -parseInt($pane.css('top')) || 0;
                    scrollTo(currentPos + delta);
                };
                
                initDrag();
                
                scrollTo(-currentScrollPosition, true);
            
                // Deal with it when the user tabs to a link or form element within this scrollpane
                $('*', this).bind(
                    'focus',
                    function(event)
                    {
                        var $e = $(this);
                        
                        // loop through parents adding the offset top of any elements that are relatively positioned between
                        // the focused element and the jScrollPaneContainer so we can get the true distance from the top
                        // of the focused element to the top of the scrollpane...
                        var eleTop = 0;
                        
                        while ($e[0] != $this[0]) {
                            eleTop += $e.position().top;
                            $e = $e.offsetParent();
                        }
                        
                        var viewportTop = -parseInt($pane.css('top')) || 0;
                        var maxVisibleEleTop = viewportTop + paneHeight;
                        var eleInView = eleTop > viewportTop && eleTop < maxVisibleEleTop;
                        if (!eleInView) {
                            var destPos = eleTop - settings.scrollbarMargin;
                            if (eleTop > viewportTop) { // element is below viewport - scroll so it is at bottom.
                                destPos += $(this).height() + 15 + settings.scrollbarMargin - paneHeight;
                            }
                            scrollTo(destPos);
                        }
                    }
                )
                
                
                if (location.hash) {
                    scrollTo(location.hash);
                }
                
                // use event delegation to listen for all clicks on links and hijack them if they are links to
                // anchors within our content...
                $(document).bind(
                    'click',
                    function(e)
                    {
                        $target = $(e.target);
                        if ($target.is('a')) {
                            var h = $target.attr('href');
                            if (h.substr(0, 1) == '#') {
                                scrollTo(h);
                            }
                        }
                    }
                );
                
                $.jScrollPane.active.push($this[0]);
                
            } else {
                $this.css(
                    {
                        'height':paneHeight+'px',
                        'width':paneWidth-this.originalSidePaddingTotal+'px',
                        'padding':this.originalPadding
                    }
                );
                // remove from active list?
                $this.parent().unbind('mousewheel');
            }
            
        }
    )
};

$.fn.jScrollPane.defaults = {
    scrollbarWidth : 1,
    scrollbarMargin : 0,
    wheelSpeed : 18,
    showArrows : false,
    arrowSize : 0,
    animateTo : false,
    dragMinHeight : 1,
    dragMaxHeight : 99999,
    animateInterval : 100,
    animateStep: 3,
    maintainPosition: true,
    scrollbarOnLeft: false,
    reinitialiseOnImageLoad: false
};

// clean up the scrollTo expandos
$(window)
    .bind('unload', function() {
        var els = $.jScrollPane.active; 
        for (var i=0; i<els.length; i++) {
            els[i].scrollTo = els[i].scrollBy = null;
        }
    }
);

})(jQuery);

/*
 * jQuery Easing v1.1.1 - http://gsgd.co.uk/sandbox/jquery.easing.php
 *
 * Uses the built in easing capabilities added in jQuery 1.1
 * to offer multiple easing options
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

jQuery.extend(jQuery.easing, {
    easein: function(x, t, b, c, d) {
        return c*(t/=d)*t + b; // in
    },
    easeinout: function(x, t, b, c, d) {
        if (t < d/2) return 2*c*t*t/(d*d) + b;
        var ts = t - d/2;
        return -2*c*ts*ts/(d*d) + 2*c*ts/d + c/2 + b;       
    },
    easeout: function(x, t, b, c, d) {
        return -c*t*t/(d*d) + 2*c*t/d + b;
    },
    expoin: function(x, t, b, c, d) {
        var flip = 1;
        if (c < 0) {
            flip *= -1;
            c *= -1;
        }
        return flip * (Math.exp(Math.log(c)/d * t)) + b;        
    },
    expoout: function(x, t, b, c, d) {
        var flip = 1;
        if (c < 0) {
            flip *= -1;
            c *= -1;
        }
        return flip * (-Math.exp(-Math.log(c)/d * (t-d)) + c + 1) + b;
    },
    expoinout: function(x, t, b, c, d) {
        var flip = 1;
        if (c < 0) {
            flip *= -1;
            c *= -1;
        }
        if (t < d/2) return flip * (Math.exp(Math.log(c/2)/(d/2) * t)) + b;
        return flip * (-Math.exp(-2*Math.log(c/2)/d * (t-d)) + c + 1) + b;
    },
    bouncein: function(x, t, b, c, d) {
        return c - jQuery.easing['bounceout'](x, d-t, 0, c, d) + b;
    },
    bounceout: 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;
        }
    },
    bounceinout: function(x, t, b, c, d) {
        if (t < d/2) return jQuery.easing['bouncein'] (x, t*2, 0, c, d) * .5 + b;
        return jQuery.easing['bounceout'] (x, t*2-d,0, c, d) * .5 + c*.5 + b;
    },
    elasin: 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;
    },
    elasout: 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;
    },
    elasinout: 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;
    },
    backin: function(x, t, b, c, d) {
        var s=1.70158;
        return c*(t/=d)*t*((s+1)*t - s) + b;
    },
    backout: function(x, t, b, c, d) {
        var s=1.70158;
        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
    },
    backinout: function(x, t, b, c, d) {
        var 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;
    }
});

/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-10-06 20:11:15 +0200 (Sa, 06 Okt 2007) $
 * $Rev: 3581 $
 *
 * Version: @VERSION
 *
 * Requires: jQuery 1.2+
 */

(function($){
    
$.dimensions = {
    version: '@VERSION'
};

// Create innerHeight, innerWidth, outerHeight and outerWidth methods
$.each( [ 'Height', 'Width' ], function(i, name){
    
    // innerHeight and innerWidth
    $.fn[ 'inner' + name ] = function() {
        if (!this[0]) return;
        
        var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
            borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
        
        return num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
    };
    
    // outerHeight and outerWidth
    $.fn[ 'outer' + name ] = function(options) {
        if (!this[0]) return;
        
        var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
            borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
        
        options = $.extend({ margin: false }, options || {});
        
        return num( this, name.toLowerCase() )
                + num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
                + num(this, 'padding' + torl) + num(this, 'padding' + borr)
                + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
    };
});

// Create scrollLeft and scrollTop methods
$.each( ['Left', 'Top'], function(i, name) {
    $.fn[ 'scroll' + name ] = function(val) {
        if (!this[0]) return;
        
        return val != undefined ?
        
            // Set the scroll offset
            this.each(function() {
                this == window || this == document ?
                    window.scrollTo( 
                        name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
                        name == 'Top'  ? val : $(window)[ 'scrollTop'  ]()
                    ) :
                    this[ 'scroll' + name ] = val;
            }) :
            
            // Return the scroll offset
            this[0] == window || this[0] == document ?
                self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
                    $.boxModel && document.documentElement[ 'scroll' + name ] ||
                    document.body[ 'scroll' + name ] :
                this[0][ 'scroll' + name ];
    };
});

$.fn.extend({
    position: function() {
        var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
        
        if (elem) {
            // Get *real* offsetParent
            offsetParent = this.offsetParent();
            
            // Get correct offsets
            offset       = this.offset();
            parentOffset = offsetParent.offset();
            
            // Subtract element margins
            offset.top  -= num(elem, 'marginTop');
            offset.left -= num(elem, 'marginLeft');
            
            // Add offsetParent borders
            parentOffset.top  += num(offsetParent, 'borderTopWidth');
            parentOffset.left += num(offsetParent, 'borderLeftWidth');
            
            // Subtract the two offsets
            results = {
                top:  offset.top  - parentOffset.top,
                left: offset.left - parentOffset.left
            };
        }
        
        return results;
    },
    
    offsetParent: function() {
        var offsetParent = this[0].offsetParent;
        while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
            offsetParent = offsetParent.offsetParent;
        return $(offsetParent);
    }
});

function num(el, prop) {
    return parseInt($.css(el.jquery?el[0]:el,prop))||0;
};

})(jQuery);

/*
 * jQuery UI Accordion 1.6
 * 
 * Copyright (c) 2007 JĂśrn Zaefferer
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.accordion.js 4876 2008-03-08 11:49:04Z joern.zaefferer $
 *
 */

;(function($) {
    
// If the UI scope is not available, add it
$.ui = $.ui || {};

$.fn.extend({
    accordion: function(options, data) {
        var args = Array.prototype.slice.call(arguments, 1);

        return this.each(function() {
            if (typeof options == "string") {
                var accordion = $.data(this, "ui-accordion");
                accordion[options].apply(accordion, args);
            // INIT with optional options
            } else if (!$(this).is(".ui-accordion"))
                $.data(this, "ui-accordion", new $.ui.accordion(this, options));
        });
    },
    // deprecated, use accordion("activate", index) instead
    activate: function(index) {
        return this.accordion("activate", index);
    }
});

$.ui.accordion = function(container, options) {
    
    // setup configuration
    this.options = options = $.extend({}, $.ui.accordion.defaults, options);
    this.element = container;
    
    $(container).addClass("ui-accordion");
    
    if ( options.navigation ) {
        var current = $(container).find("a").filter(options.navigationFilter);
        if ( current.length ) {
            if ( current.filter(options.header).length ) {
                options.active = current;
            } else {
                options.active = current.parent().parent().prev();
                current.addClass("current");
            }
        }
    }
    
    // calculate active if not specified, using the first header
    options.headers = $(container).find(options.header);
    options.active = findActive(options.headers, options.active);

    if ( options.fillSpace ) {
        var maxHeight = $(container).parent().height();
        options.headers.each(function() {
            maxHeight -= $(this).outerHeight();
        });
        var maxPadding = 0;
        options.headers.next().each(function() {
            maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
        }).height(maxHeight - maxPadding);
    } else if ( options.autoheight ) {
        var maxHeight = 0;
        options.headers.next().each(function() {
            maxHeight = Math.max(maxHeight, $(this).outerHeight());
        }).height(maxHeight);
    }

    options.headers
        .not(options.active || "")
        .next()
        .hide();
    options.active.parent().andSelf().addClass(options.selectedClass);
    
    if (options.event)
        $(container).bind((options.event) + ".ui-accordion", clickHandler);
};

$.ui.accordion.prototype = {
    activate: function(index) {
        // call clickHandler with custom event
        clickHandler.call(this.element, {
            target: findActive( this.options.headers, index )[0]
        });
    },
    
    enable: function() {
        this.options.disabled = false;
    },
    disable: function() {
        this.options.disabled = true;
    },
    destroy: function() {
        this.options.headers.next().css("display", "");
        if ( this.options.fillSpace || this.options.autoheight ) {
            this.options.headers.next().css("height", "");
        }
        $.removeData(this.element, "ui-accordion");
        $(this.element).removeClass("ui-accordion").unbind(".ui-accordion");
    }
}

function scopeCallback(callback, scope) {
    return function() {
        return callback.apply(scope, arguments);
    };
}

function completed(cancel) {
    // if removed while animated data can be empty
    if (!$.data(this, "ui-accordion"))
        return;
    var instance = $.data(this, "ui-accordion");
    var options = instance.options;
    options.running = cancel ? 0 : --options.running;
    if ( options.running )
        return;
    if ( options.clearStyle ) {
        options.toShow.add(options.toHide).css({
            height: "",
            overflow: ""
        });
    }
    $(this).triggerHandler("change.ui-accordion", [options.data], options.change);
}

function toggle(toShow, toHide, data, clickedActive, down) {
    var options = $.data(this, "ui-accordion").options;
    options.toShow = toShow;
    options.toHide = toHide;
    options.data = data;
    var complete = scopeCallback(completed, this);
    
    // count elements to animate
    options.running = toHide.size() == 0 ? toShow.size() : toHide.size();
    
    if ( options.animated ) {
        if ( !options.alwaysOpen && clickedActive ) {
            $.ui.accordion.animations[options.animated]({
                toShow: jQuery([]),
                toHide: toHide,
                complete: complete,
                down: down,
                autoheight: options.autoheight
            });
        } else {
            $.ui.accordion.animations[options.animated]({
                toShow: toShow,
                toHide: toHide,
                complete: complete,
                down: down,
                autoheight: options.autoheight
            });
        }
    } else {
        if ( !options.alwaysOpen && clickedActive ) {
            toShow.toggle();
        } else {
            toHide.hide();
            toShow.show();
        }
        complete(true);
    }
}

function clickHandler(event) {
    var options = $.data(this, "ui-accordion").options;
    if (options.disabled)
        return false;
    
    // called only when using activate(false) to close all parts programmatically
    if ( !event.target && !options.alwaysOpen ) {
        options.active.parent().andSelf().toggleClass(options.selectedClass);
        var toHide = options.active.next(),
            data = {
                instance: this,
                options: options,
                newHeader: jQuery([]),
                oldHeader: options.active,
                newContent: jQuery([]),
                oldContent: toHide
            },
            toShow = options.active = $([]);
        toggle.call(this, toShow, toHide, data );
        return false;
    }
    // get the click target
    var clicked = $(event.target);
    
    // due to the event delegation model, we have to check if one
    // of the parent elements is our actual header, and find that
    if ( clicked.parents(options.header).length )
        while ( !clicked.is(options.header) )
            clicked = clicked.parent();
    
    var clickedActive = clicked[0] == options.active[0];
    
    // if animations are still active, or the active header is the target, ignore click
    if (options.running || (options.alwaysOpen && clickedActive))
        return false;
    if (!clicked.is(options.header))
        return;

    // switch classes
    options.active.parent().andSelf().toggleClass(options.selectedClass);
    if ( !clickedActive ) {
        clicked.parent().andSelf().addClass(options.selectedClass);
    }

    // find elements to show and hide
    var toShow = clicked.next(),
        toHide = options.active.next(),
        //data = [clicked, options.active, toShow, toHide],
        data = {
            instance: this,
            options: options,
            newHeader: clicked,
            oldHeader: options.active,
            newContent: toShow,
            oldContent: toHide
        },
        down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );
    
    options.active = clickedActive ? $([]) : clicked;
    toggle.call(this, toShow, toHide, data, clickedActive, down );

    return false;
};

function findActive(headers, selector) {
    return selector != undefined
        ? typeof selector == "number"
            ? headers.filter(":eq(" + selector + ")")
            : headers.not(headers.not(selector))
        : selector === false
            ? $([])
            : headers.filter(":eq(0)");
}

$.extend($.ui.accordion, {
    defaults: {
        selectedClass: "selected",
        alwaysOpen: true,
        animated: 'slide',
        event: "click",
        header: "a",
        autoheight: true,
        running: 0,
        navigationFilter: function() {
            return this.href.toLowerCase() == location.href.toLowerCase();
        }
    },
    animations: {
        slide: function(options, additions) {
            options = $.extend({
                easing: "swing",
                duration: 300
            }, options, additions);
            if ( !options.toHide.size() ) {
                options.toShow.animate({height: "show"}, options);
                return;
            }
            var hideHeight = options.toHide.height(),
                showHeight = options.toShow.height(),
                difference = showHeight / hideHeight;
            options.toShow.css({ height: 0, overflow: 'hidden' }).show();
            options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{
                step: function(now) {
                    var current = (hideHeight - now) * difference;
                    if ($.browser.msie || $.browser.opera) {
                        current = Math.ceil(current);
                    }
                    options.toShow.height( current );
                },
                duration: options.duration,
                easing: options.easing,
                complete: function() {
                    if ( !options.autoheight ) {
                        options.toShow.css("height", "auto");
                    }
                    options.complete();
                }
            });
        },
        bounceslide: function(options) {
            this.slide(options, {
                easing: options.down ? "bounceout" : "swing",
                duration: options.down ? 1000 : 200
            });
        },
        easeslide: function(options) {
            this.slide(options, {
                easing: "easeinout",
                duration: 700
            })
        }
    }
});

})(jQuery);

/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
* 
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
* 
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
* 
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
*   sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
*   interval: 100,   // number = milliseconds of polling interval
*   over: showNav,  // function = onMouseOver callback (required)
*   timeout: 0,   // number = milliseconds delay before onMouseOut function call
*   out: hideNav    // function = onMouseOut callback (required)
* });
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($) {
    $.fn.hoverIntent = function(f,g) {
        // default configuration options
        var cfg = {
            sensitivity: 7,
            interval: 100,
            timeout: 0
        };
        // override configuration options with user supplied object
        cfg = $.extend(cfg, g ? { over: f, out: g } : f );

        // instantiate variables
        // cX, cY = current X and Y position of mouse, updated by mousemove event
        // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
        var cX, cY, pX, pY;

        // A private function for getting mouse position
        var track = function(ev) {
            cX = ev.pageX;
            cY = ev.pageY;
        };

        // A private function for comparing current and previous mouse position
        var compare = function(ev,ob) {
            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
            // compare mouse positions to see if they've crossed the threshold
            if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
                $(ob).unbind("mousemove",track);
                // set hoverIntent state to true (so mouseOut can be called)
                ob.hoverIntent_s = 1;
                return cfg.over.apply(ob,[ev]);
            } else {
                // set previous coordinates for next time
                pX = cX; pY = cY;
                // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
                ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
            }
        };

        // A private function for delaying the mouseOut function
        var delay = function(ev,ob) {
            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
            ob.hoverIntent_s = 0;
            return cfg.out.apply(ob,[ev]);
        };

        // A private function for handling mouse 'hovering'
        var handleHover = function(e) {
            // next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
            var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
            while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
            if ( p == this ) { return false; }

            // copy objects to be passed into t (required for event object to be passed in IE)
            var ev = jQuery.extend({},e);
            var ob = this;

            // cancel hoverIntent timer if it exists
            if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

            // else e.type == "onmouseover"
            if (e.type == "mouseover") {
                // set "previous" X and Y position based on initial entry point
                pX = ev.pageX; pY = ev.pageY;
                // update "current" X and Y position based on mousemove
                $(ob).bind("mousemove",track);
                // start polling interval (self-calling timeout) to compare mouse coordinates over time
                if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

            // else e.type == "onmouseout"
            } else {
                // unbind expensive mousemove event
                $(ob).unbind("mousemove",track);
                // if hoverIntent state is true, then call the mouseOut function after the specified delay
                if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
            }
        };

        // bind the function to the two event listeners
        return this.mouseover(handleHover).mouseout(handleHover);
    };
})(jQuery);
/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

    // We override the animation for all of these color styles
    jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
        jQuery.fx.step[attr] = function(fx){
            if ( fx.state == 0 ) {
                fx.start = getColor( fx.elem, attr );
                fx.end = getRGB( fx.end );
            }

            fx.elem.style[attr] = "rgb(" + [
                Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
                Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
                Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
            ].join(",") + ")";
        }
    });

    // Color Conversion functions from highlightFade
    // By Blair Mitchelmore
    // http://jquery.offput.ca/highlightFade/

    // Parse strings looking for color tuples [255,255,255]
    function getRGB(color) {
        var result;

        // Check if we're already dealing with an array of colors
        if ( color && color.constructor == Array && color.length == 3 )
            return color;

        // Look for rgb(num,num,num)
        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

        // Look for rgb(num%,num%,num%)
        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
            return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

        // Look for #a0b1c2
        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
            return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

        // Look for #fff
        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
            return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

        // Otherwise, we're most likely dealing with a named color
        return colors[jQuery.trim(color).toLowerCase()];
    }
    
    function getColor(elem, attr) {
        var color;

        do {
            color = jQuery.curCSS(elem, attr);

            // Keep going until we find an element that has color, or we hit the body
            if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
                break; 

            attr = "backgroundColor";
        } while ( elem = elem.parentNode );

        return getRGB(color);
    };
    
    // Some named colors to work with
    // From Interface by Stefan Petre
    // http://interface.eyecon.ro/

    var colors = {
        aqua:[0,255,255],
        azure:[240,255,255],
        beige:[245,245,220],
        black:[0,0,0],
        blue:[0,0,255],
        brown:[165,42,42],
        cyan:[0,255,255],
        darkblue:[0,0,139],
        darkcyan:[0,139,139],
        darkgrey:[169,169,169],
        darkgreen:[0,100,0],
        darkkhaki:[189,183,107],
        darkmagenta:[139,0,139],
        darkolivegreen:[85,107,47],
        darkorange:[255,140,0],
        darkorchid:[153,50,204],
        darkred:[139,0,0],
        darksalmon:[233,150,122],
        darkviolet:[148,0,211],
        fuchsia:[255,0,255],
        gold:[255,215,0],
        green:[0,128,0],
        indigo:[75,0,130],
        khaki:[240,230,140],
        lightblue:[173,216,230],
        lightcyan:[224,255,255],
        lightgreen:[144,238,144],
        lightgrey:[211,211,211],
        lightpink:[255,182,193],
        lightyellow:[255,255,224],
        lime:[0,255,0],
        magenta:[255,0,255],
        maroon:[128,0,0],
        navy:[0,0,128],
        olive:[128,128,0],
        orange:[255,165,0],
        pink:[255,192,203],
        purple:[128,0,128],
        violet:[128,0,128],
        red:[255,0,0],
        silver:[192,192,192],
        white:[255,255,255],
        yellow:[255,255,0]
    };
    
})(jQuery);
var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;

$(function() {
    $('.article').jScrollPane({showArrows:true});
    $('#articles').jScrollPane({showArrows:true});
    $('#images').jScrollPane({showArrows:true});
});

jQuery().ready(function(){
    
    if (!IE6) {
        
        jQuery('#sideDependentMenu').accordion({
            active: false,
            header: '.head',
            navigation: true,
            animated: 'easeslide',
            autoheight: false
        });        
        // second simple accordion with special markup
        jQuery('#navigation').accordion({
            active: false,
            header: '.head',
            navigation: true,
            event: 'mouseover',
            fillSpace: true,
            animated: 'easeslide'
        });
        
        $('.navnotlogged #multiDimHorizontMenu a').hoverIntent(function(){
            var id = $(this).parent().attr("id");
            var index = parseInt(id.charAt(id.length - 1)) + 1;
            var imageUrl = "url(/images/menu" + index + "over.png)";
            $(this).animate({
                paddingTop: "150px"
            }, 200, function(){
                $(this).css("backgroundImage", imageUrl);
            }).animate({
                paddingTop: "46px"
            }, 200).parent().animate({
                backgroundPosition: '180px 53px'
            }, 250, function(){
                switch (index) {
                    case 2:
                        $(this).css('background', 'url(/images/bg_black.png) left top repeat-x');
                        break;
                    case 3:
                        $(this).css('background', 'url(/images/bg_white.png) left top repeat-x');
                        break;
                    default:
                        $(this).css('background', 'url(/images/bg_red.png) left top repeat-x');
                }
                $(this).append('<img class="squaregif" style="position: absolute; margin: 53px 0 0 -180px; z-index: 9;" src="/images/square2.gif" alt="" />');
            })
        }, function(){
            var id = $(this).parent().attr("id");
            var index = parseInt(id.charAt(id.length - 1)) + 1;
            var imageUrl = "url(/images/menu" + index + ".png)";
            $(this).animate({
                paddingTop: "150px"
            }, 200, function(){
                $(this).css("backgroundImage", imageUrl);
            }).animate({
                paddingTop: "46px"
            }, 200).parent().animate({
                backgroundPosition: '0 0'
            }, 250, function() {
                $(this).css('background', 'url(/images/dot.jpg) -10px 29px no-repeat').animate({
                    backgroundPosition: '6px 53px'
                }, 250, function() {
                    $('.squaregif').remove();
                });
            })
        });
    }

    $(".sideDependentMenu a.level1").hoverIntent(function() {
        $(this).animate({
            backgroundPosition: "0px 6px",
            paddingLeft: "35px"
        }, 300)
    }, function() {
        $(this).animate({
            backgroundPosition: "190px 6px",
            paddingLeft: "30px"
         }, 300)
    });
});

$(document).ready(function(){
    
    $('.container').ready(function(){
        
    	var refreshId = setInterval(function(){
    		$(".container").each(function(){
        		var ah = $(this).height() + $('.right_box').height();
        		if (ah < ($(window).height() - 100)) {
        			var mh = ($(window).height() - ah - 100) / 2;
        			$('.container').animate({marginTop: mh}, 1000);
        		} else $('.container').css('margin-top', 0);
    		});
    	},1010);
    });
    
    $(".pre").hide();
    
    $(".thumbList ul li img").fadeTo("normal",0.5);
    $(".thumbList ul li img").hoverIntent(function(){
        $(this).fadeTo("normal",1);
        $(this).animate({
            paddingLeft: "9px"
        }, 100);
    }, function() {
        $(this).fadeTo("normal",0.5);
        $(this).animate({
            paddingLeft: "0"
        }, 100);
    });

    $('.more a').mouseover(function() {
        $(this).stop().animate({ backgroundColor: "#444" }, 200);
    }).mouseout(function() {
        $(this).stop().animate({ backgroundColor: "#888" }, 200);
    });
    $('.submitInput').mouseover(function() {
        $(this).stop().animate({ backgroundColor: "#4d4d4d" }, 200);
    }).mouseout(function() {
        $(this).stop().animate({ backgroundColor: "#888" }, 200);
    });

    $('#newsletterShow').click(function() {
        $('#newsletterForm').fadeIn();
        $(this).fadeOut();
        return false;
    });

    $('.sideDependentMenu ul ul a').mouseover(function() {
        $(this).stop().animate({
            backgroundPosition: "40px 6px",
            paddingLeft: "50px"
        }, 150);
    }).mouseout(function() {
        if ($(this).hasClass("current")) {
            $(this).stop().animate({
                backgroundPosition: "30px 6px",
                paddingLeft: "40px"
            }, 200);
        } else {
            $(this).stop().animate({
                backgroundPosition: "-10px 6px",
                paddingLeft: "40px"
            }, 200);
        }
    });

    $(".textimage").fadeIn(3000);

});

/*
 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
 * in FIPS PUB 180-1
 * Version 2.1a Copyright Paul Johnston 2000 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for details.
 */

/*
 * Configurable variables. You may need to tweak these to be compatible with
 * the server-side, but the defaults work in most cases.
 */
var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */

/*
 * These are the functions you'll usually want to call
 * They take string arguments and return either hex or base-64 encoded strings
 */
function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}
function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}
function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}
function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}
function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}
function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}

/*
 * Perform a simple self-test to see if the VM is working
 */
function sha1_vm_test()
{
  return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
}

/*
 * Calculate the SHA-1 of an array of big-endian words, and a bit length
 */
function core_sha1(x, len)
{
  /* append padding */
  x[len >> 5] |= 0x80 << (24 - len % 32);
  x[((len + 64 >> 9) << 4) + 15] = len;

  var w = Array(80);
  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;
  var e = -1009589776;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;
    var olde = e;

    for(var j = 0; j < 80; j++)
    {
      if(j < 16) w[j] = x[i + j];
      else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
      var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),
                       safe_add(safe_add(e, w[j]), sha1_kt(j)));
      e = d;
      d = c;
      c = rol(b, 30);
      b = a;
      a = t;
    }

    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);
    e = safe_add(e, olde);
  }
  return Array(a, b, c, d, e);

}

/*
 * Perform the appropriate triplet combination function for the current
 * iteration
 */
function sha1_ft(t, b, c, d)
{
  if(t < 20) return (b & c) | ((~b) & d);
  if(t < 40) return b ^ c ^ d;
  if(t < 60) return (b & c) | (b & d) | (c & d);
  return b ^ c ^ d;
}

/*
 * Determine the appropriate additive constant for the current iteration
 */
function sha1_kt(t)
{
  return (t < 20) ?  1518500249 : (t < 40) ?  1859775393 :
         (t < 60) ? -1894007588 : -899497514;
}

/*
 * Calculate the HMAC-SHA1 of a key and some data
 */
function core_hmac_sha1(key, data)
{
  var bkey = str2binb(key);
  if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz);

  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++)
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }

  var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz);
  return core_sha1(opad.concat(hash), 512 + 160);
}

/*
 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
 * to work around bugs in some JS interpreters.
 */
function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}

/*
 * Bitwise rotate a 32-bit number to the left.
 */
function rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}

/*
 * Convert an 8-bit or 16-bit string to an array of big-endian words
 * In 8-bit function, characters >255 have their hi-byte silently ignored.
 */
function str2binb(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);
  return bin;
}

/*
 * Convert an array of big-endian words to a string
 */
function binb2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);
  return str;
}

/*
 * Convert an array of big-endian words to a hex string.
 */
function binb2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8  )) & 0xF);
  }
  return str;
}

/*
 * Convert an array of big-endian words to a base-64 string
 */
function binb2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * (3 -  i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}

