var left_image = 0;
	var right_image = 1;
	var transition_time = 4000;
	
	jQuery(window).load(function(){
		//if there are header images
		if(header_images){
			runSlideShow();
		}
	});
	
	function runSlideShow(){
		//setup variables
		var left_top = jQuery("#header-left").height() - jQuery("#header-left img").eq(left_image).height();
		var right_top = (jQuery("#header-right img").eq(right_image).height() - jQuery("#header-right").height())*-1;
		//fade in the left image
		jQuery("#header-left img")
		.eq(left_image)
		.css({ top:left_top, opacity:'0' })
		.show()
		.animate({ top:(left_top/2), opacity:'1' }, { duration:transition_time, easing:'linear' })
		.animate({ top:0, opacity:'0' }, { queue:true, duration:transition_time, easing:'linear' });
		
		//fade in the right image
		jQuery("#header-right img")
		.eq(right_image)
		.css({ top:0, opacity:'0' })
		.show()
		.animate({ top:(right_top/2), opacity:'1' }, { duration:transition_time, easing:'linear' })
		.animate({ top:right_top, opacity:'0' }, { queue:true, duration:transition_time, easing:'linear', complete:function(){
			//run the next image
			runNextImage();
		}});
	}
	
	function runNextImage(){
		//make sure they are not animating
		if(jQuery("#header-left img").eq(left_image).is(":animated") || jQuery("#header-right img").eq(right_image).is(":animated")){
			//if either one is still animating call back to itself
			setTimeout('runNextImage()',50);
			return;
		}
		
		//increment the images
		if(left_image+2 >= header_images.length){
			if(left_image+1 >= header_images.length){
				left_image = 1;
			} else {
				left_image = 0;
			}
		} else if(left_image+1 >= header_images.length){
			left_image = 0;
		} else {
			left_image += 2;
		}
		
		//check for the right image
		if(right_image+2 >= header_images.length){
			if(right_image+1 >= header_images.length){
				right_image = 1;
			} else {
				right_image = 0;
			}
		} else if(right_image+1 >= header_images.length){
			right_image = 0;
		} else {
			right_image += 2;
		}
		
		//start the next animation
		runSlideShow();
	}
