//Modified 9.7.2010 - Edited the handlescroll function to disable it on the home page
$(document).ready(function(){
	// Auto scroll to local anchors
	$(".scroll").click(function(event){
		event.preventDefault();
		var full_url = this.href;
		var parts = full_url.split("#");
		var trgt = parts[1];
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;
		$('html, body').animate({scrollTop:target_top}, 500);
	});						   
							   
	//Gets the scroll function ready   
	$(window).scroll( function(){ handlescroll();}); 
	$(window).resize( function(){ handlescroll();});
	
	//Finds lists and divides them into columns
	$('.threeColumnList').makeacolumnlists({cols:3, colWidth:196, equalHeight:true, startN:1});
	$('.twoColumnList').makeacolumnlists({cols:2, colWidth:255, equalHeight:true, startN:1});
	
	//IE doesn't support the nth-child
	$('#leftNav ul li:nth-child(1)').addClass('firstListItem');
	$('#leftNav ul li.subListTrigger ul li:nth-child(1)').addClass('firstSubListItem');
	
	//Gets the SubLink fuction ready
	$(".triggerOff").toggle(function(){$(this).addClass("triggerStayOn");},function(){$(this).removeClass("triggerStayOn");});
	$(".triggerOff").click(function(){$(this).next(".subList").slideToggle("slow,");});
	$(".triggerOff").click(function(){$(this).next(".subList2").slideToggle("slow,");});
	$(".triggerOff").click(function(){$(this).next(".subList3").slideToggle("slow,");});
	$(".triggerOff").click(function(){$(this).next(".subList4").slideToggle("slow,");});
	$(".triggerOff").click(function(){$(this).next(".subList5").slideToggle("slow,");});
	$(".triggerOff").click(function(){$(this).next(".subList6").slideToggle("slow,");});
	$(".triggerOff").click(function(){$(this).next(".subList7").slideToggle("slow,");});
	$(".triggerOff").click(function(){$(this).next(".subList8").slideToggle("slow,");});
	$(".triggerOff").click(function(){$(this).next(".subList9").slideToggle("slow,");});
	
	//BOBBY'S CODE
	$("#list1").toggle(function(){$(this).addClass("triggerStayOn");},function(){$(this).removeClass("triggerStayOn");});
  	$("#list2").toggle(function(){$(this).addClass("triggerStayOn");},function(){$(this).removeClass("triggerStayOn");});
	$("#list3").toggle(function(){$(this).addClass("triggerStayOn");},function(){$(this).removeClass("triggerStayOn");});
	$("#list4").toggle(function(){$(this).addClass("triggerStayOn");},function(){$(this).removeClass("triggerStayOn");});
	$("#list5").toggle(function(){$(this).addClass("triggerStayOn");},function(){$(this).removeClass("triggerStayOn");});
	$("#list6").toggle(function(){$(this).addClass("triggerStayOn");},function(){$(this).removeClass("triggerStayOn");});
	$("#list7").toggle(function(){$(this).addClass("triggerStayOn");},function(){$(this).removeClass("triggerStayOn");});
	$("#list8").toggle(function(){$(this).addClass("triggerStayOn");},function(){$(this).removeClass("triggerStayOn");});
	
	
	$("#list1").click(function(){$(this).next(".subList").slideToggle("slow,");});
	$("#list2").click(function(){$(this).next(".subList2").slideToggle("slow,");});
	$("#list3").click(function(){$(this).next(".subList3").slideToggle("slow,");});
	$("#list4").click(function(){$(this).next(".subList4").slideToggle("slow,");});
	$("#list5").click(function(){$(this).next(".subList5").slideToggle("slow,");});
	$("#list6").click(function(){$(this).next(".subList6").slideToggle("slow,");});
	$("#list7").click(function(){$(this).next(".subList7").slideToggle("slow,");});
	$("#list8").click(function(){$(this).next(".subList8").slideToggle("slow,");});
	
	$("#list1").click( function(){setTimeout( function(){handlescroll();}, 600);});
	$("#list2").click( function(){setTimeout( function(){handlescroll();}, 600);});
	$("#list3").click( function(){setTimeout( function(){handlescroll();}, 600);});
	$("#list4").click( function(){setTimeout( function(){handlescroll();}, 600);});
	$("#list5").click( function(){setTimeout( function(){handlescroll();}, 600);});
	$("#list6").click( function(){setTimeout( function(){handlescroll();}, 600);});
	$("#list7").click( function(){setTimeout( function(){handlescroll();}, 600);});
	$("#list8").click( function(){setTimeout( function(){handlescroll();}, 600);});

	//END BOBBY'S CODE	
	
	$(".triggerDiv").hide();
	$(".trigger").toggle(function(){$(this).addClass("triggerOn");},function(){$(this).removeClass("triggerOn");});
	$(".trigger").click(function(){$(this).next(".triggerDiv").slideToggle("slow,");});
	$(".trigger").click( function(){setTimeout( function(){handlescroll();}, 600);});
});

//Submits search form to Google Search
function submitForm(){
	//document.forms["cse-search-form"].submit();
	document.forms["searchbox_006500010410855228799:em148ygg28e"].submit();
}


//Get specific queryString values
function getQuerystring(key, default_) {
    if (default_ == null) default_ = "";
    key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if (qs == null)
        return default_;
    else
        return qs[1];
}

