var _extend = {
	toTitleCase : function(toTransform) {
		return toTransform.replace(/\b([a-z])/g, function (_, initial) {
			return initial.toUpperCase();
		});
	}
}

$(document).ready(
	function(){
		/*$('#img1').fadeIn(2000);
		$('#img1').fadeOut(500);
		$('#img2').fadeIn(200);
		$('#img2').fadeOut(500);
		$('#img3').fadeIn(2000);
		$('#img3').fadeOut(500);
		$('#img4').fadeIn(2000);*/
		
		$('#img1').delay(500).fadeIn(2000, function () {
			$("#img1").fadeOut(500, function () {
				$('#img2').fadeIn(2000, function () {
					$("#img2").fadeOut(500, function () {
						$('#img3').fadeIn(2000, function () {
							$("#img3").fadeOut(500, function () {
								$('#img4').fadeIn(2000);
							});
						});
					});
				});
			});
		});
		
		$.fn.qtip.styles.myStyle = { // Last part is the name of the style
		width: 160,   
		background: '#1ab7ea',
		   color: '#FFF',
		   textAlign: 'left',
		   border: { width: 0 }
		}
		
		
		/* *****
		*
		*	Added By : JJ Jiles
		*	Date     : 01-11-2011
		*	The flexible version
		*
		***** */
			$.each($('#peoplecontainer> a'), function(e,i){
				/* create some globals */
				var _el  = $(this);
				var _rel = _el.attr('rel');
				var _id  = _el.attr('id');
	
				/* handle the events */
				
					/* mouseover */
					_el.mouseover(function() {						
						_el.children(".overlay").show();
					});
						
					_el.click(function (e) {
						$('#basic-modal-content').load(_id + '-30.html #content-' + _id);
						$('#basic-modal-content').modal({
							onShow: function() { window.setTimeout('tabs.init()',200) }
						});
						return false;
					});
			
					/* mouseout */
					_el.mouseout(function (e) {
						$(this).children(".overlay").hide();
					});
					
					/* qTip method */
					_el.qtip({
						content: _rel,//'<b>Jerry</b> <br />Cardiology',
						show: { when: 'mouseover', delay: 0 },
						hide: { when: 'mouseout', delay: 0 },
						position: { corner: { target: 'bottomLeft', tooltip: 'topLeft' } },
						style: 'myStyle'
					});
			});
		/* *****
		* end
		***** */
		
	}
);

/*contactpop*/

