        $(document).ready(function() {
	try{
		$('#middle').html($('#middle').html().replace('[[GoogleMap]]','<div id=\'consolGMap\' style=\'width:430px;height:300px;\'></div>'));
		DoMapContent('consolGMap', '38.874998', '-77.242384', '<strong>Concept Chiropractic and Rehab</strong><br />2826 Old Lee Highway<br />Ste 350<br />Fairfax, VA 22031<br />703-573-5500');
	} catch(err){}

	$('#quicklinks .quicklinkbox:last').addClass('last');
	$("#backtotop a").click(function() {
        $('html, body').animate({ scrollTop: 0 }, 'slow');
    });
	$('h3:odd').addClass('space');
	$('#successtories li:last').addClass('last');
	$('sup a').each(function(){$(this).attr('href','javascript:;');});
	$('sup a').click(function(){
		$('html,body').animate({scrollTop: $('a[name='+$(this).text()+']').offset().top},'slow');
	});
	$('#credits a').each(function(){
		$(this).attr('name',$(this).text());
		$(this).attr('href','javascript:;');
	});
	$("h6").replaceWith("<div class='seperator'></div>");
	if($('#quicklinks div').length==0)
		$('#quicklinks').remove();
	if($('#subnav li').length==0)
		$('#subnav').remove();
	if($('#credits a').length==0)
		$('#credits').remove();
	
	$('a.btn_go[title=GO]').click(function(){
		location.href = '/'+$('select[name='+$(this).attr('rel')+']').val();
	});
	
	$('ul.subnav').each(function(){
		var imgWidth = $(this).siblings('a').children('img').width();
		$(this).css('width',(imgWidth-5));
	});
	
	$('a[href=#graston]').click(function(){$(this).attr('href','javascript:;');Overlay.PlayGratson();return false;});
	$('a[href=#promovideo]').click(function(){$(this).attr('href','javascript:;');Overlay.PlayPromoVideo();return false;});
	
	$('a[href=#jump]').each(function(){$(this).attr('href','javascript:;');$(this).attr('name','jump');
		var oText = $(this).text();
		$('h2').each(function(){
			if($(this).text() == oText){
				$(this).prepend('<a name="'+oText+'"></a>');
			}
		});
		
	});
	$('a[name=jump]').click(function(){
		$('html,body').animate({scrollTop: $('a[name='+$(this).text()+']').offset().top - 30},'slow');
	});
	
	$('a.faqlink').toggle(
		function(){
			$('div.faq[rel=' + $(this).attr('rel') + ']').fadeIn('slow');
			$(this).text('- ' + $(this).attr('rel') + '?');
		},
		function(){
			$('div.faq[rel=' + $(this).attr('rel') + ']').fadeOut('slow');
			$(this).text('+ ' + $(this).attr('rel') + '?');
		}
	);
	
	
	$('ul#successtories li .content').expander({
		slicePoint: 175, 
		widow: 4,
		expandEffect: 'fadeIn', 
		userCollapse: true, 
		expandText: '<br />+ read more',
		expandPrefix: '...',
		userCollapseText: '<br />- minimize'
	});
	
	$('.actionbox').each(function(){
		try{
			if($(this).attr('rel').length > 0 && $(this).attr('rel') != ""){
				$(this).click(function(){
					location.href = $(this).attr('rel');
				});
				$(this).addClass('hover');
			}
		} catch(err){}
	});
	$("#searchboxContainer input").focus(function(){
		if(this.value == 'Search'){
			this.select();
		}
	});
	$("#searchboxContainer .btn_go").click(function(){
		if($('#searchboxContainer input').val() != "" && $('#searchboxContainer input').val() != "Search"){
			DoSearch($("#searchboxContainer input").val());
		}
	});
	
	$('#searchboxContainer input').keyup(function(e) {
		//alert(e.keyCode);
		if(e.keyCode == 13) {
			if($('#searchboxContainer input').val() != "" && $('#searchboxContainer input').val() != "Search"){
				DoSearch($("#searchboxContainer input").val());
			}
		}
	});

});
function DoSearch(term){
	location.href = "/Search+Results/Results?type=About|Contact|Patient Types|Spinal Conditions|Other Conditions|Treatments&searchFields=Body Copy&searchTerm="+term;
}
function DoMapContent(oMap, oLattitude, oLongitude, oFriendlyPopup) {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById('' + oMap + ''));
        var marker = new GMarker(new GLatLng(oLattitude, oLongitude));
			'' + oFriendlyPopup + '' +
			'</div>';

        map.setCenter(new GLatLng(oLattitude, oLongitude), 13);
        map.addControl(new GSmallMapControl());
        map.addOverlay(marker);
		
		var html = '<div style="width:175px; padding-right:10px;">' +
			'' + oFriendlyPopup + '' +
			'</div>';
		marker.openInfoWindowHtml(html);
    } else {
    }
}

jQuery.preloadImages = function() {
    for (var i = 0; i < arguments.length; i++) {
        jQuery("<img>").attr("src", arguments[i]);
    }
}

    
