;(
	function( $, document, undefined )
	{
		$(document).ready( 
			
			function jQuery_document_on_ready()
			{
				$("#slideshow").cycle({
                    fx: 'turnRight',
					speed: 1000,
					timeout: 6000
                });
				$(".news-slide").cycle({
                    fx: 'scrollDown',
					speed: 3000
                });
				$('a.fancybox').fancybox();
				
				$('#doctor-list a.level-1').bind(
					
					'click',
					
					function()
					{
				  		$(this).parent('li').children('ul.level-2').slideToggle(
					
							'slow',
							
							function()
							{
				    			
				  			}
				
						);
						
						if ( $(this).hasClass('minus') ) {
							$(this).removeClass('minus');
						}
						
						else {
							$(this).addClass('minus');
						}
						
						return false;
					}
					
				);
				
				/**
				 * Home Page Find a Clinic widget
				*/
				
				if ( $('#form-find-clinic').length )
				{
					$("form.jqtransform").jqTransform();
				}
				
				$('#form-find-clinic ul a').bind('click', function () {
				          
					var i = $(this).attr('index');
					var items = $('#form-find-clinic select option');
					
					var url = '';
					
					items.each( function( index, val ){
						if ( index == i )
						{
							url = $(this).val();
						}
					});
					
					
					
				
				          if (url != 'null' ) { // require a URL
				              window.location = url; // redirect
				          }
				          return false;
				      });
				
				$('#boxes').children('.box-cycle').children('.articles').cycle();
				
				/**
				 * Automagically switch out markers
				*/
				
				$('#form_filter_all').bind(
					
					'change',
					
					function()
					{
						if ( 'checked' == $(this).attr('checked') )
						{
							$('#hidden-categories li').appendTo('#map-side-bar-list');
							$('.filter-map-markers input.filter-me').removeAttr('checked');
							$('#google-maps-locations').jMapping('update',{
							    force_zoom_level: 15,
							    default_zoom_level: 15
							  });
						}
					}
					
				);
				
				if ( $('.filter-map-markers').length )
				{
					$('.filter-map-markers input.filter-me').bind(
						
						'change',
						
						function filter_map_markers()
						{
							$('.filter-map-markers input.filter-me').removeAttr('checked');
							$(this).attr('checked','checked');
							
							$('#form_filter_all').removeAttr('checked');
							
							// Hide all
							$('#map-side-bar-list li').appendTo( '#hidden-categories');
							
							var val = $(this).val();
							
							$('#hidden-categories li.' + val).appendTo('#map-side-bar-list');
							

							$('#google-maps-locations').jMapping('update',{
							    force_zoom_level: 15,
							    default_zoom_level: 15
							  });
		
						}
						
					);
				}
				
				// input placeholders
				$('input').each(
					
					function( e )
					{
						if ( $(this).attr('placeholder') )
						{
							$(this).addClass('has-placeholder');
							$(this).attr('rel', $(this).attr('placeholder') );
							
							$(this).val( $(this).attr('placeholder') );
						}
					}
					
				);
				
				$('input.has-placeholder').live(
					
					{
						
						focus: function()
						{
							var val = $(this).val();
							var holder = $(this).attr('rel');
							
							if ( val == holder )
							{
								$(this).val('');
							}
						},
						blur: function()
						{
							var val = $(this).val();
							var holder = $(this).attr('rel');
							
							if ( val == '' )
							{
								$(this).val(holder);
							}
						}
					}
				);
			}
			
		);
	}
	
) ( jQuery, document );
