
function clickLink(){
	
	var t;
	t=document.getElementById('hiddenlink').value;
	
	switch (t)
	{
	case "0":
	    window.location= ("recipient1.html");
	    break;
	case "1":
	    
	    window.location= ("recipient2.html");
	    break;
	    
	    break;
	case "2":
	    window.location= ("recipient3.html");
	    break;
	    
	 case "3":
	    window.location= ("recipient4.html");
	    break;
	
	}
	//window.location.href=b;
	return false;
	
	}


	var a = 0;		// current boolean integer value [img array index] of visible image
	var b = 0;		// current integer value [url array index] of 'current' image
	
	var t = 500;	// transition duration
	var p = 6000;	// pause duration for each image

	// create array of images
	var url = [];
	url.push('images/home_bust_mcqueary.gif');
	url.push('images/home_bust_gary.gif');
	url.push('images/home_bust_matejka.gif');
	url.push('images/home_bust_britton.gif');
	//create array of verbage
	var verbage= new Array(4);
	verbage[0]='<p>\"How can I drive <br /><span class="bigword">physician</span> <br />alignment while managing costs down?\"</p>	<a href=\"#\" class=\"button\" id=\"linkbutton\" onClick=\"clickLink(); return false;\";><span class=\"small\">click to</span> <span class=\"big\">learn more</span></a>';
	verbage[1]='<p>\"Is my supply chain nimble and  <span class="bigword">flexible</span> <br /> to respond to emergencies?\"</p>	<a href=\"#\" class=\"button\" id=\"linkbutton\" onClick=\"clickLink(); return false;\";><span class=\"small\">click to</span> <span class=\"big\">learn more</span></a>';
	verbage[2]='<p>\"How can I reduce<br /><span class="bigword">costs</span><br /> and support high-quality patient care?\"<br /></p>	<a href=\"#\" class=\"button\" id=\"linkbutton\" onClick=\"clickLink(); return false;\";><span class=\"small\">click to</span> <span class=\"big\">learn more</span></a>';
	verbage[3]='<p>\"To build a culture of<br /><span class="bigword">collaboration</span><br />supply chain can be a<br> logical place to start."<br /></p>	<a href=\"#\" class=\"button\" id=\"linkbutton\" onClick=\"clickLink(); return false;\";><span class=\"small\">click to</span> <span class=\"big\">learn more</span></a>';

	var img = [];

	var featureTimeOut;
	
$(document).ready(function() {

	$(window).bind("resize", resizeHandler);
	function resizeHandler(event){
		
		var items = $('#feature,#foot');
		var featurecopy = $('.home #feature .featurecopy');
		
		var items2 = $('#feature2,#foot');
		var featurecopy2 = $('.home #feature2 .featurecopy');
		
		var items3 = $('#feature3,#foot');
		var featurecopy3 = $('.home #feature3 .featurecopy');
		
		var items4 = $('#feature4,#foot');
		var featurecopy4 = $('.home #feature4 .featurecopy');
		
		var W = $(window).width();
		W = (W<960) ? 990 : W;
		W = (W>1200) ? 990 : W;
		//was 960.  Now 990
		var w = 990;
		var m = (W - w)/2;
		
		items.css({
			'background-position-x':m,
			'width':W
		});
		
		items2.css({
			'background-position-x':m,
			'width':W
		});

		items3.css({
			'background-position-x':m,
			'width':W
		});
		
		items4.css({
			'background-position-x':m,
			'width':W
		});
		
		if(W<1200){
			featurecopy.css({'left':(W/2)+175});
			featurecopy2.css({'left':(W/2)+175});
			featurecopy3.css({'left':(W/2)+175});
			featurecopy4.css({'left':(W/2)+175});
		}else{
			featurecopy.css({'left':775});
			featurecopy2.css({'left':775});
			featurecopy3.css({'left':775});
			featurecopy4.css({'left':775});
		}
		
	}
	
	
	//// -------------------------------------------------
	//// Rotating, Crossfading Feature Image
	
	// kill existing background image of container
	$('.home #feature .person').css('backgroundImage','none');
	

	

	// create divs for incoming and outgoing images
	// store them in variables (p0 & p1)
	$('.home #feature .person')
		.append('<div class="portrait p_0"><div style="left: 670px;" id="changeme_0" class="featurecopy"></div></div>')
		.append('<div class="portrait p_1"><div style="left: 670px;" id="changeme_1" class="featurecopy"></div></div>');
	img.push( $('.home #feature .person .p_0') );
	img.push( $('.home #feature .person .p_1') );
	
	// set base styles for portraits
	$('.home #feature .person .portrait').css({
		'width'		:	'100%',
		'height'	:	'545px',
		'position'	:	'absolute'
	});
	
	
	
	img[1].hide();	//hide incoming image initially
	

	//// -------------------------------------------------
	//// Login Form focus highlighting
	$('.login form#login input.text').focus(function() {
		$(this).parent().addClass('fieldfocus');
		$(this).parent().prev().addClass('fieldfocus');
	});
	$('.login form#login input.text').blur(function() {
		$(this).parent().removeClass('fieldfocus');
		$(this).parent().prev().removeClass('fieldfocus');
	});

	
	//// -------------------------------------------------
	//// initialize...
	$(window).resize();

	updateToFeature(0);	
	$('ul.sf-menu').superfish();
	$('#featurelink1').click(function(e) {
		e.preventDefault();
		updateToFeature(0); 
	});
	$('#featurelink2').click(function(e) {
		e.preventDefault();
		updateToFeature(1); 
	});
	$('#featurelink3').click(function(e) {
		e.preventDefault();
		updateToFeature(2); 
	});
	$('#featurelink4').click(function(e) {
		e.preventDefault();
		updateToFeature(3); 
	});	
	
	
});

function cycleFeature() {
	b = (b<url.length-1) ? b+1 : 0;
	updateToFeature(b);
}

function updateToFeature(f_idx) {
	b = f_idx;
	try {
		window.clearTimeout(featureTimeOut);
	} catch (te) {
		// No timeOut var.  This is ok.
	}
	//Set text
	$('#changeme_' + [!a+0]).html(verbage[f_idx]);
	$('#hiddenlink').val(f_idx);
	//Update links	
	for(link_idx=1;link_idx<=4;link_idx++) {
		$('#featurelink' + link_idx).removeClass('activefeature');
	}
	$('#featurelink' + (f_idx + 1)).addClass('activefeature');
	//Set pic
	img[!a+0].css('background','url('+url[f_idx]+') no-repeat top center');
	img[!a+0].fadeIn(t);
        img[a].fadeOut(t, function() {
		a = !a+0;
		featureTimeOut = window.setTimeout(cycleFeature, p);
	});
	
}