function getQuerystring2(key, default_) {
    if (default_ == null) default_ = "";
    key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&amp;]" + key + "=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if (qs == null)
        return default_;
    else
        return qs[1];
}

//Used for both handleScroll and getFlashBanner
switch (bannerType) {
    case "smallBanner": 
        {
            minHeight = 237;
            bannerType = "small";
            bannerHeight = "100";
        } break;
    case "mediumBanner": 
        {
            minHeight = 257;
            bannerType = "medium";
            bannerHeight = "120";
        } break;
    case "largeBanner": 
        {
            minHeight = 337;
            bannerType = "large";
            bannerHeight = "200";
        } break;
    case "index":
        {
            minHeight = 437;
            bannerHeight = "300";
        } break;
    case "index2":
        {
            minHeight = 437;
            bannerHeight = "300";
        } break;
    case "1000Ways": 
        {
            minHeight = 337;
            bannerHeight = "200";
        } break;
    case "noBanner": 
        {
            minHeight = 137;
            bannerHeight = "0";
        } break;
    case "newsStory": 
        {
            minHeight = 137;
            bannerHeight = "0";
        } break;
    case "openHouse": 
        {
            minHeight = 337;
            bannerType = "openHouse";
            bannerHeight = "200";
        } break;
    case "scienceSaturday": 
        {
            minHeight = 337;
            bannerType = "scienceSaturday";
            bannerHeight = "200";
        } break;
    case "library": 
        {
            minHeight = 337;
            bannerType = "library";
            bannerHeight = "200";
        } break;
}

