
$(document).ready(function() {
	
	//--------------------------------------display random spotlight
	var randomnumber=Math.floor(Math.random()*3) // to 3 spolights
	
	randomnumber = randomnumber + 1;
	
	$("#spotlight_" + randomnumber).attr("class", "");
		
	
	
	
	//-------------------------------------main nav hover-------------------------------------------------
	
	var url = window.location.href;
	
	if(url.indexOf("http://soe.lmu.edu/home") != -1) //we are under admissions category
	{
		$("#pageid55593 div a").css("background", "url(/Sites/41/templates/v2-images/nav-home.png) 0 0 no-repeat");
	}
	else if(url.indexOf("http://soe.lmu.edu/admissions") != -1) //we are under admissions category
	{
		$("#pageid55492 div a").css("background", "url(/Sites/41/templates/v2-images/nav-admission.png) 0 0 no-repeat");
	}
	else if(url.indexOf("http://soe.lmu.edu/faculty") != -1) //we are under faculty category
	{
		$("#pageid55493 div a").css("background", "url(/Sites/41/templates/v2-images/nav-faculty.png) 0 0 no-repeat");
	}
	else if(url.indexOf("http://soe.lmu.edu/centers") != -1) //we are under centers category
	{
		$("#pageid55494 div a").css("background", "url(/Sites/41/templates/v2-images/nav-center.png) 0 0 no-repeat");
	}
	else if(url.indexOf("http://soe.lmu.edu/news") != -1) //we are under news category
	{
		$("#pageid57986 div a").css("background", "url(/Sites/41/templates/v2-images/nav-news.png) 0 0 no-repeat");
	}
	else if(url.indexOf("http://soe.lmu.edu/about") != -1) //we are under about category
	{
		$("#pageid60820 div a").css("background", "url(/Sites/41/templates/v2-images/nav-about.png) 0 0 no-repeat");
	}
	else // under home
	{
		$("#pageid55593 div a").css("background", "url(/Sites/41/templates/v2-images/nav-home.png) 0 0 no-repeat");
	}
	
	
	//admission
	$("#pageid55492").hover(
		function () {
			var url = window.location.href;
			
			if(url.indexOf("http://soe.lmu.edu/admissions") != -1) //we are under admissions category
				$("#pageid55492 div a").css("background-position", "0 -38px");
				
			$("#pageid55492 ul").show();
      }, 
      	function () {	
			var url = window.location.href;
			
			if(url.indexOf("http://soe.lmu.edu/admissions") != -1) //we are under admissions category
				$("#pageid55492 div a").css("background-position", "0 0");
				
			
			$("#pageid55492 ul").hide();
      }
    );
	
	//faculty
	$("#pageid55493").hover(
		function () {
			var url = window.location.href;
			
			if(url.indexOf("http://soe.lmu.edu/faculty") != -1) //we are under faculty category
				$("#pageid55493 div a").css("background-position", "0 -38px");
			$("#pageid55493 ul").show();
      }, 
      	function () {	
			var url = window.location.href;
			
			if(url.indexOf("http://soe.lmu.edu/faculty") != -1) //we are under faculty category
				$("#pageid55493 div a").css("background-position", "0 0");
			$("#pageid55493 ul").hide();
      }
    );
	
	//centers
	$("#pageid55494 ").hover(
		function () {
			var url = window.location.href;
			
			if(url.indexOf("http://soe.lmu.edu/centers") != -1) //we are under centers category
				$("#pageid55494 div a").css("background-position", "0 -38px");
			$("#pageid55494 ul").show();
      }, 
      	function () {	
			var url = window.location.href;
			
			if(url.indexOf("http://soe.lmu.edu/centers") != -1) //we are under centers category
				$("#pageid55494 div a").css("background-position", "0 0");
			$("#pageid55494 ul").hide();
      }
    );
	
	//news
	$("#pageid55495 ").hover(
		function () {
			var url = window.location.href;
			if(url.indexOf("http://soe.lmu.edu/news") != -1) //we are under news category
				$("#pageid55495 div a").css("background-position", "0 -38px");
			$("#pageid55495 ul").show();
      }, 
      	function () {	
			var url = window.location.href;
			
			if(url.indexOf("http://soe.lmu.edu/news") != -1) //we are under news category
				$("#pageid55495 div a").css("background-position", "0 0");
			$("#pageid55495 ul").hide();
      }
    );
	
	//about
	$("#pageid60820 ").hover(
		function () {
			var url = window.location.href;
			
			if(url.indexOf("http://soe.lmu.edu/about") != -1) //we are under about category
				$("#pageid60820 div a").css("background-position", "0 -38px");
			$("#pageid60820 ul").show();
      }, 
      	function () {	
			var url = window.location.href;
			
			if(url.indexOf("http://soe.lmu.edu/about") != -1) //we are under about category
				$("#pageid60820 div a").css("background-position", "0 0");
			$("#pageid60820 ul").hide();
      }
    );
	
	
	
	
	
	$("#banner1").hover(
		
		function () {
			
			$("#teaser_title1").hide();
			$("#background1").show();
		
      }, 
      	function () {			
			$("#teaser_title1").show();
			$("#background1").hide();
		
			
      }
    );
	
	
	
	$("#banner2").hover(
		
		function () {
			
			$("#teaser_title2").hide();
			$("#background2").show();
		
      }, 
      	function () {			
			$("#teaser_title2").show();
			$("#background2").hide();
		
			
      }
    );
	
	$("#banner3").hover(
		
		function () {
			
			$("#teaser_title3").hide();
			$("#background3").show();
		
      }, 
      	function () {			
			$("#teaser_title3").show();
			$("#background3").hide();
		
			
      }
    );
	
	$("#banner1").click(
		
		function () {
			if ($("#background1 a").attr("href") != null)
				window.location = $("#background1 a").attr("href");
      }
    );
	
	$("#banner2").click(
		
		function () {
			if ($("#background2 a").attr("href") != null)
				window.location = $("#background2 a").attr("href");
      }
    );
	
	$("#banner3").click(
		
		function () {
			if ($("#background3 a").attr("href") != null)	
				window.location = $("#background3 a").attr("href");
      }
    );
	
	
	
	
	$(".alphabet").click(
		
		function () {
			$("#alphabet_" + active_alphabet).removeClass("selected");
			$("#alphabet_" + active_alphabet).addClass("alphabet");
			
			$("#info_" + active_alphabet).removeClass("info_selected");
			$("#info_" + active_alphabet).addClass("info");
			
			var click_alphabet = $(this).html(); 
			
			$(this).removeClass("alphabet");
			$(this).addClass("selected");
			$("#info_" + click_alphabet).removeClass("info");
			$("#info_" + click_alphabet).addClass("info_selected");
			
			
			active_alphabet = click_alphabet; 
			
      }
	  
    );
	
	
	
	$("#alphabet_a").click(
		
		function () {
			$("#alphabet_" + active_alphabet).removeClass("selected");
			$("#alphabet_" + active_alphabet).addClass("alphabet");
			
			$("#info_" + active_alphabet).removeClass("info_selected");
			$("#info_" + active_alphabet).addClass("info");
			
			var click_alphabet = $(this).html(); 
			
			$(this).removeClass("alphabet");
			$(this).addClass("selected");
			$("#info_" + click_alphabet).removeClass("info");
			$("#info_" + click_alphabet).addClass("info_selected");
			
			
			active_alphabet = click_alphabet; 
		
      }
	  
    );
	
	
	/***************************FOS template*********************************************/
	
	if(url.indexOf("/centers/fos.htm") != -1) //we are under home category
	{
		$("#pageid57586 div a").css("background", "url(/Sites/41/templates/v2-images/family-button-home.png) 0 -59px no-repeat");
	}
	else if(url.indexOf("/centers/fos/about") != -1) //we are under about category
	{
		$("#pageid57587 div a").css("background", "url(/Sites/41/templates/v2-images/family-button-about.png) 0 -59px no-repeat");
	}
	else if(url.indexOf("/centers/fos/partners") != -1) //we are under partners category
	{
		$("#pageid57588 div a").css("background", "url(/Sites/41/templates/v2-images/family-button-partner.png) 0 -59px no-repeat");
	}
	else if(url.indexOf("/centers/fos/resources") != -1) //we are under centers category
	{
		$("#pageid57589 div a").css("background", "url(/Sites/41/templates/v2-images/family-button-resource.png) 0 -59px no-repeat");
	}
	else if(url.indexOf("/centers/fos/news") != -1) //we are under news category
	{
		$("#pageid57590 div a").css("background", "url(/Sites/41/templates/v2-images/family-button-newsletter.png) 0 -59px no-repeat");
	}
	else // under home
	{
		$("#pageid57586 div a").css("background", "url(/Sites/41/templates/v2-images/family-button-home.png) 0 -59px no-repeat");
	}
	
	/***************************FOS template End*********************************************/
	
	
	/********************************For Admission drop down **********************************/
	
	$(".dropdown select").change(function () {
          var selected_id = $(this).attr("id");
          var url = $("#" + selected_id + " option:selected").attr("value");
          
		  if(url != "0") 
		  {
		  	if(url.indexOf("http://") == 0) //external URL)
				window.open(url, 'newwindow');
			else
				window.location = url;
		  }
		})
	
	
	
	/********************************For Faculty List **********************************/
	var active_alphabet 	
	active_alphabet = "a";
	
	$(".alphabet").click(
		
		function () {
			$("#alphabet_" + active_alphabet).removeClass("selected");
			$("#alphabet_" + active_alphabet).addClass("alphabet");
			
			$("#info_" + active_alphabet).removeClass("info_selected");
			$("#info_" + active_alphabet).addClass("info");
			
			var click_alphabet = $(this).html(); 
			
			$(this).removeClass("alphabet");
			$(this).addClass("selected");
			$("#info_" + click_alphabet).removeClass("info");
			$("#info_" + click_alphabet).addClass("info_selected");
			
			
			active_alphabet = click_alphabet; 
			
      }
	  
    );
	
	
	
	$("#alphabet_b").click(
		
		function () {
			$("#alphabet_" + active_alphabet).removeClass("selected");
			$("#alphabet_" + active_alphabet).addClass("alphabet");
			
			$("#info_" + active_alphabet).removeClass("info_selected");
			$("#info_" + active_alphabet).addClass("info");
			
			var click_alphabet = $(this).html(); 
			
			$(this).removeClass("alphabet");
			$(this).addClass("selected");
			$("#info_" + click_alphabet).removeClass("info");
			$("#info_" + click_alphabet).addClass("info_selected");
			
			
			active_alphabet = click_alphabet; 
		
      }
	  
    );
	
});// end doc ready


function ENewsletter_JoinForm_Validator()
{
  theForm = document.getElementById('IronPointForm');		
  if (theForm.Email.value == "" || theForm.Email.value == "your email address")
  {
    alert("Please enter a value for the \"Email Address\" field.");
    theForm.Email.focus();
    return (false);
  }
  if (theForm.Email.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"Email Address\" field.");
    theForm.Email.focus();
    return (false);
  }
  if (theForm.Email.value.length > 255)
  {
    alert("Please enter at most 255 characters in the \"Email Address\" field.");
    theForm.Email.focus();
    return (false);
  }
  
  document.forms[0].__VIEWSTATE.name='NOVIEWSTATE';
  document.forms.item('IronPointForm').method='post';
  document.forms.item('IronPointForm').action='http://www.simplesend.com/simple/members.asp?Task=Join';
  document.forms.item('IronPointForm').submit(); 
  return (true);
}


