/*************************************************************/
/* File Namwe : searchSite.js                                             */
/* Aim : Provide Search Facility on Nrityanjali Web Site   */
/*************************************************************/

/* Important : Remember to include this code in the pages
   where search box should appear
In Head :- 
<SCRIPT SRC="searchSite.js"></SCRIPT>

In Body :-
<form method=get action="javascript:void(0)" onsubmit="search(this); return false;">
           <p align="center">
            <b>Search this website</b><br>
            <input type=text name=srchval value=""><br>
            <input type=submit value="Search"></p>
</form>

*/

var item = new Array();
var now;

/* Enter as many additional pages that needs to be included in the search. 
    Fill in the additional listings for each page.
*/

// "Page Name","path","Page Title","Many,Key,Words","Descriptive Comments"

c=0;
item[c]=new Array("main.htm","","Nrityanjali - Home Page","home,main,index","NRITYANJALI - Home Page");
c++;
item[c]=new Array("about-us.htm","","About Nrityanjali","about, institute, profile","NRITYANJALI - The Institute of Music, Dance, Dramatics, Personality Development & Management Services");
c++;
item[c]=new Array("founder.htm","","Founder Director of Nrityanjali","doctorate, personality, development,personality development, self development, self improvement, management, management services, music, dance, dramatics, artist, professional artist group, performances, stage performances","Know our founder Director Dr. Tushar Guha");
c++; 
item[c]=new Array("pdc.htm","","Personality Development Courses","courses, personality, personality development, self analysis, self development, self improvement, professional development,  management, time management, meditation, voice modulation", "Nrityanjali - Personality Development Courses for Students, Teachers, Housewives, Managers & Professionals.");
c++; 
item[c]=new Array("arts.htm","","Performing Arts","arts, music, dance, dramatics,professional, artist group, stage performances, classical dance,indian classical dance,kathak, bharat natyam, bn", "Nrityanjali specialises in classical dances and folk dances from various states of India.");
c++; 
item[c]=new Array("performance.htm","","Nrityanjali Performances","folk dance, vocal, arts, music, dance, dramatics, professional artist group, stage performances, classical dance,indian classical dance,kathak, bharat natyam", "Performances by Nrityanjali since 1972");
c++; 
item[c]=new Array("pmp.htm","","Parichay Mein Parichay (PMP)","pmp, magazine, quarterly magazine, house magazine", "Parichay Mein Parichay (PMP) - The Quarterly House Magazine of Nrityanjali");
c++; 
item[c]=new Array("fest.htm","","Nrityanjali Fest 2001 Inter-School Competitions","competitions,western zone, central zone, navi mumbai zone, folk dance, vocal, arts, music, dance, dramatics", "NRITYANJALI Fest Inter-school Competitions - the Mega Event in Mumbai, Navi Mumbai and Thane District in December 2001");
c++; 
item[c]=new Array("comments.htm","http://nrityanjali.freeservers.com/","Comments and Suggestion","comments, suggestions, feedback", "Comments & Feedback Form");

// search for book marks
// in main.htm
c++; 
item[c]=new Array("main.htm#contact_nrityanjali","","Contact Nrityanjali","nrityanjali,contact, tele, address", "Nrityanjali contact Information......");

// in arts.htm
c++; 
item[c]=new Array("arts.htm#ClassicalDances","","Classical Dance Forms","dance, professional artist, stage performances, classical dance,indian classical dance,kathak, bharat natyam", "Nrityanjali offers performances in Kathak dance, Bharatnatyam dance, Kuchipudi dance....");

// in pdc.htm
c++; 
item[c]=new Array("pdc.htm#ProgrammesHeld","","Personality Development Courses Held","programmes held, courses, personality, personality development, self analysis, self development, self improvement, professional development,  management, time management, meditation, voice modulation", "Nrityanjali - Personality Development Courses for Students, Teachers, Housewives, Managers & Professionals.");

//in fest.htm
c++; 
item[c]=new Array("fest.htm#Central","","Nrityanjali Fest 2001 - Cental Zone","competitions,central zone", "NRITYANJALI Fest Inter-school Competitions Cental Zone Details");
c++; 
item[c]=new Array("fest.htm#Western","","Nrityanjali Fest 2001 - Western Zone","competitions,western zone", "NRITYANJALI Fest Inter-school Competitions Western Zone Details");
c++; 
item[c]=new Array("fest.htm#NaviMumbai","","Nrityanjali Fest 2001 - Navi Mumbai Zone","competitions,navi mumbai zone", "NRITYANJALI Fest Inter-school Competitions Navi Mumbai Zone Details");


page="<html><head><title>Search Results</title><SCRIPT LANGUAGE=JavaScript>function closeRemote() { timer = setTimeout('window.close();', 10); }</SCRIPT></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=80%>";

function search(frm) 
{
	now = new Date();
	self.name = now; // names current window as current date & time

	win = window.open("","","scrollbars,width=550,height=400");
	win.document.write(page);
	win.document.write("Search Result for : <b>" + frm.srchval.value+ "</b>");

	txt = frm.srchval.value.split(" ");

	fnd = new Array(); total=0;
	for (i = 0; i < item.length; i++) 
	{
		fnd[i] = 0; order = new Array(0, 4, 2, 3);
		for (j = 0; j < order.length; j++)
		for (k = 0; k < txt.length; k++)

		if (item[i][order[j]].toLowerCase().indexOf(txt[k].toLowerCase()) > -1 && txt[k] != "")
			fnd[i] += (j+1);
	}

	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, n);
		fnd[w] = 0;
	}

	win.document.write("</table><br>Total found: "+total+"<br><a href=' ' onClick='window.close();'>Close this Window</a></body></html>");
	win.document.close();
}

function show(which,wind,num) 
{
	link = item[which][1] + item[which][0]; 
/*	line = "<tr><td><a href='"+link+"' target='mainWind' onClick='closeRemote();'>"+item[which][2]+"</a> Score: "+num+"<br>";
*/
	line = "<tr><td><a href='"+link+"' target='" +now+"' onClick='closeRemote();'>"+item[which][2]+"</a> Score: "+num+"<br>";
//	line += item[which][4] + "<br>"+link+"</td></tr>";
	line += item[which][4] + "</td></tr>";

	wind.document.write(line);
	return 1;
}


