

	// preload images
	var preload = new Array (
		'img/m/over/book-clubs.jpg',
		'img/m/over/booksellers.jpg',
		'img/m/over/extras.jpg',
		'img/m/over/forum.jpg',
		'img/m/over/r-a-salvatore.jpg',
		'img/m/over/the-saga.jpg'
	);

	function preloadImages () {
		for (var i = 0; i < preload.length; i++) {
			k = i + 1;
			eval ('image' + k + ' = new Image()');
			eval ('image' + k + '.src = preload[i]');
		}
	}

	// simple browser sniffer - h/t k10k
	var isW3C = (document.getElementById) ? true : false;
	var isAll = (document.all) ? true : false;

	// no focused links
	function unblur () { this.blur (); }
	function getLinksToBlur () {
		if ((isW3C) || (isAll)) {
			if (isW3C) {
				var links = document.getElementsByTagName("a");
			} else {
				var links = document.all.tags("a");
			}
			for (i = 0; i < links.length; i++) {
				links[i].onfocus = unblur;
			}
		}
	}


	// image swapping
	function roll (obj, state) { document.getElementById(obj).src = 'img/m/' + state + '/' + obj + '.jpg'; }


	// youtube utility function
	function youTube (videoID, videoW, videoH) {

		// set defaults
		var videoID = (videoID == null) ? '' : videoID;
		var videoW = (videoW == null) ? 425 : videoW;
		var videoH = (videoH == null) ? 350 : videoH;

		// write player
		document.write ('<object width="' + videoW + '" height="' + videoH + '"><param name="movie" value="http://www.youtube.com/v/' + videoID + '"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/' + videoID + '&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="' + videoW + '" height="' + videoH + '"></object>');

	}


	// quicktime

	function renderQTPlayer (qtFile, qtW, qtH) {

		var qtW = (qtW == null) ? 250 : qtW;
		var qtH = (qtH == null) ? 16 : qtH;

		document.write ('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"');
		document.write ('        codebase="http://www.apple.com/qtactivex/qtplugin.cab"');
		document.write ('        width="' + qtW + '" height="' + qtH + '">');
		document.write ('  <param name="src" value="' + qtFile + '" />');
		document.write ('  <param name="autoplay" value="false" />');
		document.write ('  <param name="pluginspage" value="http://www.apple.com/quicktime/download/" />');
		document.write ('  <param name="controller" value="true" />');
		document.write ('  <param name="bgcolor" value="000000" />');
		document.write ('  <!--[if !IE]> <-->');
		document.write ('    <object data="' + qtFile + '" width="' + qtW + '" height="' + qtH + '" type="video/quicktime">');
		document.write ('      <param name="pluginurl" value="http://www.apple.com/quicktime/download/" />');
		document.write ('      <param name="controller" value="true" />');
		document.write ('      <param name="bgcolor" value="000000" />');
		document.write ('      <param name="autoplay" value="false" />');
		document.write ('    </object>');
		document.write ('  <!--> <![endif]-->');
		document.write ('</object>');

	}


	// use in conjunction with flvplayer.swf
	function renderFLVPlayer (flvPath, flvW, flvH, flvAutoPlay, flvVolume) {

		// set defaults
		var flvAutoPlay = (flvAutoPlay == null) ? 'false' : flvAutoPlay;
		var flvVolume = (flvVolume == null) ? '100' : flvVolume;
		var flvW = (flvW == null) ? 306 : flvW;
		var flvH = (flvH == null) ? 204 : flvH;

		// write player
		document.write ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + flvW + '" height="' + flvH + '" id="flvPlayer" align="center"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="flvplayer.swf?flvPath=' + flvPath + '&flvAutoPlay=' + flvAutoPlay + '&flvVolume=' + flvVolume + '" /><param name="quality" value="high" /><param name="wmode" value="transparent"><embed src="flvplayer.swf?flvPath=' + flvPath + '&flvAutoPlay=' + flvAutoPlay + '&flvVolume=' + flvVolume + '" quality="high" wmode="transparent" width="' + flvW + '" height="' + flvH + '" name="flvPlayer" align="center" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');

	}

	// generic flash video player
	function renderFlash (videoID, videoW, videoH) {

		// set defaults
		var videoID = (videoID == null) ? '' : videoID;
		var videoW = (videoW == null) ? 425 : videoW;
		var videoH = (videoH == null) ? 350 : videoH;

		// write player
		document.write ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + videoW + '" height="' + videoH + '" id="' + videoID + '" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + videoID + '.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="' + videoID + '.swf" quality="high" bgcolor="#000000" width="' + videoW + '" height="' + videoH + '" name="flashvideo" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');

	}

	// onload events
	window.addEventListener ? window.addEventListener("load",preloadImages,false) : window.attachEvent("onload",preloadImages);
	window.addEventListener ? window.addEventListener("load",getLinksToBlur,false) : window.attachEvent("onload",getLinksToBlur);
