function displayVideo(videourl, videotitle){
    var newHTML = "";
    hasRightVersion = DetectFlashVer(9,0,115);
	if(hasRightVersion)
	{
		videotitle = videotitle.replace(/%20/g, " ").replace("%27","'").replace("%E2%84%A2", "&trade;").replace("%C2%AE", "&reg;").replace("%26","&amp;");
	    newHTML = newHTML + '<div class="video_title">' + videotitle + '</div>';
        var hasPlaylist = videourl.match('.xml') ? true : false;
		var playlist;
        var flashvars;
		if (!hasPlaylist)
		{
			flashvars = {
			  vidWidth: "320",
			  vidHeight: "240",
			  vidPath: videourl,
			  thumbPath: "",
			  autoPlay: "true",
			  vidAspectRatio: "cut", 
			  watermark: "hide"
			};
		}
		else
		{
			playlist = videourl;
			flashvars = {
				vidWidth: "320",
				vidHeight: "240",
				vidPath: videourl,
				thumbPath: "",
				autoPlay: "true",
				vidAspectRatio: "cut", 
				watermark: "hide",
				playlistPath: playlist,
				plShowAtStart: "true",
				plHideDelay: "2000"
			};
		}
			var params = {
			  menu: "true",
			  allowfullscreen: "true",
			  allowscriptaccess: "always"
			};
			var attributes = {
			  id: "playerLite",
			  name: "playerLite"
			};
			newHTML = newHTML + '<div class="videoplayerwrapper"><div id="playerLite"></div></div>';
	}
else
	{
	   newHTML = newHTML + "<div class=\"flash_req\">";
	   newHTML = newHTML + "<div class=\"flash_header\">Flash Required</div>";
	   newHTML = newHTML + "<div class=\"flash_text\">You either do not have the Adobe&reg;<br/>"; 
	   newHTML = newHTML + "Flash Player installed or an older<br/>";
	   newHTML = newHTML + "version that cannot play the videos<br/>";
	   newHTML = newHTML + "we've created. Why not download<br/>";
	   newHTML = newHTML + "and install the latest version now?<br/>";
	   newHTML = newHTML + "It will only take a moment.";
	   newHTML = newHTML + "</div>";
	   newHTML = newHTML + "<div class=\"flash_text\">Click the button below to obtain the<br/>";
	   newHTML = newHTML + "latest version of Flash.</div>";
	   newHTML = newHTML + "<div class=\"flash_text\"><a href=\"http://get.adobe.com/flashplayer/\" target=\"_blank\" ><img alt=\"Get Adobe Flash Player\" src=\"/Style%20Library/images/get-adobe.gif\" style=\"border:0;\" /></a>";
	   newHTML = newHTML + "</div>";
	}
	var videoplaceholder = document.getElementById('VideoPlaceholder');
    videoplaceholder.innerHTML = newHTML; 
    videoplaceholder.style.display = "inline"; 
	if (hasPlaylist)
	{
		swfobject.embedSWF("/playlsi/FlashPages/playerLite-playlist.swf", "playerLite", flashvars.vidWidth, flashvars.vidHeight, "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
	}
	else
	{
		swfobject.embedSWF("/playlsi/FlashPages/playerLite.swf", "playerLite", flashvars.vidWidth, flashvars.vidHeight, "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
	}
}   
function displayVideo(videourl, videotitle, videosize, enableautoplay, thumbnailUrl, showControls){
    var newHTML = "";
    hasRightVersion = DetectFlashVer(9,0,115);
	videotitle = videotitle.replace(/%20/g, " ").replace("%27","'").replace("%E2%84%A2", "&trade;").replace("%C2%AE", "&reg;").replace("%26","&amp;");
	if (videotitle != '')
	{
		newHTML = newHTML + '<div class="video_title">' + videotitle + '</div>';
	}
	if(hasRightVersion)
	{
        var hasPlaylist = videourl.match('.xml') ? true : false;
		var playlist;
        var flashvars;
		var videoWidth;
		var videoHeight;
		if (videosize == "Widescreen")
		{
			videoWidth = "512";
			videoHeight = "288";
		}
		else if (videosize == "448")
		{
			videoWidth = "448";
			videoHeight = "336";
		}
		else
		{
			videoWidth = "320";
			videoHeight = "240";
		}
		var autoplay = enableautoplay == true ? "true" : "false";
		var thumbnailPath = thumbnailUrl != '' ? 'http://' + window.location.hostname + thumbnailUrl : '';
		var boolShowControls = showControls == true ? "true" : "false";
		if (!hasPlaylist)
		{
			flashvars = {
			  vidWidth: videoWidth,
			  vidHeight: videoHeight,
			  vidPath: videourl,
			  thumbPath: thumbnailPath,
			  autoPlay: autoplay,
			  showControls: showControls,
			  vidAspectRatio: "cut", 
			  watermark: "hide"
			};
		}
		else
		{
			playlist = videourl;
			var video = videourl.replace(/\.xml/, '.mp4');
			flashvars = {
				vidWidth: videoWidth,
				vidHeight: videoHeight,
				vidPath: videourl,
				thumbPath: thumbnailPath,
				autoPlay: autoplay,
				showControls: showControls,
				vidAspectRatio: "cut", 
				watermark: "hide",
				playlistPath: playlist,
				plShowAtStart: "true",
				plHideDelay: "2000"
			};
		}
			var params = {
			  menu: "true",
			  allowfullscreen: "true",
			  allowscriptaccess: "always",
			  wmode: "transparent"
			};
			var attributes = {
			  id: "playerLite",
			  name: "playerLite"
			};
			newHTML = newHTML + '<div class="videoplayerwrapper"><div id="playerLite"></div></div>';
	}
else
	{
	   newHTML = newHTML + "<div class=\"flash_req\">";
	   newHTML = newHTML + "<div class=\"flash_header\">Flash Required</div>";
	   newHTML = newHTML + "<div class=\"flash_text\">You either do not have the Adobe&reg;<br/>"; 
	   newHTML = newHTML + "Flash Player installed or an older<br/>";
	   newHTML = newHTML + "version that cannot play the videos<br/>";
	   newHTML = newHTML + "we've created. Why not download<br/>";
	   newHTML = newHTML + "and install the latest version now?<br/>";
	   newHTML = newHTML + "It will only take a moment.";
	   newHTML = newHTML + "</div>";
	   newHTML = newHTML + "<div class=\"flash_text\">Click the button below to obtain the<br/>";
	   newHTML = newHTML + "latest version of Flash.</div>";
	   newHTML = newHTML + "<div class=\"flash_text\"><a href=\"http://get.adobe.com/flashplayer/\" target=\"_blank\" ><img alt=\"Get Adobe Flash Player\" src=\"/Style%20Library/images/get-adobe.gif\" style=\"border:0;\" /></a>";
	   newHTML = newHTML + "</div>";
	}
	var videoplaceholder = document.getElementById('VideoPlaceholder');
    videoplaceholder.innerHTML = newHTML; 
    videoplaceholder.style.display = "inline"; 
	if (hasPlaylist)
	{
		//swfobject.addParam("wmode", "transparent");
		swfobject.embedSWF("/playlsi/FlashPages/playerLite-playlist.swf", "playerLite", flashvars.vidWidth, flashvars.vidHeight, "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
	}
	else
	{
		//swfobject.addParam("wmode", "transparent");
		swfobject.embedSWF("/playlsi/FlashPages/playerLite.swf", "playerLite", flashvars.vidWidth, flashvars.vidHeight, "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
	}
}   
function querySt(ji) {
	hu = window.location.search.substring(1);
	gy = hu.split("&");
	for (i=0;i<gy.length;i++) {
		ft = gy[i].split("=");
		if (ft[0] == ji) {
			return ft[1];
		}
	}
}

	var secondaryNavPane;
	var slideSpeed = 0;
	var secondaryNav;
	var slideEndMarker = false;
	var galleryContainer = false;
	var numLinks = 0;
	var numPages = 0;

	document.getElementsByClassName = function(cl) {
		var retnode = [];
		var myclass = new RegExp('\\b'+cl+'\\b');
		var elem = this.getElementsByTagName('*');
		for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
			if (myclass.test(classes)) retnode.push(elem[i]);
		}
		return retnode;
	}; 

	function getTopPos(inputObj)
	{		
	  var returnValue = inputObj.offsetTop;
	  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
	  return returnValue;
	}
	
	function getLeftPos(inputObj)
	{

	  var returnValue = inputObj.offsetLeft;
	  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
	  return returnValue;
	}

	
	function initSlide(e)
	{
		if(document.all)e = event;
		
		if(this.src.indexOf('over')<0)this.src = this.src.replace('.gif','-over.gif');
		
		slideSpeed = e.clientY + Math.max(document.body.scrollTop,document.documentElement.scrollTop) - getTopPos(this);
		if(this.src.indexOf('down')>=0){
			slideSpeed = (slideSpeed)*-1;	
		}else{
			slideSpeed = arrowImageHeight - slideSpeed;
			
		}
		slideSpeed = Math.round(slideSpeed * 10 / arrowImageHeight);
	}
	
	function stopSlide()
	{		
		slideSpeed = 0;
		this.src = this.src.replace('-over','');
	}
	
	function slideNavPane()
	{
		if(slideSpeed!=0){
			var topPos = secondaryNav.style.top.replace(/[^\-0-9]/g,'')/1;	
			if(slideSpeed<0 && slideEndMarker.offsetTop<(secondaryNavPane.offsetHeight - topPos)){
				slideSpeed=0;
			
			}
			topPos = topPos + slideSpeed;
			if(topPos>0)topPos=0;

		 	secondaryNav.style.top = topPos + 'px';
	 	
		}
	 	setTimeout('slideNavPane()',30);		
	}
	
	function slide(direction)
	{
		var topPos = secondaryNav.style.top.replace('px', '');
		var prevLink = document.getElementById('prev_page_link').getElementsByTagName('img')[0];
		var nextLink = document.getElementById('next_page_link').getElementsByTagName('img')[0];

		
		if (direction == 'up' && topPos !=0)
		{
			topPos = parseInt(topPos) + 55;
			secondaryNav.style.top = topPos + 'px';
			var currentPage = Math.abs(topPos) / 55;
			
			if (currentPage == 0)
			{
				prevLink.style.visibility = "hidden";
			}

			nextLink.style.visibility = "visible";
			nextLink.style.cursor = "hand";

		}
		else if (direction == 'down') 
		{
			topPos = parseInt(topPos) - 55;
			//var numPages = Math.ceil(numLinks/12);
			var currentPage = Math.abs(topPos) / 55;
			//if(currentPage < numPages)
			//{
				secondaryNav.style.top = topPos + 'px';
			
				if (currentPage+1 == numPages)
				{
					nextLink.style.visibility = "hidden";
				}
				prevLink.style.visibility = "visible";
				prevLink.style.cursor = "hand";
		}
		
		
	}
	
	function initGalleryScript()
	{
		secondaryNavPane = document.getElementById('secondary_nav_wrapper');
		secondaryNav = document.getElementById('secondary_nav');
		secondaryNav.style.top = '0px';
		
		numLinks = (secondaryNavPane.getElementsByTagName('li').length);
		
		if (numLinks <= 5)
		{
			document.getElementById('next_page_link').getElementsByTagName('img')[0].style.visibility = "hidden";
			document.getElementById('next_page_link').onclick = null;
		}
		else
		{
			document.getElementById('next_page_link').getElementsByTagName('img')[0].style.cursor = "hand";
		}
		
		document.getElementById('prev_page_link').getElementsByTagName('img')[0].style.visibility = "hidden";
		document.getElementById('prev_page_link').getElementsByTagName('img')[0].style.cursor = "text";
		
		var linkCount = 0;
		var charCount = 0;
		var currentPageCharCount = 0;
		var currentPageLinkCount = 0;
		var currentLink = 0;
		for (linkCount; linkCount < numLinks; linkCount++)
		{
			//if (document.all)
			//{
			//	charCount += secondaryNavPane.getElementsByTagName('li')[linkCount].innerText.length;
			//}
			//else
			//{
			//	charCount += secondaryNavPane.getElementsByTagName('li')[linkCount].textContent.length;
			//}
			
			if (secondaryNavPane.getElementsByTagName('li')[linkCount].className == 'current_page' || secondaryNavPane.getElementsByTagName('li')[linkCount].className == 'first current_page')
			{
				currentPageCharCount = charCount;
				currentPageLinkCount = linkCount+1;
				if (secondaryNavPane.getElementsByTagName('li')[linkCount].className == 'current_page' || secondaryNavPane.getElementsByTagName('li')[linkCount].className == 'first current_page')
				{
					currentLink = linkCount+1;
				}
			}
		}
		
		//numPages = Math.ceil(Math.ceil((((charCount*6) + (numLinks*10))/250))/2);
		numPages = Math.ceil(numLinks/5);
		//var currentPageSelection = Math.ceil(Math.ceil((((currentPageCharCount*6) + (currentPageLinkCount*10))/250))/2);
		var currentPageSelection = Math.ceil(currentLink/5);
		var page = 0;
		for (page;page < currentPageSelection-1; page++)
		{
			slide('down');
		}
		
		slideNavPane();	
	}
	
	
	

