/*==========================================
	Saint Joseph Health System - Sonoma County
	------------------------------------------
	Copyright © 2009 McMurry
	Design by Angie Thompson
	XHTML/CSS/JS by Brandon Kidd
==========================================*/

$(function() {
	// jQuery Functions
	$('#slideshow .slide a').each(function(){
		$(this).parents('.slide').css('cursor', 'pointer').click(function(){
			window.location = $(this).find('a').attr('href');
		});
	});
	if($('#slideshow .slide').length > 1){
		$('#slideshow').cycle({ delay: 300, fx: 'fade', pause: 1, speed: 500, sync: 0, timeout: 6500, cleartype: true });
	}
	if ($('#video-list a').length > 1) {
	    $('#video-list').cycle({ delay: 300, fx: 'fade', pause: 1, speed: 500, sync: 0, timeout: 6500, cleartype: true });
	}
	$('#latest-news .articles').cycle({ delay: 300, fx: 'fade', pause: 1, speed: 500, sync: 0, timeout: 4000, cleartype: true });
	$('#areas-of-excellence .service').css('cursor', 'pointer').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
	}).click(function(){
		window.location = $(this).find('a').attr('href');
	});
	var _LocInfoTabs = '<ul><li class="tab tab-santarosamemorial selected"><a href="javascript:void(0);" title="Santa Rosa Memorial Hospital">Santa Rosa Memorial Hospital</a></li><li class="tab tab-petalumavalley"><a href="javascript:void(0);" title="Petaluma Valley Hospital">Petaluma Valley Hospital</a></li><li class="tab tab-urgentcare"><a href="javascript:void(0);" title="Urgent Care Centers">Urgent Care Centers</a></li><li class="tab tab-hospice"><a href="javascript:void(0);" title="Hospice">Hospice</a></li></ul>';
	$('#location-information').prepend(_LocInfoTabs);
	$('#location-information .tab').click(function(){
		$('#location-information .tab, #location-information .panel').removeClass('selected');
		$(this).addClass('selected');
		var aC = $(this).attr('class').split(' ');
		var x = '#location-information .' + aC[1].replace('tab','panel');
		$(x).addClass('selected');
	});
});