ContactPop={replaceHref:[''],formPhpLocation:'/yourstory/index.php',pathToContactPop:'/yourstory/',contactHeadline:'Share Your Story',headerBgColor:'#1AB7EA',overlayFadeIn:600,overlayFadeOut:500,overlayEasing:'',openButtonSelector:'.contact',closeButtonSelector:'.close-overlay',resetFormEachTime:1,fadeOverlayIE:0,fadeOverlayIE6:0,obj:{},formFields:{},submitEvent:0,overlayFade:1,appendOverlay:function(){ContactPop.obj.overlay=jQuery('<div id="contact-pop-overlay"></div>').appendTo(jQuery('BODY'));ContactPop.obj.panelWrapper=jQuery('<div id="contact-pop-panel-wrapper"></div>').appendTo(ContactPop.obj.overlay);ContactPop.obj.panel=jQuery('<div id="contact-pop-panel"></div>').appendTo(ContactPop.obj.panelWrapper);ContactPop.obj.panelHeadline=$('<h2 id="contact-pop-header">'+ContactPop.contactHeadline+'</h2>').appendTo(ContactPop.obj.panel);if(ContactPop.headerBgColor!='#777777')ContactPop.obj.panelHeadline.css('backgroundColor',ContactPop.headerBgColor);ContactPop.obj.panelHeadline.append('<a href="#" class="close-overlay">X</a></h2>');ContactPop.obj.form=jQuery('<form action="'+ContactPop.formPhpLocation+'" method="get" id="contact-pop-form"></div>').appendTo(ContactPop.obj.panel);ContactPop.obj.loading=jQuery('<div id="contact-pop-loading-gif-wrapper"></div>').appendTo(ContactPop.obj.panel);ContactPop.obj.loading.append('<img src="'+ContactPop.pathToContactPop+'/img/ajax-loader.gif" alt="" id="contact-pop-loading-gif" />')},getFormContent:function(){jQuery.get(ContactPop.formPhpLocation,{'ajaxForm':1},function(html){if(html){ContactPop.obj.loading.fadeOut(200);ContactPop.obj.form.html(html);ContactPop.attachFormEvents()}})},attachFormEvents:function(){jQuery(ContactPop.closeButtonSelector,ContactPop.obj.panel).click(function(ev){ev.preventDefault();ContactPop.hideOverlay()});if(jQuery.browser.msie){jQuery('input.submit',ContactPop.obj.form).click(function(ev){ev.preventDefault();ContactPop.submitForm()})}else if(!ContactPop.submitEvent){ContactPop.obj.form.submit(function(ev){ev.preventDefault();ContactPop.submitForm()});ContactPop.submitEvent=1}},checkOverlayFade:function(){if($.browser.msie&&!ContactPop.fadeOverlayIE&&!($.browser.version<7&&ContactPop.fadeOverlayIE6))return false;else return true},showOverlay:function(){if(typeof(ContactPop.obj.overlay)=='undefined'){ContactPop.appendOverlay();ContactPop.getFormContent()}else if(ContactPop.resetFormEachTime)ContactPop.getFormContent();if(ContactPop.overlayFade)ContactPop.obj.overlay.fadeIn(ContactPop.overlayFadeOut,ContactPop.overlayEasing);else ContactPop.obj.overlay.show()},hideOverlay:function(){if(ContactPop.overlayFade)ContactPop.obj.overlay.fadeOut(ContactPop.overlayFadeIn,ContactPop.overlayEasing);else ContactPop.obj.overlay.hide()},submitForm:function(){jQuery('input, select, textarea',ContactPop.obj.form).each(function(){ContactPop.addFormField(jQuery(this))});ContactPop.formFields['ajaxForm']=1;ContactPop.obj.form.fadeOut(200);ContactPop.obj.loading.fadeIn(200);jQuery.post(ContactPop.formPhpLocation,ContactPop.formFields,function(html){if(html){ContactPop.obj.form.html(html);ContactPop.obj.loading.fadeOut(200);ContactPop.obj.form.fadeIn(200);ContactPop.attachFormEvents()}})},addFormField:function($field){var fieldName=$field.attr('name');if(fieldName)ContactPop.formFields[fieldName]=$field.val()},init:function(){var anchorSelector='';if(typeof(ContactPop.replaceHref)!='object')ContactPop.replaceHref=[ContactPop.replaceHref];for(var i=0;i<ContactPop.replaceHref.length;i++){if(ContactPop.replaceHref[i])anchorSelector+='a[href='+ContactPop.replaceHref[i]+'], '}if(ContactPop.openButtonSelector)anchorSelector+=ContactPop.openButtonSelector;else anchorSelector=anchorSelector.substr(0,anchorSelector.length-2);ContactPop.obj.ctas=jQuery(anchorSelector);ContactPop.obj.ctas.click(function(ev){ev.preventDefault();ContactPop.showOverlay()});ContactPop.overlayFade=ContactPop.checkOverlayFade();var overlayImg=new Image();if(jQuery.browser.msie&&jQuery.browser.version<7)overlayImg.src=ContactPop.pathToContactPop+'/img/overlay-ie6.png';else overlayImg.src=ContactPop.pathToContactPop+'/img/overlay.png'}};jQuery(function(){ContactPop.init()});
		
		/*
		$('#jeannie').mouseover(function (e) { 
			$(this).children(".overlay").show();
		});
		$('#jeannie').mouseout(function (e) {
			$(this).children(".overlay").hide();
		});
		$('#jeannie').qtip({
			content: '<b>Jeannie</b> <br />Breast Cancer Center',
			show: { when: 'mouseover', delay: 0 },
			hide: { when: 'mouseout', delay: 0 },
			position: { corner: { target: 'bottomLeft', tooltip: 'topLeft' } },
			style: 'myStyle'
		});
		
		$('#jeannie').click(function (e) {
			$('#basic-modal-content').load('jeannie-30.html #content-jeannie');
			$('#basic-modal-content').modal();
			return false;
		});
		
		$('#lauraann').mouseover(function (e) { 
			$(this).children(".overlay").show();
		});
		$('#lauraann').mouseout(function (e) {
			$(this).children(".overlay").hide();
		});
		$('#lauraann').qtip({
			content: '<b>Laura Ann</b> <br />Breast Cancer Center',
			show: { when: 'mouseover', delay: 0 },
			hide: { when: 'mouseout', delay: 0 },
			position: { corner: { target: 'bottomLeft', tooltip: 'topLeft' } },
			style: 'myStyle'
		});
		$('#lauraann').click(function (e) {
			$('#basic-modal-content').load('lauraann-30.html #content-lauraann');
			$('#basic-modal-content').modal();
			return false;
		});
		
		$('#brian').mouseover(function (e) { 
			$(this).children(".overlay").show();
		});
		$('#brian').mouseout(function (e) {
			$(this).children(".overlay").hide();
		});
		$('#brian').qtip({
			content: '<b>Brian</b> <br />Cardiology',
			show: { when: 'mouseover', delay: 0 },
			hide: { when: 'mouseout', delay: 0 },
			position: { corner: { target: 'bottomLeft', tooltip: 'topLeft' } },
			style: 'myStyle'
		});
		$('#brian').click(function (e) {
			$('#basic-modal-content').load('brian-30.html #content-brian');
			$('#basic-modal-content').modal();
			return false;
		});
		
		$('#nolan').mouseover(function (e) { 
			$(this).children(".overlay").show();
		});
		$('#nolan').mouseout(function (e) {
			$(this).children(".overlay").hide();
		});
		$('#nolan').qtip({
			content: '<b>Nolan</b> <br />Cardiology',
			show: { when: 'mouseover', delay: 0 },
			hide: { when: 'mouseout', delay: 0 },
			position: { corner: { target: 'bottomLeft', tooltip: 'topLeft' } },
			style: 'myStyle'
		});
		$('#nolan').click(function (e) {
			$('#basic-modal-content').load('nolan-30.html #content-nolan');
			$('#basic-modal-content').modal();
			return false;
		});
		
		$('#jaden').mouseover(function (e) { 
			$(this).children(".overlay").show();
		});
		$('#jaden').mouseout(function (e) {
			$(this).children(".overlay").hide();
		});
		$('#jaden').qtip({
			content: '<b>Jaden &amp; Ava</b> <br />Lovelace NICU',
			show: { when: 'mouseover', delay: 0 },
			hide: { when: 'mouseout', delay: 0 },
			position: { corner: { target: 'bottomLeft', tooltip: 'topLeft' } },
			style: 'myStyle'
		});
		$('#jaden').click(function (e) {
			$('#basic-modal-content').load('jaden-30.html #content-jaden');
			$('#basic-modal-content').modal();
			return false;
		});
		
		$('#tamy').mouseover(function (e) { 
			$(this).children(".overlay").show();
		});
		$('#tamy').mouseout(function (e) {
			$(this).children(".overlay").hide();
		});
		$('#tamy').qtip({
			content: '<b>Tamy &amp; Glenn</b> <br />Orthopedics',
			show: { when: 'mouseover', delay: 0 },
			hide: { when: 'mouseout', delay: 0 },
			position: { corner: { target: 'bottomLeft', tooltip: 'topLeft' } },
			style: 'myStyle'
		});
		$('#tamy').click(function (e) {
			$('#basic-modal-content').load('tamy-30.html #content-tamy');
			$('#basic-modal-content').modal();
			return false;
		});
		
		$('#dustin').mouseover(function (e) { 
			$(this).children(".overlay").show();
		});
		$('#dustin').mouseout(function (e) {
			$(this).children(".overlay").hide();
		});
		$('#dustin').qtip({
			content: '<b>Dustin</b> <br />Lovelace Rehabilitation',
			show: { when: 'mouseover', delay: 0 },
			hide: { when: 'mouseout', delay: 0 },
			position: { corner: { target: 'bottomLeft', tooltip: 'topLeft' } },
			style: 'myStyle'
		});
		$('#dustin').click(function (e) {
			$('#basic-modal-content').load('dustin-30.html #content-dustin');
			$('#basic-modal-content').modal();
			return false;
		});
		
		$('#jerry').mouseover(function (e) { 
			$(this).children(".overlay").show();
		});
		$('#jerry').mouseout(function (e) {
			$(this).children(".overlay").hide();
		});
		$('#jerry').qtip({
			content: '<b>Jerry</b> <br />Cardiology',
			show: { when: 'mouseover', delay: 0 },
			hide: { when: 'mouseout', delay: 0 },
			position: { corner: { target: 'bottomLeft', tooltip: 'topLeft' } },
			style: 'myStyle'
		});
		$('#jerry').click(function (e) {
			$('#basic-modal-content').load('jerry-30.html #content-jerry');
			$('#basic-modal-content').modal();
			return false;
		});
		*/
