//////////////////////////////////////////////////////////////

$(function(){

	// Used for lightboxes on portfolio and experience pages
	$("a[rel^='prettyPhoto']").prettyPhoto({
		show_title: false,
		theme: 'dark_rounded',
		opacity: 0.5
	});
	
	if ($('#experience-nav').length) {
		$('#experience-nav li a').click(function() {
		$('#experience-nav li a').removeClass('current');
		$(this).addClass('current');
			var $targ=$(this).attr('rel');
			//alert($targ);
			if ($('.experience-tab').length) {
				$('.experience-tab').each(function() {
					if ($targ == this.id) { $(this).css('display','block'); }
					else { $(this).css('display','none'); }
				});
			}
			return false;
		});
	}
	
	if ($('.experience .experience-frame').length) {
		$('.experience .experience-frame ul li a').click(function() { 
		
			var this_href=$(this).attr('href'); 
			$(this).parents('div').children('p').each(function(i) {
				if ($(this).parents('div').children('p').get(i)) {
					var thisp = $(this).parents('div').children('p').get(i);
					var this_src = $(thisp).contents('a').contents('img').attr('src');
					if (this_href==this_src) { $(thisp).addClass('first'); }
					else { $(thisp).removeClass('first'); }
				}
			});
			
			return false;
		});
	}
});
