/* Product Finder JS */

var iApplication = iWavelength = iIsolation = 0;
var pfOrder = "";
var pfStep = 1;
var strPFOutput = "";
var pfLocked = false;

//called by body.onload event
function loadPFDisplay() {
	parseQueryString();
	
	sortDisplays();
	
	swapHTML("pfDisplay",strPFOutput);
	
	filterProductMatrix();
}

function parseQueryString() {
	var qs = location.search;
	
	if (qs.indexOf("app=")!=-1) {
		iApplication = parseInt(qs.substr(qs.indexOf("app=")+4,1));
	}
	if (qs.indexOf("wav=")!=-1) {
		iWavelength = parseInt(qs.substr(qs.indexOf("wav=")+4,1));
	}
	if (qs.indexOf("iso=")!=-1) {
		iIsolation = parseInt(qs.substr(qs.indexOf("iso=")+4,1));
	}
	
	if (qs.indexOf("order=")!=-1) {
		pfOrder = qs.substr(qs.indexOf("order=")+6,1);
	}
	
	if (qs.indexOf("step=")!=-1) {
		pfStep = qs.substr(qs.indexOf("step=")+5,1);
	}
}

var strProductsHTML = "";
strProductsHTML += '<table cellpadding="0" cellspacing="0" border="0" width="444">';
strProductsHTML += '<tr><td>';
strProductsHTML += '<a href="/products/flatpak_isolator.shtml"><img src="/images/level2/products/pfbtn_flatpak_on.gif" width="82" height="65" alt="Flatpak Isolator" name="pfflatpak" border="0" /></a>';
strProductsHTML += '<img src="/images/spacer.gif" width="8" height="1" border="0" alt="" />';
strProductsHTML += '<a href="/products/round_mini_isolator.shtml"><img src="/images/level2/products/pfbtn_mini_on.gif" width="82" height="65" border="0" alt="Round Mini Isolator" name="pfmini" /></a>';
strProductsHTML += '<img src="/images/spacer.gif" width="8" height="1" border="0" alt="" />';
strProductsHTML += '<a href="/products/large_aperture_free_space_isolator.shtml"><img src="/images/level2/products/pfbtn_aperture_on.gif" width="82" height="65" border="0" alt="Large Aperture Free Space Isolator" name="pfaperture" /></a>';
strProductsHTML += '<img src="/images/spacer.gif" width="8" height="1" border="0" alt="" />';
strProductsHTML += '<a href="/products/periodically_poled_lithium_niobate.shtml"><img src="/images/level2/products/pfbtn_poled_on.gif" width="82" height="65" border="0" alt="Periodically Poled Lithium Niobate" name="pfpoled" /></a>';
strProductsHTML += '<img src="/images/spacer.gif" width="8" height="1" border="0" alt="" />';
strProductsHTML += '<a href="/products/faraday_rotator_mirror.shtml"><img src="/images/level2/products/pfbtn_faraday_on.gif" width="82" height="65" border="0" alt="Faraday Rotator Mirror" name="pffaraday" /></a>';
strProductsHTML += '</td></tr>';
strProductsHTML += '</table>';

