﻿/****************************************************************************************	
	[GLOBAL JQUERY]
*****************************************************************************************/
$(document).ready(function() {

    // Superfish dropdown menu
    $("#nav-main ul").superfish({ delay: 400, animation: { height: "show" }, speed: "fast", autoArrows: false, dropShadows: false });
    // Tabs
    $("#tabs").accessibleTabs();
    $("#tabs-summary").accessibleTabs({ tabhead: "h2" });
    // Rotators
    $('#clients').innerfade({ speed: 1000, timeout: 4000, type: 'random', containerheight: '1em' });
    $('#rotator').innerfade({ speed: 1000, timeout: 8000, type: 'random', containerheight: '1em' });

    // Clear text input values
    var swap_text_boxes = [];
    jQuery.each($("input[type='text'].autoclear"), function() {
        swap_text_boxes[$(this).attr('id')] = $(this).attr('value');
        $(this).bind('focus', function() {
            if ($(this).val() == swap_text_boxes[$(this).attr('id')]) {
                $(this).val('');
            }
        });
        $(this).bind('blur', function() {
            if ($(this).val() == '') {
                $(this).val(swap_text_boxes[$(this).attr('id')]);
            }
        });
    });

    // Enable forms to be submitted via ENTER key
    var AreaSelector = "#content-wrapper, .search, #login";
    var ButtonSelector = "input[type='submit'],input[type='image'],button";
    jQuery.each($(AreaSelector), function() {
        $(this).keypress(function(e) {
            if (e.which == 13 && e.target.type != 'textarea') {
                var arrItems = $(this).find(ButtonSelector);
                if (arrItems.length > 0) {
                    $(this).find(ButtonSelector)[0].click();
                }
                return false;
            }
        });
    });

    // Append WAI-ARIA landmark roles
    $("#header").attr("role", "banner");
    $(".search, #journal-search").attr("role", "search");
    $("#nav-main, #sidebar ul").attr("role", "navigation");
    $("#content-main").attr("role", "main");
    $("#aside").attr("role", "complementary");
    $("#footer").attr("role", "contentinfo");

    // Restrict number of characters in textareas - used for Reviews and Forum modules but can be used anywhere
    $("textarea.char-limit-2000").charLimit({ limit: 2000 }); // Large character limit - 2000 (Forum)
    $("textarea.char-limit-255").charLimit({ limit: 255 }); // Small character limit - 255 (Registration Form)

});

