$(document).ready(function() {
// SHOW FORM
function show_career_form(obj) {
	$('.career-form').show();
	$(obj).parent().css('text-align','left');
	$(obj).parent().html('<h1>Apply for a Career or Internship</h1>');
}
$('.career-internships .career-form-show').click(function(){
	show_career_form(this);
	return false;
});
$('.menuitem').children('a').live('click',function(){ return false; } );

// NAV HOVER ANIMATION
$('.menu-item').removeClass('menu-item').addClass('menuitem'); // gets ride of the li:hover CSS
$('#nav ul li ul li').removeClass('menuitem'); // apply class only to top level

/* for determining widths so we can have bold on hover
$('.sub-menu li').each(function(){
	$(this).css('width',(parseFloat($(this).css('width'))*0.85));
});
*/

// PHOTO REEL
// variables
var num = 0;
var inc = false;
var linkNames = new Array(
	"&middot;",
	"&middot;",
	"&middot;",
	"&middot;",
	"&middot;"
);
var linkUrls = new Array(
	"#",
	"http://paxafricana.org/donate",
	"http://paxafricana.org/sponsor-a-student",
	"http://paxafricana.org/quiz",
	"http://paxafricana.org/career-internships"
);

// activate the photo reel
$('#photoreel')
.cycle({
	fx: 'fade', // name of transition effect (or comma separated names, ex: fade,scrollUp,shuffle) 
	activePagerClass:'currphoto',
	timeout: 4000,  // milliseconds between slide transitions (0 to disable auto advance) 
	speed: 2000,  // speed of the transition (any valid fx speed value) 

	pager: '#photoreelControl',
	// callback fn that creates a thumbnail to use as pager anchor 
	pagerAnchorBuilder: function(idx, slide) { 
		if(!inc){
			inc = true;
		}else{
			num = num + 1;
		}
		$('#photoreel' + (num+1)).attr('href',linkUrls[num]);
		return '<li><a href="#">' + linkNames[num] + '</a></li>'; 
	},
	// override Cycle's default updateActivePagerLink function 
	updateActivePagerLink: function(pager, activeIndex) { 
		$(pager).find('li:eq('+activeIndex+')').addClass('activeLI').siblings().removeClass('activeLI'); 
	} 

});

// set css
$('#photoreelControl').css({'margin':'auto', 'width':'216px'});
$('#photoreelControl li').css({'list-style':'none', 'color':'#330000', 'float':'left', 'font-size':'25px', 'margin':'0 3px 0 3px', 'width':'30px', 'height':'20px', 'text-align':'center'});
$('#photoreelControl a').css({'text-decoration':'none', 'display':'block', 'height':'100%'});
$('#photoreelControl a:link').css({'text-decoration':'none'});
$('#photoreelControl a:hover').css({'font-weight':'bold', 'text-decoration':'none'});
$('#photoreelControl a:visited').css({'text-decoration':'none'});

});

