var $j = jQuery.noConflict();

$j(document).ready(function() {


//Limits member's area homepage documents to 2 per category (classification).
$j(".litcat").each(function() {
  $j(this).children("p:gt(4)").hide();
  $j(this).children(".literature-container").children("span.icon2").hide();
});

//Gets FMA content for Flash player on homepage
function getFMAcontent(){
  var FMAcontent = $j("div.sliderwrapper").html();
  return FMAconent;
}




$j(".small-box").hover(
  function () {
    $j(this).children(".small-box-middle").children("img").animate({"opacity": 0.6}, 500);
  }, 
  function () {
    $j(this).children(".small-box-middle").children("img").animate({"opacity": 1}, 500);
  }
);




//$j(".product-listing").hover(
  //function () {
    //$j(this).children(".product-listing-right").animate({"opacity": 0.6}, 500);
  //}, 
  //function () {
    //$j(this).children(".product-listing-right").animate({"opacity": 1}, 500);
  //}
//);











//MAIN NAVIGATION SCRIPTS


//Setup 
var navMain = "ul#nav_849842"; //Defines which dynamic menu to target
var urlPath2 = jQuery.url.segment(0);  //Gets current section from second segment of URL



$j(navMain + ' li a').append('<span></span>'); //Adds span inside of ul li a. Business catalyst does not let you add additonal elements to the menu markup, so this must be done through jquery.

$j(navMain + ' li a[href*=' + urlPath2 + ']').parent('li').addClass('active'); //Finds LI linked containing urlPath2 and adds class of active.



$j(navMain + ' li').not('li.selected, li.active').hover(function(){
  	$j(this).find('a').css({'background-position' : '0 -100px', 'color' : '#000'});
     $j(this).find('a span').css('background-position', '0 -100px');
     },
     function(){
     $j(this).find('a').css({'background-position' : '0 0', 'color' : '#fff'});
     $j(this).find('a span').css('background-position', '0 0');
     }); 
//Navigation Animation - Size
var navDuration = 150;
var navJumpHeight = "15px";
		$j(navMain + ' li').not('li.selected, li.active').hover(function() {
            $j(this).animate({ top : "-="+navJumpHeight }, navDuration);            
        }, function() {
            $j(this).animate({ top : "15px" }, navDuration);
        }); 
//Navigation Animation - Background
//This gets the width of the menu to allow us to margin auto 0 center it.
//var navMainWidth = $j(navMain).width();
//$j(navMain).css('width', navMainWidth + 'px');
//$j(navMain).css('margin', '0 auto');


  





//Products Navigation
var subNav2 = "ul#nav_854967"; //Defines which dynamic menu to target
var urlPath2 = jQuery.url.segment(1);  //Gets current section from second segment of URL

$j(subNav2 + '  li ul li a[href*=' + urlPath2 + ']').parent('li').parent('ul').css('display', 'block'); //Finds LI linked containing urlPathN and adds class of active.


//Entire Div Clickable boxes (various)	
$j(document).ready(function(){

	$j(".small-box").click(function(){
	  window.location=$j(this).find("a").attr("href"); return false;
	});

});


$j(document).ready(function(){

	$j(".product-listing").click(function(){
	  window.location=$j(this).find("a").attr("href"); return false;
	});

});

$j(document).ready(function(){

	$j("div.contentdiv").click(function(){
	  window.location=$j(this).find("a.real-link").attr("href"); return false;
	});

});



$j(document).ready(function(){

	$j("div.small-box-full").click(function(){
	  window.location=$j(this).find("a").attr("href"); return false;
	});

});


//Support Navigation
var subNav3 = "ul#nav_882336"; //Defines which dynamic menu to target
var urlPath3 = jQuery.url.segment(1);  //Gets current section from second segment of URL

$j(subNav3 + '  li ul li a[href*=' + urlPath3 + ']').parent('li').parent('ul').css('display', 'block'); //Finds LI linked containing urlPathN and adds class of active.

//Our Company Navigation
var subNav4 = "ul#nav_882342"; //Defines which dynamic menu to target
var urlPath4 = jQuery.url.segment(1);  //Gets current section from second segment of URL

$j(subNav4 + '  li ul li a[href*=' + urlPath4 + ']').parent('li').parent('ul').css('display', 'block'); //Finds LI linked containing urlPathN and adds class of active.

//TECHNOLOGY Navigation
var subNav5 = "ul#nav_882342"; //Defines which dynamic menu to target
var urlPath5 = jQuery.url.segment(1);  //Gets current section from second segment of URL

$j(subNav5 + '  li ul li a[href*=' + urlPath5 + ']').parent('li').parent('ul').css('display', 'block'); //Finds LI linked containing urlPathN and adds class of active.

//NEWS ROOM Navigation
var subNav6 = "ul#nav_882340"; //Defines which dynamic menu to target
var urlPath6 = jQuery.url.segment(1);  //Gets current section from second segment of URL

$j(subNav6 + '  li ul li a[href*=' + urlPath6 + ']').parent('li').parent('ul').css('display', 'block'); //Finds LI linked containing urlPathN and adds class of active.


//INDUSTRIES Navigation
var subNav7 = "ul#nav_882330"; //Defines which dynamic menu to target
var urlPath7 = jQuery.url.segment(1);  //Gets current section from second segment of URL

$j(subNav7 + '  li ul li a[href*=' + urlPath7 + ']').parent('li').parent('ul').css('display', 'block'); //Finds LI linked containing urlPathN and adds class of active.




//Beign Scripts for Checkboxes and Radio buttons

var d = document;
var safari = (navigator.userAgent.toLowerCase().indexOf('safari') != -1) ? true : false;
var gebtn = function(parEl,child) { return parEl.getElementsByTagName(child); };
onload = function() {

    var body = gebtn(d,'body')[0];
    body.className = body.className && body.className != '' ? body.className + ' has-js' : 'has-js';

    if (!d.getElementById || !d.createTextNode) return;
    var ls = gebtn(d,'label');
    for (var i = 0; i < ls.length; i++) {
        var l = ls[i];
        if (l.className.indexOf('label_') == -1) continue;
        var inp = gebtn(l,'input')[0];
        if (l.className == 'label_check') {
            l.className = (safari && inp.checked == true || inp.checked) ? 'label_check c_on' : 'label_check c_off';
            l.onclick = check_it;
        };
        if (l.className == 'label_radio') {
            l.className = (safari && inp.checked == true || inp.checked) ? 'label_radio r_on' : 'label_radio r_off';
            l.onclick = turn_radio;
        };
    };
};
var check_it = function() {
    var inp = gebtn(this,'input')[0];
    if (this.className == 'label_check c_off' || (!safari && inp.checked)) {
       
        this.className = 'label_check c_on';
        if (safari) inp.click();
    } else {
       
        this.className = 'label_check c_off';
        if (safari) inp.click();
    };
};
var turn_radio = function() {
    var inp = gebtn(this,'input')[0];
    if (this.className == 'label_radio r_off' || inp.checked) {
        var ls = gebtn(this.parentNode,'label');
        for (var i = 0; i < ls.length; i++) {
            var l = ls[i];
            if (l.className.indexOf('label_radio') == -1)  continue;
            l.className = 'label_radio r_off';
        };
        this.className = 'label_radio r_on';
        if (safari) inp.click();
    } else {
        this.className = 'label_radio r_off';
        if (safari) inp.click();
    };
};

});     

//End Scripts for Checkboxes and Radio Buttons

     
