
$(document).ready(function() {
						   
				   
	// home page 'areas of expertise' roll-over
	$("ul.specialties li").hover( 
		function () {
        	$(this).addClass("homepage-specialty-hover");
		}, 
		 function () {
			$(this).removeClass("homepage-specialty-hover");
		}
	);
	
	
	// home page 'physicians' roll-over
	$("#dr-list li").hover( 
		function () {
        	$(this).addClass("homepage-specialty-hover");
		}, 
		 function () {
			$(this).removeClass("homepage-specialty-hover");
		}
	);


	
	// home page 'prepare for your visit' links			   
	$("#prepare-link").click(function() {						 
		// event.preventDefault();
		$("#prepare-specialties").toggle();
	});
	
	// home page location panes			   
	$(".location-name").click(function() {						 
		$(".location").slideUp("normal");
		$(this).next().slideDown("normal");
	});
	
	// assessment form processing
	$("#symptomButton").click(function() {		
		print();
		
		/*
		$('head').append('<link rel="stylesheet" href="/css/assessment.print.css" type="text/css" />');
		$("textarea").css("border-width", "0");
		$(".breadcrumb").hide();
		$("#printButton").css("display","inline");
		$("#printButton").next().css("font-weight","normal").css("font-size","10pt").css("display","inline");
		$(".field.print").css("margin-top","30px");
		*/
		
		
		// $("#assessment-form .field").hide();
		// $("#assessment-form input:checked").parent().show();
		// $("#assessment-form input:checked").hide();
		/*
		$("textarea").filter( function (index) {
				if ($(this).val() != '')
				{
					return $(this);
				}
			}).parent().show();
		*/
		// $("#assessment-form [type=button]").hide();
		// alert("Use your browser to print this page and take it to your doctor");
		// print();
	});
	
	// assessment form processing
	$("#printButton").click(function() {		
		print();
	});
	
	// assessment form processing
	$("#backButton").click(function() {		
		$('head').append('<link rel="stylesheet" href="/css/assessment.print.css" type="text/css" />');
	});
	
	// imaging tabs
	$(".tab-title a").click(function() {
		// unset all tabs and panels
		$(".tab-title").removeClass("live");
		$(".tab-body").removeClass("live");
		
		// define which panel is to be set to display
		var item = $(this).parent().attr("class").replace("tab-title","tab-body").replace(" ", ".");
		//alert(item);
		
		// set the current tab and panel
		$("."+item).addClass("live");
		$(this).parent().addClass("live");
	});
	
	// scroll the doctors on the homepage
	$("#doc-scroll").click( function() {
		if ($("#doc-box-inset").css("top") == "0px")
		{
			$("#doc-box-inset").animate( { top:"-200px" }, 1500,0,function () {
				$("#doc-scroll").fadeOut("normal", function() {
					$("#doc-scroll").text("Scroll Up").fadeIn();
				});
			});
		}
		else
		{
			$("#doc-box-inset").animate( { top:"0px" }, 1500,0,function () {
				$("#doc-scroll").fadeOut("normal", function() {
					$("#doc-scroll").text("Scroll Down").fadeIn();
				});
			});
		}
	});
	
	/* ########### EXPERTISE TABS ############# */
	
	// add separators
	$("#tabs .tab:not(:last)").after("<img class='separator' src='/img/tabs.separator.jpg' />");
	
	// if its the active tab, remove the separators...
	$("#tabs .tab.active").prev(".separator").replaceWith("");
	$("#tabs .tab.active").next(".separator").replaceWith("");
	
	// ...and add the sides of the tab
	$("#tabs .tab.active").before("<img class='separator' src='/img/tabs.active.left.jpg' />");
	$("#tabs .tab.active").after("<img class='separator' src='/img/tabs.active.right.jpg' />");
	
	// for each header in the content...
	$("#content h3").each( function(i) {
		
		//create an anchor link
		var anchor = $(this).text().replace(" ","") + i;
		var link = '<a class="anchor" href="#' + anchor + '">' + $(this).text() + '</a>';
		
		// and add it to the set of links at the top
		var newHtml = $("#anchors").html() + link;
		$("#anchors").html(newHtml);
		
		// finally, add a named anchor tag above each header with a link back to top
		$(this).before('<a name="' + anchor + '"></a>');
		$(this).append('<a href="#top"><img class="top" src="/img/top.btn.gif" alt="top" /></a>');
		
	});
	
	if ($("#anchors").html() == '')
	{
		$("#anchors").css("display","none");
		$("#tabs").css("margin-bottom","30px");
	}	
		
	/* ########## END EXPERTISE TABS ############## */
	
	
	
	/* ########## EXPERTISE ORANGE SYMPTOMS BOX ############## */
	
	$("#treatments.sidebar input[type=image]").submit( function() {
		alert("http://ncvi.prospercreative.com" + $("#treatments.sidebar select").val());
		// window.location = "http://ncvi.prospercreative.com" + $("#treatments.sidebar select").val();
	}); 
	
	$("#modal-dialog .close a").click( function() {
		$("#modal-grayout").fadeOut();
		$("#modal-wrap").fadeOut(); 
	});
	
	/* ########## HOMEPAGE PULL-DOWN ############## */
	
	/*
	$("#treatment-flyout img").hover( 
		function() { 
			$("#treatment-flyout > div").show();
		},
		function(){
			$("#treatment-flyout > div").hide();
		}
	);
	*/
	
	$("#treatment-flyout a").hover( 
		function() { 
			$("#treatment-flyout div#" + $(this).attr("id").replace("item_", "menu_")).stop().show();
			// $("#treatment-flyout  a + div").show();
		},
		function(){
			$("#treatment-flyout div#" + $(this).attr("id").replace("item_", "menu_")).stop().hide();
			//$(this).children("div").hide();
			//$(this).siblings("div").hide();
			// $("#treatment-flyout  a + div").hide();
		}
	);

	$("#treatment-flyout div").hover( 
		function() { 
			$(this).stop().show();
		},
		function(){
			$(this).stop().hide();
		}
	);
	
	
});




