/*
 * jQuery EasIng v1.1.2 - 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
 */
eval(function(p, a, c, k, e, d){
    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--) {
            d[e(c)] = k[c] || e(c)
        }
        k = [function(e){
            return d[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
}('l.Y(l.n,{15:9(x,t,b,c,d){6 c*(t/=d)*t+b},V:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},U:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},17:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},P:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},O:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},13:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},S:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},18:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},G:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},B:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},M:9(x,t,b,c,d){6-c*8.A(t/d*(8.g/2))+c+b},C:9(x,t,b,c,d){6 c*8.m(t/d*(8.g/2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*t+s)+1)+b},H:9(x,t,b,c,d,s){e(s==w)s=1.j;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.y))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.y))+1)*t+s)+2)+b},z:9(x,t,b,c,d){6 c-l.n.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.i)){6 c*(7.q*t*t)+b}k e(t<(2/2.i)){6 c*(7.q*(t-=(1.5/2.i))*t+.i)+b}k e(t<(2.5/2.i)){6 c*(7.q*(t-=(2.J/2.i))*t+.L)+b}k{6 c*(7.q*(t-=(2.Q/2.i))*t+.T)+b}},W:9(x,t,b,c,d){e(t<d/2)6 l.n.z(x,t*2,0,c,d)*.5+b;6 l.n.v(x,t*2-d,0,c,d)*.5+c*.5+b}});', 62, 71, '||||||return||Math|function|||||if|var|PI|pow|75|70158|else|jQuery|sin|easing|sqrt||5625|abs|||asin|easeOutBounce|undefined||525|easeInBounce|cos|easeInOutQuint|easeOutSine|easeInOutSine|easeOutExpo|easeInOutExpo|easeOutQuint|easeInOutBack|easeInCirc|25|easeInElastic|9375|easeInSine|easeInOutElastic|easeInQuart|easeOutCubic|625|easeInOutCubic|easeInOutQuart|984375|easeInOutQuad|easeOutQuad|easeInOutBounce|easeOutElastic|extend|easeInBack||easeInOutCirc|easeOutCirc|easeOutQuart|easeOutBack|easeInQuad|easeInExpo|easeInCubic|easeInQuint'.split('|'), 0, {}))

/*
 * jQuery Easing Compatibility v1 - http://gsgd.co.uk/sandbox/jquery.easing.php
 *
 * Adds compatibility for applications that use the pre 1.2 easing names
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */
eval(function(p, a, c, k, e, d){
    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--) {
            d[e(c)] = k[c] || e(c)
        }
        k = [function(e){
            return d[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
}('0.C(0.1,{7:2(x,t,b,c,d){3 0.1.D(x,t,b,c,d)},5:2(x,t,b,c,d){3 0.1.6(x,t,b,c,d)},h:2(x,t,b,c,d){3 0.1.B(x,t,b,c,d)},A:2(x,t,b,c,d){3 0.1.m(x,t,b,c,d)},y:2(x,t,b,c,d){3 0.1.w(x,t,b,c,d)},v:2(x,t,b,c,d){3 0.1.u(x,t,b,c,d)},s:2(x,t,b,c,d){3 0.1.r(x,t,b,c,d)},q:2(x,t,b,c,d){3 0.1.p(x,t,b,c,d)},o:2(x,t,b,c,d){3 0.1.n(x,t,b,c,d)},8:2(x,t,b,c,d){3 0.1.l(x,t,b,c,d)},g:2(x,t,b,c,d){3 0.1.j(x,t,b,c,d)},i:2(x,t,b,c,d){3 0.1.k(x,t,b,c,d)},z:2(x,t,b,c,d){3 0.1.f(x,t,b,c,d)},e:2(x,t,b,c,d){3 0.1.a(x,t,b,c,d)},9:2(x,t,b,c,d){3 0.1.4(x,t,b,c,d)}});', 40, 40, 'jQuery|easing|function|return|easeInOutBack|easeOut|easeOutQuad|easeIn|elasin|backinout|easeOutBack||||backout|easeInBack|elasout|easeInOut|elasinout|easeOutElastic|easeInOutElastic|easeInElastic|easeInExpo|easeInOutBounce|bounceinout|easeOutBounce|bounceout|easeInBounce|bouncein||easeInOutExpo|expoinout|easeOutExpo||expoout|backin|expoin|easeInOutQuad|extend|easeInQuad'.split('|'), 0, {}))

/*
 jQuery Coda-Slider v1.1 - http://www.ndoherty.com/coda-slider
 Copyright (c) 2007 Niall Doherty
 Inspired by the clever folks at http://www.panic.com/coda
 Many thanks to Gian Carlo Mingati. Coda-Slider is a heavily modified version of his slideViewer, which can be found at  http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html
 
 Requirements:
 -  jQuery 1.2 ... available via  http://www.jquery.com
 -  jQuery easing plugin (1.2) ... available via  http://gsgd.co.uk/sandbox/jquery/easing/
 - jQuery easing compatability plugin ... available via  http://gsgd.co.uk/sandbox/jquery/easing/
 - CSS included in index.html
 */
jQuery(function(){
    jQuery("div.csw").prepend("<p class='loading'>Loading...<br /><img src='/images/ajax-loader.gif' alt='loading...'/ ></p>");
});
var j = 0;
jQuery.fn.codaSlider = function(settings){
    settings = jQuery.extend({
        easeFunc: "expoinout",
        easeTime: 750,
        toolTip: false
    }, settings);
    return this.each(function(){
        var container = jQuery(this);
        // Remove the preloader gif...
        container.find("p.loading").remove();
        // Self-explanatory...
        container.removeClass("csw").addClass("stripViewer");
        // Get the width of a panel, set from CSS...
        var panelWidth = container.find("div.panel").width();
        // panelCount gives us a count of the panels in the container...
        var panelCount = container.find("div.panel").size();
        // Calculate the width of all the panels when lined up end-to-end...
        var stripViewerWidth = panelWidth * panelCount;
        // Use the above width to specify the CSS width for the panelContainer element...
        container.find("div.panelContainer").css("width", stripViewerWidth);
        // Set the navWidth as a multiple of panelCount to account for margin-right on each li
        var navWidth = panelCount * 2;
        
        // Specify the current panel.
        // If the loaded URL has a hash (cross-linking), we're going to use that hash to give the slider a specific starting position...
        if (location.hash && parseInt(location.hash.slice(1)) <= panelCount) {
            var cPanel = parseInt(location.hash.slice(1));
            var cnt = -(panelWidth * (cPanel - 1));
            jQuery(this).find("div.panelContainer").css({
                left: cnt
            });
            // Otherwise, we'll just set the current panel to 1...
        }
        else {
            var cPanel = 1;
        };
        
        // Create appropriate nav
        container.each(function(i){
        
            // Create the Tabs
            jQuery(this).before("<div class='stripNav' id='stripNav" + j + "'><ul><\/ul><\/div>");
            jQuery(this).find("div.panel").each(function(n){
                jQuery("div#stripNav" + j + " ul").append("<li class='tab" + (n + 1) + "'><a href='#" + (n + 1) + "'>" + jQuery(this).attr("title") + "<\/a><\/li>");
            });
            
            // Tab nav
            jQuery("div#stripNav" + j + " a").each(function(z){
                // Figure out the navWidth by adding up the width of each li
                navWidth += jQuery(this).parent().width();
                // What happens when a nav link is clicked
                jQuery(this).bind("click", function(){
                    jQuery(this).addClass("current").parent().parent().find("a").not(jQuery(this)).removeClass("current"); // wow!
                    var cnt = -(panelWidth * z);
                    cPanel = z + 1;
                    jQuery(this).parent().parent().parent().next().find("div.panelContainer").animate({
                        left: cnt
                    }, settings.easeTime, settings.easeFunc);
                });
            });
            
            // Same-page cross-linking
            jQuery("div.dynamic-content a[href*='#']").click(function(){
                jQuery(this).parents().find(".stripNav ul li a:eq(" + (parseInt(jQuery(this).attr("href").slice(1)) - 1) + ")").trigger('click');
            });
            
            // Specify which tab is initially set to "current". Depends on if the loaded URL had a hash or not (cross-linking).
            if (location.hash && parseInt(location.hash.slice(1)) <= panelCount) {
                jQuery("div#stripNav" + j + " a:eq(" + (location.hash.slice(1) - 1) + ")").addClass("current");
            }
            else {
                jQuery("div#stripNav" + j + " a:eq(0)").addClass("current");
            }
            
        });
        
        j++;
    });
};

/* Custom Functions for Nexidia */

/* swfObject */
var flashvars = {};
var params = {};
params.wmode = "transparent";
var attributes = {};
attributes.id = "feature-holder";
swfobject.embedSWF("nexidia_header.swf", "feature-holder", "700", "353", "8.0.0", "/swf/expressInstall.swf", flashvars, params, attributes);

/*sIFR Replacement*/
var trade = {
    src: '/swf/trade.swf',
    wmode: 'transparent'
};

sIFR.activate(trade);

sIFR.replace(trade, {
    selector: '#home-page h2',
    css: ['.sIFR-root {color: #000000; font-weight: normal; font-size: 15px; background: none; }']
});
sIFR.replace(trade, {
    selector: '#home-page .static_home_content h3',
    css: ['.sIFR-root {color: #ffffff; font-weight: normal; font-size: 27px; background: none; }']
});

/*sIFR.replace(trade, {
 selector: 'h3'
 ,css: [
 '.sIFR-root {color: #191919; font-weight: normal; font-size: 15px; background: none;leading: -2; }',
 'a { text-decoration: none }',
 'a:link { color: #191919 }',
 'a:hover { color: #191919; text-decoration: underline; }'
 ]
 });*/
sIFR.replace(trade, {
    selector: 'h2',
    css: ['.sIFR-root {color: #2969b3; font-weight: bold; font-size: 24px; background: none; }']
});
sIFR.replace(trade, {
    selector: 'h6',
    css: ['.sIFR-root {color: #2969b3; font-weight: bold; font-size: 14px; background: none; text-transform: uppercase; }']
});

/* Global jQuery Functions */

$(document).ready(function(){
    /* Clear Search text on Focus */
    $('.search-textfield').focus(function(){
        $(this).val('');
    })
		
		/* Document List Tree */
	  try{
			$("#document-list").treeview({
	      collapsed: true,
	      animated: "fast"
	    });	
		}catch(e){}
		
    
    /*
     * capture all the links within the sempage to track the links
     */
    $('.sem_results a').click(function(){
        var semAction = $(this)[0].href;
        
        $.ajax({
					  //ensure that we don't pop-up the resource until the request has been logged
					  async: false,
            type: "GET",
            url: "/?e=sem.clickTrack",
						data: 'resourceUrl=' + escape(semAction)
        });
        return true;
    })
	
	/* hide all elements with this class */
    $('.hideme').hide();
	
});


/*Main Menu - SuckerFish */
startList = function(){
    if (document.all && document.getElementById) {
        navRoot = document.getElementById("main-nav");
        for (i = 0; i < navRoot.childNodes.length; i++) {
            node = navRoot.childNodes[i];
            if (node.nodeName == "LI") {
                node.onmouseover = function(){
                    this.className += " over";
                }
                node.onmouseout = function(){
                    this.className = this.className.replace(" over", "");
                }
            }
        }
    }
	/* hide all elements with this class */
    $('.hidemeDelayed').hide();
}
window.onload = startList;


/* Contact Center show/hide script */
function showSlidingDiv(a){
$("#"+a).animate({"height": "toggle"}, { duration: 500 });
}

function closeSlidingDiv(a){
$("#"+a).animate({"height": "toggle"}, { duration: 500 });
}
