// swap image by nick

function SwapItem (itemID) { 
  var x = document.getElementById(itemID);
  if (x){
     x.src = x.src.replace("_off","_on");
  return true;
  }
}
function SwapItemRestore (itemID) { 
  var x = document.getElementById(itemID);
  if (x){
     x.src = x.src.replace("_on","_off");
  return true;
  }
}

function ripSubHeads(i){
if ($(i).parent().siblings("#subExpandMe").children("div").children(".subArtSmall").children().length){
	$(i).css("background-image","url(/images/centers/sub-more-articles.gif)");
}
}

$(document).ready(function(){
//header links
 $(".firstColumnButton").hover(
      function () {
        $(this).css("background","url(/images/header/1st-column-buttons-on.gif)");
      }, 
      function () {
        $(this).css("background","url(/images/header/1st-column-buttons-off.gif)");
      }
    );
$("#secondColumnSearch").hover(
      function () {
        $(this).css("background","url(/images/header/2nd-column-buttons-on.gif)");
      }, 
      function () {
        $(this).css("background","url(/images/header/2nd-column-buttons-off.gif)");
      }
    );
$("#secondColumnPractitioner").hover(
      function () {
        $(this).css("background","url(/images/header/2nd-column-practitioner-on.gif)");
      }, 
      function () {
        $(this).css("background","url(/images/header/2nd-column-practitioner-off.gif)");
      }
    );
//make sure feature box is same height as left dept box
		firstDeptHeight = $("#firstDept").height();
		$("#deptPaddingStretch").css("height",firstDeptHeight);
//beauty links

    $(".beauty09Link").hover(
      function () {
        $(this).css("background","#bcdbe9");
      }, 
      function () {
        $(this).css("background","#99c4d7");
      }
    );
	linkHeight = $("#beauty09Links").height();
	borderHeight = $("#beauty09Links").height() + 2;
	$("#beauty09LinksBorder").css("height", "" + borderHeight + "px");
	$("#beauty09LinksContainer").css("height", "" + linkHeight + "px");
	$("#beauty09Links li:last").css("border-bottom", "none");
	$("#showHeight").click(
		function () {
			$("#showHeight").text('It be ' + linkHeight + 'px high');
		});
	
ripSubHeads("#subExpander1");
ripSubHeads("#subExpander2");
ripSubHeads("#subExpander3");
ripSubHeads("#subExpander4");

$(".subTopic-topWellness").toggle(function(){ 
	if($(this).parent().siblings("#subExpandMe").children("div").children(".subArtSmall").children().length){
    $(this).css("background-image","url(/images/centers/sub-less-articles.gif)");
	$(this).parent(".noBlinkSubTopic-top").siblings("#subExpandMe").children("div").children(".subArtSmall").slideDown(1200);
    return false;
	}
    },
	function(){ 
	if($(this).parent().siblings("#subExpandMe").children("div").children(".subArtSmall").children().length){
    $(this).css("background-image","url(/images/centers/sub-more-articles.gif)");
	$(this).parent(".noBlinkSubTopic-top").siblings("#subExpandMe").children("div").children(".subArtSmall").slideUp(1200);
    return false;
	}
});
    
	
//show contact form for practitioner sign-up
if($('input[name=contactMe]').attr('checked')){
$("#practitionerContactMe").show();
}else{
	$("#practitionerContactMe").hide();
}

$("#contactMe").click(
	function(){
		$("#practitionerContactMe").toggle();
	});
//end documentReady
});