function bg(obj,rgb)
{
	if (rgb==1)
    obj.style.background='#ddd';  //siva
	else if(rgb==2)
    obj.style.background='#efefef';  //svjetlo siva
  else if(rgb==3)
    obj.style.background='#ffffff';//bijela
  else if(rgb==4)
    obj.style.background='#3a64b6';//plava
  else if(rgb==5)
    obj.style.background='#c5e9f7';//svjetlo plava
  else
    obj.style.background='';
}

function mailhide(part1, part2, part3, anchor_text)
{
  document.write('<a href="mai'+'lto:'+part3+part1+part2+'">'+anchor_text+'</a>');
}

function showhide(obj) 
{
  el = document.getElementById(obj);
  el.style.display = (el.style.display == 'block') ? 'none' : 'block';
}


//selective drop down 
function SelObj(formname,selname,textname,str) {
  this.formname = formname;
  this.selname = selname;
  this.textname = textname;
  this.select_str = str || '';
  this.selectArr = new Array();
  this.initialize = initialize;
  this.bldInitial = bldInitial;
  this.bldUpdate = bldUpdate;
}

function initialize() {
  if (this.select_str =='') {
    for(var i=0;i<document.forms[this.formname][this.selname].options.length;i++) {
      this.selectArr[i] = document.forms[this.formname][this.selname].options[i];
      this.select_str += document.forms[this.formname][this.selname].options[i].value+":"+
      document.forms[this.formname][this.selname].options[i].text+",";
    }
  } 
  else {
    var tempArr = this.select_str.split(',');
    for(var i=0;i<tempArr.length;i++) {
      var prop = tempArr[i].split(':');
      this.selectArr[i] = new Option(prop[1],prop[0]);
    }
  }
  return;
}

function bldInitial() {
  this.initialize();
  for(var i=0;i<this.selectArr.length;i++)
    document.forms[this.formname][this.selname].options[i] = this.selectArr[i];
  document.forms[this.formname][this.selname].options.length = this.selectArr.length;
  return;
}

function bldUpdate() {
  var str = document.forms[this.formname][this.textname].value.replace('^\\s*','');
  if(str == '') {this.bldInitial();return;}
  this.initialize();
  var j = 0;
  pattern1 = new RegExp("^"+str,"i");
  for(var i=0;i<this.selectArr.length;i++)
    if(pattern1.test(this.selectArr[i].text)) 
  document.forms[this.formname][this.selname].options[j++] = this.selectArr[i];
  document.forms[this.formname][this.selname].options.length = j;
  if(j==1){
    document.forms[this.formname][this.selname].options[0].selected = true;
//document.forms[this.formname][this.textname].value = document.forms[this.formname][this.selname].options[0].text;
  }
}

function setUp() {
  obj1 = new SelObj('menuform','itemlist','entry');
  // menuform is the name of the form you use
  // itemlist is the name of the select pulldown menu you use
  // entry is the name of text box you use for typing in
  obj1.bldInitial(); 
}
//end 