/*Changes the title of the current page. Used in conjunction with breadcrumb function
var browser = navigator.appName;
var titleBarArray = titlePath.split(":");

var startValue = titleBarArray.length - 2;
var endValue = titleBarArray.length;
var titleBarText = "";
var i = 1;

if(titleBarArray.length == 1){
	document.getElementById("pageTitle").text = "Lycoming College";		
}else{
	while(startValue != endValue){
		if(i == 1){titleBarText += titleBarArray[startValue].replace("&amp;", "&");}
		if(i == 2){titleBarText += ": " + titleBarArray[startValue].replace("&amp;", "&");}
		startValue++;
		i++;
	}
	if(titleBarText == "404:  File Not Found - Lycoming College"){
		titleBarText = "404 (File Not Found) - Lycoming College";
	}
	document.getElementById("pageTitle").text = (titleBarText.replace("&amp;", "&"));		
}*/

	
//Prints out the required breadcrumbs, as long as the title is proper
function getBreadcrumb(){
	var url = document.location.href;
	var title = titlePath;
	
	
	switch(title){
		case "Lycoming College": {	
			breadcrumbHTML = "<li>Home</li>";			
		}break;
		case "404: File Not Found - Lycoming College": {	
			breadcrumbHTML =  "<li><a class=\"breadCrumbLink\" href=\"/\">Home</a></li>\n";	
			breadcrumbHTML += "<li>404 (File Not Found)</li>\n";			
		}break;
		default: {
			// Start Breadcrumb with Home link
			var breadcrumbHTML;
				breadcrumbHTML =  "<li><a class=\"breadCrumbLink\" href=\"/\">Home</a></li>\n";
				
			// Determin how many subsites there are
			String.prototype.count = function(s1){ 
				return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
			}
			numberSubSites = title.count(':'); 
			switch(numberSubSites){
				case 1: {	
					var subSite = title.split(":")
						subSite = subSite[0];
						subSite1URL = url.split("/");
						subSite1URL = subSite1URL[3];
						
					var currentPage = title.split(":")
						currentPage = currentPage[1].split(" - ");
						currentPage = currentPage[0];
						
					var currentPageLength = currentPage.length;
					var subString = currentPage.substr(currentPageLength - 4, 4);
					
					if(subString == "Home"){
						breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length - 5) + "</li>\n";	
					}else{
						breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/\">" + subSite + "</a></li>\n";	
						breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length) + "</li>\n";					
						subSiteHome = subSite;			
					}				
				}break;
				case 2: {	
					var subSite1 = title.split(":");
						subSite1 = subSite1[0];
						if(subSite1 == "Offices"){
											
							var subSite1 = title.split(":")
								subSite1 = subSite1[1];
								subSite1URL = url.split("/");
								subSite1URL = subSite1URL[3];
						
							var subSite2 = title.split(":");
								subSite2 = subSite2[1];
								subSite2URL = url.split("/");
								subSite2URL = subSite2URL[4];
											
							var currentPage = title.split(":")
								currentPage = currentPage[2].split(" - ");
								currentPage = currentPage[0];
							
							var currentPageLength = currentPage.length;
							var subString = currentPage.substr(currentPageLength - 4, 4);
							
							if(subString == "Home"){
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/offices/\">Offices</a></li>\n";
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length - 5) + "</li>\n";	
							}else{
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/offices/\">Offices</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length) + "</li>\n";					
								subSiteHome = subSite2;
							}	
						}
						else if(subSite1 == "Academics"){
											
							var subSite1 = title.split(":")
								subSite1 = subSite1[1];
								subSite1URL = url.split("/");
								subSite1URL = subSite1URL[3];
						
							var subSite2 = title.split(":");
								subSite2 = subSite2[1];
								subSite2URL = url.split("/");
								subSite2URL = subSite2URL[4];
											
							var currentPage = title.split(":")
								currentPage = currentPage[2].split(" - ");
								currentPage = currentPage[0];
							
							var currentPageLength = currentPage.length;
							var subString = currentPage.substr(currentPageLength - 4, 4);
							
							if(subString == "Home"){
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/academics/\">Academics</a></li>\n";
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length - 5) + "</li>\n";	
							}else{
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/academics/\">Academics</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length) + "</li>\n";					
								subSiteHome = subSite2;
							}	
						}
						
						else{
							subSite1URL = url.split("/");
							subSite1URL = subSite1URL[3];
						
							var subSite2 = title.split(":");
								subSite2 = subSite2[1];
								subSite2URL = url.split("/");
								subSite2URL = subSite2URL[4];
											
							var currentPage = title.split(":")
								currentPage = currentPage[2].split(" - ");
								currentPage = currentPage[0];
								
							var currentPageLength = currentPage.length;
							var subString = currentPage.substr(currentPageLength - 4, 4);
							
							if(subString == "Home"){
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length - 5) + "</li>\n";	
							}else{
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/" + subSite2URL + "/\">" + subSite2 + "</a></li>\n";	
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length) + "</li>\n";					
								subSiteHome = subSite2;
							}								
						}			
				}break;
				case 3: {	
					var subSite1 = title.split(":");
						subSite1 = subSite1[0];
						if(subSite1 == "Offices"){
											
							var subSite1 = title.split(":")
								subSite1 = subSite1[1];
								subSite1URL = url.split("/");
								subSite1URL = subSite1URL[3];
						
							var subSite2 = title.split(":");
								subSite2 = subSite2[2];
								subSite2URL = url.split("/");
								subSite2URL = subSite2URL[4];			
											
							var currentPage = title.split(":")
								currentPage = currentPage[3].split(" - ");
								currentPage = currentPage[0];
							
							var currentPageLength = currentPage.length;
							var subString = currentPage.substr(currentPageLength - 4, 4);
							
							if(subString == "Home"){
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/offices/\">Offices</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length - 5) + "</li>\n";	
							}else{
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/offices/\">Offices</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/" + subSite2URL + "/\">" + subSite2 + "</a></li>\n";	
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length) + "</li>\n";	
								subSiteHome = subSite2;
							}	
						}
						else if(subSite1 == "Academics"){
											
							var subSite1 = title.split(":")
								subSite1 = subSite1[1];
								subSite1URL = url.split("/");
								subSite1URL = subSite1URL[3];
						
							var subSite2 = title.split(":");
								subSite2 = subSite2[2];
								subSite2URL = url.split("/");
								subSite2URL = subSite2URL[4];			
											
							var currentPage = title.split(":")
								currentPage = currentPage[3].split(" - ");
								currentPage = currentPage[0];
							
							var currentPageLength = currentPage.length;
							var subString = currentPage.substr(currentPageLength - 4, 4);
							
							if(subString == "Home"){
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/academics/\">Academics</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length - 5) + "</li>\n";	
							}else{
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/academics/\">Academics</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/" + subSite2URL + "/\">" + subSite2 + "</a></li>\n";	
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length) + "</li>\n";	
								subSiteHome = subSite2;
							}	
						}else{
							subSite1URL = url.split("/");
							subSite1URL = subSite1URL[3];
						
							var subSite2 = title.split(":");
								subSite2 = subSite2[1];
								subSite2URL = url.split("/");
								subSite2URL = subSite2URL[4];
											
							var currentPage = title.split(":")
								currentPage = currentPage[2].split(" - ");
								currentPage = currentPage[0];
								
							var currentPageLength = currentPage.length;
							var subString = currentPage.substr(currentPageLength - 4, 4);
							
							if(subString == "Home"){
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length - 5) + "</li>\n";	
							}else{
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/\">" + subSite1 + "</a></li>\n";
								breadcrumbHTML +=  "<li><a class=\"breadCrumbLink\" href=\"/" + subSite1URL + "/" + subSite2URL + "/\">" + subSite2 + "</a></li>\n";	
								breadcrumbHTML +=  "<li>" + currentPage.substr(1,currentPage.length) + "</li>\n";					
								subSiteHome = subSite2;
							}								
						}			
				}break;
			}
		}break;
	}
	
	
	return document.write(breadcrumbHTML);
}			


