// JavaScript Document
//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("#","","Creating blank presentations","Creating blank presentations","");
c++; item[c]=new Array("#","","Creating presentations based on templates","Creating presentations based on templates","");
c++; item[c]=new Array("#","","Closing files","Closing files","");

c++; item[c]=new Array("#","","Creating a slide master","Creating a slide master","");
c++; item[c]=new Array("#","","Viewing several slides","Viewing several slides","");
c++; item[c]=new Array("#","","Viewing the current slides","Viewing the current slides","");
c++; item[c]=new Array("#","","Using the Zoom function","Using the Zoom function","");
c++; item[c]=new Array("#","","Switching to normal view","Switching to normal view","");

c++; item[c]=new Array("#","","Adding slide titles","Adding slide titles","");
c++; item[c]=new Array("#","","Adding bulleted text","Adding bulleted text","");
c++; item[c]=new Array("#","","Adding floating text","Adding floating text","");

c++; item[c]=new Array("#","","Printing entire presentations","Printing entire presentations","");
c++; item[c]=new Array("#","","Printing slide ranges","Printing slide ranges","");
c++; item[c]=new Array("#","","Printing the current slide","Printing the current slide","");
c++; item[c]=new Array("#","","Printing note slides","Printing note slides","");
c++; item[c]=new Array("#","","Printingn handouts","Printingn handouts","");
c++; item[c]=new Array("#","","Inserting columns","Inserting columns","");

c++; item[c]=new Array("#","","Inserting slides using the menu bar","Inserting slides using the menu bar","");
c++; item[c]=new Array("#","","Changing slide layouts","Changing slide layouts","");
c++; item[c]=new Array("#","","Moving slides","Moving slides","");
c++; item[c]=new Array("#","","Deleting slides","Deleting slides","");

c++; item[c]=new Array("#","","Changing fonts using the menu bar","Changing fonts using the menu bar","");
c++; item[c]=new Array("#","","Changing font size using the menu bar","Changing font size using the menu bar","");
c++; item[c]=new Array("#","","Changing font colour using the menu bar","Changing font colour using the menu bar","");
c++; item[c]=new Array("#","","Changing bullets","Changing bullets","");

c++; item[c]=new Array("#","","Inserting tables","Inserting tables","");
c++; item[c]=new Array("#","","Inserting text in tables","Inserting text in tables","");

c++; item[c]=new Array("#","","Inserting columns","Inserting columns","");
c++; item[c]=new Array("#","","Deleting columnes","Deleting columnes","");
c++; item[c]=new Array("#","","Deleting rows","Deleting rows","");
c++; item[c]=new Array("#","","Appending rows","Appending rows","");
c++; item[c]=new Array("#","","Deleting cell contents","Deleting cell contents","");
c++; item[c]=new Array("#","","Deleting tables","Deleting tables","");

c++; item[c]=new Array("#","","Aligning cell contents","Aligning cell contents","");
c++; item[c]=new Array("#","","Changing border styles","Changing border styles","");
c++; item[c]=new Array("#","","Changing individual borders","Changing individual borders","");
c++; item[c]=new Array("#","","Adding shading to tables","Adding shading to tables","");

c++; item[c]=new Array("#","","Creating charts","Creating charts","");
c++; item[c]=new Array("#","","Editing chart data","Editing chart data","");
c++; item[c]=new Array("#","","Including and excluding chart data series","Including and excluding chart data series","");
c++; item[c]=new Array("#","","Adding titles to charts","Adding titles to charts","");
c++; item[c]=new Array("#","","Inserting and positioning legends in charts","Inserting and positioning legends in charts","");
c++; item[c]=new Array("#","","Deleting legends in charts","Deleting legends in charts","");
c++; item[c]=new Array("#","","Adding a category axis title to charts","Adding a category axis title to charts","");
c++; item[c]=new Array("#","","Adding a value axis title to charts","Adding a value axis title to charts","");
c++; item[c]=new Array("#","","Aligning cell contents","Aligning cell contents","");
c++; item[c]=new Array("#","","Changing border styles","Changing border styles","");

c++; item[c]=new Array("#","","Changing data series colours and patterns","Changing data series colours and patterns","");
c++; item[c]=new Array("#","","Changing font attributes sizes and colours","Changing font attributes sizes and colours","");
c++; item[c]=new Array("#","","Changing border lines","Changing border lines","");
c++; item[c]=new Array("#","","Adding patters and colours","Adding patters and colours","");

c++; item[c]=new Array("#","","Insert clip art","Insert clip art","");
c++; item[c]=new Array("#","","Adding rectangles and squares to presentations","Adding rectangles and squares to presentations","");
c++; item[c]=new Array("#","","Drawing straight lines","Drawing straight lines","");
c++; item[c]=new Array("#","","Adding block arrows to presentations","Adding block arrows to presentations","");
c++; item[c]=new Array("#","","Adding ellipses and circles to presentations","Adding ellipses and circles to presentations","");

c++; item[c]=new Array("#","","Moving objects","Moving objects","");
c++; item[c]=new Array("#","","Moving objects using the Standard toolbar","Moving objects using the Standard toolbar","");
c++; item[c]=new Array("#","","Sizing objects","Sizing objects","");
c++; item[c]=new Array("#","","Deleting objects","Deleting objects","");
c++; item[c]=new Array("#","","Grouping objects","Grouping objects","");
c++; item[c]=new Array("#","","Ungrouping objects","Ungrouping objects","");
c++; item[c]=new Array("#","","Flipping objects","Flipping objects","");
c++; item[c]=new Array("#","","Aligning objects","Aligning objects","");

c++; item[c]=new Array("#","","Changing border line attributes","Changing border line attributes","");
c++; item[c]=new Array("#","","Adding arrow heads to lines and polylines","Adding arrow heads to lines and polylines","");
c++; item[c]=new Array("#","","Adding colour to drawings","Adding colour to drawings","");
c++; item[c]=new Array("#","","Adding patterns to drawings","Adding patterns to drawings","");
c++; item[c]=new Array("#","","Adding shadows to drawings","Adding shadows to drawings","");
c++; item[c]=new Array("#","","Adding colour to shadowed drawings","Adding colour to shadowed drawings","");
c++; item[c]=new Array("#","","Adding shades to drawings","Adding shades to drawings","");
c++; item[c]=new Array("#","","Adding shades to patterns","Adding shades to patterns","");
c++; item[c]=new Array("#","","Colouring drawings","Colouring drawings","");
c++; item[c]=new Array("#","","Shading drawings","Shading drawings","");

c++; item[c]=new Array("#","","Animating objects and text","Animating objects and text","");
c++; item[c]=new Array("#","","Ordering animated objects and text","Ordering animated objects and text","");

c++; item[c]=new Array("#","","Playing slide shows","Playing slide shows","");
c++; item[c]=new Array("#","","Continuous slide shows","Continuous slide shows","");
c++; item[c]=new Array("#","","Interrupting slide shows","Interrupting slide shows","");
c++; item[c]=new Array("#","","Slide transition effects","Slide transition effects","");
c++; item[c]=new Array("#","","Timing slides","Timing slides","");
c++; item[c]=new Array("#","","Navigating through slide shows","Navigating through slide shows","");

/*******************************************************************************
	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: PowerPoint 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()
