var info = new Array(
	"---Please select the gallery---*---Please select the print---",
    "Realism*China Cove and Bird Island 16 x 40|Redwood Cathedral 20 x 30|Redwood Cathedral 14 x 21|Point Lobos Pine 20 x 30|Point Lobos Pine 14 x 21|Eucalyptus by the Beach 20 x 30|Eucalyptus by the Beach 14 x 21|Morning Rain 20 x 30|Morning Rain 14 x 21|Morning Monarchs 40 x30|Kids and Cats 20 x 23|Kids and Cats 14 x 16|Carson Trail 20 x 24|Carson Trail 13.5 x 16|The Baby-sitter 25 x 20|The Baby-sitter 17 x 13.5|Green Valley Schoolhouse 25.5 x 20|Above Day Valley 20 x 28|Around The Bend 11 x 44|Top of Green Valley Road 19 x 31|Pacific Grove Before The Storm 19 x 31|Beach Road TBD x TBD|Sunrise TBD x TBD|Nacogdoches Road 20 x 25.5|The Gray Fox 18 x 24",
    "Watercolors*Around The Bend 11 x 44|Green Valley Schoolhouse 25.5 x 20|Harkins Slough Afternoon 13.5 x 33|Holohan Road 30 x 40|Pacific Grove Before The Storm 19 x 31|Santa Cruz Sunset 13.5 x 17|Top of Green Valley Road 19 x 31",
    "Josh and Friends*Kids and Cats 20 x 23|Kids and Cats 14 x 16|The Race 15.5 x 31|The Race 10 x 20|Sand Castle 20 x 26|Sand Castle 13.5 x 17|The Balloonists, Artist Proof|The Balloonists 20 x 26|The Balloonists 13.5 x 18|Warrior Elves 20 x 30|Warrior Elves 13 x 19.5|Carson Trail 20 x 24|Carson Trail 13.5 x 16|Baby Dragons 20 x 27|Baby Dragons 13.5 x 18|Forest Elves 30 x 20|Forest Elves 19.5 x 13|The Baby-sitter 25 x 20|The Baby-sitter 17 x 13.5|Valencia Creek 24 x 36|Morning Monarchs 40 x30|The New Airplane 8 x 10",
    "In Private Collections*The Gray Fox 18 x 24|Nacogdoches Road 20 x 25.5|Summer Stream 9 x 12|Nightshade 20 x 24|Northcoast Lighthouse 26.5 x 20|Big Sur Julia Pfeifer 15 x 30|Stone House In Sierras 40 x 30"
);

function stringSplit ( string, delimiter ) { 
    if ( string == null || string == "" ) { 
        return null; 
    } else if ( string.split != null ) { 
        return string.split ( delimiter ); 
    } else { 
        var ar = new Array(); 
        var i = 0; 
        var start = 0; 
        while( start >= 0 && start < string.length ) { 
             var end = string.indexOf ( delimiter, start ) ; 
             if( end >= 0 ) { 
                 ar[i++] = string.substring ( start, end ); 
                 start = end+1; 
             } else { 
                 ar[i++] = string.substring ( start, string.length ); 
                 start = -1; 
             } 
        } 
        return ar; 
    } 
} 

var menu1 = new Array();
var menu2 = new Array();

function createMenus () {
    for ( var i=0; i < info.length; i++ ) {
        menu1[i] = stringSplit ( info[i], '*' );
        menu2[i] = stringSplit ( menu1[i][1], '|' );
    }

    var g = document.myForm.gal;
    var p = document.myForm.title;

    g.length = menu1.length;
    p.length = menu2[0].length; 
    for ( var i=0; i < menu1.length; i++ ) {
         g.options[i].value  = menu1[i][0];
         g.options[i].text   = menu1[i][0];
    }
    document.myForm.gal.selected = 0;
    for (var x=0; x < menu2[0].length; x++) {
         p.options[x].text = menu2[0][x];
         p.options[x].value = menu2[0][x];
    }         
    document.myForm.title.selected = 0;
}

function updateMenus ( what ) {
    var sel = what.selectedIndex;

    if ( sel >= 0 && sel < menu1.length ) 
        var temp = menu2[sel];
    else
        var temp = new Array ();
    
    what.form.title.length = temp.length;

    for ( var i = 0; i < temp.length; i++ ) {
        what.form.title.options[i].text  = temp[i];
        what.form.title.options[i].value = temp[i];
    }
    what.form.title.selected=0;
}

