//JS (mostly JQuery) for front page and template
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

$(document).ready(
	function(){
		$(".initiallyHidden").css("display", "none");		  
		
		$(".expandableContent h1").click(
			function(){
				$(this).siblings().toggle("fast");
				/*
				if($(this).children("span.expansionMarker").text() == "+"){
					$(this).children("span.expansionMarker").text("-");
				}else{
					$(this).children("span.expansionMarker").text("+");
				}
				*/
				if($(this).children("a").children("span.expansionMarker").text() == "+"){
					$(this).children("a").children("span.expansionMarker").text("-");
				}else{
					$(this).children("a").children("span.expansionMarker").text("+");
				}
				
				alert($(this).children("a").children("span.expansionMarker").next().text);
				
				//alert($(this).children("a").lastChild.value);
				
				/*
				if(getCookie("")){
					
				}
				*/
				
				/*
				if(document.cookie.length > 0){
					
				}
				
				//Let's make our cookie expire in 1000 days.
				var expirationDate = new Date();
				expirationDate.setDate(expirationDate.getDate + 1000);*/
			}
		);
		
		$("#photo1").mouseover(
			function(){
				$("#mainPhoto").attr("src", "images/main image.jpg");
				$("#pictureContainer p").text("Sample Gates seen from Indiana Avenue");
			}
		);
		
		$("#photo2").mouseover(
			function(){
				$("#mainPhoto").attr("src", "images/main image 2.jpg");
				$("#pictureContainer p").text("IU logo and Herman B. Wells statue");
			}
		);
		
		$("#photo3").mouseover(
			function(){
				$("#mainPhoto").attr("src", "images/main image 3.jpg");
				$("#pictureContainer p").text("Caption pending");
			}
		);
		
		$("#photo4").mouseover(
			function(){
				$("#mainPhoto").attr("src", "images/main image 4.jpg");
				$("#pictureContainer p").text("Franklin Hall");
			}
		);
		
		
		/*
		$("#photo2").hover(
			function(){
				$("#mainPhoto").attr("src", "main image 2.jpg");
			}
		);
		$("#photo2").hover(
			function(){
				$("#mainPhoto").attr("src", "main image 2.jpg");
			}
		);
		*/
		
		/*$("input[type='text']").focus(
			function(){
				$(this).css("background-color", "#ff0000");			
			}
		);*/
		
		$("#navigation h1 a").tooltip(
			{
				delay: 0,
				showURL: false,
				showBody: " - "
				
				
			}
		);
		/*
		$("ul li a").hover(
			function(){
				$(this).parent().css("list-style", "disc");
			},
			function(){
				$(this).parent().css("list-style", "none");
			}
		);
		*/
	}
	
);