////////////////////////////////////

var definitionWindow;
var soundWindow;

////////////////////////////////////
function definition(term) {
	var definitionURL;
	var windowName;
	var browserType;
	var leftPos;
	var topPos;

	definitionURL = "term/"+ term+ ".html";
	stylesheetURL = "phonehistory.css";	
	windowName = "definitionWindow";

	var part1 = "<HTML><HEAD>" +
		"<TITLE>" + "What is a " + term + "?" +
		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
		"</TITLE>" +
		"</HEAD>" +
		"<FRAMESET ROWS='45,*' BORDER=0 FRAMEBORDER=0>" +
		"<FRAME NAME=f1 FRAMEBORDER=1 SCROLLING=no SRC=\"\">" +
		"<FRAME NAME=f2 SCROLLING=yes SRC='" + definitionURL + "'>" +
		"</FRAMESET>" +
		"</HTML>";

	var part2 = "<HTML><HEAD>" +
		"<link rel=StyleSheet href='" + stylesheetURL + "' type='text/css'>" +
		 "</HEAD>" +
		 "<BODY CLASS=DefHeader>" +
		"<TABLE width=300 border=0 cellpadding=0 cellspacing=0>" +
   		"<TR valign=top>" +
		"<TD>" +
		term +
		"</TD>" +
		"<TD WIDTH=65>"  +
		"<FORM ACTION='javascript:parent.window.close()'><INPUT TYPE=SUBMIT VALUE='Close'></FORM>" +
		"</TD>" +
		"</TR>" +
		"</TABLE>"
		"</DIV>" +
		"</BODY>" +
		"</HTML>";

	browserType = "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)";
	if (browserType.indexOf("AOL") >0) {
		leftPos = 0;
		topPos = 0;
	} 
	else {
		leftPos = (window.screen.width/2) - (300 + 10); 
		topPos = (window.screen.height/2) - (300 + 10);
	}
		
  	if (definitionWindow != null && definitionWindow.open) definitionWindow.close();	
	definitionWindow = window.open("",windowName,"titlebar=no,menubar=no,toolbar=no,location=no,dependant,scrollbars,resizable=no,width=300,height=300,left=" + leftPos + ",top=" + topPos);
	definitionWindow.document.write(part1);

	definitionWindow.f1.document.open("text/html");
	definitionWindow.f1.document.write(part2);
	
	if (window.focus) {
		definitionWindow.focus();
	}

}


////////////////////////////////////
function soundclip(soundFile)  {
	var soundURL;
	var windowName;
	var browserType;
	var leftPos;
	var topPos;

	soundURL = "sound/"+ soundFile + ".html";
	windowName = "soundWindow";

	browserType = "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)";
	if (browserType.indexOf("AOL") >0) {
		leftPos = 0;
		topPos = 0;
	} 
	else {
		leftPos = (window.screen.width/2) - (300 + 10); 
		topPos = (window.screen.height/2) - (300 + 10);
	}
		
  	if (soundWindow != null && soundWindow.open) soundWindow.close();	
	soundWindow = window.open(soundURL,windowName,"titlebar=no,menubar=no,toolbar=no,location=no,dependant,scrollbars,resizable=yes,width=340,height=300,left=" + leftPos + ",top=" + topPos);
	soundWindow.document.write(part1);
	
	if (window.focus) {
		soundWindow.focus();
	}

}
///////////////////////////////////////////////////////////////

function soundpopup(soundFile,repeat)  {
	var soundURL;
	var windowName;
	var browserType;
	var leftPos;
	var topPos;

	soundURL = "sound/"+ soundFile + ".wav";
	stylesheetURL = "phonehistory.css";	
	windowName = "soundWindow";
	
	if (repeat=="YES")  netscapeSound = '<embed src = "' + soundURL + '"autostart="true" hidden="true" loop="true" ></embed>';
	else netscapeSound = '<embed src = "' + soundURL + '"autostart="true" hidden="true" loop="false" ></embed>';
	
	if (repeat=="YES")  explorerSound = '<bgsound src = "' + soundURL + '" loop="-1">';
	else  explorerSound = '<bgsound src = "' + soundURL + '">';

	if ( navigator.appName == 'Netscape' ) {
	  noiseMaker = netscapeSound;
 	} else if ( navigator.appName == 'Microsoft Internet Explorer' ) {
 	  noiseMaker = explorerSound;
 	} else {
 	  noiseMaker = explorerSound + netscapeSound;
	}


	var part1 = "<HTML><HEAD>" +
		"<TITLE>" + "Sound" +
		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
		"</TITLE>" +
		"<link rel=StyleSheet href='" + stylesheetURL + "' type='text/css'>" +
		noiseMaker +
		"</HEAD>" +
		"<BODY CLASS=sndpopup>" +
		"<IMG SRC='image/speaker_anim.gif' WIDTH=70 HEIGHT=49><P>" +
		"Please wait for sound to download.<P>" +
		"<TABLE><TR><TD>" +
		"<FORM ACTION='javascript:parent.window.close()'><INPUT TYPE=SUBMIT VALUE='Close'></FORM>" +
		"<TD>" ;
	var part2 = "<FORM ACTION='javascript:parent.window.location.reload()'><INPUT TYPE=SUBMIT VALUE='Repeat'></FORM>" 
	var part3= "</TR></TABLE>" +
		"</BODY>" +
		"</HTML>";

	browserType = "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)";
	if (browserType.indexOf("AOL") >0) {
		leftPos = 0;
		topPos = 0;
	} 
	else {
		leftPos = (window.screen.width/2) - (300 + 10); 
		topPos = (window.screen.height/2) - (300 + 10);
	}
		
  	if (soundWindow != null && soundWindow.open) soundWindow.close();	
	soundWindow = window.open("",windowName,"titlebar=no,menubar=no,toolbar=no,location=no,dependant,scrollbars=no,resizable=no,width=180,height=200,left=" + leftPos + ",top=" + topPos);
	soundWindow.document.write(part1);
	if (repeat=="NO") soundWindow.document.write(part2);
	soundWindow.document.write(part3);
	
	if (window.focus) {
		soundWindow.focus();
	}
	
	/* The following code may help to determine if the sound file has downloaded 
	**  var timerID = null;
	**   function checkIfLoaded() {
	**    if (document.embeds[0].IsReady() == true)  {
	**	statusmessage.innerText = "";
	**	clearInterval(timerID);
	**   }
	**  }
	** (onload) timerID = setInterval("checkIfLoaded()", 1000);'
	** inline--> <B ID="statusmessage"><I>Still Loading...</I></B> 
	*/
    

}
///////////////////////////////////////////////////////////////

