// JavaScript Document

function addOption(theSel, theText, theValue)
{
  if (theText !="" && theValue !="" ){
	  var newOpt = new Option(theText, theValue);
	  var selLength = theSel.length;
	  //alert(selLength);
	  theSel.options[selLength] = newOpt;
  }
}

function deleteOption(theSel, theIndex)
{ 
  var selLength = theSel.length;
  if(selLength>0)
  {
    theSel.options[theIndex] = null;
  }
}

function deleteAllOption(theSel){
	var selLen=theSel.length;
	for(i=theSel.length ;i>=0;i--)
		theSel.options[0] = null;
}

function split_list(hide_item,list_item,spritstr){
	thedata=hide_item.value;
	var arr_s =thedata.split(spritstr);
	
	
	for(i=0;i<arr_s.length;i++){
		if(arr_s[i].length >0)
			addOption(list_item,arr_s[i],arr_s[i]);
	}
	
}


function cleanValue(frmItem){
	frmItem.value='';
}

function addOptionChkLen(theSel, field,maxNum,msg){
	
	if (theSel.length >= maxNum ){
		alert(msg);
	}else{
		addOption(theSel, field.value,  field.value);
		field.value="";
	}
	
	
}

