//center alignment jQuery plugin
(function($) {
    $.fn.centerAlign = function()   {

        if($(this).length)    {
            //set this inline before we can get the actual width
            $(this).css('display', 'inline');

            w = $(this).width();

            $(this).width(w).css('display', 'block');
        }
    return this;
    }
}) (jQuery);

$(document).ready(function(){
    $('.pagination > ul').centerAlign();

    //Cufon font replacement (site)
    Cufon.replace('.side-banner h3');
    Cufon.replace('#header-title');
    Cufon.replace('#pos-headline');

    //Cufon font replacement (blog)
    Cufon.replace('.strap h1');
    Cufon.replace('#pos-headline');
    Cufon.replace('#blog h2');
    Cufon.replace('#blog h2 a');
    Cufon.replace('.side_box h3');
    Cufon.replace('h4.block');

	//YOU TUBE VIDEO LOADED INTO LIGHTBOX HERE
	//THE EMDBEDDED OBJECT CODE NEEDS TO BE SURROUND
	//BY TWO DIVS
	//<div class="hidden"><div id="video"></div></div>
	//THE FIRST HIDES THE CONTENT FROM THE BROWSER WINDOW ONLOAD
	//THE SECOND LOADS ALL CONTENT WITHIN THE DIV TO THE LIGHTBOX WINDOW
	$(".launch-video").colorbox({html:$("#video").html()});
	$(".launch-video").colorbox({width:"605px", height: "530px", inline:true, href:"#video"});

	//LIFE CYCLE LOADED INTO LIGHTBOX HERE
	//THE EMDBEDDED CONTENT NEEDS TO BE SURROUND
	//BY TWO DIVS
	//<div class="hidden"><div id="life-cycle-light-box-container"></div></div>
	//THE FIRST HIDES THE CONTENT FROM THE BROWSER WINDOW ONLOAD
	//THE SECOND LOADS ALL CONTENT WITHIN THE DIV TO THE LIGHTBOX WINDOW
	$(".inline-all").colorbox({width:"725px", height: "540px", inline:true, href:"#life-cycle-light-box-container"});


	//DISPLAYS CONTENT WITHIN THE PREVIEW PANE OF LIFECYCLE
	$("a.inline-top-left").mouseover(function() {
		$(".top-left-hidden").show();
	});
	$("a.inline-top-left").mouseout(function() {
		$(".top-left-hidden").hide();
	});

	$("a.inline-top-center").mouseover(function() {
		$(".top-center-hidden").show();
	});
	$("a.inline-top-center").mouseout(function() {
		$(".top-center-hidden").hide();
	});

	$("a.inline-top-right").mouseover(function() {
		$(".top-right-hidden").show();
	});
	$("a.inline-top-right").mouseout(function() {
		$(".top-right-hidden").hide();
	});

	$("a.inline-center-left").mouseover(function() {
		$(".center-left-hidden").show();
	});
	$("a.inline-center-left").mouseout(function() {
		$(".center-left-hidden").hide();
	});

	$("a.inline-center-right").mouseover(function() {
		$(".center-right-hidden").show();
	});
	$("a.inline-center-right").mouseout(function() {
		$(".center-right-hidden").hide();
	});

	$("a.inline-bottom-left").mouseover(function() {
		$(".bottom-left-hidden").show();
	});
	$("a.inline-bottom-left").mouseout(function() {
		$(".bottom-left-hidden").hide();
	});

	$("a.inline-bottom-center").mouseover(function() {
		$(".bottom-center-hidden").show();
	});
	$("a.inline-bottom-center").mouseout(function() {
		$(".bottom-center-hidden").hide();
	});

	$("a.inline-bottom-right").mouseover(function() {
		$(".bottom-right-hidden").show();
	});
	$("a.inline-bottom-right").mouseout(function() {
		$(".bottom-right-hidden").hide();
	});

	//JOBS SECTION OPEN FUCNTION
	$("a.button").click(function(){
	var id = $(this).attr('id').match(/.+\-([0-9]+)/);
	$('table[id^="table-"] tr.hidden').hide();

	var table = $('#table-' + id[1]);
	table.find('.hidden').show();
	table.find('.summary').hide();
	$(".more").show();
	table.find('.more').hide();
		$('.column').css('height', 'auto');
		equalHeight($('.column'));
		return false;
	});

	//JOBS SECTION CLOSE FUCNTION
	$("a.button-close").click(function(){
	var id = $(this).attr('id').match(/.+\-([0-9]+)/);
	$('table[id^="table-"] tr.hidden').hide();

	var table = $('#table-' + id[1]);
	table.find('.hidden').hide();
	table.find('.summary').show();
	table.find('.more').show();
		$('.column').css('height', 'auto');
		equalHeight($('.column'));
		return false;
	});

});

