it's jsut a matter of using PHP arrays and string functions. Look at the source code of that javascript. Particularly look the function LoadArrays()
It creates javascript arrays that look like the following:
Array[0] = new sElement('UK','En','England')
Array[1] = new sElement('UK','Ir','Ireland')
Array[2] = new sElement('UK','Sc','Scotland')
Array[3] = new sElement('UK','Wa','Wales')
Array[4] = new sElement('UK','Ia','Isle of Arran')
Array[5] = new sElement('USA','Ny','New York')
Array[6] = new sElement('USA','Il','Illinois')
Array[7] = new sElement('USA','Fl','Florida')
Array[8] = new sElement('USA','Nm','New Mexico')
What you want to do is put each seperate value in one array key, then loop through the array to create a javascript array that looks just like this. The following code actually echo's the arrays to the browser, but what you would do is just put them in <script language="javascript" tags. Copy and paste this code and upload to your server. Then, look at the source (uses newlines, not breaks). You'll get the idea.
<?
// you could pull this out of a database or create this array
// dynamically however you wanted
// as long as you output in this format
$options = array(
"UK,En,England",
"UK,Ir,Ireland",
"UK,Sc,Scotland",
"UK,Wa,Wales",
"UK,Ia,Isle of Arran",
"USA,Ny,New York",
"USA,Il,Illinois",
"USA,Fl,Florida",
"USA,Nm,New Mexico"
);
$options = str_replace(",", "','", $options);
for($i=0; $i<count($options); $i++) {
echo "Array[" . $i . "] = new sElement('" . $options[$i] . "')\n";
}
?>
Cgraz