//Determins if there should be a 'Home' link or not
function homeLink(){	
	var url = document.location.href;	
	var title = titlePath;
	var homeLinkHTML = "";
	String.prototype.count = function(s1){ 
		return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
	}
	var numberSubSites = url.count("/"); 
	var homeLinkURL = url.split("/");
		homeLinkURL = homeLinkURL[3];
	
	var subSiteHome = title.split(": ");
		subSiteHome = subSiteHome[0];
		
	if(numberSubSites > 4){
		var subSite1 = title.split(":");
			subSite1 = subSite1[0];
			
		var subSite2 = title.split(":");
			subSite2 = subSite2[1];
		
		if(subSite1 == "Offices"){
		    if ((urlSubString1 == "index.html") || (urlSubString1 == "index.aspx") || (urlSubString2 == "/")) {
			}else{
				homeLinkHTML = "<li class=\"leftNavItem\"><a class=\"leftNavLink\" href=\"/" + homeLinkURL + "/\">" + subSite2 + " Home</a></li>";
			}	
		}
		else if(subSite1 == "Academics"){
		    if ((urlSubString1 == "index.html") || (urlSubString1 == "index.aspx") || (urlSubString2 == "/")) {
			}else{
				homeLinkHTML = "<li class=\"leftNavItem\"><a class=\"leftNavLink\" href=\"/" + homeLinkURL + "/\">" + subSite2 + " Home</a></li>";
			}	
		}else{
			homeLinkHTML = "<li class=\"leftNavItem\"><a class=\"leftNavLink\" href=\"/" + homeLinkURL + "/\">" + subSite1 + " Home</a></li>";	
		}
	}else{
		var urlLength = url.length;	
		var urlSubString1 = url.substr(urlLength - 10, 10);
		var urlSubString2 = url.substr(urlLength - 1, 1);

		var subSite1 = title.split(":");
			subSite1 = subSite1[0];
			
		var subSite2 = title.split(":");
			subSite2 = subSite2[1];
		
		if(subSite1 == "Offices"){
		    if ((urlSubString1 == "index.html") || (urlSubString1 == "index.aspx") || (urlSubString2 == "/")) {
			}else{
				homeLinkHTML = "<li class=\"leftNavItem\"><a class=\"leftNavLink\" href=\"/" + homeLinkURL + "/\">" + subSite2 + " Home</a></li>";
			}	
		}
				
		else if(subSite1 == "Academics"){
		    if ((urlSubString1 == "index.html") || (urlSubString1 == "index.aspx") || (urlSubString2 == "/")) {
			}else{
				homeLinkHTML = "<li class=\"leftNavItem\"><a class=\"leftNavLink\" href=\"/" + homeLinkURL + "/\">" + subSite2 + " Home</a></li>";
			}	
		}
		else{
		    if ((urlSubString1 == "index.html") || (urlSubString1 == "index.aspx") || (urlSubString2 == "/")) {
			}else{
				homeLinkHTML = "<li class=\"leftNavItem\"><a class=\"leftNavLink\" href=\"/" + homeLinkURL + "/\">" + subSite1 + " Home</a></li>";	
			}
		}
	}
	document.write(homeLinkHTML);
}			

	
//Determines when to scroll the floating left navigation menu
function handlescroll(){
	if(bannerType == "index"){}
	else{
		if($("#leftNav").height() > 450){
			$("#content").css({"min-height": $("#leftNav").height()+"px"});}
		else{$("#content").css({"min-height": 450+"px"});}
		//if ( minHeight+$("#content").height()-$(window).scrollTop() <= $("#leftNav").height()){
		if ( $(window).scrollTop()>minHeight && minHeight+$("#content").height()-$(window).scrollTop() <= $("#leftNav").height()){
			$("#leftNav").css({"top": $("#content").height()-$(window).scrollTop()+minHeight-$("#leftNav").height()+"px", "float":"left", "position":"fixed", "height":"auto"});
			}
		if ( $(window).scrollTop() > minHeight && $("#leftNav").height() < $(window).height() && $("#leftNav").height() < $("#content").height() && minHeight+$("#content").height()-$(window).scrollTop() > $("#leftNav").height()){
			$("#leftNav").css({"top": 0+"px", "float":"left", "position":"fixed", "height":"auto"});
			if($(".pageTop").length===0) {
				$("#leftNav ul#leftNavList").append("<li class='pageTop' style='font-weight: bold;'><a class='leftNavLink' style='cursor: pointer; display: block;'><strong>Top of page</strong></a></li>"); 
				$(".pageTop").slideDown(500).click(function(){$(window).scrollTop(0);});
			}
		} 
		else if ( $(window).scrollTop() < minHeight)  {
			$("#leftNav").css({"top": (minHeight - 5)+"px", "float":"left", "position":"absolute", "height":"auto"});
			if($("#leftNav").height() > 450){
				$("#content").css({"min-height": $("#leftNav").height()+"px"});
			}
			else{$("#content").css({"min-height": 450+"px"});}
			$(".pageTop").slideUp(200, function() {$(".pageTop").remove();}); 
		}
	}
}


