$(document).ready(function(){


	// DROPDOWNS
	$('.sf-navbar').superfish({
		autoArrows:  false,
		delay:       200,
        speed:       1
	}).find('ul').bgIframe();

	// HOVER
	$(".sf-navbar > li, .hover").hover( 
		// over
		function(){
			var theImg = $(this).find('img:first');
			// store the original image src
			theImg.data( "originalsrc" , theImg.attr("src") );

			// add -over to the image unless it is already -over
			if (!theImg.attr("src").match(/-over/) ) {
				theImg.attr( "src", theImg.attr("src").replace(/\./, "-over.") );
			}
			
		},
		
		// out
		function(){
			var theImg = $(this).find('img:first');
			// replace the original src
			theImg.attr("src", theImg.data("originalsrc"));
		}
	);

	// section change
	$('#sectionLinks a').click(function(){
		var theDiv = $(this).attr("href").substring(1);
		theDiv = theDiv.replace(/\/$/, "");
		showSection(theDiv);
	});
	
	// modal boxes
	$('.eeoPolicy').click(function (e) {
		e.preventDefault();
		$('#eeoPolicy').modal({
			opacity : '75', 
			closeHTML: '<a href="" class="closeLink">close</a>'
		});
	});
	
	$('.interestPolicy').click(function (e) {
		e.preventDefault();
		$('#interestPolicy').modal({
			opacity : '75', 
			closeHTML: '<a href="" class="closeLink">close</a>'
		});
	});

	$('.externalRecruit').click(function (e) {
        e.preventDefault();
        $('#externalRecruit').modal({
            opacity : '75',
            closeHTML: '<a href="" class="closeLink">close</a>'
        });
    });
	
	$('.systemNotice').click(function (e) {
        e.preventDefault();
        $('#systemNotice').modal({
            opacity : '75',
            closeHTML: '<a href="" class="closeLink">close</a>'
        });
    });
	

	// lightbox
	$('a[rel*=lightbox], .productThumbs a').lightBox({
		imageLoading: '/images/lightbox/ico-loading.gif',
		imageBtnClose: '/images/lightbox/btn-close.gif',
		imageBtnPrev: '/images/lightbox/btn-prev.gif',
		imageBtnNext: '/images/lightbox/btn-next.gif',
		imageBlank: '/images/lightbox/blank.gif'
  	});
	
	
	// headline seletor
	$("#headlineSelector a").click(function(e){
		e.preventDefault();
		var theDiv = $(this).attr('href').substring(1);
		
		$(".headlines").slideUp();
		$("#" + theDiv).slideDown();
		
		$("#headlineSelector a").removeClass('selected');
		$(this).addClass('selected');
	});
		
});


function showSection(theDiv) {
	$(".section:visible").hide();
	$("#" + theDiv).show();
}