function sortDisplays() {
	if (pfStep==1) {
		switch (pfOrder) {
			case "a":
				iApplication = 1;
				preloadAppImages();
				strPFOutput += buildApplicationDisplay(iApplication,1,true,"wav");
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
			case "w":
				iWavelength = 1;
				preloadWavImages();
				strPFOutput += buildWavelengthDisplay(iWavelength,1,true,"app");
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
			case "i":
				iIsolation = 1;
				preloadIsoImages();
				strPFOutput += buildIsolationDisplay(iIsolation,1,true,"app");
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
			default:
				iApplication = 1;
				preloadAppImages();
				strPFOutput += buildApplicationDisplay(iApplication,1,true,"wav");
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
		}
	} else if (pfStep==2) {
		switch (pfOrder) {
			case "a":
				iWavelength = 1;
				preloadWavImages();
				strPFOutput += buildApplicationDisplay(iApplication,1,false);
				strPFOutput += '<br />';
				strPFOutput += buildWavelengthDisplay(iWavelength,2,true,"iso");
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
			case "w":
				iApplication = 1;
				preloadAppImages();
				strPFOutput += buildWavelengthDisplay(iWavelength,1,false);
				strPFOutput += '<br />';
				strPFOutput += buildApplicationDisplay(iApplication,2,true,"iso");
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
			case "i":
				iApplication = 1;
				preloadAppImages();
				strPFOutput += buildIsolationDisplay(iIsolation,1,false);
				strPFOutput += '<br />';
				strPFOutput += buildApplicationDisplay(iApplication,2,true,"wav");
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
			default:
				iWavelength = 1;
				preloadWavImages();
				strPFOutput += buildApplicationDisplay(iApplication,1,false);
				strPFOutput += '<br />';
				strPFOutput += buildWavelengthDisplay(iWavelength,2,true,"iso");
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
		}
	} else if (pfStep==3) {
		switch (pfOrder) {
			case "a":
				iIsolation = 1;
				preloadIsoImages();
				strPFOutput += buildApplicationDisplay(iApplication,1,false);
				strPFOutput += '<br />';
				strPFOutput += buildWavelengthDisplay(iWavelength,2,false);
				strPFOutput += '<br />';
				strPFOutput += buildIsolationDisplay(iIsolation,3,true);
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
			case "w":
				iIsolation = 1;
				preloadIsoImages();
				strPFOutput += buildWavelengthDisplay(iWavelength,1,false);
				strPFOutput += '<br />';
				strPFOutput += buildApplicationDisplay(iApplication,2,false);
				strPFOutput += '<br />';
				strPFOutput += buildIsolationDisplay(iIsolation,3,true);
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
			case "i":
				iWavelength = 1;
				preloadWavImages();
				strPFOutput += buildIsolationDisplay(iIsolation,1,false);
				strPFOutput += '<br />';
				strPFOutput += buildApplicationDisplay(iApplication,2,false);
				strPFOutput += '<br />';
				strPFOutput += buildWavelengthDisplay(iWavelength,3,true);
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
			default:
				iIsolation = 1;
				preloadIsoImages();
				strPFOutput += buildApplicationDisplay(iApplication,1,false);
				strPFOutput += '<br />';
				strPFOutput += buildWavelengthDisplay(iWavelength,2,false);
				strPFOutput += '<br />';
				strPFOutput += buildIsolationDisplay(iIsolation,3,true);
				strPFOutput += '<br />';
				strPFOutput += strProductsHTML;
				break;
		}
	}
}

