//array for displaying number of ../nuggets found during search... 
var numConversion = new Array();

//array for storing links to ../nuggets, nugget title, keyintropcss...
var item = new Array();

//populating the array...
for (var i=0; i<150; i++){
	numConversion[i] = i;
}

// "Page Name","path","Page Title","Many,Key,Words","Descriptive Comments"
//c++; item[c]=new Array("javascript:openNugget('../nuggets/windows/Chapter8//_nugget.html',670,530);","","","","");

c=0; item[c]=new Array("#","","Adjusting Mouse Pointer speed","Adjusting Mouse Pointer speed","");
c++; item[c]=new Array("#","","Adjusting mouse double-click speed","Adjusting mouse double-click speed","");
c++; item[c]=new Array("#","","Switching mouse buttons","Switching mouse buttons","");
c++; item[c]=new Array("#","","Displaying and hiding Mouse Pointer trails","Displaying and hiding Mouse Pointer trails","");
c++; item[c]=new Array("#","","Adjusting Mouse Wheel scrolling","Adjusting Mouse Wheel scrolling","");
c++; item[c]=new Array("#","","Changing mouse pointer shapes","Changing mouse pointer shapes","");

c++; item[c]=new Array("#","","Launching programs using the Start menu","Launching programs using the Start menu","");
c++; item[c]=new Array("#","","Launching programs by double-clicking","Launching programs by double-clicking","");
c++; item[c]=new Array("#","","Launching programs using the Right Mouse button","Launching programs using the Right Mouse button","");
c++; item[c]=new Array("#","","Launching programs using the Enter key","Launching programs using the Enter key","");
c++; item[c]=new Array("#","","Launching programs using the Quick Launch bar","Launching programs using the Quick Launch bar","");
c++; item[c]=new Array("#","","Exiting programs using the Close button","Exiting programs using the Close button","");
c++; item[c]=new Array("#","","Exiting programs using the Window Control icon menu","Exiting programs using the Window Control icon menu","");
c++; item[c]=new Array("#","","Exiting programs using the File menu","Exiting programs using the File menu","");
c++; item[c]=new Array("#","","Exiting programs using the Taskbar","Exiting programs using the Taskbar","");

c++; item[c]=new Array("#","","Opening windows","Opening windows","");
c++; item[c]=new Array("#","","Switching windows by pointing and clicking","Switching windows by pointing and clicking","");
c++; item[c]=new Array("#","","Switching windows with the Taskbar","Switching windows with the Taskbar","");
c++; item[c]=new Array("#","","Using Taskbar groups","Using Taskbar groups","");
c++; item[c]=new Array("#","","Closing windows with the Close button","Closing windows with the Close button","");
c++; item[c]=new Array("#","","Closing windows with the Window Control icon menu","Closing windows with the Window Control icon menu","");
c++; item[c]=new Array("#","","Closing windows by double-clicking","Closing windows by double-clicking","");
c++; item[c]=new Array("#","","Closing windows with the Taskbar","Closing windows with the Taskbar","");
c++; item[c]=new Array("#","","Sizing windows with the sizing buttons","Sizing windows with the sizing buttons","");
c++; item[c]=new Array("#","","Sizing windows by double-clicking","Sizing windows by double-clicking","");
c++; item[c]=new Array("#","","Sizing windows by dragging","Sizing windows by dragging","");
c++; item[c]=new Array("#","","Moving windows","Moving windows","");

c++; item[c]=new Array("#","","Displaying the Desktop by minimizing or closing windows","Displaying the Desktop by minimizing or closing windows","");
c++; item[c]=new Array("#","","Displaying the Desktop with the Taskbar","Displaying the Desktop with the Taskbar","");
c++; item[c]=new Array("#","","Automatically arranging icons","Automatically arranging icons","");
c++; item[c]=new Array("#","","Arranging icons by properties","Arranging icons by properties","");
c++; item[c]=new Array("#","","Creating shortcut icons on the Desktop","Creating shortcut icons on the Desktop","");
c++; item[c]=new Array("#","","Creating shortcut icons in the Start menu","Creating shortcut icons in the Start menu","");
c++; item[c]=new Array("#","","Deleting icons from the Desktop using the Right Mouse button","Deleting icons from the Desktop using the Right Mouse button","");
c++; item[c]=new Array("#","","Deleting icons from the Desktop using the Delete key","Deleting icons from the Desktop using the Delete key","");
c++; item[c]=new Array("#","","Deleting icons from the Desktop using the Start menu","Deleting icons from the Desktop using the Start menu","");

