// Slide Show Scripts
var FirstPg = 1
// dw = Document Write (i.e. write a single line of code)
function dw(text) {
	document.writeln(text);
}
function AddData() {
	// add the pointer to the respective data file
	dw("");
}
function GetMouseOverText() {
	// Get the text to be displayed over the image
	var strTemp = "";
	strTemp = "Click to view larger image";
	return strTemp;
}
function GetUrlParameter(PName) {
	// get the desired url parameter from the url
	// define the value to be returned
	var pValue = "NotFound";
	// get the current url
	var PgUrl = window.location.href;
	// add the equal sign to the desired parameter name
	PName = PName + "=";
	// look for the parameter in the url
	if (PgUrl.indexOf(PName) > -1) {
		var PgIdx = PgUrl.indexOf(PName) + PName.length;
		pValue = PgUrl.substring(PgIdx);
		// if from the detail page, look for the secondary occurence of the &
		if (pValue.indexOf("&") > -1) {
			pValue = pValue.substring(0,pValue.indexOf("&"));
		}
	}
	return pValue;
}
function GetPageNo() {
	// Get the Page Number from the URL.  Start with 1
	var PgUrl = window.location.href;
	var PgNo = 1;
	if (PgUrl.indexOf("&P=") > -1) {
		var PgIdx = PgUrl.indexOf("&P=")+3;
		PgNo = PgUrl.substring(PgIdx);
		// if from the detail page, look for the secondary occurence of the &
		if (PgNo.indexOf("&D=") > -1) {
			PgNo=PgNo.substring(0,PgNo.indexOf("&D="));
		}
	}
	return PgNo;
}
function GetPath() {
	// Get the path to the Slideshow
	// Expected Format:
	// file:///N:/CMonsters/WebSite/SShows/showpic.html?Path=ExoticRacing&P=2&D=L&F=IMG_2645rs.jpg
	var PgUrl = window.location.href;
	var SPath = "";
	if (PgUrl.indexOf("?Path=") > -1) {
		var PgIdx = PgUrl.indexOf("?Path=")+6;
		SPath = PgUrl.substring(PgIdx);
	}
	if (SPath.indexOf("&D=") > -1) {
		SPath = SPath.substring(0,SPath.indexOf("&D="));
	}
	if (SPath.indexOf("&P=") > -1) {
		SPath = SPath.substring(0,SPath.indexOf("&P="));
	}
	if (SPath.indexOf("&F=") > -1) {
		SPath = SPath.substring(0,SPath.indexOf("&F="));
	}
	if (SPath.indexOf("&V=") > -1) {
		SPath = SPath.substring(0,SPath.indexOf("&V="));
	}
	return SPath;
}
function GetPicName() {
	// Get the name of the Picture to be displayed
	var PgUrl = window.location.href;
	var PicNm = "";
	if (PgUrl.indexOf("&F=") > -1) {
		var PgIdx = PgUrl.indexOf("&F=")+3;
		PicNm = PgUrl.substring(PgIdx);
	}
	return PicNm;
}
function GetPicDir() {
	// Get the Direction of the Picture to be displayed
	var PgUrl = window.location.href;
	var PicDir = "";
	if (PgUrl.indexOf("&D=") > -1) {
		var PgIdx = PgUrl.indexOf("&D=")+3;
		PicDir = PgUrl.substr(PgIdx,1);
	}
	return PicDir;
}
function GetVideoName() {
	// Get the name of the Picture to be displayed
	var PgUrl = window.location.href;
	var VidNm = "";
	if (PgUrl.indexOf("&V=") > -1) {
		var PgIdx = PgUrl.indexOf("&V=")+3;
		VidNm = PgUrl.substring(PgIdx);
	}
	return VidNm;
}
function ShowPg() {
	// Create the "Page" to be displayed.  Heart of the slideshow application
	var PgNo = GetPageNo();
	var strOver = "Click to view larger image";
	var strTemp = "';
	dw(strTemp);
	if (screen.width > 1024) {
		var szw=640; var szh=480;
	} else if (screen.width == 1024) {
		var szw=600; var szh=450;
	} else if (screen.width == 800) {
		var szw=416; var szh=312;
	} else {
		var szw=320; var szh=240;
	}
	strTemp = "";
	} else {
		strTemp = strTemp + " width=" + szh + " height=" + szw + ">";
	}
	dw(strTemp);
	dw("");
	// Link to the Previous Page
	dw("     ");
	if (PgNo > FirstPg) dw("");
	dw("<-Previous Picture");
	if (PgNo > FirstPg) dw("");
	// Link to the Next Page
	dw("     ");
	if (PgNo < LastPg) dw("");
	dw("Next Picture ->");
	if (PgNo < LastPg) dw("");
	// some blank space for readability
	dw("
");
	// and the text to go with it.
	dw(PgText[PgNo]);
	// if this is the first page, add a link to the how to use the slideshow page.
	if (PgNo == 1) {
		dw("
");
		dw("PS: If you would like an overview of how to use this slideshow,");
		dw('please click here.');
	}
	// if the last page, add a link back to the entrance
	if (PgNo == LastPg) {
		dw("
Return to CMonsters Entrance");
	}
}
function ShowPic() {
	// Display an individual Picture, as large as possible, in a new window
	var PicDir = GetPicDir();
	var PicNm = GetPicName();
	var PgNo = GetPageNo();
	var OrigPic = "";
	if (OrigPics[PgNo]) OrigPic=OrigPics[PgNo];
	var strTemp="";
	if (screen.width > 1024) {
		var szh=640; var szw=480;
		if (PicDir == 'L') { var szw=640; var szh=480;}
	} else if (screen.width == 1024) {
		var szh=600; var szw=450;
		if (PicDir == 'L') { var szw=640; var szh=480;}
	} else if (screen.width == 800) {
		var szh=416; var szw=312;
		if (PicDir == 'L') { var szw=576; var szh=432;}
	} else {
		var szh=320; var szw=240;
		if (PicDir == 'L') { var szw=416; var szh=312;}
	}
	// if there is an original picture, turn the image into a secondary link
	if (OrigPic != "") dw("');
	strTemp = "./"+GetPath()+"/"+PicNm;
	dw("")
	if (OrigPic != "") dw("");
}
function ShowVideo() {
	// display a video that will start before the entire video is downloaded
	var vPath = GetUrlParameter("Path");
	var VidNm = GetUrlParameter("V");
	var PicNm = GetUrlParameter("F");
	if (screen.width > 1024) {
		var szw=640; var szh=360;
	} else if (screen.width == 1024) {
		var szw=576; var szh=324;
	} else if (screen.width == 800) {
		var szw=416; var szh=234;
	} else {
		var szw=320; var szh=180;
	}
	dw('');
}
function ShowTitle() {
	// write the page title
	dw("