function buildApplicationDisplay(index,order,currentDisplay,next) {
	// build the currently displayed image suffix
	var hl = new Array("","","","","","","","");
	hl[index] = "_hl";
	
	if (!currentDisplay) {
		for (i=0;i<hl.length;i++) {
			hl[i] = hl[i] + "_inact";
		}
	}
	
	// build the mouseover event
	var aBegin = new Array("","","","","","","","");
	var aEnd = new Array("","","","","","","","");
	if (currentDisplay) {
		aBegin[1] = '<a href="javascript:void(lockSelection(\'app1\'));" onmouseover="if (!pfLocked) {iApplication=1;filterProductMatrix();clearPFImages(\'app\');swapPFImage(\'app1\',\'/images/level2/products/pfbtn_app1_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_app1.gif\');}" onfocus="this.blur();">';
		aBegin[2] = '<a href="javascript:void(lockSelection(\'app2\'));" onmouseover="if (!pfLocked) {iApplication=2;filterProductMatrix();clearPFImages(\'app\');swapPFImage(\'app2\',\'/images/level2/products/pfbtn_app2_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_app2.gif\');}" onfocus="this.blur();">';
		aBegin[3] = '<a href="javascript:void(lockSelection(\'app3\'));" onmouseover="if (!pfLocked) {iApplication=3;filterProductMatrix();clearPFImages(\'app\');swapPFImage(\'app3\',\'/images/level2/products/pfbtn_app3_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_app3.gif\');}" onfocus="this.blur();">';
		aBegin[4] = '<a href="javascript:void(lockSelection(\'app4\'));" onmouseover="if (!pfLocked) {iApplication=4;filterProductMatrix();clearPFImages(\'app\');swapPFImage(\'app4\',\'/images/level2/products/pfbtn_app4_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_app4.gif\');}" onfocus="this.blur();">';
		aBegin[5] = '<a href="javascript:void(lockSelection(\'app5\'));" onmouseover="if (!pfLocked) {iApplication=5;filterProductMatrix();clearPFImages(\'app\');swapPFImage(\'app5\',\'/images/level2/products/pfbtn_app5_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_app5.gif\');}" onfocus="this.blur();">';
		for (i=1;i<=5;i++) {
			aEnd[i] = '</a>';
		}
	}
		
	var output = "";
	output += '<table cellpadding="0" cellspacing="0" border="0" width="444">';
	output += '<tr><td colspan="5">';
	output += '<p><span class="subheadPF">'+order+'. Select Your Application</span></p>';
	output += '<p>From the choices below, select the application for which you need a product.<br />&nbsp;</p>';
	output += '</td></tr>';
	
	var str = new Array();
	str[str.length] = '<tr>';
	str[str.length] = '<td>'+aBegin[1]+'<img src="/images/level2/products/pfbtn_app1'+hl[1]+'.gif" width="84" height="26" border="0" alt="Semiconductor Laser Modules" name="app1" />'+aEnd[1]+'</td>';
	str[str.length] = '<td>'+aBegin[2]+'<img src="/images/level2/products/pfbtn_app2'+hl[2]+'.gif" width="92" height="26" border="0" alt="Tunable Laser Modules" name="app2" />'+aEnd[2]+'</td>';
	str[str.length] = '<td>'+aBegin[3]+'<img src="/images/level2/products/pfbtn_app3'+hl[3]+'.gif" width="110" height="26" border="0" alt="Automation Compliant Modules" name="app3" />'+aEnd[3]+'</td>';
	str[str.length] = '<td>'+aBegin[4]+'<img src="/images/level2/products/pfbtn_app4'+hl[4]+'.gif" width="64" height="26" border="0" alt="Optical Sensing" name="app4" />'+aEnd[4]+'</td>';
	str[str.length] = '<td>'+aBegin[5]+'<img src="/images/level2/products/pfbtn_app5'+hl[5]+'.gif" width="94" height="26" border="0" alt="Optical Test/Instrumentation" name="app5" />'+aEnd[5]+'</td>';
	str[str.length] = '</tr>';
	str[str.length] = '</table>';
	for (i=0;i<str.length;i++) {
		output += str[i];
	}
	
	var infoBox = "pfinfo_app"+index;
	var borderColor = (currentDisplay)?"#cf1040":"#cccccc";
	var nextBtn = (currentDisplay)?next:"";
	// build the bottom "info" box
	output += buildInfoDisplay(infoBox,borderColor,nextBtn,currentDisplay);
	
	return output;
}