c++; item[c]=new Array("#","","Hiding and displaying the Taskbar","Hiding and displaying the Taskbar","");
c++; item[c]=new Array("#","","Displaying the Taskbar in front of or behind windows","Displaying the Taskbar in front of or behind windows","");
c++; item[c]=new Array("#","","Moving the Taskbar","Moving the Taskbar","");
c++; item[c]=new Array("#","","Sizing the Taskbar","Sizing the Taskbar","");
c++; item[c]=new Array("#","","Adding icons to the Quick Launch bar","Adding icons to the Quick Launch bar","");
c++; item[c]=new Array("#","","Deleting icons from the Quick Launch bar","Deleting icons from the Quick Launch bar","");
c++; item[c]=new Array("#","","Hiding and displaying the Quick Launch bar","Hiding and displaying the Quick Launch bar","");
c++; item[c]=new Array("#","","Button groups","Button groups","");
c++; item[c]=new Array("#","","Locking and unlocking the Taskbar","Locking and unlocking the Taskbar","");
c++; item[c]=new Array("#","","Displaying and hiding the time","Displaying and hiding the time","");
c++; item[c]=new Array("#","","Hiding and displaying inactive icons","Hiding and displaying inactive icons","");

c++; item[c]=new Array("#","","Changing themes","Changing themes","");
c++; item[c]=new Array("#","","Changing Desktop background images","Changing Desktop background images","");
c++; item[c]=new Array("#","","Changing Desktop background colours","Changing Desktop background colours","");
c++; item[c]=new Array("#","","Setting screen savers","Setting screen savers","");
c++; item[c]=new Array("#","","Changing screen resolutions","Changing screen resolutions","");

c++; item[c]=new Array("#","","Using the Calculator","Using the Calculator","");
c++; item[c]=new Array("#","","Using WordPad","Using WordPad","");
c++; item[c]=new Array("#","","Using Paint","Using Paint","");
c++; item[c]=new Array("#","","Using Windows Media Player","Using Windows Media Player","");
c++; item[c]=new Array("#","","Using Notepad","Using Notepad","");
c++; item[c]=new Array("#","","Using Disk Cleanup","Using Disk Cleanup","");
c++; item[c]=new Array("#","","Using System Information","Using System Information","");
c++; item[c]=new Array("#","","Using Disk Defragmenter","Using Disk Defragmenter","");

c++; item[c]=new Array("#","","Launching Windows Explorer","Launching Windows Explorer","");
c++; item[c]=new Array("#","","Displaying folders","Displaying folders","");
c++; item[c]=new Array("#","","Selecting folders","Selecting folders","");
c++; item[c]=new Array("#","","Selecting drives","Selecting drives","");
c++; item[c]=new Array("#","","Selecting files","Selecting files","");
c++; item[c]=new Array("#","","Selecting consecutive files or folders","Selecting consecutive files or folders","");
c++; item[c]=new Array("#","","Selecting non-contiguous files or folders","Selecting non-contiguous files or folders","");
c++; item[c]=new Array("#","","Listing folder contents using the Explorer Bar","Listing folder contents using the Explorer Bar","");
c++; item[c]=new Array("#","","Listing folder contents using the Contents pane","Listing folder contents using the Contents pane","");
c++; item[c]=new Array("#","","Expanding or collapsing folders while selecting them","Expanding or collapsing folders while selecting them","");
c++; item[c]=new Array("#","","Expanding or collapsing folders without selecting them","Expanding or collapsing folders without selecting them","");
c++; item[c]=new Array("#","","Searching for files or folders","Searching for files or folders","");
c++; item[c]=new Array("#","","Modifying views","Modifying views","");
c++; item[c]=new Array("#","","Listing files and folders by properties","Listing files and folders by properties","");
c++; item[c]=new Array("#","","Grouping files and folders","Grouping files and folders","");
c++; item[c]=new Array("#","","Sorting files and folders using the Contents pane","Sorting files and folders using the Contents pane","");
c++; item[c]=new Array("#","","Sorting files and folders using the Right Mouse button","Sorting files and folders using the Right Mouse button","");
c++; item[c]=new Array("#","","Formatting disks","Formatting disks","");
c++; item[c]=new Array("#","","Exiting Windows Explorer","Exiting Windows Explorer","");

c++; item[c]=new Array("#","","Creating folders using the Menu bar","Creating folders using the Menu bar","");
c++; item[c]=new Array("#","","Creating folders using the Right Mouse button","Creating folders using the Right Mouse button","");
c++; item[c]=new Array("#","","Copying files or folders using the Menu bar","Copying files or folders using the Menu bar","");
c++; item[c]=new Array("#","","Copying files or folders by dragging","Copying files or folders by dragging","");
c++; item[c]=new Array("#","","Copying files or folders using the Right Mouse button","Copying files or folders using the Right Mouse button","");
c++; item[c]=new Array("#","","Copying files or folders using the keyboard","Copying files or folders using the keyboard","");
c++; item[c]=new Array("#","","Moving files or folders using the Menu bar","Moving files or folders using the Menu bar","");
c++; item[c]=new Array("#","","Moving files or folders by dragging","Moving files or folders by dragging","");
c++; item[c]=new Array("#","","Moving files or folders using the Right Mouse button","Moving files or folders using the Right Mouse button","");
c++; item[c]=new Array("#","","Moving files or folders using the keyboard","Moving files or folders using the keyboard","");
c++; item[c]=new Array("#","","Renaming files or folders using the Menu bar","Renaming files or folders using the Menu bar","");
c++; item[c]=new Array("#","","Renaming files or folders using the Right Mouse button","Renaming files or folders using the Right Mouse button","");
c++; item[c]=new Array("#","","Deleting files or folders using the Menu bar","Deleting files or folders using the Menu bar","");
c++; item[c]=new Array("#","","Deleting files or folders using the Delete key","Deleting files or folders using the Delete key","");
c++; item[c]=new Array("#","","Deleting files or folders using the Right Mouse button","Deleting files or folders using the Right Mouse button","");
c++; item[c]=new Array("#","","Restoring files or folders using the Menu bar","Restoring files or folders using the Menu bar","");
c++; item[c]=new Array("#","","Restoring files or folders using the Right button","Restoring files or folders using the Right button","");