//Prints out which flash banner to use, large or small
function getFlashBanner(){
	var url = document.location.href;
	
	var xmlPath = url.split("/")
		xmlPath = "/" + xmlPath[3] + "/images/banner/" + bannerType + "/";
	
	var newFlashVar = "/flash2010/flashBannerLarge.swf?urlVariable=" + xmlPath;
	var randomNumber = Math.floor(Math.random() * 101)
	switch(bannerType){
		case "1000Ways": {
			var newFlashVar = "flash/newBanner.swf";		
			flashBanner =  ("<div style='height: " + bannerHeight + "px; overflow: hidden; z-index: 5;'>\n");
			flashBanner += ("	<div id='flashBanner' style='height: " + bannerHeight + "px;'>\n");
			flashBanner += ("		<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://..../swflash.cab#version=9,0,0,0' width='800' height='" + bannerHeight + "'>\n")
			flashBanner += ("			<param name='movie' value='" + newFlashVar + "' />\n")
			flashBanner += ("			<param name='quality' value='high' />\n")
			flashBanner += ("			<param name='wmode' value='transparent' />\n")
			flashBanner += ("			<embed id='flashVars2' src='" + newFlashVar + "' quality='high' wmode='transparent' pluginspage='http://..../index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' style='width: 800px; height: " + bannerHeight + "px;'></embed>\n")
			flashBanner += ("		</object>\n")
			flashBanner += ("	</div>\n");		
			flashBanner += ("</div>\n");				
		}break;
        case "small": 
            {
                var newFlashVar = "/flash2010/flashBannerSmall.swf?urlVariable=" + xmlPath + "&id=" + randomNumber;
                flashBanner = ("<div style='height: " + bannerHeight + "px; overflow: hidden; z-index: 5;'>\n");
                flashBanner += ("	<div id='flashBanner' style='height: " + bannerHeight + "px;'>\n");
                flashBanner += ("		<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://..../swflash.cab#version=9,0,0,0' width='800' height='" + bannerHeight + "'>\n")
                flashBanner += ("			<param name='movie' value='" + newFlashVar + "' />\n")
                flashBanner += ("			<param name='quality' value='high' />\n")
                flashBanner += ("			<param name='wmode' value='transparent' />\n")
                flashBanner += ("			<embed id='flashVars2' src='" + newFlashVar + "' quality='high' wmode='transparent' pluginspage='http://..../index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' style='width: 800px; height: " + bannerHeight + "px;'></embed>\n")
                flashBanner += ("		</object>\n")
                flashBanner += ("	</div>\n");
                flashBanner += ("</div>\n");
            } break;
        case "medium": 
            {
                var newFlashVar = "/flash2010/flashBannerMedium.swf?urlVariable=" + xmlPath + "&id=" + randomNumber;
                flashBanner = ("<div style='height: " + bannerHeight + "px; overflow: hidden; z-index: 5;'>\n");
                flashBanner += ("	<div id='flashBanner' style='height: " + bannerHeight + "px;'>\n");
                flashBanner += ("		<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://..../swflash.cab#version=9,0,0,0' width='800' height='" + bannerHeight + "'>\n")
                flashBanner += ("			<param name='movie' value='" + newFlashVar + "' />\n")
                flashBanner += ("			<param name='quality' value='high' />\n")
                flashBanner += ("			<param name='wmode' value='transparent' />\n")
                flashBanner += ("			<embed id='flashVars2' src='" + newFlashVar + "' quality='high' wmode='transparent' pluginspage='http://..../index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' style='width: 800px; height: " + bannerHeight + "px;'></embed>\n")
                flashBanner += ("		</object>\n")
                flashBanner += ("	</div>\n");
                flashBanner += ("</div>\n");
            } break;
        case "large": 
            {
                var newFlashVar = "/flash2010/flashBannerLarge.swf?urlVariable=" + xmlPath + "&id=" + randomNumber;
                flashBanner = ("<div style='height: " + bannerHeight + "px; overflow: hidden; z-index: 5;'>\n");
                flashBanner += ("	<div id='flashBanner' style='height: " + bannerHeight + "px;'>\n");
                flashBanner += ("		<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://..../swflash.cab#version=9,0,0,0' width='800' height='" + bannerHeight + "'>\n")
                flashBanner += ("			<param name='movie' value='" + newFlashVar + "' />\n")
                flashBanner += ("			<param name='quality' value='high' />\n")
                flashBanner += ("			<param name='wmode' value='transparent' />\n")
                flashBanner += ("			<embed id='flashVars2' src='" + newFlashVar + "' quality='high' wmode='transparent' pluginspage='http://..../index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' style='width: 800px; height: " + bannerHeight + "px;'></embed>\n")
                flashBanner += ("		</object>\n")
                flashBanner += ("	</div>\n");
                flashBanner += ("</div>\n");					
		}break;
		case "openHouse": {
			var newFlashVar = "/flash2010/openHouseBanner.swf";			
			flashBanner =  ("<div style='height: " + bannerHeight + "px; overflow: hidden; z-index: 5;'>\n");
			flashBanner += ("	<div id='flashBanner' style='height: " + bannerHeight + "px; background: #FFF;'>\n");
			flashBanner += ("		<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://..../swflash.cab#version=9,0,0,0' width='800' height='" + bannerHeight + "'>\n")
			flashBanner += ("			<param name='movie' value='" + newFlashVar + "' />\n")
			flashBanner += ("			<param name='quality' value='high' />\n")
			flashBanner += ("			<param name='wmode' value='transparent' />\n")
			flashBanner += ("			<embed id='flashVars2' src='" + newFlashVar + "' quality='high' wmode='transparent' pluginspage='http://..../index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' style='width: 800px; height: " + bannerHeight + "px;'></embed>\n")
			flashBanner += ("		</object>\n")
			flashBanner += ("	</div>\n");		
			flashBanner += ("</div>\n");				
		}break;
		case "scienceSaturday": {
			var newFlashVar = "/flash2010/scienceSaturdayBanner.swf";			
			flashBanner =  ("<div style='height: " + bannerHeight + "px; overflow: hidden; z-index: 5;'>\n");
			flashBanner += ("	<div id='flashBanner' style='height: " + bannerHeight + "px; background: #FFF;'>\n");
			flashBanner += ("		<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://..../swflash.cab#version=9,0,0,0' width='800' height='" + bannerHeight + "'>\n")
			flashBanner += ("			<param name='movie' value='" + newFlashVar + "' />\n")
			flashBanner += ("			<param name='quality' value='high' />\n")
			flashBanner += ("			<param name='wmode' value='transparent' />\n")
			flashBanner += ("			<embed id='flashVars2' src='" + newFlashVar + "' quality='high' wmode='transparent' pluginspage='http://..../index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' style='width: 800px; height: " + bannerHeight + "px;'></embed>\n")
			flashBanner += ("		</object>\n")
			flashBanner += ("	</div>\n");		
			flashBanner += ("</div>\n");				
		}break;
		case "library": {
			var newFlashVar = "/library/flash/HPAd2011.swf";			
			flashBanner =  ("<div style='height: " + bannerHeight + "px; overflow: hidden; z-index: 5;'>\n");
			flashBanner += ("	<div id='flashBanner' style='height: " + bannerHeight + "px; background: #FFF;'>\n");
			flashBanner += ("		<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://..../swflash.cab#version=9,0,0,0' width='800' height='" + bannerHeight + "'>\n")
			flashBanner += ("			<param name='movie' value='" + newFlashVar + "' />\n")
			flashBanner += ("			<param name='quality' value='high' />\n")
			flashBanner += ("			<param name='wmode' value='transparent' />\n")
			flashBanner += ("			<embed id='flashVars2' src='" + newFlashVar + "' quality='high' wmode='transparent' pluginspage='http://..../index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' style='width: 800px; height: " + bannerHeight + "px;'></embed>\n")
			flashBanner += ("		</object>\n")
			flashBanner += ("	</div>\n");		
			flashBanner += ("</div>\n");				
		}break;
		case "noBanner": {
			var newFlashVar = "/flash2010/winterIntro.swf";		
			flashBanner =  ("<div style=\"width: 800px; height: 0px; background: #FFF; overflow: hidden; margin: 0 auto;\"></div>");		
		}break;
		case "newsStory": {
			var newFlashVar = "/flash2010/winterIntro.swf";		
			flashBanner =  ("<div style=\"width: 800px; height: 0px; background: #FFF; overflow: hidden; margin: 0 auto;\"></div>");		
		}break;
		case "index": {
			var newFlashVar = "/flash2010/interactive.swf";		
			flashBanner =  ("<div style='height: " + bannerHeight + "px; overflow: hidden; z-index: 5;'>\n");
			flashBanner += ("	<div id='flashBanner' style='height: " + bannerHeight + "px;'>\n");
			flashBanner += ("		<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://..../swflash.cab#version=9,0,0,0' width='800' height='" + bannerHeight + "'>\n")
			flashBanner += ("			<param name='movie' value='" + newFlashVar + "' />\n")
			flashBanner += ("			<param name='quality' value='high' />\n")
			flashBanner += ("			<param name='wmode' value='transparent' />\n")
			flashBanner += ("			<embed id='flashVars2' src='" + newFlashVar + "' quality='high' wmode='transparent' pluginspage='http://..../index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' style='width: 800px; height: " + bannerHeight + "px;'></embed>\n")
			flashBanner += ("		</object>\n")
			flashBanner += ("	</div>\n");		
			flashBanner += ("</div>\n");

		} break;
		case "index2":
			{
				var newFlashVar = "/flash2010/konami.swf";
				flashBanner = ("<div style='height: " + bannerHeight + "px; overflow: hidden; z-index: 5;'>\n");
				flashBanner += ("	<div id='flashBanner' style='height: " + bannerHeight + "px;'>\n");
				flashBanner += ("		<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://..../swflash.cab#version=9,0,0,0' width='800' height='" + bannerHeight + "'>\n")
				flashBanner += ("			<param name='movie' value='" + newFlashVar + "' />\n")
				flashBanner += ("			<param name='quality' value='high' />\n")
				flashBanner += ("			<param name='wmode' value='transparent' />\n")
				flashBanner += ("			<embed id='flashVars2' src='" + newFlashVar + "' quality='high' wmode='transparent' pluginspage='http://..../index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' style='width: 800px; height: " + bannerHeight + "px;'></embed>\n")
				flashBanner += ("		</object>\n")
				flashBanner += ("	</div>\n");
				flashBanner += ("</div>\n");
			} break;
	}
	return document.write(flashBanner);
}


