/*                                                                              */
/* function ADDDATE adds the current date                                       */
/*                                                                              */

function adddate() {

var ktNow   = new Date
var monName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
var dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")    

var ktYear = ktNow.getYear()

    if (ktYear < 2000) {
        ktYear = ktYear + 1900
    }
					 
document.write(dayName[ktNow.getDay()] + "<br />")
document.write(monName[ktNow.getMonth()] + " ")
document.write(ktNow.getDate() + ", " + ktYear + "." + "<br />")
}
/* end of function adddate                                                      */   


/*                                                                              */
/* function playAudio plays an audio file                                       */
/*                                                                              */

function playaudio(soundfile) { 

/* Open a new window for a new page inside the current page  */

leftPos = 0
topPos = 0

if (screen) {
   leftPos = leftPos+100
	 topPos = topPos+100
}	  
audioWindow = window.open("", "newWin", "width=480,height=480,left="+leftPos+",top="+topPos+"")
audioWindow.focus()

/* For those browers that support plugins, and maintain a non empty plugin      */
/* array, establish whether Windows Media Player or Quicktime are available     */
/* Special case: MS IE V4 and below, on Apple Mac has no plugin support but is  */
/* known to have Quicktime.                                                     */
/* Special case: MS IE V4 and above have an empty plugins array, but ActiveX    */
/* will automatically load the correct plugin if the browser does not have it.  */  
/* If both Windows Media Player and Quicktime are available, use QT             */      

var haveqt = false;
var havewmp = false;
var haveIEandWMP = false;

if (navigator.plugins) {
    for (i=0; i < navigator.plugins.length; i++ ) {
         if (navigator.plugins[i].name.indexOf("Windows Media Player") >= 0) { 
				     havewmp = true;  
				 }	 
    }	
    for (i=0; i < navigator.plugins.length; i++ ) {
         if (navigator.plugins[i].name.indexOf("QuickTime") >= 0) { 
				     haveqt = true;
						 havewmp = false; 
				 }	 
    }	
}

if ((navigator.appVersion.indexOf("Mac") >= 0)
   && (navigator.appName.substring(0,9) == "Microsoft")
   && (parseInt(navigator.appVersion) < 5) ) { 
	 haveqt = true; 
	 havewmp = false;
}
else {
   if ((navigator.appVersion.indexOf("Mac") == -1) 
	    && (navigator.appName.substring(0,9) == "Microsoft") 
			&& (parseInt(navigator.appVersion) >= 4) ) {
			haveIEandWMP = true;
			havewmp = false;
			haveqt = false;
   }
}

/* start writing out the new page */

audioWindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
audioWindow.document.write('"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');

audioWindow.document.write('<html>');
audioWindow.document.write('<head>');
audioWindow.document.write('<title>Play Scuba Diving audio excerpt</title>');

audioWindow.document.write('<style type="text/css">');
audioWindow.document.write('body {font-family: arial, sans-serif; font-size: 12px; color: blue; background-color:#d1f3eb; width: 480px; height: 480px;}'); 
audioWindow.document.write('img#img1  {width: 236px; height: 319px; padding: 0 20px 20px 20px; }');
audioWindow.document.write('div.left {width: 140px; float: left; margin: 10px 5px 0 5px; }');
audioWindow.document.write('div.rite {float: right; margin: 10px 5px 0 5px; }');
audioWindow.document.write('div.midy {width: 320px; margin-left: auto; margin-right: auto; }');
audioWindow.document.write('div.midy2 {width: 320px; margin-left: auto; margin-right: auto; }');
audioWindow.document.write('form {margin-left: auto; margin-right: auto; }');
audioWindow.document.write('</style>');

audioWindow.document.write('</head>');
audioWindow.document.write('<body>');

audioWindow.document.write('<div class="left">');
audioWindow.document.write('<p>Read by Hilary Neville</p>');

audioWindow.document.write('<p>General Fiction <br />');
audioWindow.document.write('&pound;17.99');
audioWindow.document.write('</p>');
audioWindow.document.write('<p>');
audioWindow.document.write('6 Audio Cassettes<br />');
audioWindow.document.write('8hrs playing time<br />');
audioWindow.document.write('</p>');
audioWindow.document.write('<p>');
audioWindow.document.write('Product code SOUNDS3349<br />');
audioWindow.document.write('ISBN 1-84559-380-4');
audioWindow.document.write('</p>');
audioWindow.document.write('<p>&nbsp;</p>');
audioWindow.document.write('<p>If you&rsquo;d like to buy the audio book, go to <br />');
audioWindow.document.write('<a href="http://www.isis-publishing.co.uk/" target="_blank"> Isis Publishing.</a>');
audioWindow.document.write('</p>');
audioWindow.document.write('</div>');

audioWindow.document.write('<div class="rite">');
audioWindow.document.write('<img src="../images/scuba dancing.jpg" id="img1" alt="Scuba Dancing audio cover" />');
audioWindow.document.write('</div>');
audioWindow.document.write('<br clear="all" />');

audioWindow.document.write('<div class="midy">');

if (haveIEandWMP) {  
   audioWindow.document.write('<object id="MediaPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="320" height="45" type="application/x-mplayer2" standby="Loading Windows Media Player ...">');
	 audioWindow.document.write(' <param name="url" value="' + soundfile + '" />');
   audioWindow.document.write('	<param name="src" value="' + soundfile + '" />');
   audioWindow.document.write('	<param name="autostart" value="true" />');
   audioWindow.document.write('	<param name="showcontrols" value="true" />');
   audioWindow.document.write('	<param name="PlayCount" value="1" />');
	 audioWindow.document.write('</object>');
}
else {
   if (havewmp) {
      audioWindow.document.write('	 <object type="application/x-mplayer2" data="' + soundfile + '" width="320" height="45">'); 
      audioWindow.document.write('	  <param name="src" value="' + soundfile + '" />');
      audioWindow.document.write('		<param name="url" value="' + soundfile + '" />');
	    audioWindow.document.write('	  <param name="autostart" value="true" />');
	    audioWindow.document.write('	  <param name="contoller" value="true" />');					 
      audioWindow.document.write('	 </object>'); 
   }
   else {
      if (haveqt) {
         audioWindow.document.write('<object type="audio/mpeg" data="' + soundfile + '" width="320" height="16">'); 
	       audioWindow.document.write(' <param name="src" value="' + soundfile + '" />');
	       audioWindow.document.write(' <param name="url" value="' + soundfile + '" />');
         audioWindow.document.write(' <param name="autoplay" value="true" />');
         audioWindow.document.write(' <param name="controller" value="true" />');
         audioWindow.document.write('</object>');				 
      }
      else {
         audioWindow.document.write('<br />' + 'Download an MP3 clip of <span class="boldblu">Scuba Dancing</span>' + '<a href="http://www.nicolaslade.com/images/scuba.mp3"> here.</a>' + '<br />');
      }		
    }
}					 	 			

audioWindow.document.write('<br />');
audioWindow.document.write('<br />');
audioWindow.document.write('</div>');

audioWindow.document.write('<div class="midy2">');
audioWindow.document.write('<input type="button" value="Close this window" onclick="javascript:window.close();">');
audioWindow.document.write('</div>');

audioWindow.document.write('</body>');
audioWindow.document.write('</html>');
audioWindow.document.close(); // "Finalizes" new window 
}

/* end of function playAudio                                                            */

