﻿var speaks = null;

function initSpeaks()
{

    speaks = new Array(23);

    /*
        speaks element definitions:
        0 = All
        
        Application
        1 = Stage Monitor
        2 = Pole Mount
        3 = Flyable
        4 = Mains
        
        Audience Size
        5 = < 200
        6 = 201 - 400
        7 = > 400
        
        Active/Passive
        8 = Passive
        9 = Active
    */

speaks[0]="xxx.xx...xSRM150";
speaks[1]="xxxxxx...xSRM350";
speaks[2]="xxxxxxx..xSRM450";
speaks[3]="xxx.xxx..xSWA1501";
speaks[4]="xxx.xxxx.xSWA1801z";
speaks[5]="xxx.xxxx.xSWA2801z";
speaks[6]="xxxxxx..x.C200";
speaks[7]="xxxxxxx.x.C300z";
speaks[8]="x.xxxxxx.xHD1521";
speaks[9] = "x.xxxxxx.xHD1531";
speaks[10] = "x.x.x.x..xHD1501";
speaks[11] = "x.xxx.xx.xHD1801";
speaks[12] = "xxx.xx...xTH15A";
speaks[13] = "x.x.xxx..xTH18s";
speaks[14] = "x.x.xxx..xSRM1801";
speaks[15]="xxxxxxx..xHD1221";
speaks[16]="x.xxxxxx.xHDA";
speaks[17] = "xxx.xx...xTH12A";
}

function DOM(n)
{
	return document.getElementById(n);
}

function showMatches()
{
	if ( speaks == null )
		initSpeaks();

	var spk_use, spk_audience, spk_amp;

	spk_use = DOM("spk_use").value;
	spk_audience = DOM("spk_audience").value;
	spk_amp = DOM("spk_amp").value;

	if ( spk_use == 1 )
	{
		DOM("spk_audience").disabled = true;
		DOM("spk_audience").selectedIndex = 0;
	}
	else
	{
		DOM("spk_audience").disabled = false;
	}


	var i;
	for ( i = 0 ; i < 23 ; i++ )
	{
		var nm = "st_" + speaks[i].substring( 10, 255 );
		var o = DOM(nm);
		if ( o == null )
		{
			// alert(nm);
			continue;

		}

		if ( speaks[i].substr( spk_use, 1 ) == 'x' && 
			speaks[i].substr( spk_audience, 1 ) == 'x' &&
			speaks[i].substr( spk_amp, 1 ) == 'x' )
		{
			o.className = "rotate";
		}
		else
		{
			o.className = "rotate_off";
		}
		
	}
	// hide SRM450 for mains in large audiences
	if ( spk_use == 4 && spk_audience > 5 )
	{
		DOM("st_SRM450").className = "rotate_off";

	}
}

// JavaScript Document

//<![CDATA[

function DOM(n) 
{
	if (document.all) return(document.all[n]);
	if (document.getElementById) return(document.getElementById(n));
	return(null);
}


function toggleDisplay( n ) 
{
	var o = DOM(n);

	if ( o == null )
		return;

	o.style.display = (o.style.display == '') ? "none" :  "";
}

function hide( n ) {
	var o = DOM(n);

	if ( o == null )
	{
		alert(n);
		return;
	}

	if ( o.style.display == "" )
		o.style.display = "none";
}

function show( n ) {
	var o = DOM(n);

	if ( o == null )
	{
		alert(n);
		return;
	}

	if ( o.style.display == "none" )
		o.style.display = "";
}

function showpanel( n ) {

	hide("panel_default");

	hide("panel_srm150");
	hide("panel_srm350");
	hide("panel_srm450");
	hide("panel_hd1521");
	hide("panel_hd1221");
	hide("panel_hd1531");
	hide("panel_hd1501");
	hide("panel_hd1801");
	hide("panel_swa1501");
	hide("panel_swa1801z");
	hide("panel_swa2801z");
	hide("panel_c200");
	hide("panel_c300z");
	hide("panel_th15a");
	hide("panel_TH18s");
	hide("panel_SRM1801");
	hide("panel_hda");
	hide("panel_th12a");

	show( n );
}


/*
find the line:
speaks = new Array(20);
add to 20 the number of new products, so for 1 new product it becomes 
speaks = new Array(21);
(this is always 1 larger than the number of products)

copy this line
speaks[19]="x.x.xxxxx.S218s";
& paste new ones at the end for each new product, renumber the sequentially & modify the product name
speaks[21]="x.x.xxxxx.HD1234";

update the settings... here's the deal with the Xs and periods... if you look at the drop down selectors in selector_inc.html, the value of each OPTION is a number that corresponds to the position in this string.. if there's an "x" in a particular position, it shows the product's title when that option is selected, otherwise it hides it.  Here's the key to each character position in that string (starting with 0, everything in javascript starts at 0 rather than 1):

character 0 (the first character) is "all", you always put an "x" in the first position
character 1 is Stage Monitor (x for yes, period for no)
character 2 is Pole Mount
character 3 is Flyable
character 4 is Mains
character 5 is <200
character 6 201-400
character 7 is 400+
character 8 is Passive
character 9 is Active
characters 10+ is the ID of product title

then at the bottom of the file there's function called showpanel, just copy the last line like:

hide("panel_s218s");

and paste a new one at the end for each new product, and change the ID, like::

hide("panel_hd1234");
*/

//]]>


