$j(document).ready(function() {
	resize();
	$j.fn.fullscreenr({  width: 1024, height: 683, bgID: '.backimg' });
	if (!$j.browser.msie) { $j(".nav a, .jspTrack, .jspDrag").corner(); }
	
	$j(".cycle").cycle({
		timeout: 5000
	});
});

$j(window).resize(function() { resize(); });
$j(window).load(function() { $j(".backimg").fadeIn("slow") });

function resize() {
	var container_height = $j(window).height() - $j("#footer").height();
	fix = (isie6()) ? 37 : 10;
	$j("#container").height(container_height - fix);
	scrollbarinit();
}

function isie6() { if (($j.browser.msie) && ($j.browser.version.substr(0,1)<8)) { return true; } else { return false; }}
function scrollbarinit() { if ((getUrlVars()["page"] != undefined) && (!isie6())) { $j('.scroll').jScrollPane({ verticalGutter: 30 }); }}

function getUrlVars() {
	var vars = [], hash;
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	for(var i = 0; i < hashes.length; i++) {
		hash = hashes[i].split('=');
		vars.push(hash[0]);
		vars[hash[0]] = hash[1];
	}
	return vars;
}

/* jcorner */

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}(';(G($){Y h=13.1d(\'U\').y,u=h[\'2T\']!==15,I=h[\'2M\']!==15,k=h[\'1M\']!==15||h[\'2s\']!==15,1q=13.2E||0,25=$.1c.1y&&(($.1c.2x<8&&!1q)||1q<8),1E=$.1c.1y&&(G(){Y a=13.1d(\'U\');2y{a.y.1s(\'m\',\'0+0\');a.y.2Y(\'m\')}2q(e){5 2g}5 29})();$.1a=$.1a||{};$.1a.1M=u||I||k;G 1m(a,p){5 S($.7(a,p))||0};G 1h(s){s=S(s).2S(16);5(s.1N<2)?\'0\'+s:s};G 23(a){33(a){Y v=$.7(a,\'1r\'),Z;9(v&&v!=\'1W\'&&v!=\'32(0, 0, 0, 0)\'){9(v.2J(\'Z\')>=0){Z=v.14(/\\d+/g);5\'#\'+1h(Z[0])+1h(Z[1])+1h(Z[2])}5 v}9(a.2D.1Q()==\'3b\')H;a=a.17}5\'#2Z\'};G 26(a,i,b){1A(a){6\'x\':5 l.x(b*(1-l.1g(l.1x(i/b))));6\'2d\':5 l.x(b*(1+l.1g(l.1x(i/b))));6\'2j\':5 b-i;6\'2k\':5 l.x(b*(l.1g(l.1x((b-i-1)/b))));6\'2n\':5 l.x(b*(l.1G(i,b/i)));6\'1H\':5 l.x(b*(l.1G(b,(b-i-1))));6\'1J\':5 l.x(b*(l.2z(i)));6\'1K\':5 l.x(b*(l.1g(i)));6\'1L\':5 l.x(b*(l.30(i)));6\'1O\':5 l.x(b*(l.34(i)));6\'1P\':5 l.x(b*(l.2r((b-i-1),b)));6\'1v\':6\'1R\':5(i&1)?(i+1):b;6\'1S\':5(i&2)?(i+1):b;6\'1T\':5(i&3)?(i+1):b;6\'1U\':5(i%2)*b;6\'1V\':5 b;6\'1t\':6\'1X\':5 i+1;6\'1Z\':5 i/2+1;6\'22\':5(b-i)/2+1}};$.12.J=G(g){9(4.1N==0){9(!$.2A&&4.27){Y s=4.27,c=4.2G;$(G(){$(s,c).J(g)})}5 4}5 4.2O(G(a){Y b=$(4),o=[b.2W($.12.J.1o.2i)||\'\',g||\'\'].31(\' \').1Q(),1n=/1n/.W(o),1e=((o.14(/1e:(#[0-2l-f]+)/)||[])[1]),1f=((o.14(/1f:(#[0-2l-f]+)/)||[])[1]),m=S((o.14(/(\\d+)r/)||[])[1])||10,2p=/x|1t|1X|1V|2k|2d|2j|2n|1H|1J|1K|1U|1L|1P|1O|1T|1S|1v|1R|22|1Z/,1u=((o.14(2p)||[\'x\'])[0]),1I=/1v|1t/.W(o),1k={T:0,B:1},n={K:/E|2N|A/.W(o),M:/E|2Q|C/.W(o),N:/F|2U|A/.W(o),O:/F|2X|C/.W(o)},Q,D,1l,j,z,d,q,1p,i,w,e,c,1b,$V;9(!n.K&&!n.M&&!n.N&&!n.O)n={K:1,M:1,N:1,O:1};9($.12.J.1o.1Y&&1u==\'x\'&&(k||u||I)&&!1e&&!1f){9(n.K)b.7(k?\'t-E-A-k\':u?\'-u-t-k-2t\':\'-I-t-E-A-k\',m+\'r\');9(n.M)b.7(k?\'t-E-C-k\':u?\'-u-t-k-2u\':\'-I-t-E-C-k\',m+\'r\');9(n.N)b.7(k?\'t-F-A-k\':u?\'-u-t-k-2v\':\'-I-t-F-A-k\',m+\'r\');9(n.O)b.7(k?\'t-F-C-k\':u?\'-u-t-k-2w\':\'-I-t-F-C-k\',m+\'r\');5}Q=13.1d(\'U\');$(Q).7({20:\'21\',1F:\'11\',2B:\'11\',2C:\'11\',1r:1f||\'1W\',24:\'1w\'});D={T:S($.7(4,\'2F\'))||0,R:S($.7(4,\'2H\'))||0,B:S($.7(4,\'2I\'))||0,L:S($.7(4,\'2K\'))||0};9(2L 4.y.28!=15)4.y.28=1;9(!1n)4.y.t=\'X\';Q.y.2a=1e||23(4.17);1l=$(4).2P();1z(j 2b 1k){z=1k[j];9((z&&(n.N||n.O))||(!z&&(n.K||n.M))){Q.y.24=\'X \'+(n[j+\'R\']?\'1w\':\'X\')+\' X \'+(n[j+\'L\']?\'1w\':\'X\');d=13.1d(\'U\');$(d).2R(\'2c-J\');q=d.y;z?4.18(d):4.2e(d,4.2f);9(z&&1l!=\'2V\'){9($.7(4,\'P\')==\'2h\')4.y.P=\'1B\';q.P=\'1C\';q.F=q.A=q.1D=q.1i=\'0\';9(1E)q.1s(\'m\',\'4.17.2m\');1j q.m=\'2o%\'}1j 9(!z&&$.1c.1y){9($.7(4,\'P\')==\'2h\')4.y.P=\'1B\';q.P=\'1C\';q.E=q.A=q.C=q.1D=q.1i=\'0\';9(1E){1p=1m(4,\'35\')+1m(4,\'36\');q.1s(\'m\',\'4.17.2m - \'+1p+\'+ "r"\')}1j q.m=\'2o%\'}1j{q.P=\'1B\';q.1i=!z?\'-\'+D.T+\'r -\'+D.R+\'r \'+(D.T-m)+\'r -\'+D.L+\'r\':(D.B-m)+\'r -\'+D.R+\'r -\'+D.B+\'r -\'+D.L+\'r\'}1z(i=0;i<m;i++){w=l.37(0,26(1u,i,m));e=Q.38(2g);e.y.39=\'0 \'+(n[j+\'R\']?w:0)+\'r 0 \'+(n[j+\'L\']?w:0)+\'r\';z?d.18(e):d.2e(e,d.2f)}9(1I&&$.1a.3a){9(z&&25)19;1z(c 2b n){9(!n[c])19;9(z&&(c==\'K\'||c==\'M\'))19;9(!z&&(c==\'N\'||c==\'O\'))19;1b={P:\'1C\',t:\'X\',1i:0,1D:0,20:\'21\',1r:Q.y.2a};$V=$(\'<U/>\').7(1b).7({m:m+\'r\',1F:\'11\'});1A(c){6\'K\':$V.7({F:0,A:0});H;6\'M\':$V.7({F:0,C:0});H;6\'N\':$V.7({E:0,A:0});H;6\'O\':$V.7({E:0,C:0});H}d.18($V[0]);Y f=$(\'<U/>\').7(1b).7({E:0,F:0,m:\'11\',1F:m+\'r\'});1A(c){6\'K\':f.7({A:m});H;6\'M\':f.7({C:m});H;6\'N\':f.7({A:m});H;6\'O\':f.7({C:m});H}d.18(f[0])}}}}})};$.12.3c=G(){9(k||u||I)4.7(k?\'t-k\':u?\'-u-t-k\':\'-I-t-k\',0);$(\'U.2c-J\',4).3d();5 4};$.12.J.1o={1Y:29,2i:\'3e-J\'}})(3f);',62,202,'||||this|return|case|css||if|||||||||||radius|Math|width|opts|||ds|px||border|moz|||round|style|bot|left||right|pad|top|bottom|function|break|webkit|corner|TL||TR|BL|BR|position|strip||parseInt||div|horz|test|none|var|rgb||1px|fn|document|match|undefined||parentNode|appendChild|continue|support|common|browser|createElement|cc|sc|cos|hex2|margin|else|edges|cssHeight|sz|keep|defaults|bw|mode|backgroundColor|setExpression|bevelfold|fx|dogfold|solid|asin|msie|for|switch|relative|absolute|padding|expr|height|atan2|jut|fold|curl|tear|wicked|borderRadius|length|long|sculpt|toLowerCase|dog|dog2|dog3|fray|notch|transparent|bevel|useNative|steep|overflow|hidden|invsteep|gpc|borderStyle|noBottomFold|getWidth|selector|zoom|true|borderColor|in|jquery|cool|insertBefore|firstChild|false|static|metaAttr|sharp|bite|9a|offsetWidth|slide|100|re|catch|log|BorderRadius|topleft|topright|bottomleft|bottomright|version|try|atan|isReady|minHeight|fontSize|nodeName|documentMode|paddingTop|context|paddingRight|paddingBottom|indexOf|paddingLeft|typeof|WebkitBorderRadius|tl|each|outerHeight|tr|addClass|toString|MozBorderRadius|bl|auto|attr|br|removeExpression|ffffff|tan|join|rgba|while|sqrt|borderLeftWidth|borderRightWidth|max|cloneNode|borderWidth|boxModel|html|uncorner|remove|data|jQuery'.split('|'),0,{}))

