// JavaScript Document for the /Gardasil-facts page


//////////////////////////////////////////////////////
// onSubmitSendFriend
//////////////////////////////////////////////////////
function show(t,b)
{
document.getElementById(t).style.display='inline';
document.getElementById(b).style.display='none';
}

function hide(t,b)
{
document.getElementById(t).style.display='none';
document.getElementById(b).style.display='inline';
}

function onSubmitSendFriend() 
{
  var p = new Object();
  
  p.toEmail = $("#friends_email").val();
  p.fromEmail = $("#your_email").val();
  
  if (!p.toEmail.match(/^([a-zA-Z0-9_\.\-\+=])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)) 
  {
    alert("Please enter a valid email address for your friend.");
    $('#friends_email').focus();
  } 
  else if (!p.fromEmail.match(/^([a-zA-Z0-9_\.\-\+=])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)) 
  {
    alert("Please enter a valid email address.");
    $('#your_email').focus();
  } 
  else 
  {
    p.formname = "gardasil_cns_eaf";
    p.reqf = "fromEmail,toEmail";
    p.subject = "Have you seen this?";
    p.emailAFriend = "true";
    p.emailFile = "gardasil/tell-a-friend/did-you-know-en.html";
    $.get('/pdc/gardasil/tellAFriend.do', p);
    $(".tell-friend-pop").hide();
    $(".tell-friend-thankyou").show();
    writeSpotlightTag("1595705", "garda956", "sdidy419");  //search
    writeSpotlightTag("887836", "garda599", "ddidy496");  //display
    sdcTagPseudoPage("/Gardasil-facts/share-with-friend/thank-you/", "Email Did-You-Know to a Friend - Thank You");
  }

  return false;
}

$(document).ready(function() {
	/*$(".moreLink").click(function() {
		//$(".moreContent").hide();
		//$(this).prev(".moreLink").show();
		//$(this).parent().parent().next().show();
		//$(this).hide();
	});*/
	/*$(".lessLink").click(function() {
		$(this).parent().hide();
		$(".moreLink").show();
	});*/
	
	
	$("#moreLink1").click(function() {
	    $(this).hide();
		$("#moreContent1").show();
		$("#lessLink1").show();
	});
	$("#lessLink1").click(function() {
		$(this).hide();
		$("#moreContent1").hide();
		$("#moreLink1").show();
	});
	
	
	$("#moreLink2").click(function() {
	    $(this).hide();
		$("#moreContent2").show();
		$("#lessLink2").show();
	});
	$("#lessLink2").click(function() {
		$(this).hide();
		$("#moreContent2").hide();
		$("#moreLink2").show();
	});
	
	
	$("#moreLink3").click(function() {
	    $(this).hide();
		$("#moreContent3").show();
		$("#lessLink3").show();
	});
	$("#lessLink3").click(function() {
		$(this).hide();
		$("#moreContent3").hide();
		$("#moreLink3").show();
	});
	
	
	
	$("#moreLink4").click(function() {
	    $(this).hide();
		$("#moreContent4").show();
		$("#lessLink4").show();
	});
	$("#lessLink4").click(function() {
		$(this).hide();
		$("#moreContent4").hide();
		$("#moreLink4").show();
	});
	
	$("#moreLink5").click(function() {
	    $(this).hide();
		$("#moreContent5").show();
		$("#lessLink5").show();
	});
	$("#lessLink5").click(function() {
		$(this).hide();
		$("#moreContent5").hide();
		$("#moreLink5").show();
	});
	
	
	$("#moreLink6").click(function() {
	    $(this).hide();
		$("#moreContent6").show();
		$("#lessLink6").show();
	});
	$("#lessLink6").click(function() {
		$(this).hide();
		$("#moreContent6").hide();
		$("#moreLink6").show();
	});
	
	$("#moreLink7").click(function() {
	    $(this).hide();
		$("#moreContent7").show();
		$("#lessLink7").show();
	});
	$("#lessLink7").click(function() {
		$(this).hide();
		$("#moreContent7").hide();
		$("#moreLink7").show();
	});
	
	$("#moreLink8").click(function() {
	    $(this).hide();
		$("#moreContent8").show();
		$("#lessLink8").show();
	});
	$("#lessLink8").click(function() {
		$(this).hide();
		$("#moreContent8").hide();
		$("#moreLink8").show();
	});
	
	$(".shareLink").click(function() {
	   $(this).next().fadeIn("fast");
           sdcTagPseudoPage("/Gardasil-facts/share-with-friend/", "Email Did-You-Know to a Friend");
	});
	$(".tell-friend-close").click(function() {
	   $(this).parent().fadeOut("fast");
	});
	$("#tell-friend-submit").click(function() {
		onSubmitSendFriend();
	});
	$('#global-nav li').supersleight();
	$('#global-nav li a').supersleight();
	$('.tell-friend-pop').supersleight();
});


// FANCY TOOL TIPS, HOVER. see exploder.js for for IE6 additional rules
	/*$(".tip .tip-content,.tip .tip-bottom").hide();*/
	/*$(".tip").hoverIntent(function () {
			$(this).children(".tip-content,.tip-bottom").css({left:"-1px", cursor:"default"}).show();
			
		},
		function () {
			$(this).children(".tip-content,.tip-bottom").hide();
	});
	// DISABLE ANCHORS ON TOOL TIP LINKS
	$(".tip:not(.external)").click(function(){
		return false
	});*/
	