// Places AddThis button if its not the 404 page
function getAddThis(){
	var addThis = "";
	
	if(bannerType == "noBanner"){
		addThis =  ("<div id=\"addThis\" style=\"dispaly: none;\">\n</div>");
	}
	else if(bannerType == "newsStory"){
		addThis =  ("<div id=\"addThis\">\n");
		addThis += ("	<a class=\"addthis_button\" href=\"http://addthis.com/bookmark.php?v=250&amp;pub=lycomingcollege\">\n");
		addThis += ("		<img style=\"float: right; margin-top: 7px; border:0\" src=\"http://s7.addthis.com/static/btn/sm-share-en.gif\" width=\"83\" height=\"16\" alt=\"Bookmark and Share\" />\n");
		addThis += ("	</a>\n");
		addThis += ("	<script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#pub=lycomingcollege\"></script>\n");
		addThis += ("</div>\n");
	}
	else if(bannerType == "index"){

		addThis = ("<style>#linkBar #breadCrumb{width: 290px;}</style>\n");
		addThis += ("<div id=\"icons\">\n");
		addThis += ("	<div id=\"facebookIcon\" title=\"Lycoming College on Facebook\">\n");
		addThis += ("		<a href=\"http://www.facebook.com/lycoming?v=app_4949752878\" target=\"_blank\"><img src=\"/images/iconFacebook.gif\" width=\"16px\" height=\"16px\" border=\"0\" /></a>\n");	
		addThis += ("	</div>\n");
		addThis += ("	<div id=\"calendarIcon\" title=\"Lycoming College Event Calendars\">\n");
		addThis += ("		<a href=\"/calendar/\"><img src=\"/images/iconCalendar.png\" width=\"16px\" height=\"16px\" border=\"0\" /></a>\n");	
		addThis += ("	</div>\n");
		addThis += ("	<div id=\"galleriesIcon\" title=\"Photo and Video Galleries\">\n");
		addThis += ("		<a href=\"/galleries/\"><img src=\"/images/iconGalleries.png\" width=\"16px\" height=\"16px\" border=\"0\" /></a>\n");	
		addThis += ("	</div>\n");
		addThis += ("	<div id=\"rssIcon\" title=\"Lycoming College RSS Feeds\">\n");
		addThis += ("		<a href=\"/rss/index.aspx\"><img src=\"/images/iconRSS.png\" width=\"16px\" height=\"16px\" border=\"0\" /></a>\n");	
		addThis += ("	</div>\n");
		addThis += ("	<div id=\"infoIcon\" title=\"Request Information\">\n");
		addThis += ("		<a href=\"/admissions/requestInfo.asp\"><img src=\"/images/iconInfo.png\" width=\"16px\" height=\"16px\" border=\"0\" /></a>\n");	
		addThis += ("	</div>\n");
		addThis += ("	<div id=\"iconSearch\" title=\"Search/Directories\">\n");
		addThis += ("		<a href=\"/search/\"><img src=\"/images/iconSearch.png\" width=\"16px\" height=\"16px\" border=\"0\" /></a>\n");	
		addThis += ("	</div>\n");
		addThis += ("	<div class=\"clear\"></div>\n");
		addThis += ("</div>\n");
		addThis += ("	<div id=\"addThis\" style=\"width: 83px;\">\n");
		addThis += ("		<a class=\"addthis_button\" href=\"http://addthis.com/bookmark.php?v=250&amp;pub=lycomingcollege\">\n");
		addThis += ("			<img style=\"float: right; margin-top: 7px; border:0\" src=\"http://s7.addthis.com/static/btn/sm-share-en.gif\" width=\"83\" height=\"16\" alt=\"Bookmark and Share\" />\n");
		addThis += ("		</a>\n");
		addThis += ("		<script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#pub=lycomingcollege\"></script>\n");
		addThis += ("	</div>\n");
		
	}else{
		addThis =  ("<div id=\"addThis\">\n");
		addThis += ("	<a class=\"addthis_button\" href=\"http://addthis.com/bookmark.php?v=250&amp;pub=lycomingcollege\">\n");
		addThis += ("		<img style=\"float: right; margin-top: 7px; border:0\" src=\"http://s7.addthis.com/static/btn/sm-share-en.gif\" width=\"83\" height=\"16\" alt=\"Bookmark and Share\" />\n");
		addThis += ("	</a>\n");
		addThis += ("	<script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#pub=lycomingcollege\"></script>\n");
		addThis += ("</div>\n");
	}

	return document.write(addThis);
}
 

