geowick07
10+ year member
CarAudio.com Veteran
x3. I loved the old one. Wish i knew someone who had it to download. I would host that thing for all in a second!
<HTML>
<HEAD>
<BASE HREF="http://www.subwoofertools.com/boxprogram.asp">
<title>Subwoofertools.com Custom Subwoofer Enclosure Design</title>
<script language="javascript">
<!--
var req;
function calcQts(theForm)
{
// check to see if all required elements are populated
if(theForm.qes.value!='' && theForm.qms.value!='')
{
// calculate Qts
var myQes = theForm.qes.value * 1;
var myQms = theForm.qms.value * 1;
var myQts = (myQes * myQms) / (myQes + myQms);
theForm.qts.value = myQts;
}
}
function loadBox(theForm)
{
var xmlUrl;
xmlUrl = 'portedsizetuningxml.asp'
// check to see if all required elements are populated
if(theForm.align.options[theForm.align.selectedIndex].value!='custom' && theForm.numw.options[theForm.numw.selectedIndex].value!='' && theForm.dia.options[theForm.dia.selectedIndex].value!='')
{
xmlUrl = 'xml/portedsizetuningxml.asp?align='+theForm.align.options[theForm.align.selectedIndex].value+'&qts='+theForm.qts.value+'&vas='+theForm.vas.value+'&fs='+theForm.fs.value+'&numw='+theForm.numw.value+'&dia='+theForm.dia.value;
//alert(xmlUrl);
loadXMLDoc(xmlUrl);
return true;
}
return false;
}
function handleForm(theForm)
{
var xmlUrl;
xmlUrl = 'frxml.asp';
// check to see if all elements are populated
if(theForm.vb.value!='' && theForm.fb.value!='' && theForm.vas.value!='' && theForm.qts.value!='' && theForm.fs.value!='')
{
//res = theForm.resolution.value
// send xml request to engine
xmlUrl = 'xml/frxml.asp?qts=' + theForm.qts.value + '&fs=' + theForm.fs.value + '&vas=' + theForm.vas.value + '&fb=' + theForm.fb.value + '&vb=' + theForm.vb.value + '&res=24&numw=' + theForm.numw.value;
//alert(xmlUrl);
loadXMLDoc(xmlUrl);
return true;
}// end if
return false;
}// end function
function loadXMLDoc(url){
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest)
{
//alert('DOM');
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
return true;
// branch for IE/Windows ActiveX version
} // end if
else if (window.ActiveXObject)
{
req = new ActiveXObject("MSXML2.XMLHTTP");
if (req)
{
//alert("Microsoft")
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
return true;
}// end if(req)
return false;
}// end if(window.XMLHttpRequest)
return false;
}// end loadXMLDoc
function processReqChange() {
var response;
// only if req shows "complete"
if (req.readyState == 4)
{
// only if "OK"
if (req.status == 200)
{
//alert("We loaded some XML!!!");
response = req.responseXML.documentElement;
var boxstg
boxstg = response.getElementsByTagName('boxstg')[0].firstChild.data;
//alert('boxstg=' + boxstg);
switch(boxstg*1)
{
case 1:
// load up net volume and tuning frequency
xml2VolFreq(response);
break;
case 2:
// draw response curve
drawResponseCurve(response);
break;
default:
alert('Error: handler not ready for stage: ' + boxstg);
break;
}
return true;
}
else
{
alert("There was a problem retrieving the XML data:\n" + req.statusText);
return false;
}// end if(req.status==200)
}// end if(req.readyState==4)
}// end function processReqChange
function xml2VolFreq(xmlresponse)
{
alignMsg = document.getElementById('alignMSG');
alignMsg.innerHTML = xmlresponse.getElementsByTagName('alignmsg')[0].firstChild.data;
fVb = document.getElementById('vb');
fVb.value = xmlresponse.getElementsByTagName('boxVolume')[0].firstChild.data;
fFb = document.getElementById('fb');
fFb.value = xmlresponse.getElementsByTagName('tuningFrequency')[0].firstChild.data;
fFb.focus();
fFb.blur();
return true;
}
function drawResponseCurve(response)
{
var frequencies, decibels, numfreq;
// get all "cycles"
frequencies = response.getElementsByTagName('cycles');
// get all "decibels"
decibels = response.getElementsByTagName('decibels');
numfreq = decibels.length;
// draw table
responseCurveTable = document.createElement('table');
responseCurveTable.cellSpacing = '0';
responseCurveTable.cellPadding = '0';
responseCurveTableBody = document.createElement('tbody');
responseCurveRow = document.createElement('tr');
responseCurveTable.appendChild(responseCurveTableBody);
responseCurveTableBody.appendChild(responseCurveRow);
document.getElementById('outputGraph').innerHTML = '';
document.getElementById('outputGraph').appendChild(responseCurveTable);
// loop through each until graph is drawn.
for(i=0; i<numfreq;i++)
{
curveSectionParent = document.createElement('td');
curveSectionParent.style.width = '4px';
curveSectionParent.style.height = 200;
myTop = 0 - (decibels[i].firstChild.data * 2)
myTop += 26
var sectMsg = 'SPL: ' + decibels[i].firstChild.data + ' dB @ ' + frequencies[i].firstChild.data + 'hz';
curveSectionParent.onmouseover = showMsg(sectMsg);
addCurveSection(curveSectionParent, myTop, '#000000');
addCurveSection(curveSectionParent, 26, '#FF0000');
addCurveSection(curveSectionParent, 32, '#0FF000');
responseCurveRow.appendChild(curveSectionParent);
}// end for(i=0; i<numfreq;i++)
return true;
}
function showMsg(fMsg)
{
var tempMsg;
tempMsg = fMsg;
return function()
{
writeMsg(tempMsg);
}
}
function writeMsg(fMsg)
{
divOutputText = document.getElementById("outputText")
divOutputText.innerHTML = fMsg;
// position outputText to follow mouse
follow;
return true;
}
function loadAlignments(theForm)
{
// check to see if dia is selected
if(theForm.dia.value!=''){
// clear out the alignment drop-down
var alignSelect
alignSelect = document.getElementById('align');
alignSelect.innerHTML = '';
// custom option
addOption(alignSelect, 'custom', 'Custom');
switch(theForm.dia.value*1)
{
case 1:
//6.5" round
case 11:
//18" round
document.getElementById('alignMSG').innerHTML = ""
break;
case 2:
//8" Round
case 3:
//8" square
addOption(alignSelect, 'MC', 'Medium Commercial');
break;
case 4:
//10" round
case 5:
//10" square
case 6:
//12" round
case 7:
//12" square
addOption(alignSelect, 'SC', 'Small Commercial');
addOption(alignSelect, 'MC', 'Medium Commercial');
addOption(alignSelect, 'LC', 'Large Commercial');
break;
case 8:
//13.5" round
case 9:
//15" round
case 10:
//15" square
addOption(alignSelect, 'SC', 'Small Commercial');
break;
default:
alert('Dia value=' + theForm.dia.value);
}
// check to see if big three parameters are populated; add "custom" sizes
if(theForm.vas.value!='' && theForm.qts.value!= '' && theForm.fs.value!='')
{
//QB3
addOption(alignSelect, 'QB3', 'Maximally Flat');
//QB315
addOption(alignSelect, 'QB315', 'SQL');
//QB330
addOption(alignSelect, 'QB330', 'Compact');
//xBass
addOption(alignSelect, 'XBASS', 'xBass (home theater)');
//EBS
addOption(alignSelect, 'EBS', 'QEBS (home theater)');
}
}
return;
}
function addOption(objSelect, fValue, fText)
{
var fOption = document.createElement("option");
fOption.value = fValue;
fOption.appendChild(document.createTextNode(fText));
objSelect.appendChild(fOption);
return;
}
function addCurveSection(curveParent, sectionTop, sectionColor)
{
var fDiv = document.createElement("div");
fDiv.style.position = 'absolute';
fDiv.style.fontSize = '1px';
fDiv.style.top = sectionTop;
fDiv.style.backgroundColor = sectionColor;
fDiv.style.width = '4px';
fDiv.style.height = '2px';
//fDiv.appendChild(document.createTextNode(''));
curveParent.appendChild(fDiv);
}
//-->
</script>
</HEAD>
<BODY>
<h2>SubwooferTools.com Custom Enclosure Design</h2>
<table width="100%">
<tr><td valign="top">
<form id="boxInfo">
<fieldset>
<legend>Woofer</legend>
<table>
<tbody>
<tr><td>Select size:</td>
<td><select id="dia" onChange="loadAlignments(this.form)" TABINDEX="0">
<option value="" selected>Woofer Diameter</option>
<option value="1">6.5" Round</option>
<option value="2">8" Round</option>
<option value="3">8" Square</option>
<option value="4">10" Round</option>
<option value="5">10" Square</option>
<option value="6">12" Round</option>
<option value="7">12" Square</option>
<option value="8">13.5" Round</option>
<option value="9">15" Round</option>
<option value="10">15" Square</option>
<option value="11">18" Round</option>
</select>
</td></tr>
<tr><td>Woofer Vas</td><td><input type="text" size="5" id="vas" onBlur="handleForm(this.form);loadAlignments(this.form);" TABINDEX="1">Cubic Feet</td></tr>
<tr><td>Woofer Qes</td><td><input type="text" size="5" id="qes" onBlur="calcQts(this.form);" TABINDEX="2"></td></tr>
<tr><td>Woofer Qms</td><td><input type="text" size="5" id="qms" onBlur="calcQts(this.form);" TABINDEX="3"></td></tr>
<tr><td>Woofer Qts</td><td><input type="text" size="5" id="qts" onBlur="handleForm(this.form);loadAlignments(this.form);" TABINDEX="4"></td></tr>
<tr><td>Woofer Fs</td><td><input type="text" size="5" id="fs" onBlur="handleForm(this.form);loadAlignments(this.form);" TABINDEX="5">Hz</td></tr>
<tr><td>Woofer Xmax</td><td><input type="text" size="5" id="xmax" onBlur="handleForm(this.form);loadAlignments(this.form);" TABINDEX="6"></td></tr>
<tr><td>Number of Woofers:</td>
<td><select id="numw" onChange="loadBox(this.form);" TABINDEX="7">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td></tr>
</tbody>
</table>
</fieldset>
<fieldset>
<legend>Box</legend>
<table>
<tbody>
<tr><td>Select a box alignment:</td>
<td><select id="align" onChange="loadBox(this.form);" TABINDEX="8"></select>
</td></tr>
<tr><td>Total Net Volume:</td><td><input type="text" size="5" id="vb" onBlur="handleForm(this.form)" TABINDEX="9">Cubic Feet</td></tr>
<tr><td>Tuning Frequency:</td><td><input type="text" size="5" id="fb" onBlur="handleForm(this.form)" TABINDEX="10">Hz</td></tr>
<tr><td>Desired Width:</td><td><input type="text" size="5" id="width" onBlur="handleForm(this.form)" TABINDEX="11">Hz</td></tr>
<tr><td>Desired Height:</td><td><input type="text" size="5" id="height" onBlur="handleForm(this.form)" TABINDEX="12">Hz</td></tr>
</tbody>
</table>
</form>
</td>
<td valign="top" width="400">
<div id = "outputText"></div>
<div width="100%">
<p>Frequency Response:</p>
<hr />
<div id = "outputGraph" style="position:relative;border-left:1px solid #000000;border-bottom:1px solid #000000;width:400px;"></div>
</div>
<div id = "alignMSG" width="100%"></div>
</td></tr></table>
</BODY>
<SCRIPT language="Javascript">
<!--
// FILE ARCHIVED ON 20061213180511 AND RETRIEVED FROM THE
// INTERNET ARCHIVE ON 20080510213338.
// JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
// ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
// SECTION 108(a)(3)).
var sWayBackCGI = "http://web.archive.org/web/20061213180511/";
function xResolveUrl(url) {
var image = new Image();
image.src = url;
return image.src;
}
function xLateUrl(aCollection, sProp) {
var i = 0;
for(i = 0; i < aCollection.length; i++) {
if (typeof(aCollection[i][sProp]) == "string") {
if (aCollection[i][sProp].indexOf("mailto:") == -1 &&
aCollection[i][sProp].indexOf("javascript:") == -1) {
if(aCollection[i][sProp].indexOf("http") == 0) {
aCollection[i][sProp] = sWayBackCGI + aCollection[i][sProp];
} else {
aCollection[i][sProp] = sWayBackCGI + xResolveUrl(aCollection[i][sProp]);
}
}
}
}
}
xLateUrl(document.getElementsByTagName("IMG"),"src");
xLateUrl(document.getElementsByTagName("A"),"href");
xLateUrl(document.getElementsByTagName("AREA"),"href");
xLateUrl(document.getElementsByTagName("OBJECT"),"codebase");
xLateUrl(document.getElementsByTagName("OBJECT"),"data");
xLateUrl(document.getElementsByTagName("APPLET"),"codebase");
xLateUrl(document.getElementsByTagName("APPLET"),"archive");
xLateUrl(document.getElementsByTagName("EMBED"),"src");
xLateUrl(document.getElementsByTagName("BODY"),"background");
var forms = document.getElementsByTagName("FORM");
if (forms) {
var j = 0;
for (j = 0; j < forms.length; j++) {
f = forms[j];
if (typeof(f.action) == "string") {
if(typeof(f.method) == "string") {
if(typeof(f.method) != "post") {
f.action = sWayBackCGI + f.action;
}
}
}
}
}
//-->
</SCRIPT>
</HTML>