var footerlinks = new Array(); 
$(document).ready(function() {

  // Initialize menu: requires superfish.js and hoverIntent.js
  $("#globalNav").superfish({ 
    hoverClass: 'sfHover',
    animation: {height:'show'}, 
    delay: 200,
    speed: 100,
    autoArrows: false,
    dropShadows: false                            
	}); 
	
	
	// Italicize last word in h1 tags
	/*if (!$("#content-column h1").html().match("<DIV")) {
	  var arrTitle = $("#content-column h1").text().split(" ");
	  var newTitle = "";
	  for (var i = 0; i < arrTitle.length; i++) {
		  if (i == arrTitle.length - 1) {
			  newTitle += "<em>" + arrTitle[i] + "</em>"; 	
		  } else {
			  newTitle += arrTitle[i] + " ";
		  }
	  }
	  $("#content-column h1").html(newTitle);
	}*/
	
	
	// Add Larger Capital letter to footer links
/*	footerlinks = $("#footer").find("a");
	var newTxt = "";
	for (var i = 1; i < footerlinks.length + 1; i++) {
		newTxt = replaceCaps($("#footer ul li:nth-child(" + i + ")").html());
		$("#footer ul li:nth-child(" + i + ")").html(newTxt);
	}
*/	// Removed and set with css "font-variant:small-caps;"

  $("#footer ul li:last-child").addClass("last");
  
  if ($("a").attr("href") == "/Specialties.aspx") {
	  	alert("found");
		this.href = "/Specialties/Skin-Care.aspx";  
  }
	
  // Remove and add text in e-mail
  $("#ctl00_plcMain_NewsletterSubscription_txtEmail").focus(function() {
    if (this.value == "e-mail address") {
        this.value = "";
        this.style.color = "#000000";
    }
  });
  $("#ctl00_plcMain_NewsletterSubscription_txtEmail").blur(function() {
    if (this.value == "") {
        this.value = "e-mail address";
        this.style.color = "#999999";
    }
  });
  
  $("#email").focus(function() {
    if (this.value == "e-mail address") {
        this.value = "";
        this.style.color = "#000000";
    }
  });
  
  $("#email").blur(function() {
    if (this.value == "") {
        this.value = "e-mail address";
        this.style.color = "#999999";
    }
  });
  
  $("#signupbtn").click(function() {
    window.open('http://visitor.constantcontact.com/d.jsp?m=1102308224609&p=oi&ea=' + $("#email").val());
  });

  
  // FAQ Handler
  $("#faqs h2 a").click(function () {
     $("#FAQ" + this.id).slideToggle("normal");
     return false;
  });

});

/*function replaceCaps(str) {
	var re = new RegExp(/[A-Z]/g);
	var m;
	var output = "<a";
	for (var i = 2; i < str.length - 3; i++) {
		m = re.exec(str.charAt(i));
		if (m == null) {
			output += str.charAt(i);
		} else {
			output += "<span>" + str.charAt(i) + "</span>";
		}
	}
	output += "a>"
	return output;
}
*/