//Used to control the 'Quick Links' drop-down menu
function quickLinks(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}



//Sorts vertical lists into multiple columns
jQuery.fn.makeacolumnlists = function(settings){
	settings = jQuery.extend({
		cols: 3,		// set number of columns
		colWidth: 0,		// set width for each column or leave 0 for auto width
		equalHeight: false, 	// can be false, 'ul', 'ol', 'li'
		startN: 1		// first number on your ordered list
	}, settings);
 
	if(jQuery('> li', this)) {
		this.each(function(y) {
			var y=jQuery('.li_container').size(),
		    	height = 0, 
		        maxHeight = 0,
				t = jQuery(this),
				classN = t.attr('class'),
				listsize = jQuery('> li', this).size(),
				percol = Math.ceil(listsize/settings.cols),
				contW = t.width(),
				bl = ( isNaN(parseInt(t.css('borderLeftWidth'),10)) ? 0 : parseInt(t.css('borderLeftWidth'),10) ),
				br = ( isNaN(parseInt(t.css('borderRightWidth'),10)) ? 0 : parseInt(t.css('borderRightWidth'),10) ),
				pl = parseInt(t.css('paddingLeft'),10),
				pr = parseInt(t.css('paddingRight'),10),
				ml = parseInt(t.css('marginLeft'),10),
				mr = parseInt(t.css('marginRight'),10),
				col_Width = Math.floor((contW - (settings.cols-1)*(bl+br+pl+pr+ml+mr))/settings.cols);
			if (settings.colWidth) {
				col_Width = settings.colWidth; 
			}
			var colnum=1,
				percol2=percol;
			jQuery(this).addClass('li_cont1').wrap('<div id="li_container' + (++y) + '" class="li_container"></div>');
			if (settings.equalHeight=='li') {
			    jQuery('> li', this).each(function() {
			        var e = jQuery(this);
			        var border_top = ( isNaN(parseInt(e.css('borderTopWidth'),10)) ? 0 : parseInt(e.css('borderTopWidth'),10) );
			        var border_bottom = ( isNaN(parseInt(e.css('borderBottomWidth'),10)) ? 0 : parseInt(e.css('borderBottomWidth'),10) );
			        height = e.height() + parseInt(e.css('paddingTop'), 10) + parseInt(e.css('paddingBottom'), 10) + border_top + border_bottom;
			        maxHeight = (height > maxHeight) ? height : maxHeight;
			    });
			}
			for (var i=0; i<=listsize; i++) {
				if(i>=percol2) { percol2+=percol; colnum++; }
				var eh = jQuery('> li:eq('+i+')',this);
				eh.addClass('li_col'+ colnum);
				if(jQuery(this).is('ol')){eh.attr('value', ''+(i+settings.startN))+'';}
				if (settings.equalHeight=='li') {
			        var border_top = ( isNaN(parseInt(eh.css('borderTopWidth'),10)) ? 0 : parseInt(eh.css('borderTopWidth'),10) );
			        var border_bottom = ( isNaN(parseInt(eh.css('borderBottomWidth'),10)) ? 0 : parseInt(eh.css('borderBottomWidth'),10) );
					mh = maxHeight - (parseInt(eh.css('paddingTop'), 10) + parseInt(eh.css('paddingBottom'), 10) + border_top + border_bottom );
			        eh.height(mh);
				}
			}
			jQuery(this).css({cssFloat:'left', width:''+col_Width+'px'});
			for (colnum=2; colnum<=settings.cols; colnum++) {
				if(jQuery(this).is('ol')) {
					jQuery('li.li_col'+ colnum, this).appendTo('#li_container' + y).wrapAll('<ol class="li_cont'+colnum +' ' + classN + '" style="float:left; width: '+col_Width+'px;"></ol>');
				} else {
					jQuery('li.li_col'+ colnum, this).appendTo('#li_container' + y).wrapAll('<ul class="li_cont'+colnum +' ' + classN + '" style="float:left; width: '+col_Width+'px;"></ul>');
				}
			}
			if (settings.equalHeight=='ul' || settings.equalHeight=='ol') {
				for (colnum=1; colnum<=settings.cols; colnum++) {
				    jQuery('#li_container'+ y +' .li_cont'+colnum).each(function() {
				        var e = jQuery(this);
				        var border_top = ( isNaN(parseInt(e.css('borderTopWidth'),10)) ? 0 : parseInt(e.css('borderTopWidth'),10) );
				        var border_bottom = ( isNaN(parseInt(e.css('borderBottomWidth'),10)) ? 0 : parseInt(e.css('borderBottomWidth'),10) );
				        height = e.height() + parseInt(e.css('paddingTop'), 10) + parseInt(e.css('paddingBottom'), 10) + border_top + border_bottom;
				        maxHeight = (height > maxHeight) ? height : maxHeight;
				    });
				}
				for (colnum=1; colnum<=settings.cols; colnum++) {
					var eh = jQuery('#li_container'+ y +' .li_cont'+colnum);
			        var border_top = ( isNaN(parseInt(eh.css('borderTopWidth'),10)) ? 0 : parseInt(eh.css('borderTopWidth'),10) );
			        var border_bottom = ( isNaN(parseInt(eh.css('borderBottomWidth'),10)) ? 0 : parseInt(eh.css('borderBottomWidth'),10) );
					mh = maxHeight - (parseInt(eh.css('paddingTop'), 10) + parseInt(eh.css('paddingBottom'), 10) + border_top + border_bottom );
			        eh.height(mh);
				}
			}
		    jQuery('#li_container' + y).append('<div style="clear:both; overflow:hidden; height:0px;"></div>');
		});
	}
}
 