function buildWavelengthDisplay(index,order,currentDisplay,next) {
	var hl = new Array("","","","","","","");
	hl[index] = "_hl";
	
	if (!currentDisplay) {
		for (i=0;i<hl.length;i++) {
			hl[i] = hl[i] + "_inact";
		}
	}
	
	var aBegin = new Array("","","","","","","");
	var aEnd = new Array("","","","","","","");
	if ((currentDisplay)&&(iApplication>0)) {
		aBegin[1] = '<a href="javascript:void(lockSelection(\'wav1\'));" onmouseover="if (!pfLocked) {iWavelength=1;filterProductMatrix();clearPFImages(\'wav\');swapPFImage(\'wav1\',\'/images/level2/products/pfbtn_wav1_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_app'+iApplication+'wav1.gif\');}" onfocus="this.blur();">';
		aBegin[2] = '<a href="javascript:void(lockSelection(\'wav2\'));" onmouseover="if (!pfLocked) {iWavelength=2;filterProductMatrix();clearPFImages(\'wav\');swapPFImage(\'wav2\',\'/images/level2/products/pfbtn_wav2_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_app'+iApplication+'wav2.gif\');}" onfocus="this.blur();">';
		aBegin[3] = '<a href="javascript:void(lockSelection(\'wav3\'));" onmouseover="if (!pfLocked) {iWavelength=3;filterProductMatrix();clearPFImages(\'wav\');swapPFImage(\'wav3\',\'/images/level2/products/pfbtn_wav3_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_app'+iApplication+'wav3.gif\');}" onfocus="this.blur();">';
		aBegin[4] = '<a href="javascript:void(lockSelection(\'wav4\'));" onmouseover="if (!pfLocked) {iWavelength=4;filterProductMatrix();clearPFImages(\'wav\');swapPFImage(\'wav4\',\'/images/level2/products/pfbtn_wav4_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_app'+iApplication+'wav4.gif\');}" onfocus="this.blur();">';
		for (i=1;i<=4;i++) {
			aEnd[i] = '</a>';
		}
	} else if (currentDisplay) {
		aBegin[1] = '<a href="javascript:void(lockSelection(\'wav1\'));" onmouseover="if (!pfLocked) {iWavelength=1;filterProductMatrix();clearPFImages(\'wav\');swapPFImage(\'wav1\',\'/images/level2/products/pfbtn_wav1_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_wav1.gif\');}" onfocus="this.blur();">';
		aBegin[2] = '<a href="javascript:void(lockSelection(\'wav2\'));" onmouseover="if (!pfLocked) {iWavelength=2;filterProductMatrix();clearPFImages(\'wav\');swapPFImage(\'wav2\',\'/images/level2/products/pfbtn_wav2_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_wav2.gif\');}" onfocus="this.blur();">';
		aBegin[3] = '<a href="javascript:void(lockSelection(\'wav3\'));" onmouseover="if (!pfLocked) {iWavelength=3;filterProductMatrix();clearPFImages(\'wav\');swapPFImage(\'wav3\',\'/images/level2/products/pfbtn_wav3_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_wav3.gif\');}" onfocus="this.blur();">';
		aBegin[4] = '<a href="javascript:void(lockSelection(\'wav4\'));" onmouseover="if (!pfLocked) {iWavelength=4;filterProductMatrix();clearPFImages(\'wav\');swapPFImage(\'wav4\',\'/images/level2/products/pfbtn_wav4_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_wav4.gif\');}" onfocus="this.blur();">';
		for (i=1;i<=4;i++) {
			aEnd[i] = '</a>';
		}
	}
	
	var output = "";
	output += '<table cellpadding="0" cellspacing="0" border="0" width="444">';
	output += '<tr><td colspan="4">';
	output += '<p><span class="subheadPF">'+order+'. Select Your Wavelength</span></p>';
	output += '<p>From the choices below, select the wavelength you need.<br />&nbsp;</p>';
	output += '</td></tr>';
	
	var str = new Array();
	str[str.length] = '<tr>';
	str[str.length] = '<td>'+aBegin[1]+'<img src="/images/level2/products/pfbtn_wav1'+hl[1]+'.gif" width="111" height="26" border="0" alt="500-1000nm" name="wav1" />'+aEnd[1]+'</td>';
	str[str.length] = '<td>'+aBegin[2]+'<img src="/images/level2/products/pfbtn_wav2'+hl[2]+'.gif" width="110" height="26" border="0" alt="1000-1500nm" name="wav2" />'+aEnd[2]+'</td>';
	str[str.length] = '<td>'+aBegin[3]+'<img src="/images/level2/products/pfbtn_wav3'+hl[3]+'.gif" width="115" height="26" border="0" alt="1500-2000nm" name="wav3" />'+aEnd[3]+'</td>';
	str[str.length] = '<td>'+aBegin[4]+'<img src="/images/level2/products/pfbtn_wav4'+hl[4]+'.gif" width="108" height="26" border="0" alt="2000-2500nm" name="wav4" />'+aEnd[4]+'</td>';
	str[str.length] = '</tr>';
	str[str.length] = '</table>';
	for (i=0;i<str.length;i++) {
		output += str[i];
	}
	
	var infoBox = (iApplication>0)?"pfinfo_app"+iApplication+"wav"+index:"pfinfo_wav"+index;
	var borderColor = (currentDisplay)?"#cf1040":"#cccccc";
	var nextBtn = (currentDisplay)?next:"";
	output += buildInfoDisplay(infoBox,borderColor,nextBtn,currentDisplay);
	
	return output;
}