c++; item[c]=new Array("#","","Logging in","Logging in","");
c++; item[c]=new Array("#","","Switching user accounts","Switching user accounts","");
c++; item[c]=new Array("#","","Checking the current user account","Checking the current user account","");
c++; item[c]=new Array("#","","Logging off","Logging off","");
c++; item[c]=new Array("#","","Creating user accounts","Creating user accounts","");
c++; item[c]=new Array("#","","Changing user account names","Changing user account names","");
c++; item[c]=new Array("#","","Changing user account types","Changing user account types","");
c++; item[c]=new Array("#","","Deleting user accounts","Deleting user accounts","");
c++; item[c]=new Array("#","","Creating passwords","Creating passwords","");
c++; item[c]=new Array("#","","Changing passwords using limited accounts","Changing passwords using limited accounts","");
c++; item[c]=new Array("#","","Deleting passwords using limited accounts","Deleting passwords using limited accounts","");
c++; item[c]=new Array("#","","Changing pictures using limited accounts","Changing pictures using limited accounts","");





/*******************************************************************************
	Function Name:	search();
	Arguments:			frm - form object containing the search keywords entered by the user.
	Description:			This function is used to search for nuggets using the search value entered by
								the user in the Search field. It matches the search string with the nugget title
								and its corresponding keywords and displays the link for the nugget if a match 
								is found. This function is called when the Search button is clicked.
********************************************************************************/

page =  ' 	<html> 																															'
page +=	'  		<head> 																														'
page += '			<link rel="stylesheet" type="text/css" href="css/ie-stylesheet.css"> 						'
page +=	' 			<script language="JavaScript1.2" src="scripts/nugget.js"></script> 							'
page +=	' 			<script language="JavaScript1.2" src="scripts/functions.js"></script> 							'
page +=	' 			<title>Search Results: Windows XP eLearning Nuggets</title> 										'	
page +=	' 		</head>																														'
page +=	' 		<body onUnload="setFocus();"> 																														'
page +=	'			<img class="srchLogo" src="images/search_logo.gif">													'
page +=	' 			<div id="srchMain"> 																								';

function search(frm) {
	
	//search string to display in the search window...
  	srchTxt = frm.srchVal.value;

	//search string to be used for matching with nugget title and keywords...	
  	txt = frm.srchVal.value.toLowerCase();

	//splitting search sentences using space as a delimiter and storing it as an array...
  	txt = txt.split(" ");
  	fnd = new Array(); 
	total=0;

	//searching for a match...
	for (i = 0; i < item.length; i++) {
     	fnd[i] = 0; 
   		for (k = 0; k < txt.length; k++)
   	  		if (item[i][3].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "")
       			fnd[i] += (1);
     }

	//creating a window in which the search results will be displayed...
  	win = window.open("","","scrollbars, width=625, height=300");
	
	//writing/rendering the heading section of the search window...	
  	win.document.write(page);

	//finding and formatting links for display in the search window...
     for (i = 0; i < fnd.length; i++) {
     	n = 0; 
		w = -1;
        
		for (j = 0;j < fnd.length; j++)
         	if (fnd[j] > n) { n = fnd[j]; w = j; };
            	if (w > -1) 
			   		total += show(w, win);
               	fnd[w] = 0;
     }

	//rendering the rest of the page...	
	win.document.write('<br></div>');
		
	//displaying the heading in the search window... 
	win.document.write('<span class="srchWndHeading1">Search text: '+srchTxt+'</span><br>');
	win.document.write('<span class="srchWndHeading2">Total number of eLearning Nuggets found: '+numConversion[total]+'</span>');
	win.document.write('</body></html>');
	win.document.close();
}

/*****************************************************************************************************
	Function Name:	show();
	Arguments:			which 	- the element in the item array containing all the links.
								wind 	- the window in which to display the links.
	Description:			This function is used to format and display all the matching links in the
								search window.
******************************************************************************************************/

function show(which,wind) {

	link = item[which][1] + item[which][0];
//   	if (link.indexOf("#") > -1)
		line = '<span class="disabled">'+item[which][2]+'</span><br>';
//   	else
//		line = '<a class="enabled" onFocus="loseFocus(this);" href="'+link+'">'+item[which][2]+'</a><br>';

   wind.document.write(line);
   return 1;
}	//Function show()