jQuery.fn.uncolumnlists = function(){
	jQuery('.li_cont1').each(function(i) {
		var onecolSize = jQuery('#li_container' + (++i) + ' .li_cont1 > li').size();
		if(jQuery('#li_container' + i + ' .li_cont1').is('ul')) {
			jQuery('#li_container' + i + ' > ul > li').appendTo('#li_container' + i + ' ul:first');
			for (var j=1; j<=onecolSize; j++) {
				jQuery('#li_container' + i + ' ul:first li').removeAttr('class').removeAttr('style');
			}
			jQuery('#li_container' + i + ' ul:first').removeAttr('style').removeClass('li_cont1').insertBefore('#li_container' + i);
		} else {
			jQuery('#li_container' + i + ' > ol > li').appendTo('#li_container' + i + ' ol:first');
			for (var j=1; j<=onecolSize; j++) {
				jQuery('#li_container' + i + ' ol:first li').removeAttr('class').removeAttr('style');
			}
			jQuery('#li_container' + i + ' ol:first').removeAttr('style').removeClass('li_cont1').insertBefore('#li_container' + i);
		}
		jQuery('#li_container' + i).remove();
	});
}





// Fade from yellow to white on FAQs
var FadeSteps = new Array();
	FadeSteps[1] = "FFFFFF";
	FadeSteps[2] = "FFFFEE";
	FadeSteps[3] = "FFFFDD";
	FadeSteps[4] = "FFFFCC";
	FadeSteps[5] = "FFFFBB";
	FadeSteps[6] = "FFFFAA";
	FadeSteps[7] = "FFFF99";
	FadeSteps[8] = "FFFF88";
	FadeSteps[9] = "FFFF77";
	FadeSteps[10] = "FFFF66";
function doFade(colorId, targetId) {
    if (colorId >= 1) {
		document.getElementById(targetId).style.backgroundColor = "#" + FadeSteps[colorId];
        if (colorId==1) {
            document.getElementById(targetId).style.backgroundColor = "transparent";
		}
        colorId--;
        setTimeout("doFade("+colorId+",'"+targetId+"')", 100);
	}
}
