//Data.js      Routines for showing Alhphabetical Catalog Database

var A_Index="";
var  AType, HType, SType;
function AlphaSelect(){
A_Index=Alpha_Main.selectedIndex;
AType=Alpha_Main.options[A_Index].text;
if (A_Index > 0)  AjaxRequest("Menu.asp?Alpha="+AType);
}


function Text_Main_Routine(R){
Text_Main_Init();
var N=R.Headers.length;
for (i=1; i < N; i++){
var optn = document.createElement("OPTION");
	optn.text = R.Headers[i];
	Text_Main.options.add(optn);
}}


function AjaxResult(R){
R= eval ( '(' + R + ')' );
if (R.Tcode == "2") Show_Data(R);
if (R.Tcode==1) Text_Main_Routine(R);
 }
 



function Get_Data(){
Clear_Table();

 if (A_Index > 0) {
AType=Alpha_Main.options[A_Index].text;
SType = Text_Main.selectedIndex;
AjaxRequest("Detail.asp?AType="+AType+"&SType="+SType);
}
}    
function Show_Data(R){
var row,cell;
Detail_Table.style.fontFamily="Arial";
Detail_Table.style.fontSize="10pt";
//Data_Table.style.textAlign="center";
var Records=R.Catalog.length-1;
for (i=1; i <= Records; i++){
row = Detail_Table.insertRow(i);

cell = row.insertCell(0);
cell.style.background="#70C3C9";
cell.innerHTML = R.Name[i];

cell = row.insertCell(1);
cell.style.background="#70C3C9";
cell.style.textAlign="Center";
cell.innerHTML = R.Page[i];

cell = row.insertCell(2);
cell.style.background="#70C3C9";
cell.style.textAlign="Center";
cell.innerHTML = "<a href=" + '"http://www.VibrationMounts.com/RFQ/' + R.Catalog[i] + '"' + " target='_blank'>" + R.Catalog[i] + "</a>";
cell.style.color="blue";
} }

function Clear_Table()
{
    var lastRow = Detail_Table.rows.length;
 for (i=lastRow-1; i >0; i--)  Detail_Table.deleteRow(i);}     

function Text_Main_Init(){
var TX=Text_Main.length-1;
for (i=TX; i > 0; i--) Text_Main.remove(i);
}