/* fullscreenr */

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}('(4($){$.y.F=4(a){7(a.1===p)o(\'k 9 i g e 1, l v j f 6 h. q r 6 s t.\');7(a.3===p)o(\'k 9 i g e 3, l v j f 6 h. q r 6 s t.\');7(a.8===p)o(\'k 9 i g e C, l #w j f 6 h.\');5 b={3:z,1:L,8:\'w\'};5 a=$.D({},b,a);$(E).H(4(){$(a.8).m(a)});$(n).A("B",4(){$(a.8).m(a)});u 0};$.y.m=4(a){5 b=a.1/a.3;5 c=$(n).3();5 d=$(n).1();7((d/c)>b){$(0).1(d);$(0).3(d/b)}G{$(0).3(c);$(0).1(c*b)}$(0).x(\'I\',(c-$(0).3())/2);$(0).x(\'K\',(d-$(0).1())/2);u 0}})(J);',48,48,'this|height||width|function|var|be|if|bgID|supply|||||image|now|background|used|the|will|Please|default|fullscreenrResizer|window|alert|undefined|These|may|very|inaccurate|return|values|bgimg|css|fn|1280|bind|resize|ID|extend|document|fullscreenr|else|ready|left|jQuery|top|1024'.split('|'),0,{}))

/*!
 * jQuery Cycle Lite Plugin
 * http://malsup.com/jquery/cycle/lite/
 * Copyright (c) 2008-2011 M. Alsup
 * Version: 1.3.1 (07-OCT-2011)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.3.2 or later
 */