/****************************************************************************************	
	[JQUERY PLUGINS]
*****************************************************************************************/
/*
 Superfish v1.4.8 - jQuery menu widget Copyright (c) 2008 Joel Birch CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php, http://www.gnu.org/licenses/gpl.html
*/
eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } (';(2($){$.k.z=2(d){4 e=$.k.z,c=e.c,$N=$([\'<O 1k="\',c.P,\'"> &#1l;</O>\'].g(\'\')),q=2(){4 a=$(3),l=A(a);Q(l.B);a.R().1m().r()},C=2(){4 a=$(3),l=A(a),o=e.9;Q(l.B);l.B=1n(2(){o.D=($.1o(a[0],o.$m)>-1);a.r();t(o.$m.E&&a.F([\'h.\',o.j].g(\'\')).E<1){q.8(o.$m)}},o.S)},A=2(a){4 b=a.F([\'5.\',c.G,\':T\'].g(\'\'))[0];e.9=e.o[b.U];u b},V=2(a){a.v(c.W).1p($N.1q())};u 3.n(2(){4 s=3.U=e.o.E;4 o=$.X({},e.Y,d);o.$m=$(\'h.\'+o.H,3).1r(0,o.Z).n(2(){$(3).v([o.j,c.I].g(\' \')).1s(\'h:10(5)\').11(o.H)});e.o[s]=e.9=o;$(\'h:10(5)\',3)[($.k.12&&!o.13)?\'12\':\'1t\'](q,C).n(2(){t(o.14)V($(\'>a:T-1u\',3))}).w(\'.\'+c.I).r();4 b=$(\'a\',3);b.n(2(i){4 a=b.15(i).F(\'h\');b.15(i).1v(2(){q.8(a)}).1w(2(){C.8(a)})});o.16.8(3)}).n(2(){4 a=[c.G];t(e.9.J&&!($.x.17&&$.x.18<7))a.1x(c.y);$(3).v(a.g(\' \'))})};4 f=$.k.z;f.o=[];f.9={};f.K=2(){4 o=f.9;t($.x.17&&$.x.18>6&&o.J&&o.L.19!=1y)3.1z(f.c.y+\'-1a\')};f.c={I:\'p-1A\',G:\'p-1B-1C\',W:\'p-1D-5\',P:\'p-1E-1F\',y:\'p-1G\'};f.Y={j:\'1H\',H:\'1I\',Z:1,S:1J,L:{19:\'1K\'},1b:\'1L\',14:M,J:M,13:1c,16:2(){},1d:2(){},1e:2(){},1f:2(){}};$.k.X({r:2(){4 o=f.9,w=(o.D===M)?o.$m:\'\';o.D=1c;4 a=$([\'h.\',o.j].g(\'\'),3).1M(3).w(w).11(o.j).1g(\'>5\').1N().1h(\'1i\',\'1j\');o.1f.8(a);u 3},R:2(){4 o=f.9,1O=f.c.y+\'-1a\',$5=3.v(o.j).1g(\'>5:1j\').1h(\'1i\',\'1P\');f.K.8($5);o.1d.8($5);$5.1Q(o.L,o.1b,2(){f.K.8($5);o.1e.8($5)});u 3}})})(1R);', 62, 116, '||function|this|var|ul|||call|op|||||||join|li||hoverClass|fn|menu|path|each||sf|over|hideSuperfishUl||if|return|addClass|not|browser|shadowClass|superfish|getMenu|sfTimer|out|retainPath|length|parents|menuClass|pathClass|bcClass|dropShadows|IE7fix|animation|true|arrow|span|arrowClass|clearTimeout|showSuperfishUl|delay|first|serial|addArrow|anchorClass|extend|defaults|pathLevels|has|removeClass|hoverIntent|disableHI|autoArrows|eq|onInit|msie|version|opacity|off|speed|false|onBeforeShow|onShow|onHide|find|css|visibility|hidden|class|187|siblings|setTimeout|inArray|append|clone|slice|filter|hover|child|focus|blur|push|undefined|toggleClass|breadcrumb|js|enabled|with|sub|indicator|shadow|sfHover|overideThisToUse|800|show|normal|add|hide|sh|visible|animate|jQuery'.split('|'), 0, {}));
/**
* INNERFADE Author: Torsten Baldes Mail: t.baldes@medienfreunde.com Web: http://medienfreunde.com
* based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/ and Ralf S. Engelschall http://trainofthoughts.org/
*/
eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(3($){$.M.5=3(a){N r.O(3(){$.5(r,a)})};$.5=3(a,b){g c={\'n\':\'s\',\'j\':\'P\',\'9\':\'h\',\'k\':Q,\'C\':\'R\',\'D\':\'5\',\'l\':E};2(b)$.S(c,b);2(c.l===E)g d=$(a).l();6 g d=$(a).l(c.l);2(d.4>1){$(a).o(\'F\',\'T\').o(\'U\',c.C).V(c.D);W(g i=0;i<d.4;i++){$(d[i]).o(\'z-X\',Y(d.4-i)).o(\'F\',\'Z\').10()};2(c.9=="h"){p(3(){$.5.m(d,c,1,0)},c.k);$(d[0]).t()}6 2(c.9=="7"){g e=8.q(8.7()*(d.4));p(3(){11{f=8.q(8.7()*(d.4))}G(e==f);$.5.m(d,c,f,e)},c.k);$(d[e]).t()}6 2(c.9==\'u\'){c.9=\'h\';g f=8.q(8.7()*(d.4));p(3(){$.5.m(d,c,(f+1)%d.4,f)},c.k);$(d[f]).t()}6{v(\'w-H x y A \\\'h\\\', \\\'7\\\' B \\\'u\\\'\')}}};$.5.m=3(a,b,c,d){2(b.n==\'I\'){$(a[d]).12(b.j);$(a[c]).13(b.j)}6 2(b.n==\'s\'){$(a[d]).14(b.j);$(a[c]).15(b.j,3(){J($(r)[0])})}6 v(\'w-n x y A \\\'I\\\' B \\\'s\\\'\');2(b.9=="h"){2((c+1)<a.4){c=c+1;d=c-1}6{c=0;d=a.4-1}}6 2(b.9=="7"){d=c;G(c==d)c=8.q(8.7()*a.4)}6 v(\'w-H x y A \\\'h\\\', \\\'7\\\' B \\\'u\\\'\');p((3(){$.5.m(a,b,c,d)}),b.k)}})(16);3 J(a){2(a.K.L){a.K.L(\'17\')}}', 62, 70, '||if|function|length|innerfade|else|random|Math|type|||||||var|sequence||speed|timeout|children|next|animationtype|css|setTimeout|floor|this|fade|show|random_start|alert|Innerfade|must|either||be|or|containerheight|runningclass|null|position|while|Type|slide|removeFilter|style|removeAttribute|fn|return|each|normal|2000|auto|extend|relative|height|addClass|for|index|String|absolute|hide|do|slideUp|slideDown|fadeOut|fadeIn|jQuery|filter'.split('|'), 0, {}));
/**
* Accessible, unobtrusive tabs Version: 1.1.1, http://blog.ginader.de/dev/yamltabs/index.php
* Copyright (c) 2007 Dirk Ginader (ginader.de) Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php - http://www.gnu.org/licenses/gpl.html
*/
(function($) { $.fn.extend({ getUniqueId: function(p) { return p + new Date().getTime(); }, accessibleTabs: function(config) { var defaults = { wrapperClass: 'content clearfix', currentClass: 'current', tabhead: 'h4', tabbody: '.tab-content', fx: 'fadeIn', fxspeed: 1, currentInfoText: 'current tab: ', currentInfoPosition: 'prepend', currentInfoClass: 'current-info hide' }; var options = $.extend(defaults, config); var o = this; return this.each(function() { var el = $(this); var list = ''; var contentAnchor = o.getUniqueId('accessibletabscontent'); var tabsAnchor = o.getUniqueId('accessibletabs'); $(el).wrapInner('<div class="' + options.wrapperClass + '"></div>'); $(el).find(options.tabhead).each(function(i) { var id = ''; if (i === 0) { id = ' id="' + tabsAnchor + '"'; } list += '<li><a' + id + ' href="#' + contentAnchor + '">' + $(this).text() + '</a></li>'; $(this).remove(); }); $(el).prepend('<ul id="tab-nav">' + list + '</ul>'); $(el).find(options.tabbody).hide(); $(el).find(options.tabbody + ':first').show().before('<' + options.tabhead + '><a tabindex="0" class="hide" name="' + contentAnchor + '" id="' + contentAnchor + '">' + $(el).find("ul>li:first").text() + '</a></' + options.tabhead + '>'); $(el).find("ul>li:first").addClass(options.currentClass).find('a')[options.currentInfoPosition]('<span class="' + options.currentInfoClass + '">' + options.currentInfoText + '</span>'); $(el).find('ul>li>a').each(function(i) { $(this).click(function(event) { event.preventDefault(); $(el).find('ul>li.current').removeClass(options.currentClass).find("span." + options.currentInfoClass).remove(); $(this).blur(); $(el).find(options.tabbody + ':visible').hide(); $(el).find(options.tabbody).eq(i)[options.fx](options.fxspeed); $('#' + contentAnchor).text($(this).text()).focus(); $(this)[options.currentInfoPosition]('<span class="' + options.currentInfoClass + '">' + options.currentInfoText + '</span>').parent().addClass(options.currentClass); }); }); }); } }); })(jQuery);
/* Branches Popup */
$(function() { $('#branches ul li').each(function() { var time = 100; var hideDelay = 400; var hideDelayTimer = null; var newZIndex = 2; var defaultZIndex = 1; var beingShown = false; var shown = false; var trigger = $(this); var popup = $('div.popup', this).css('opacity', 0); popup.parent().css('z-index', defaultZIndex); $([trigger.get(0), popup.get(0)]).mouseover(function() { if (hideDelayTimer) clearTimeout(hideDelayTimer); if (beingShown || shown) { return; } else { beingShown = true; popup.parent().css('z-index', newZIndex); popup.css({ display: 'block' }).animate({ opacity: 1 }, time, 'swing', function() { beingShown = false; shown = true; }); } }).mouseout(function() { if (hideDelayTimer) clearTimeout(hideDelayTimer); hideDelayTimer = setTimeout(function() { hideDelayTimer = null; popup.animate({ opacity: 0 }, time, 'swing', function() { shown = false; popup.parent().css('z-index', defaultZIndex); popup.css('display', 'none'); }); }, hideDelay); }); }); });
/*
* CharLimit - jQuery plugin for counting and limiting characters for input and textarea fields - michal.podhradsky@gmail.com
* $Version: 18.11.2008
*/
(function($) {$.fn.charLimit = function(options) {var defaults = { limit: 30, descending: true }; var o = $.extend(defaults, options); return this.each(function(i) {var obj = $(this); var message = obj.next("p.char-count"); message.html("<em></em> characters remaining (" + o.limit + " maximum). " + message.text()); countChars(); function countChars() { var value = (o.descending) ? o.limit - obj.val().length : obj.val().length; message.children("em:first-child").text(value); } obj.keydown(function(e) {if (obj.val().length >= o.limit && e.keyCode != "8" && e.keyCode != "9" && e.keyCode != "46") e.preventDefault(); countChars();}).keyup(function(e) {if (obj.val().length >= o.limit) { obj.val(obj.val().substr(0, o.limit)) };countChars();})});}})(jQuery);