function buildIsolationDisplay(index,order,currentDisplay,next) {
	var hl = new Array("","","","","","","","","");
	hl[index] = "_hl";
	
	if (!currentDisplay) {
		for (i=0;i<hl.length;i++) {
			hl[i] = hl[i] + "_inact";
		}
	}
	
	var aBegin = new Array("","","","","","","","","");
	var aEnd = new Array("","","","","","","","","");
	if (currentDisplay) {
		aBegin[1] = '<a href="javascript:void(lockSelection(\'iso1\'));" onmouseover="if (!pfLocked) {iIsolation=1;filterProductMatrix();clearPFImages(\'iso\');swapPFImage(\'iso1\',\'/images/level2/products/pfbtn_iso1_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_iso1.gif\');}" onfocus="this.blur();">';
		aBegin[2] = '<a href="javascript:void(lockSelection(\'iso2\'));" onmouseover="if (!pfLocked) {iIsolation=2;filterProductMatrix();clearPFImages(\'iso\');swapPFImage(\'iso2\',\'/images/level2/products/pfbtn_iso2_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_iso2.gif\');}" onfocus="this.blur();">';
		aBegin[3] = '<a href="javascript:void(lockSelection(\'iso3\'));" onmouseover="if (!pfLocked) {iIsolation=3;filterProductMatrix();clearPFImages(\'iso\');swapPFImage(\'iso3\',\'/images/level2/products/pfbtn_iso3_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_iso3.gif\');}" onfocus="this.blur();">';
		aBegin[4] = '<a href="javascript:void(lockSelection(\'iso4\'));" onmouseover="if (!pfLocked) {iIsolation=4;filterProductMatrix();clearPFImages(\'iso\');swapPFImage(\'iso4\',\'/images/level2/products/pfbtn_iso4_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_iso4.gif\');}" onfocus="this.blur();">';
		aBegin[5] = '<a href="javascript:void(lockSelection(\'iso5\'));" onmouseover="if (!pfLocked) {iIsolation=5;filterProductMatrix();clearPFImages(\'iso\');swapPFImage(\'iso5\',\'/images/level2/products/pfbtn_iso5_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_iso5.gif\');}" onfocus="this.blur();">';
		aBegin[6] = '<a href="javascript:void(lockSelection(\'iso6\'));" onmouseover="if (!pfLocked) {iIsolation=6;filterProductMatrix();clearPFImages(\'iso\');swapPFImage(\'iso6\',\'/images/level2/products/pfbtn_iso6_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_iso6.gif\');}" onfocus="this.blur();">';
		aBegin[7] = '<a href="javascript:void(lockSelection(\'iso7\'));" onmouseover="if (!pfLocked) {iIsolation=7;filterProductMatrix();clearPFImages(\'iso\');swapPFImage(\'iso7\',\'/images/level2/products/pfbtn_iso7_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_iso7.gif\');}" onfocus="this.blur();">';
		aBegin[8] = '<a href="javascript:void(lockSelection(\'iso8\'));" onmouseover="if (!pfLocked) {iIsolation=8;filterProductMatrix();clearPFImages(\'iso\');swapPFImage(\'iso8\',\'/images/level2/products/pfbtn_iso8_hl.gif\',\'pfinfo\',\'/images/level2/products/pfinfo_iso8.gif\');}" onfocus="this.blur();">';
		for (i=1;i<=8;i++) {
			aEnd[i] = '</a>';
		}
	}
	
	var output = "";
	output += '<table cellpadding="0" cellspacing="0" border="0" width="444">';
	output += '<tr><td colspan="8">';
	output += '<p><span class="subheadPF">'+order+'. Select Your Typical Isolation</span></p>';
	output += '<p>From the choices below, select the isolation you need.<br />&nbsp;</p>';
	output += '</td></tr>';
	
	var str = new Array();
	str[str.length] = '<tr>';
	str[str.length] = '<td>'+aBegin[1]+'<img src="/images/level2/products/pfbtn_iso1'+hl[1]+'.gif" width="55" height="26" border="0" alt=">=35db" name="iso1" />'+aEnd[1]+'</td>';
	str[str.length] = '<td>'+aBegin[2]+'<img src="/images/level2/products/pfbtn_iso2'+hl[2]+'.gif" width="56" height="26" border="0" alt=">=40db" name="iso2" />'+aEnd[2]+'</td>';
	str[str.length] = '<td>'+aBegin[3]+'<img src="/images/level2/products/pfbtn_iso3'+hl[3]+'.gif" width="55" height="26" border="0" alt=">=43db" name="iso3" />'+aEnd[3]+'</td>';
	str[str.length] = '<td>'+aBegin[4]+'<img src="/images/level2/products/pfbtn_iso4'+hl[4]+'.gif" width="56" height="26" border="0" alt=">=50db" name="iso4" />'+aEnd[4]+'</td>';
	str[str.length] = '<td>'+aBegin[5]+'<img src="/images/level2/products/pfbtn_iso5'+hl[5]+'.gif" width="55" height="26" border="0" alt=">=60db" name="iso5" />'+aEnd[5]+'</td>';
	str[str.length] = '<td>'+aBegin[6]+'<img src="/images/level2/products/pfbtn_iso6'+hl[6]+'.gif" width="56" height="26" border="0" alt=">=65db" name="iso6" />'+aEnd[6]+'</td>';
	str[str.length] = '<td>'+aBegin[7]+'<img src="/images/level2/products/pfbtn_iso7'+hl[7]+'.gif" width="55" height="26" border="0" alt=">=70db" name="iso7" />'+aEnd[7]+'</td>';
	str[str.length] = '<td>'+aBegin[8]+'<img src="/images/level2/products/pfbtn_iso8'+hl[8]+'.gif" width="56" height="26" border="0" alt=">=75db" name="iso8" />'+aEnd[8]+'</td>';
	str[str.length] = '</tr>';
	str[str.length] = '</table>';
	for (i=0;i<str.length;i++) {
		output += str[i];
	}
	
	var infoBox = "pfinfo_iso"+index;
	var borderColor = (currentDisplay)?"#cf1040":"#cccccc";
	var nextBtn = (currentDisplay)?next:"";
	output += buildInfoDisplay(infoBox,borderColor,nextBtn,currentDisplay);
	
	return output;
}

