	var rhythmplayer;
	var sevIndex = 0;
	var sevImages;
	var sevThumbs;
	var alfondIndex = 0;
	var alfondImages;
	var alfondThumbs;
	var alfondImgHeight;
	var snippetMovieLeft = 0;
	var videoSnippetArray = [];
	var currentDefinitionShowing = "";
	
	$(document).ready(function() {
		$("#browserSpecsContainer").fadeIn('slow');
		$("a#closeBrowserSpecs").click(function() {
			$("#browserSpecsContainer").fadeOut();
			return false;
		});
		
		//*************************************************
		// for cgh slide shows
		//*************************************************
		$("#myController").jFlow({
			slides: "#slides",  // the div where all your sliding divs are nested in
			controller: ".jFlowControl", // must be class, use . sign
			slideWrapper : "#jFlowSlide", // must be id, use ## sign
			selectedWrapper: "jFlowSelected",  // just pure text, no sign
			width: "436px",  // this is the width for the content-slider
			height: "235px",  // this is the height for the content-slider
			duration: 400,  // time in miliseconds to transition one slide
			auto: false,
			prev: ".jFlowPrev", // must be class, use . sign
			next: ".jFlowNext" // must be class, use . sign
		});
		
		//*************************************************
		// for table row
		//*************************************************
		$(".withborder tr:not(\'.header\'):not(\'.subheader\'):not(\'.tertheader\'):not(\'.headerLive\'):not(\'.nonHeaderLive\'):even").addClass("odd");
		$(".withborder tr:not(\'.header\'):not(\'.subheader\'):not(\'.tertheader\'):not(\'.headerLive\'):not(\'.nonHeaderLive\'):odd").addClass("even");
		
		//*************************************************
		// For Seville Rotation - /global/ed/seville/
		//*************************************************	
		if ($("#sevilleSSImages").length != 0) { 
			sevImages = $("#sevilleSSImages img");
			sevThumbs = $("#sevilleSSThumbnails img");
			for (var j = 0; j < sevThumbs.length; j++) {
				$(sevThumbs[j]).addClass("sevthumb-" + j);
				$(sevImages[j]).addClass("sevimage-" + j);
			}
			showSeville(sevIndex);
			setInterval("sevSift();", 6000);
		}
		
		//*************************************************
		// For Alfond Image Rotation - /giving/alfond/
		//*************************************************
		if ($("#alfondSSImages").length != 0) {
			alfondImages = $("#alfondSSImages img");
			alfondThumbs = $("#alfondSSThumbnails img");
			alfondImgHeight = $(alfondThumbs).attr("height");
			$(alfondThumbs).slice(0,4).clone().appendTo("#alfondSSThumbnails");
			for (var i = 0; i < alfondThumbs.length; i++) {
				$(alfondThumbs[i]).addClass("thumb-" + i);
				$(alfondImages[i]).addClass("image-" + i);
			}
			showAlfond(alfondIndex);
			setInterval("siftAlfond();", 6000);
		}
		
		//*************************************************
		//for Virtual Tour homepage
		//*************************************************
		$("#vtWalking a.portland").hover(function() {
			$("#vtWalking .vtTopImage").addClass("portland");
			$("#vtWalking .vtTopNav a").removeClass("active");
			return false;
		}, function() {
			$("#vtWalking .vtTopImage").removeClass("portland");
			$("#vtWalking .vtTopNav a.biddeford").addClass("active");
			return false;
		});
		
		$("#vtOverview a.portland").hover(function() {
			$("#vtOverview .vtTopImage").addClass("portland");
			$("#vtOverview .vtTopNav a").removeClass("active");
			return false;
		}, function() {
			$("#vtOverview .vtTopImage").removeClass("portland");
			$("#vtOverview .vtTopNav a.biddeford").addClass("active");
			return false;
		});
	
		$(".revealContent").hide();
		$(".revealLink").click(function() { $(".revealContent").show();	});
		
		$(".hideParentStopMovie").click(function() {
			$(this).parent("div").hide();
			$(this).parent("div").prev("div").fadeIn('slow');
			if (rhythmplayer) { rhythmplayer.sendEvent("stop"); }
		});
		
		$(".hideParentStopMovie").hover(function() { $("body").css("cursor", "pointer"); }, function() {	$("body").css("cursor", "auto"); });
		
		//*************************************************
		// Specific to - /research/msc/marc/
		//*************************************************
		$("#rhythms-video").hide();
		$(".rhythms-content-link").click(function() {
			$("#rhythms-content").hide();
			$("#rhythms-video").fadeIn('slow');
			if (navigator.appVersion.indexOf("MSIE") != -1) { rhythmplayer.sendEvent("play"); }
			return false;
		});
		
		//*************************************************
		// definition wigit
		//*************************************************
		if ($("span.word-definition").length != 0) {
			var spanCount = 0;
			$("span.word-definition").each(function(){
				var spanWord = "", spanDefinition = "";
				spanCount++;
				$(this).find("span").each(function(){
					var spanClass =  $(this).attr('class');
					if (spanClass == 'word-to-define') {spanWord = $(this).text();$(this).attr('id','word'+spanCount);}
					else if (spanClass == 'actual-definition') {spanDefinition = $(this).text();$(this).attr('id','definition'+spanCount);}
				});
				if (spanWord != "" && spanDefinition != "") {
					$("#word"+spanCount).html($("#word"+spanCount).html()+'<span style="vertical-align:super;font-size:10px;color:#0096D6;">(?)</span>');
					$("#definition"+spanCount).replaceWith('<div class="actual-definition" id="definition'+spanCount+'"><div id="arrow"><!-- --></div>' + $("#definition"+spanCount).html() + '</div>')
					var topDiff = $(this).height() * 2.4;
					$("#definition"+spanCount).css({'top':'-'+topDiff+'px'});
					$("#word"+spanCount).click(function(){
						var spanID = "", continueShowingDefinition = true;
						$(this).parent().find("div").each(function(){
							if ($(this).attr('class') == 'actual-definition') {
								spanID = $(this).attr('id');
								if (currentDefinitionShowing == spanID) { 
									$("#"+spanID).fadeOut('fast');
									currentDefinitionShowing="";
								} else { 
									if (currentDefinitionShowing != "") {
										$("#"+currentDefinitionShowing).fadeOut('fast');
									}
									currentDefinitionShowing = spanID;
									$("#"+spanID).fadeIn('fast');
									$("#"+spanID).click(function(){
										$("#"+spanID).fadeOut('fast');
										currentDefinitionShowing="";
									});
								}
							}
						});
					});
				} else if (spanWord != "") {$(this).html(spanWord);}
				else {$(this).hide();}
			});
		}
		
		//*************************************************
		// Meter bar snippet
		//*************************************************
		if ($(".meter-bar").length != 0) {
			var floatRow = $(".meter-bar table tr.float-direction td:nth-child(2)").text();
			var goalRow = $(".meter-bar table tr.goal-count td:nth-child(2)").text();
			var countRow = $(".meter-bar table tr.current-count td:nth-child(2)").text();
			var increment = $(".meter-bar table tr.increment td:nth-child(2)").text();
			increment*=1;
			if (floatRow != '' && goalRow != '' && countRow != '') {
				$(".meter-bar").html('<div class="label">Goal Meter</div><div class="meter-bar-container"><div class="meter-bar-legend"><!-- --></div><div class="meter-bar-overlay"><div class="meter-bar-overlay-image"><!-- --></div><div class="meter-bar-overlay-bg"><!-- --></div></div><div class="clear-all"><!-- --></div></div>');
				//var mbHeight = $(".meter-bar").height(); // actual height of image
				var mbHeight = 291; // actual height of image
				var pixelPerPercent = (mbHeight / 100); // pixels for each percent
				var currPercent = Math.round((countRow/goalRow) * 100); // gets current percent 
				if (currPercent >= 100) { var currPixels = mbHeight; }
				else {var currPixels = Math.round(currPercent * pixelPerPercent) + 1;}
				if (floatRow.toLowerCase() == 'right') {$(".meter-bar").css({'float':'right'});}
				else if (floatRow.toLowerCase() == 'left') {$(".meter-bar").css({'float':'left'});}
				var incCount = 0;
				for (var i = increment; i <= goalRow; i += increment) {
					incCount++;
					$(".meter-bar .meter-bar-container .meter-bar-legend").html('<div class="marker" id="marker-' + incCount + '">' + i + '</div>' + $(".meter-bar .meter-bar-container .meter-bar-legend").html());
					var topSpot = Math.round(mbHeight - (Math.round((i/goalRow) * 100) * pixelPerPercent)) - 1;
					$(".meter-bar .meter-bar-container .meter-bar-legend #marker-" + incCount).css({'top':topSpot,'left':'0'});
				}
				$(".meter-bar .meter-bar-container .meter-bar-overlay-bg").animate({top:'+='+mbHeight,left:'0'},0);
				$(".meter-bar").fadeIn('slow');
				$(".meter-bar .meter-bar-container .meter-bar-overlay-bg").animate({top:'-='+currPixels,left:'0'},1000);
			} else {
				$(".meter-bar").hide();
			}
		}
		
		//*************************************************
		// Video Snippet's included on the page...
		//*************************************************
		if ($(".video-snippets").length != 0) {
			// BEGIN load jquery scrollto library
			var head = document.getElementsByTagName('head')[0];
			var script = document.createElement('script');
			script.type = 'text/javascript';
			script.src = '/lib/mobile/jquery.scrollTo-min.js';
			head.appendChild(script);
			// END load jquery scrollto library
			var videos = [];
			var videoCount = 0;
			var currentPage = 1;
			maxPages = 1;
			videos[videoCount] = []; 
			var activeCell = false;
			var scrollWidth = 198;
			var rows = $(".video-snippets table tr:gt(0)");
			// load images into the videos array
			rows.each(function(index) {
				$(this).children("td").each(function() {
					var id =  $(this).attr('id');
					if (id == 'sv-label') {
						var label = $(this).eq(0).text();
						if (label.substr(0,6) != '{label') { activeCell = true; }
						videos[videoCount]['label'] = label;
					} else if (id == 'sv-image') {
						videos[videoCount]['image'] = $(this).find('img').attr('src');
					} else if (id == 'sv-video') {
						var tempvideo = $(this).find('a').attr('href');
						tempvideo = tempvideo.split("/");
						videos[videoCount]['video'] = tempvideo[tempvideo.length-1];
					}
				});
				if (activeCell) { videoCount++; videos[videoCount] = []; }
				activeCell = false;
			});
			// loop through video's if they exist
			if (videoCount > 0) {
				var display = "";
				if (videoCount == 1) { // only one video
					display += '<hr/>';
					display += '<div id="video-snippet-dropdown">&nbsp;</div>';
					display += '<div id="video-snippet-container"><a href="javascript:;" onclick="javascript:snippetSelectMovie(\'' + videos[0]['video'] + '\',\'1\',\'' + videos[0]['image'] + '\');"><span class="play188"><!-- &nbsp; --></span><img src="' + videos[0]['image'] + '" alt="' + videos[0]['label'] + '" title="' + videos[0]['label'] + '" width="188" height="104" /></a><br/><strong>' + videos[0]['label'] + '</strong></div>';
					$(".video-snippets").css({'float':'right','width':'198px','padding':'0','margin':'0'});
					$(".video-snippets").slideUp('fast',function() {
						$(".video-snippets").html(display);
						$("#video-snippet-dropdown").css({'position':'relative','top':'0','right':'0','padding':'0','margin':'0','width':'0','height':'0'});
						$("#video-snippet-container").css({'padding':'0 5px 5px 5px','text-align':'center'});
						$("#video-snippet-container").css({"line-height":"25px"});
						$(".video-snippets").css({'margin':'0 0 0 20px'});
						$(".video-snippets").slideDown('slow');	
					});
				} else { // multiple video's
					maxPages = videoCount-1;
					display += '<hr/>';
					display += '<div id="video-snippet-dropdown">&nbsp;</div>';
					display += '<div id="video-snippet-container">';
					display += '	<div id="left-video-snippet-button"><div class="snippet-button"><span><</span></div></div>';
					display += '	<div id="video-snippet-sliders">';
					display += '		<ul>';
					for (var i = 0; i < videoCount; i++) {
						display += '			<li><a href="javascript:;" onclick="javascript:snippetSelectMovie(\'' + videos[i]['video'] + '\',\'2\',\''+ videos[i]['image'] + '\');"><span class="play188"><!-- &nbsp; --></span><img src="' + videos[i]['image'] + '" alt="' + videos[i]['label'] + '" title="' + videos[i]['label'] + '" width="188" height="104" /></a><br/><strong>' + videos[i]['label'] + '</strong></li>';
					}
					display += '		</ul>';
					display += '	</div>';
					display += '	<div id="right-video-snippet-button"><div class="snippet-button"><span>></span></div></div>';
					display += '	<div style="position:relative;width:100%;height:0;visibility:hidden;clear:both;margin:0;padding:0;"><!-- --></div>';
					display += '</div>';
					display += '<div style="position:relative;width:100%;height:0;visibility:hidden;clear:both;margin:0;padding:0;"><!-- --></div>';
					$(".video-snippets").html(display);
					$(".video-snippets").slideUp('fast');
					$("#left-video-snippet-button .snippet-button").hide();
					if (videoCount == 2) { $("#right-video-snippet-button .snippet-button").hide(); }
					$("#video-snippet-dropdown").hide();
					$("#video-snippet-dropdown").slideUp('fast', function() { $(".video-snippets").slideDown('slow'); });
				}
				$("#left-video-snippet-button").click(function() {
					if (currentPage > 1 && videoCount != 2) {
						currentPage--;
						if (currentPage == 1) { $("#left-video-snippet-button .snippet-button").hide(); }
						else { $("#left-video-snippet-button .snippet-button").show(); }
						if (currentPage < maxPages) { $("#right-video-snippet-button .snippet-button").show(); }
						var currentLeftPos = (scrollWidth * currentPage) - scrollWidth;
						$("#video-snippet-sliders").scrollTo({top:0,left:currentLeftPos},500);
						snippetMovieLeft = currentLeftPos;
					}
				});
				$("#right-video-snippet-button").click(function() {
					if (currentPage < maxPages && videoCount != 2) {
						currentPage++;
						if (currentPage > 1) { $("#left-video-snippet-button .snippet-button").show(); }
						if (currentPage == maxPages) { $("#right-video-snippet-button .snippet-button").hide(); }
						else { $("#right-video-snippet-button .snippet-button").show(); }
						var currentLeftPos = (scrollWidth * currentPage) - scrollWidth;
						$("#video-snippet-sliders").scrollTo({top:0,left:currentLeftPos},500);
						snippetMovieLeft = currentLeftPos;
					}
				});
			}
		}
		
		
		//****************************************************
		// Video Snippet's included on the page... (VERSION 2)
		//****************************************************
		if ($(".video-snippets-new").length != 0) {
			var videoSnippetCounter = 0;
			// BEGIN load jquery scrollto library
			var head = document.getElementsByTagName('head')[0];
			var script = document.createElement('script');
			script.type = 'text/javascript';
			script.src = '/lib/mobile/jquery.scrollTo-min.js';
			head.appendChild(script);
			// END load jquery scrollto library
			
			var activeCell = false;
			$(".video-snippets-new").each(function(){
				var snippetID = "snippet"+videoSnippetCounter;
				$(this).attr("id",snippetID);
				videoSnippetArray[snippetID] = [];
				videoSnippetArray[snippetID]["videoCount"] = 0;
				videoSnippetArray[snippetID]["currentPage"] = 1;
				videoSnippetArray[snippetID]["maxPages"] = 1;
				videoSnippetArray[snippetID]["videos"] = [];
				videoSnippetArray[snippetID]["videos"][videoSnippetArray[snippetID]["videoCount"]] = [];
				videoSnippetArray[snippetID]["snippetMovieLeft"] = 0;
				var rows = $("#"+snippetID+" table tr:gt(0)");
				rows.each(function(index) {
					$(this).children("td").each(function() {
						var id =  $(this).attr('id');
						if (id == 'sv-label') {
							var label = $(this).eq(0).text();
							if (label.substr(0,6) != '{label') { activeCell = true; }
							videoSnippetArray[snippetID]["videos"][videoSnippetArray[snippetID]["videoCount"]]['label'] = label;
						} else if (id == 'sv-image') {
							videoSnippetArray[snippetID]["videos"][videoSnippetArray[snippetID]["videoCount"]]['image'] = $(this).find('img').attr('src');
						} else if (id == 'sv-video') {
							var tempvideo = $(this).find('a').attr('href');
							tempvideo = tempvideo.split("/");
							videoSnippetArray[snippetID]["videos"][videoSnippetArray[snippetID]["videoCount"]]['video'] = tempvideo[tempvideo.length-1];
						}
					});
					if (activeCell) { videoSnippetArray[snippetID]["videoCount"]++; videoSnippetArray[snippetID]["videos"][videoSnippetArray[snippetID]["videoCount"]] = []; }
					activeCell = false;
				});
				// loop through video's if they exist
				if (videoSnippetArray[snippetID]["videoCount"] > 0) {
					var display = "";
					if (videoSnippetArray[snippetID]["videoCount"] == 1) { // only one video
						display += '<hr/>';
						display += '<div id="vsd-'+snippetID+'" class="video-snippet-dropdown">&nbsp;</div>';
						display += '<div id="vsc-'+snippetID+'" class="video-snippet-container"><a href="javascript:;" onclick="javascript:snippetSelectMovie2(\''+snippetID+'\',\'' + videoSnippetArray[snippetID]["videos"][0]['video'] + '\',\'1\',\'' + videoSnippetArray[snippetID]["videos"][0]['image'] + '\');"><span class="play188"><!-- &nbsp; --></span><img src="' + videoSnippetArray[snippetID]["videos"][0]['image'] + '" alt="' + videoSnippetArray[snippetID]["videos"][0]['label'] + '" title="' + videoSnippetArray[snippetID]["videos"][0]['label'] + '" width="188" height="104" /></a><br/><strong>' + videoSnippetArray[snippetID]["videos"][0]['label'] + '</strong></div>';
						$("#"+snippetID).css({'float':'right','width':'198px','padding':'0','margin':'0'});
						$("#"+snippetID).slideUp('fast',function() {
							$("#"+snippetID).html(display);
							$("#vsd-"+snippetID+".video-snippet-dropdown").css({'position':'relative','top':'0','right':'0','padding':'0','margin':'0','width':'0','height':'0'});
							$("#vsc-"+snippetID+".video-snippet-container").css({'padding':'0 5px 5px 5px','text-align':'center'});
							$("#vsc-"+snippetID+".video-snippet-container").css({"line-height":"25px"});
							$("#"+snippetID).css({'margin':'0 0 0 20px'});
							$("#"+snippetID).slideDown('slow');	
						});
					} else { // multiple video's
						videoSnippetArray[snippetID]["maxPages"] = videoSnippetArray[snippetID]["videoCount"]-1;
						display += '<hr/>';
						display += '<div id="vsd-'+snippetID+'" class="video-snippet-dropdown">&nbsp;</div>';
						display += '<div id="vsc-'+snippetID+'" class="video-snippet-container">';
						display += '	<div class="left-video-snippet-button" onclick="javascript:forceScrollLeft(\''+snippetID+'\');"><div class="snippet-button"><span><</span></div></div>';
						display += '	<div class="video-snippet-sliders">';
						display += '		<ul>';
						for (var i = 0; i < videoSnippetArray[snippetID]["videoCount"]; i++) {
							display += '			<li><a href="javascript:;" onclick="javascript:snippetSelectMovie2(\''+snippetID+'\',\'' + videoSnippetArray[snippetID]["videos"][i]['video'] + '\',\'2\',\''+ videoSnippetArray[snippetID]["videos"][i]['image'] + '\');"><span class="play188"><!-- &nbsp; --></span><img src="' + videoSnippetArray[snippetID]["videos"][i]['image'] + '" alt="' + videoSnippetArray[snippetID]["videos"][i]['label'] + '" title="' + videoSnippetArray[snippetID]["videos"][i]['label'] + '" width="188" height="104" /></a><br/><strong>' + videoSnippetArray[snippetID]["videos"][i]['label'] + '</strong></li>';
						}
						display += '		</ul>';
						display += '	</div>';
						display += '	<div class="right-video-snippet-button" onclick="javascript:forceScrollRight(\''+snippetID+'\');"><div class="snippet-button"><span>></span></div></div>';
						display += '	<div style="position:relative;width:100%;height:0;visibility:hidden;clear:both;margin:0;padding:0;"><!-- --></div>';
						display += '</div>';
						display += '<div style="position:relative;width:100%;height:0;visibility:hidden;clear:both;margin:0;padding:0;"><!-- --></div>';
						$("#"+snippetID).html(display);
						$("#"+snippetID).slideUp('fast');
						$("#vsc-"+snippetID+" .left-video-snippet-button .snippet-button").hide();
						if (videoSnippetArray[snippetID]["videoCount"] == 2) { $(".right-video-snippet-button .snippet-button").hide(); }
						$("#vsd-"+snippetID+".video-snippet-dropdown").hide();
						$("#vsd-"+snippetID+".video-snippet-dropdown").slideUp('fast', function() { $("#"+snippetID).slideDown('slow'); });
					}
				}
				videoSnippetCounter++;
			});
		}
	}); // --> END $(document).ready
	
	function doScroll(divID,currentLeftPos) {
		$(".video-snippets-new #vsc-"+divID+".video-snippet-container .video-snippet-sliders").scrollTo({top:0,left:currentLeftPos},500);
	}
	
	function forceScrollLeft(snID) {
		if (videoSnippetArray[snID]["currentPage"] > 1 && videoSnippetArray[snID]["videoCount"] != 2) {
			videoSnippetArray[snID]["currentPage"]--;
			if (videoSnippetArray[snID]["currentPage"] == 1) { $("#vsc-"+snID+".video-snippet-container .left-video-snippet-button .snippet-button").hide(); }
			else { $("#vsc-"+snID+".video-snippet-container .left-video-snippet-button .snippet-button").show(); }
			if (videoSnippetArray[snID]["currentPage"] < videoSnippetArray[snID]["maxPages"]) { $("#vsc-"+snID+".video-snippet-container .right-video-snippet-button .snippet-button").show(); }
			var currentLeftPos = (198 * videoSnippetArray[snID]["currentPage"]) - 198;
			$(".video-snippets-new #vsc-"+snID+".video-snippet-container .video-snippet-sliders").scrollTo({top:0,left:currentLeftPos},500);
			$.scrollTo( '#target-examples', 800, {easing:'elasout'} );
			videoSnippetArray[snID]["snippetMovieLeft"] = currentLeftPos;
		}
	}	

	function forceScrollRight(snID) {
		if (videoSnippetArray[snID]["currentPage"] < videoSnippetArray[snID]["maxPages"] && videoSnippetArray[snID]["videoCount"] != 2) {
			$(".video-snippets-new #vsc-"+snID+".video-snippet-container .video-snippet-sliders").width('386');
			videoSnippetArray[snID]["currentPage"]++;
			if (videoSnippetArray[snID]["currentPage"] > 1) { $("#vsc-"+snID+".video-snippet-container .left-video-snippet-button .snippet-button").show(); }
			if (videoSnippetArray[snID]["currentPage"] == videoSnippetArray[snID]["maxPages"]) { $("#vsc-"+snID+".video-snippet-container .right-video-snippet-button .snippet-button").hide(); }
			else { $("#vsc-"+snID+".video-snippet-container .right-video-snippet-button .snippet-button").show(); }
			var currentLeftPos = (198 * videoSnippetArray[snID]["currentPage"]) - 198;
			$(".video-snippets-new #vsc-"+snID+".video-snippet-container .video-snippet-sliders").scrollTo({top:0,left:currentLeftPos},500);
			videoSnippetArray[snID]["snippetMovieLeft"] = currentLeftPos;
		}
	}

	function snippetVideosForceLeftClick() {
		$("#left-video-snippet-button").trigger('click');
	}
	
	function snippetVideosForceRightClick() {
		$("#right-video-snippet-button").trigger('click');
	}

	function snippetShutdownMovie(isMult) {
		if (isMult == 1) {
			$(".video-snippets").animate({width:'198px'},500);
			$("#video-snippet-container").css({"line-height":"25px"});
			$(".video-snippets").css({'margin':'0 0 0 20px'});
			$("#video-snippet-dropdown").animate({width:'0',height:'0'},500);
			$("#video-snippet-dropdown").slideUp('slow',function() {
				$("#video-snippet-dropdown").html("");
			});
			$("#video-snippet-container").slideDown('slow');
		} else {
			$("#video-snippet-dropdown").slideUp('slow',function() {
				$("#video-snippet-dropdown").html("");
			});
			$("#video-snippet-container").slideDown('slow');
			$("#video-snippet-sliders").scrollTo({top:0,left:snippetMovieLeft},0);
		}
	}
	
	function snippetShutdownMovie2(snipID, isMult) {
		if (isMult == 1) {
			$("#"+snipID).animate({width:'198px'},500);
			$("#vsc-"+snipID+".video-snippet-container").css({"line-height":"25px"});
			$("#"+snipID).css({'margin':'0 0 0 20px'});
			$("#vsd-"+snipID+".video-snippet-dropdown").animate({width:'0',height:'0'},500);
			$("#vsd-"+snipID+".video-snippet-dropdown").slideUp('slow',function() {
				$("#vsd-"+snipID+".video-snippet-dropdown").html("");
			});
			$("#vsc-"+snipID+".video-snippet-container").slideDown('slow');
		} else {
			$("#vsd-"+snipID+".video-snippet-dropdown").slideUp('slow',function() {
				$("#vsd-"+snipID+".video-snippet-dropdown").html("");
			});
			$("#vsc-"+snipID+".video-snippet-container").slideDown('slow');
			$("#"+snipID+" .video-snippet-sliders").scrollTo({top:0,left:videoSnippetArray[snipID]["snippetMovieLeft"]},0);
		}
	}
	
	function snippetSelectMovie(which,isMult,img) {
		//android = (/android/i.test(navigator.userAgent.toLowerCase()));
	    apple = (/iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase()));
	    var display = "";
		if (apple) {
			display += '<div class="hideParentStopMovie" style="text-align:right;" onclick="javascript:snippetShutdownMovie(\'' + isMult + '\');">X Close</div>';
			display += '<video src="http://stream.une.edu/hosted/majors/' + which + '" width="436" height="278" preload="none" controls="controls" poster="' + img + '"></video>';
		} else {
			display += '<div class="hideParentStopMovie" style="text-align:right;" onclick="javascript:snippetShutdownMovie(\'' + isMult + '\');">X Close</div>';
			display += '<div id="preview">This video requires the latest version of Flash Player</div>';
			display += '<script type="text/javascript" src="/shadowbox/libraries/mediaplayer/swfobject.js"></script>';
			display += '<script type="text/javascript">';
			display += '	var s1 = new SWFObject("/shadowbox/libraries/mediaplayer/player.swf","rhythmsplayer","436","278","9");';
			display += '	s1.addParam("allowfullscreen","true");';
			display += '	s1.addParam("allowscriptaccess","always");';
			display += '	s1.addParam("wmode","opaque");';
			display += '	s1.addParam("flashvars","streamer=rtmp://stream.une.edu/hosted&file=mp4:hosted/majors/' + which + '&image=&skin=/shadowbox/libraries/mediaplayer/modieus.swf&lightcolor=##005596");';
			display += '	s1.write("preview");';
			display += '</script>';
		}
		if (isMult == 1) {
			$("#video-snippet-dropdown").html(display);
			$("#video-snippet-container").css({"line-height":"0"});
			$(".video-snippets").css({'margin':'0'});
			$("#video-snippet-container").slideUp('fast');
			$(".video-snippets").animate({width:'436px'},1000);
			$("#video-snippet-dropdown").animate({width:'436px',height:'319px'},1000,function(){ //359px
				if (navigator.appVersion.indexOf("MSIE") != -1) { playerReady(); rhythmplayer.sendEvent("play"); }
			});
		} else {
			$("#video-snippet-dropdown").html(display);
			$("#video-snippet-container").slideUp('fast');
			$("#video-snippet-dropdown").slideDown('slow',function(){
				if (navigator.appVersion.indexOf("MSIE") != -1) { playerReady(); rhythmplayer.sendEvent("play"); }
			});
		}
		$(".hideParentStopMovie").css({"background-color":"#FFFFFF","cursor":"pointer"});
	}
	
	function snippetSelectMovie2(snipID, which,isMult,img) {
		//android = (/android/i.test(navigator.userAgent.toLowerCase()));
	    apple = (/iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase()));
	    var display = "";
		if (apple) {
			display += '<div class="hideParentStopMovie" style="text-align:right;" onclick="javascript:snippetShutdownMovie2(\''+snipID+'\',\'' + isMult + '\');">X Close</div>';
			display += '<video src="http://stream.une.edu/hosted/majors/' + which + '" width="436" height="278" preload="none" controls="controls" poster="' + img + '"></video>';
		} else {
			display += '<div class="hideParentStopMovie" style="text-align:right;" onclick="javascript:snippetShutdownMovie2(\''+snipID+'\',\'' + isMult + '\');">X Close</div>';
			display += '<div id="preview'+snipID+'">This video requires the latest version of Flash Player</div>';
			display += '<script type="text/javascript" src="/shadowbox/libraries/mediaplayer/swfobject.js"></script>';
			display += '<script type="text/javascript">';
			display += '	var s1 = new SWFObject("/shadowbox/libraries/mediaplayer/player.swf","vplayer-'+snipID+'","436","278","9");';
			display += '	s1.addParam("allowfullscreen","true");';
			display += '	s1.addParam("allowscriptaccess","always");';
			display += '	s1.addParam("wmode","opaque");';
			display += '	s1.addParam("flashvars","streamer=rtmp://stream.une.edu/hosted&file=mp4:hosted/majors/' + which + '&image=&skin=/shadowbox/libraries/mediaplayer/modieus.swf&lightcolor=##005596");';
			display += '	s1.write("preview'+snipID+'");';
			display += '</script>';
		}
		if (isMult == 1) {
			$("#vsd-"+snipID+".video-snippet-dropdown").html(display);
			$("#vsc-"+snipID+".video-snippet-container").css({"line-height":"0"});
			$("#"+snipID).css({'margin':'0'});
			$("#vsc-"+snipID+".video-snippet-container").slideUp('fast');
			$("#"+snipID).animate({width:'436px'},1000);
			$("#vsd-"+snipID+".video-snippet-dropdown").animate({width:'436px',height:'319px'},1000,function(){
				//if (navigator.appVersion.indexOf("MSIE") != -1) {
					playerReady();
					var currPlayer = document.getElementById('vplayer-'+snipID);
					currPlayer.sendEvent("play");
				//}
			});
		} else {
			$("#vsd-"+snipID+".video-snippet-dropdown").html(display);
			$("#vsc-"+snipID+".video-snippet-container").slideUp('fast');
			$("#vsd-"+snipID+".video-snippet-dropdown").slideDown('slow',function(){
				//if (navigator.appVersion.indexOf("MSIE") != -1) {
					playerReady();
					var currPlayer = document.getElementById('vplayer-'+snipID);
					currPlayer.sendEvent("play");
				//}
			});
		}
		$("#"+snipID+" .hideParentStopMovie").css({"background-color":"#FFFFFF","cursor":"pointer"});
	}

	// JW Player Required Function
	function playerReady(object) {
		if (document.getElementById("rhythmsplayer")) {
			rhythmplayer = document.getElementById("rhythmsplayer");
			if (navigator.appVersion.indexOf("MSIE") == -1 && object.id == 'rhythmsplayer') { rhythmplayer.sendEvent("play"); }
		}
	}
	
	function sevSift() {
		if (sevIndex < (sevThumbs.length-1)) { sevIndex += 1; }
		else { sevIndex = 0; }
		showSeville(sevIndex);
	}
	
	function showSeville(sevnum) {
		$(sevImages).fadeOut(400);
		$(".sevimage-"+sevnum).stop().fadeIn(400);
		$(sevThumbs).fadeTo(400,0.5);
		$(".sevthumb-"+sevnum).stop().fadeTo(400,1.0);
	}
	
	function siftAlfond() {
		if (alfondIndex < (alfondThumbs.length-1)) { alfondIndex += 1; }
		else { alfondIndex = 0; }
		showAlfond(alfondIndex);
	}
	
	function showAlfond(num) {
		$(alfondImages).fadeOut(400);
		$(".image-" + num).stop().fadeIn(400);
		var scrollPos = (num + 1) * alfondImgHeight;
		$("#alfondSSThumbnails").stop().animate({scrollTop: scrollPos}, 400);
	}
	
	// SWIPE CODE
	var fingers;
	var startX;
	var startY;
	var endX;
	var endY;
	var swipeAngle;
	var swipeDirection;
	var swipeDistance;
	var minDistance = 50;

	function touchGlobalStart(event) {
		//event.preventDefault();
		fingers = event.touches.length;
		if (fingers == 1) {
			//alert(event.touches[0].pageX);
			startX = event.touches[0].pageX;
			startY = event.touches[0].pageY;
		} else {
			touchGlobalCancel(event);
		}
	}

	function touchGlobalMove(event) {
		//event.preventDefault();
		if (fingers == 1) {
			endX = event.touches[0].pageX;
			endY = event.touches[0].pageY;
		} else {
			touchGlobalCancel(event);
		}
	}

	function touchGlobalEnd(event, leftEvent, rightEvent) {
		event.preventDefault();
		if (fingers == 1) {
			calculateDistanceGlobal();
			if (swipeDistance >= minDistance) {
				caluculateAngleGlobal();
				determineSwipeDirectionGlobal();
				if (swipeDirection == 'right') { setTimeout(rightEvent, 0); }
				else if (swipeDirection == 'left') { setTimeout(leftEvent, 0); }
				touchGlobalCancel(event);
			}
		} else {
			touchGlobalCancel(event);
		}
	}

	function touchGlobalCancel(event) {
		// Reset the touch event
		fingers = undefined;
		startX = undefined;
		startY = undefined;
		endX = undefined;
		endY = undefined;
		swipeAngle = undefined;
		swipeDirection = undefined;
		swipeDistance = undefined;
	}

	function calculateDistanceGlobal() {
		swipeDistance = Math.round(Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2)));
	}

	function caluculateAngleGlobal() {
		var X = startX-endX;
		var Y = endY-startY;
		var Z = Math.round(Math.sqrt(Math.pow(X,2)+Math.pow(Y,2))); //the distance - rounded - in pixels
		var r = Math.atan2(Y,X); //angle in radians (Cartesian system)
		swipeAngle = Math.round(r*180/Math.PI); //angle in degrees
		if ( swipeAngle < 0 ) { swipeAngle =  360 - Math.abs(swipeAngle); }
	}

	function determineSwipeDirectionGlobal() {
		if ( (swipeAngle <= 45) && (swipeAngle >= 0) ) {
			swipeDirection = 'left';
		} else if ( (swipeAngle <= 360) && (swipeAngle >= 315) ) {
			swipeDirection = 'left';
		} else if ( (swipeAngle >= 135) && (swipeAngle <= 225) ) {
			swipeDirection = 'right';
		} else if ( (swipeAngle > 45) && (swipeAngle < 135) ) {
			swipeDirection = 'down';
		} else {
			swipeDirection = 'up';
		}
	}

	// END SWIPE CODE
	
	
	// Select List Jump Function
	function jumpto(form, name) {
		var myindex= eval('form.'+ name + '.selectedIndex');			//Gets index of user selection in Stringexp
		var myval=eval('form.' + name + '.options[myindex].value');		//Gets value at myindex
		eval('form.'+ name + '.selectedIndex = 0');						//Resets selected index to 0 (default)
		if (myval != "") {
			location.href=myval;									//If value is local, send this window to new page.
		}
	}

