// JavaScript Document


function clearText(textBox) {
     if (textBox.value == textBox.defaultValue) {
         textBox.value = ""
     }
 }

	function move(fbox, tbox, dir_flag, county) {
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for (i = 0; i < tbox.options.length; i++) {
	arrLookup[tbox.options[i].text] = tbox.options[i].value;
	arrTbox[i] = tbox.options[i].text;
	}
	var fLength = 0;
	var tLength = arrTbox.length;
	for(i = 0; i < fbox.options.length; i++) {
	arrLookup[fbox.options[i].text] = fbox.options[i].value;
	if (fbox.options[i].selected && fbox.options[i].value != "") {
	arrTbox[tLength] = fbox.options[i].text;
	tLength++;
	}
	else {
	arrFbox[fLength] = fbox.options[i].text;
	fLength++;
	   }
	}
	arrFbox.sort();
	arrTbox.sort();
	fbox.length = 0;
	tbox.length = 0;
	var c;
	for(c = 0; c < arrFbox.length; c++) {
	var no = new Option();
	no.value = arrLookup[arrFbox[c]];
	no.text = arrFbox[c];
	fbox[c] = no;
	}
	for(c = 0; c < arrTbox.length; c++) {
	var no = new Option();
	no.value = arrLookup[arrTbox[c]];
	no.text = arrTbox[c];
	tbox[c] = no;
	   }
	var selected_cities="";
	
	if (dir_flag == 'a') {
	  for(c=0; c < tbox.options.length; c++) {
	    if (tbox.options[c].value != '')
	      if (selected_cities.length == 0)
		    selected_cities = tbox.options[c].value;
		  else
		    selected_cities = selected_cities + "," + tbox.options[c].value;
	  }   
	} else {
	  for(c=0; c < fbox.options.length; c++) {
	    if (fbox.options[c].value != '')
	      if (selected_cities.length == 0)
		    selected_cities = fbox.options[c].value;
		  else
		    selected_cities = selected_cities + "," + fbox.options[c].value;	    
	  }   	
	}
	
	document.area.selected_cities.value = selected_cities;
	}
	
	function setCheckboxesByName(the_form, elts_name, do_check) {
    var elts = document.forms[the_form].elements[elts_name];
    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;
 if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
            elts[i].checked = do_check;
        } 
    } else {
        elts.checked = do_check;
    }
}