// function to build lower half of display boxes
function buildInfoDisplay(info,borderColor,nextBtn,currentDisplay) {
	var str = new Array();
	str[str.length] = '<table cellpadding="0" cellspacing="0" border="0" width="444">';
	str[str.length] = '<tr>';
	str[str.length] = '<td bgcolor="'+borderColor+'" rowspan="3"><img src="/images/spacer.gif" width="2" height="1" border="0" alt="" /></td>';
	str[str.length] = '<td><img src="/images/spacer.gif" width="1" height="5" border="0" alt="" /><br />';
	str[str.length] = (currentDisplay)?'<img src="/images/spacer.gif" width="299" height="15" border="0" alt="" /><a href="javascript:void(unlockSelection());" onfocus="this.blur();"><img src="/images/spacer.gif" width="136" height="15" border="0" alt="" name="unlock" /></a><img src="/images/spacer.gif" width="5" height="15" border="0" alt="" /><br />':'<img src="/images/spacer.gif" width="440" height="15" border="0" alt="" />';
	str[str.length] = '<img src="/images/spacer.gif" width="1" height="5" border="0" alt="" /></td>';
	str[str.length] = '<td bgcolor="'+borderColor+'" rowspan="3"><img src="/images/spacer.gif" width="2" height="1" border="0" alt="" /></td>';
	str[str.length] = '</tr>';
	str[str.length] = '<tr>';
	str[str.length] = '<td bgcolor="#ffffff">';
	str[str.length] = '<img src="/images/spacer.gif" width="20" height="1" border="0" alt="" />';
	str[str.length] = '<img src="/images/level2/products/'+info+'.gif" width="400" height="40" border="0" alt="" name="pfinfo" /><br />';
	str[str.length] = buildNextButton(nextBtn);
	str[str.length] = '</td>';
	str[str.length] = '</tr>';
	str[str.length] = '<tr>';
	str[str.length] = '<td bgcolor="'+borderColor+'"><img src="/images/spacer.gif" width="440" height="2" border="0" alt="" /></td>';
	str[str.length] = '</tr>';
	str[str.length] = '</table>';
	
	var output="";
	for (i=0;i<str.length;i++) {
		output += str[i];
	}
	
	return output;
}