;(function($) {

var ver = 'Lite-1.3';

$.fn.cycle = function(options) {
    return this.each(function() {
        options = options || {};
        
        if (this.cycleTimeout) clearTimeout(this.cycleTimeout);
        this.cycleTimeout = 0;
        this.cyclePause = 0;
        
        var $cont = $(this);
        var $slides = options.slideExpr ? $(options.slideExpr, this) : $cont.children();
        var els = $slides.get();
        if (els.length < 2) {
            window.console && console.log('terminating; too few slides: ' + els.length);
            return; // don't bother
        }

        // support metadata plugin (v1.0 and v2.0)
        var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
		var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
		if (meta)
			opts = $.extend(opts, meta);
            
        opts.before = opts.before ? [opts.before] : [];
        opts.after = opts.after ? [opts.after] : [];
        opts.after.unshift(function(){ opts.busy=0; });
            
        // allow shorthand overrides of width, height and timeout
        var cls = this.className;
        opts.width = parseInt((cls.match(/w:(\d+)/)||[])[1]) || opts.width;
        opts.height = parseInt((cls.match(/h:(\d+)/)||[])[1]) || opts.height;
        opts.timeout = parseInt((cls.match(/t:(\d+)/)||[])[1]) || opts.timeout;

        if ($cont.css('position') == 'static') 
            $cont.css('position', 'relative');
        if (opts.width) 
            $cont.width(opts.width);
        if (opts.height && opts.height != 'auto') 
            $cont.height(opts.height);

        var first = 0;
        $slides.css({position: 'absolute', top:0, left:0}).each(function(i) { 
            $(this).css('z-index', els.length-i) 
        });
        
        $(els[first]).css('opacity',1).show(); // opacity bit needed to handle reinit case
        if ($.browser.msie) els[first].style.removeAttribute('filter');

        if (opts.fit && opts.width) 
            $slides.width(opts.width);
        if (opts.fit && opts.height && opts.height != 'auto') 
            $slides.height(opts.height);
        if (opts.pause) 
            $cont.hover(function(){this.cyclePause=1;}, function(){this.cyclePause=0;});

        var txFn = $.fn.cycle.transitions[opts.fx];
		txFn && txFn($cont, $slides, opts);
        
        $slides.each(function() {
            var $el = $(this);
            this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height();
            this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width();
        });

        if (opts.cssFirst)
            $($slides[first]).css(opts.cssFirst);

        if (opts.timeout) {
            // ensure that timeout and speed settings are sane
            if (opts.speed.constructor == String)
                opts.speed = {slow: 600, fast: 200}[opts.speed] || 400;
            if (!opts.sync)
                opts.speed = opts.speed / 2;
            while((opts.timeout - opts.speed) < 250)
                opts.timeout += opts.speed;
        }
        opts.speedIn = opts.speed;
        opts.speedOut = opts.speed;

 		opts.slideCount = els.length;
        opts.currSlide = first;
        opts.nextSlide = 1;

        // fire artificial events
        var e0 = $slides[first];
        if (opts.before.length)
            opts.before[0].apply(e0, [e0, e0, opts, true]);
        if (opts.after.length > 1)
            opts.after[1].apply(e0, [e0, e0, opts, true]);
        
        if (opts.click && !opts.next)
            opts.next = opts.click;
        if (opts.next)
            $(opts.next).bind('click', function(){return advance(els,opts,opts.rev?-1:1)});
        if (opts.prev)
            $(opts.prev).bind('click', function(){return advance(els,opts,opts.rev?1:-1)});

        if (opts.timeout)
            this.cycleTimeout = setTimeout(function() {
                go(els,opts,0,!opts.rev)
            }, opts.timeout + (opts.delay||0));
    });
};

function go(els, opts, manual, fwd) {
    if (opts.busy) return;
    var p = els[0].parentNode, curr = els[opts.currSlide], next = els[opts.nextSlide];
    if (p.cycleTimeout === 0 && !manual) 
        return;

    if (manual || !p.cyclePause) {
        if (opts.before.length)
            $.each(opts.before, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
        var after = function() {
            if ($.browser.msie)
                this.style.removeAttribute('filter');
            $.each(opts.after, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
            queueNext();
        };

        if (opts.nextSlide != opts.currSlide) {
            opts.busy = 1;
            $.fn.cycle.custom(curr, next, opts, after);
        }
        var roll = (opts.nextSlide + 1) == els.length;
        opts.nextSlide = roll ? 0 : opts.nextSlide+1;
        opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
    }
    
    function queueNext() {
        if (opts.timeout)
            p.cycleTimeout = setTimeout(function() { go(els,opts,0,!opts.rev) }, opts.timeout);
    }
};

// advance slide forward or back
function advance(els, opts, val) {
    var p = els[0].parentNode, timeout = p.cycleTimeout;
    if (timeout) {
        clearTimeout(timeout);
        p.cycleTimeout = 0;
    }
    opts.nextSlide = opts.currSlide + val;
    if (opts.nextSlide < 0) {
        opts.nextSlide = els.length - 1;
    }
    else if (opts.nextSlide >= els.length) {
        opts.nextSlide = 0;
    }
    go(els, opts, 1, val>=0);
    return false;
};

$.fn.cycle.custom = function(curr, next, opts, cb) {
    var $l = $(curr), $n = $(next);
    $n.css(opts.cssBefore);
    var fn = function() {$n.animate(opts.animIn, opts.speedIn, opts.easeIn, cb)};
    $l.animate(opts.animOut, opts.speedOut, opts.easeOut, function() {
        $l.css(opts.cssAfter);
        if (!opts.sync) fn();
    });
    if (opts.sync) fn();
};

$.fn.cycle.transitions = {
    fade: function($cont, $slides, opts) {
		$slides.not(':eq(0)').hide();
		opts.cssBefore = { opacity: 0, display: 'block' };
		opts.cssAfter  = { display: 'none' };
		opts.animOut = { opacity: 0 };
		opts.animIn = { opacity: 1 };
    },
    fadeout: function($cont, $slides, opts) {
		opts.before.push(function(curr,next,opts,fwd) {
			$(curr).css('zIndex',opts.slideCount + (fwd === true ? 1 : 0));
			$(next).css('zIndex',opts.slideCount + (fwd === true ? 0 : 1));
		});
		$slides.not(':eq(0)').hide();
		opts.cssBefore = { opacity: 1, display: 'block', zIndex: 1 };
		opts.cssAfter  = { display: 'none', zIndex: 0 };
		opts.animOut = { opacity: 0 };
    }
};

$.fn.cycle.ver = function() { return ver; };

// @see: http://malsup.com/jquery/cycle/lite/
$.fn.cycle.defaults = {
	animIn:        {},
	animOut:       {},
	fx:           'fade',
    after:         null, 
    before:        null, 
	cssBefore:     {},
	cssAfter:      {},
    delay:         0,    
    fit:           0,    
    height:       'auto',
	metaAttr:     'cycle',
    next:          null, 
    pause:         0,    
    prev:          null, 
    speed:         1000, 
    slideExpr:     null,
    sync:          1,    
    timeout:       4000 
};

})(jQuery);
