// JavaScript Document

// FUNCTIONS 

				function fader() {
            var oCurPhoto = jQuery('#show1 div.current');
            var oNxtPhoto = oCurPhoto.next();
            if (oNxtPhoto.length == 0)
                oNxtPhoto = jQuery('#show1 div:first');

            oCurPhoto.removeClass('current').addClass('previous');
            oNxtPhoto.css({ opacity: 0.0 }).addClass('current').animate({ opacity: 1.0 }, 2000,
                function() {
                    oCurPhoto.removeClass('previous');
                }); 
		}; 
		

// Footer 

function footerIn(){
	jQuery("#footer").animate({"height" : "31px"},1000);
	  };
	  
// end FUNCTIONS



jQuery(document).ready(function(){
								
	jQuery.noConflict();

						   
//  ...............................................MAIN NAV
    

// initialise Superfish 
 
        jQuery("ul.menu").superfish(function(){}); 
						   
// instantiate fader in time

            setInterval("fader()", 7000);
			
			
			
//  ............................................ FOOTER			

//Fix Iphone and Ipad floating footer issue
if((navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPad") != -1) || (navigator.platform.indexOf("iPod") != -1))
{
	 jQuery("#footer").css({"position" : "static", "margin" : "0"});
} 


// Fade in footer
jQuery("#footer").css({"height" : "0px"});
var t=setTimeout("footerIn()",1500);




// Add pipes to top nav to ease Joomla menu 
jQuery("#loginWrap li a:visible:not(:last)").each(function() {
jQuery(this).append('<span style=\"margin-left:13px; color:#f173ac;\">|</span>');
});

// Add pipes to top nav to ease Joomla menu 
jQuery('.separator, .sf-js-enabled li a:visible:not(:last)').each(function() {
jQuery(this).append('<span style=\"margin-left:13px; color:#f173ac;">|</span>');
});

// Add pipes to footer login to ease Joomla menu 
jQuery("#footer li a:not(:last)").each(function() {
jQuery(this).append('<span>|</span>');
});






 
//  ...............................................PRODUCT SLIDER
// Hover states for product slider

jQuery("#prodsliderbntleft").hover(function(){
jQuery(this).css({"background-position" : "0px -41px"});
jQuery(this).addClass("cursor_pointer");
},
function(){
jQuery(this).css({"background-position" : "0px 0px"});
jQuery(this).addClass("cursor_pointer");
}
);

jQuery("#prodsliderbntright").hover(function(){
jQuery(this).css({"background-position" : "-34px -41px"});
jQuery(this).addClass("cursor_pointer");
},
function(){
jQuery(this).css({"background-position" : "-34px 0px"});
jQuery(this).removeClass("cursor_pointer");
}
);

jQuery('#prodsliderwrap').cycle({ 
    fx:     'scrollHorz', 
    speed:  2000, 
    timeout: 9000, 
    next:   '#prodsliderbntright', 
    prev:   '#prodsliderbntleft' 
});

//  ...............................................PRODUCT 

				
// style the list page 
jQuery(".prodHeadWrap img:first-child").wrap("<div class=\"prodImg\">");
jQuery(".prodHeadWrap").each( function(i) {
jQuery(".prodImg:eq("+i+")").css({"float" : "left", "margin" : "0 19px 0 17px", "width" : "200px"});
var myheight = jQuery(this).height();
jQuery(".prodImg:eq("+i+")").css({ "height" : myheight});

});

// add wave hr style line to each prodHeadWrap

// ........................................... Customer edu

// catagories list styles

jQuery(".catListCenter img:first-child").wrap("<div class=\"prodImg\">");
jQuery(".catListCenter").each( function(i) {
jQuery(".prodImg:eq("+i+")").css({"float" : "left", "margin" : "-17px 15px 0 0", "width" : "100px"});
readmoreLink = jQuery(".readon:eq("+i+")").attr('href');
jQuery(".prodImg:eq("+i+") img").wrap("<a href="+readmoreLink+">");
jQuery(".catListCenter:eq("+i+") h2").wrap("<a href="+readmoreLink+">");
var myheight = jQuery(this).height();
jQuery(".prodImg:eq("+i+")").css({ "height" : myheight+15});

});


jQuery(".prodHeadWrap").append('<div class=\"waveRule\"><img  src=\"images/stories/common/waveStoryDivider.jpg\" alt=\"waveStoryDivider\" width=\"960\" height=\"50\" /></div>');


// jQuery(".readMe").each(function(i) {

// add on click to read me
// jQuery(this).click(function() {
// jQuery(".prodBodyWrap").hide();
// jQuery(".prodBodyWrap:eq("+i+")").animate({height: "toggle"}, 1000);
// });
	
// });


// ........................................... CONTACTS


jQuery('div.tabs ul.tabNavigation a').click(function () {                        
		var pageLink = jQuery(this).attr("href");
		jQuery("#holder").load(pageLink+' .contact');
		jQuery('div.tabs ul.tabNavigation a').removeClass('selected');
		jQuery(this).addClass('selected');
		
		return false;		

}).filter(':first').click();

	// set time out to load then validate :(						   
            setInterval("jQuery('#commentForm').validate();", 3000);

// add header for careers based on having jobs or not
// see below code for careers catagory page
//<div id="haveJobs">Current Employment Listing</div>
//<div id="noJobs">Check back periodically for employment listings!</div>

if(jQuery('table.category tbody').length > 0) {
jQuery(".catOn").css({"display" : "block"});

}else {jQuery(".catOff").css({"display" : "block"});}



// ........................................... JQ ZOOMS 

//  Satndard Zoom
var standard = {  
            zoomType: 'standard',  
            lens: true,  
            preloadImages: true,  
            alwaysOn:false,  
            zoomWidth: 300,  
            zoomHeight: 300,  
            xOffset:20,  
            yOffset:0,  
            position:'right',
			showEffect: "fadein",
			fadeinSpeed: "slow",
			fadeoutSpeed: "slow"
    }; 
	
    jQuery('.standardZoom').jqzoom(standard); 
	
//  Satndard Zoom
var inner = {  
            zoomType: 'innerzoom',  
            title: false,  
            preloadImages: true,  
            alwaysOn:false,  
            position:'right',
			showEffect: "fadein",
			fadeinSpeed: "slow",
			fadeoutSpeed: "slow"
    }; 
	
    jQuery('.innerZoom').jqzoom(inner); 

// add hover to blueBTN

jQuery(".blueBTN:parent").each(function() {
 jQuery(this).hover(function() {
 jQuery(this).css({"opacity" : .6})
},
function() {
 jQuery(this).css({"opacity" : 1})
})
})


}); // end ready

