$(document).ready(function()
{
	//highslide
	hs.graphicsDir = 'images/highslide/';
	hs.showCredits = false;
	if (hs.addSlideshow) hs.addSlideshow({
		slideshowGroup: '1',
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: true,
		overlayOptions: {
			opacity: .6,
			position: 'bottom center',
			hideOnMouseOut: true
		}
	});
	//tooltip
	$('.expand img').qtip({
		api: {
			//update title tag content
			beforeShow: function() {
				this.updateContent(this.elements.target.attr('title')) 
			}
		},
		content: {
			//set text to title tag
			text: false
		},
		show: 'mouseover',
		hide: 'mouseout',
		//set delay to zero
		show: { delay: 0 },
		style: { 
			//set css style white-space to nowrap
			'white-space' : 'nowrap',
			name: 'dark',
			textAlign: 'center',
			tip: { 
				 corner: 'bottomMiddle', 
				 size: { x: 20, y : 8 }
			 }
		},
		position: {
			//adjust y axis starting position
			adjust: { x: 0, y: -8 },
		  corner: {
			 target: 'topMiddle',
			 tooltip: 'bottomMiddle'
		  }
	   }
	});
	$('#projectList img').qtip({
		content: {
			text: false
		},
		show: 'mouseover',
		hide: 'mouseout',
		show: { delay: 0 },
		style: { 
			'white-space' : 'nowrap',
			name: 'dark',
			textAlign: 'center',
			tip: { 
				 corner: 'bottomMiddle', 
				 size: { x: 20, y : 8 }
			 }
		},
		position: {
			adjust: { x: 0, y: -8 },
		  corner: {
			 target: 'topMiddle',
			 tooltip: 'bottomMiddle'
		  }
	   }
	});
	$('#controls img').qtip({
		content: {
			text: false
		},
		show: 'mouseover',
		hide: 'mouseout',
		show: { delay: 0 },
		style: { 
			'white-space' : 'nowrap',
			textAlign: 'center',
			name: 'dark',
			tip: { 
				 corner: 'topMiddle', 
				 size: { x: 20, y : 8 }
			 }
		},
		position: {
		  corner: {
			 target: 'bottomMiddle',
			 tooltip: 'topMiddle'
		  }
	   }
	});
	
	//projects
	$(".thumb").click(function()
	{
		//get box id
		var box = $(this).attr("id").replace("Thumb", "");
		//if box is visible
		var isVisible = $("#"+box).is(':visible');
		//slide up all project boxes
		$("#projects .boxalt").slideUp("normal");
		//if the box is not visible
		if(!isVisible)
		{
			//slide box down
			$("#"+box).slideDown();
			
		}
	});
	
	//experience
	$(".expand img").click(function()
	{	
		var image = $(this).attr("src");
		if(image == "images/min.png")
		{
			$(this).attr("src", "images/expand.png");
			$(this).attr("title", "Click to expand");
			$(this).parents(".jobHeader").next().slideUp("slow");
		}
		else
		{
			$(this).attr("src", "images/min.png");
			$(this).attr("title", "Click to collapse");
			$(this).parents(".jobHeader").next().slideDown("slow");
		}
	});
	
	//print 
	$("#print").click(function()
	{	
		//print dialog
		window.print();
	});
	
	//fancy box
	$(".fancybox").fancybox({
		'width'				: '75%',
		'height'			: '75%',
		'type'				: 'iframe'
	});
	
});

//highslide gallery options
var galleryOptions = { 
	thumbnailId: 'firstPhoto', 
	slideshowGroup: '1', 
	align: 'center', 
	outlineType: 'rounded-white', 
	dimmingOpacity: 0.75, 
	transitions: ['expand', 'crossfade'] 
};	