_d=document
SCombo = new Array()

// Custom Stuff goes here: ---------------------------------------------------------------
// Only the next 8 lines need to be edited. You need to tell SCombo which SELECT Boxes are 
// part of the SCombo system and you need to declare the names of the data arrays.

SCombo[0]=SComboUeberrubriken               // Continent Array Data
SCombo[1]=SComboUnterrubriken                // Country Array Data 

frm1=_d.qsearch['num_rubrikid1']        // Form SELECT container for Continents
frm2=_d.qsearch['num_rubrikid2']       // Form SELECT container for Countries

                            // property: onlyPopulateNextBox
onlyPopulateNextBox=false;  // Set to true SCombo will only display data for the only next select box in the sequence.
                            // Set to false it will display ALL the data for all select Boxes
                            
                            
                            // property returnTextValues
returnTextValues=false;     // Set to true will change the values returned to your CGI script
                            // True will return the text equivalent and false will return the numerical indentifier

// End of custom stuff. ------------------------------------------------------------------

function changeReturnValues()
{
	if(returnTextValues)
	{
		for(_a=1;_a<=SCombo.length;_a++)
		{
			frm=eval("frm"+_a)
			fSi=frm.selectedIndex
			if(fSi>-1)
			{
				frm[fSi].value=frm[fSi].text
			}
		}
	}
}


function getSelNumber(sel)
{
	testnumber=0;
	gotnumber=0;
	while(!gotnumber)
	{
		testnumber++;
		if(eval("frm"+testnumber).name == sel.name)gotnumber=1;
	}
	return testnumber;
}

function getSelValue(sel)
{
	if (sel.selectedIndex == -1) return ("");
	return sel[sel.selectedIndex].value;
}

function pdchange(sel)
{
	num=getSelNumber(sel)
	populateBoxesTo=SCombo.length

	if(window.onlyPopulateNextBox)populateBoxesTo=num+1
	
	for(x=num;x<SCombo.length;x++)
	{
		par=SCombo[x]
		frm=eval("frm"+(x+1))
		frm.length=0;
		for(a=1;a<par.length;a++)
		{
			if(x<populateBoxesTo)
			{
			
				if(getSelValue(sel)==par[a+x-1])
				{
					opt=new Option(par[a+1+x], par[a+x]);
					j=frm.length;
					frm[j]=opt;
				}
			}
			a+=x+2
		}
	}

	parv=getSelNumber(sel)
	par=SCombo[getSelNumber(sel)-1]
	lnk=par[getSelValue(sel)*(parv+2)];
	//alert(lnk);
  if(lnk)location.href=lnk
	
}

function allFillSelect(what)
{
	par=SCombo[+what-1]
	//alert(what);
	//alert(what+" "+eval("frm"+what).name)
	frm=eval("frm"+what)
	frm.length = 0;
	for(a=1;a<par.length;a++)
	{
		opt=new Option(par[a+what], par[a+what-1]);
		j = frm.length;
		frm[j]=opt;		
		a=a+what+1
	}
}



function pdSet(sel, txt, bywhat)
{
	
	frm=eval("frm"+sel)
	if(frm.length<2)allFillSelect(sel)
	for(a=0;a<frm.length;a++)
	{
		if((bywhat=="text" && frm[a].text==txt) || (bywhat=="id" && frm[a].value==txt))
		{
			frm.selectedIndex=a
			pdchange(frm)
		}
	}
}




function pdSetByText(sel,txt)
{
	allFillSelect(sel)
	frm=eval("frm"+sel)
	for(a=0;a<frm.length;a++)
	{
		if(frm[a].text==txt)	
		{
			frm.selectedIndex=a
			pdchange(frm)
		}
	}
}

function pdSetByID(sel,txt)
{
	allFillSelect(sel)
	frm=eval("frm"+sel)
	for(a=0;a<frm.length;a++)
	{
		if(frm[a].value==txt)	
		{
			frm.selectedIndex=a
			pdchange(frm)
		}
	}
}

function changeData(what)
{
	par=SCombo[+what-1]
	frm=eval("frm"+what)
	frm.length = 0;
	for(a=1;a<par.length;a++)
	{
		opt=new Option(par[a+what], par[a]);
		j = frm.length;
		frm[j]=opt;		
		a=a+what
	}
}


//pdSet(1,"alle Rubriken","text")     

//pdSet(1,"Europe","text")             // Tell SCombo to jump to the text item: 'Europe' in Box 1
//pdSet(2,"United Kingdom","text")     // Tell SCombo to jump to the text item: 'United Kingdom' in box 2
//pdSet(3,"West Midlands","text")      // Tell SCombo to jump to the text item: 'West Midlands' in box 3

//pdSet(1,6,"id")                      // Tell SCombo to jump to the item with id of 6 in box 1
//pdSet(2,193,"id")                    // Tell SCombo to jump to the item with id of 193 in box 2
//pdSet(3,106,"id")                    // Tell SCombo to jump to the item with id of 106 in box 3

allFillSelect(1)                     // Tell SCombo to show ALL data in box 1
//allFillSelect(2)                     // Tell SCombo to show ALL data in box 2
//allFillSelect(3)                     // Tell SCombo to show ALL data in box 3
//allFillSelect(4)                    // Tell SCombo to show ALL data in box 4

