var showHref = 'true';

function improveH(){	
  g = g + Math.round((160-g)/2);
  height = g + 'px';
  chSdiv.style.height = height;
  if(g >= 160){
	clearInterval(timer);
  }
}


function showS(id)
 {
  document.getElementById('addToC_'+id).value = '';
  var chSelect = document.getElementById('chSelect'+id)
  chSelect.style.display = 'block';

  chSdiv = document.getElementById('chSdiv'+id);
  chSdiv.style.display = 'block';

  g=4;
  p = /px/gi;
  if( parseInt(chSdiv.style.height) > 1 ){
	chSdiv.style.height = '1px';
  }
  i = 0;
  timer = setInterval('improveH()', 70);
  chSelect.focus();
 }

function hideS(id)
 {
  var Select = document.getElementById('chSelect'+id);
  Select.style.display = 'none';
  document.getElementById('chSdiv'+id).style.display = 'none';
  if(showHref == 'true'){
	  document.getElementById('show_sel_href'+id).style.display = 'inline';
  }
  else{
	  document.getElementById('show_sel_href'+id).style.display = 'none';
  }
 }

function fillText(id){
  var Select = document.getElementById('chSelect'+id);
  var textInput = document.getElementById('addToC_'+id);
  var options = Select.options;
  var k  = 0;	
  var str = '';

  for (var i = 0; i < options.length; i++){
    if(options[i].selected){
	str = str + options[i].innerHTML;
	if(i < (options.length-1)){
		str = str + ', ';
	}
    }    
  }
  textInput.value = str;
}
