

function search(frm) 
{
	win = window.open("","","scrollbars,status,resizable")

	win.document.write("<html><head><title>Search Results</title>" + String.fromCharCode(13))
	win.document.write("<link rel='stylesheet' type='text/css' href='http://cp.agilent.com/agilent/css4/agilent4.css'></head>" + String.fromCharCode(13))
	win.document.write("<body bgcolor='white'><h1>DoC Search Results</h1>" + String.fromCharCode(13))
	win.document.write("<hr size=1 noshade>" + String.fromCharCode(13))
	
	if(frm.srchval.value.length > 0)
	{
		win.document.write("The database contains a total of " + products.length + " products." + String.fromCharCode(13))
		win.document.write("The following products were found when searching for '" + frm.srchval.value + "':" + String.fromCharCode(13))

		win.document.write("<table border=0 cellspacing=5 width='90%'>" + String.fromCharCode(13))
		win.document.write("<tr><td><b>PN</b></td><td><b>Description</b></td><td><b>File Name</b></td><td><b>DoC Date</b></td></tr>" + String.fromCharCode(13))

		searchStrings=frm.srchval.value.toLowerCase().split(" ");
		
		total = 0
		for(i=0;i<products.length;++i)
		{
			isSearched = true;
			PN = products[i][0].toLowerCase();
			Desc = products[i][2].toLowerCase();
			for(iString=0;iString<searchStrings.length;++iString)
			{
				searchString = searchStrings[iString];
				if(PN.indexOf(searchString)<0 && Desc.indexOf(searchString)<0) isSearched = false;
			}
			if(isSearched) {total++;show(win,i);}
		}
	
		win.document.write("</table><br>" + String.fromCharCode(13))
		win.document.write("<b>Total number of products found: " + total + "</b>" + String.fromCharCode(13))

	} else {
		win.document.write("<b>No search criteria specified.</b><br></" +  String.fromCharCode(66) + "ody></html>" + String.fromCharCode(13))
		//win.document.write("<b>No search criteria specified.</b><br>&lt;/body&gt;</html>" + String.fromCharCode(13))
		//win.document.write("<b>No search criteria specified.</b><br></body></html>" + String.fromCharCode(13))
	}
	
	win.document.write("<hr size=1 noshade>" + String.fromCharCode(13))
	win.document.write("</html>" + String.fromCharCode(13))
	win.document.close();

	return true;
}

function show(win,which) 
{
	pn = products[which][0];
	link = products[which][1]; 
	name = products[which][2];
	date = products[which][3];

	line = "<tr>";
	if(link.length > 5){
		if(link.substr(0,5) == "!REQ:"){
		    line += "<td colspan=1 valign=top style='color:#C08080;width=20%'><b>" + pn + "</b></td>"
		    line += "<td colspan=3 style='color:#C08080;'>"
		    if(name!="N/A") line += name
		    else line += "(name not specified)"
		    line +=  ": "
		    line += "<b><i>A declaration of Conformity for this model, product, accessory or component is not required by EU law.</i></b><br>";
		} else {
			line += "<td valign=top style='width=20%'>" + "<a href='http://regulations.corporate.agilent.com/DoC/" + link + "'>" + pn + "</a></td>";
		    //line += "<td valign=top style='width=20%'>" + "<a href='" + link + "'>" + pn + "</a></td>";
		    line += "<td style='width=40%'>" + name + "</td><td style='width=20%'>" + link + "</td><td style='width=20%'>" + date + "</td></tr>";
		}
	} else if(link == "N/A"){
	    line += "<td colspan=1 valign=top style='color:#f08080;'><b>" + pn + "</b></td>"
	    line += "<td colspan=3 style='color:#f08080;'>" + name + ": "
	    line += "<b><i>The system couldn't download a Declaration of Conformity for this model.</i></b><br>";
	    line += "<font size='1'>Please contact your local Agilent representative obtain the declaration.</font></td></tr>";
	} else {
	    line += "<td valign=top style='width=20%'>" + "<a href='" + link + "'>" + pn + "</a></td>";
	    line += "<td style='width=40%'>" + name + "</td><td style='width=20%'>" + link + "</td><td style='width=20%'>" + date + "</td></tr>";
	}
	line += "</font></td></tr>";

	win.document.write(line);
	return true;
}