function buildNextButton(section) {
	var str = "";
	switch (section) {
		case "app":
			str += '<img src="/images/spacer.gif" width="1" height="20" border="0" alt="" /><br />';
			str += '<table cellpadding="0" cellspacing="0" border="0">';
			str += '<tr>';
			str += '<td><img src="/images/spacer.gif" width="20" height="1" border="0" alt="" /><a href="#" onclick="showNextPF();return false;">Show Application?</a></td>';
			str += '<td><img src="/images/spacer.gif" width="5" height="1" border="0" alt="" /><a href="#" onclick="showNextPF();"><img src="/images/level2/products/btn_nextpfdisplay.gif" width="22" height="22" border="0" alt="" /></a></td>';
			str += '</tr>';
			str += '<tr><td colspan="2"><img src="/images/spacer.gif" width="1" height="10" border="0" alt="" /></td></tr>';
			str += '</table>';
			break;
		case "wav":
			str += '<img src="/images/spacer.gif" width="1" height="20" border="0" alt="" /><br />';
			str += '<table cellpadding="0" cellspacing="0" border="0">';
			str += '<tr>';
			str += '<td><img src="/images/spacer.gif" width="20" height="1" border="0" alt="" /><a href="#" onclick="showNextPF();return false;">Show Wavelength?</a></td>';
			str += '<td><img src="/images/spacer.gif" width="5" height="1" border="0" alt="" /><a href="#" onclick="showNextPF();"><img src="/images/level2/products/btn_nextpfdisplay.gif" width="22" height="22" border="0" alt="" /></a></td>';
			str += '</tr>';
			str += '<tr><td colspan="2"><img src="/images/spacer.gif" width="1" height="10" border="0" alt="" /></td></tr>';
			str += '</table></td>';
			break;
		case "iso":
			str += '<img src="/images/spacer.gif" width="1" height="20" border="0" alt="" /><br />';
			str += '<table cellpadding="0" cellspacing="0" border="0">';
			str += '<tr>';
			str += '<td><img src="/images/spacer.gif" width="20" height="1" border="0" alt="" /><a href="#" onclick="showNextPF();return false;">Show Isolation?</a></td>';
			str += '<td><img src="/images/spacer.gif" width="5" height="1" border="0" alt="" /><a href="#" onclick="showNextPF();"><img src="/images/level2/products/btn_nextpfdisplay.gif" width="22" height="22" border="0" alt="" /></a></td>';
			str += '</tr>';
			str += '<tr><td colspan="2"><img src="/images/spacer.gif" width="1" height="10" border="0" alt="" /></td></tr>';
			str += '</table></td>';
			break;
		default:
			str += '<img src="/images/spacer.gif" width="1" height="20" border="0" alt="" /></td>';
			break;
	}
	return str;
}

function lockSelection(sel) {
	if (sel.substr(0,3)=="app") {
		iApplication = parseInt(sel.substr(3));
	} else if (sel.substr(0,3)=="wav") {
		iWavelength = parseInt(sel.substr(3));
	} else if (sel.substr(0,3)=="iso") {
		iIsolation = parseInt(sel.substr(3));
	}
	filterProductMatrix();
	clearPFImages(sel.substr(0,3));
	swapPFImage(sel,"/images/level2/products/pfbtn_"+sel+"_hl.gif","pfinfo","/images/level2/products/pfinfo_"+sel+".gif","unlock","/images/level2/products/pf_unlock.gif");
	pfLocked = true;
}

function unlockSelection() {
	swapPFImage("unlock","/images/spacer.gif");
	pfLocked = false;
}

// assembles a URL based on the user's choice and reloads the page
function showNextPF() {
	url = "/products/product_finder.shtml?step="+(parseInt(pfStep)+1);
	url += (pfOrder!="")?"&order="+pfOrder:"";
	url += (iApplication>0)?"&app="+iApplication:"";
	url += (iWavelength>0)?"&wav="+iWavelength:"";
	url += (iIsolation>0)?"&iso="+iIsolation:"";
	
	//alert(url);
	location.replace(url);
}

function swapPFImage() {
	if (isNS4) {
		for(var i=0;i<arguments.length;i++) {
			document.pfDisplay.document.images[arguments[i]].src = arguments[i+1];
			++i;
		}
	} else {
		for(var i=0;i<arguments.length;i++) {
			document.images[arguments[i]].src = arguments[i+1];
			++i;
		}
	}
}

function clearPFImages(section) {
	counter = (section=="app")?5:(section=="wav")?4:(section=="iso")?8:-1;
	for (i=1;i<counter+1;i++) {
		swapPFImage(section+i,"/images/level2/products/pfbtn_"+section+i+".gif");
	}
}
