function checkall(o)
{
	var f = o.form;
	
	for (i = 0; i < f.elements.length; i++)
		if ( f.elements[i].type == "checkbox" )
			f.elements[i].checked = o.checked;
	
}

function getChecked(f)
{
	var x = "";

	for (i = 0; i < f.elements.length; i++)
		if ( f.elements[i].checked && f.elements[i].value != "" )
			x += f.elements[i].value + "-";
			
	return x;
}

function countChars(n,h)
{
	var num = n.value.length;
	if (num > 160)
	{
		document.getElementById(h).style.color='#CC0000';
		document.getElementById(h).value = num;		
	}
	else
	{
		document.getElementById(h).style.color='';
		document.getElementById(h).value = num;
	}
}

// dual select menu start
var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);

function addOption(theSel, theText, theValue)
{
  var newOpt = new Option(theText, theValue);
  var selLength = theSel.length;
  theSel.options[selLength] = newOpt;
}

function deleteOption(theSel, theIndex)
{ 
  var selLength = theSel.length;
  if(selLength>0)
  {
    theSel.options[theIndex] = null;
  }
}

function moveOptions(theSelFrom, theSelTo, select_all, destroy)
{
  
  var selLength = theSelFrom.length;
  var selectedText = new Array();
  var selectedValues = new Array();
  var selectedCount = 0;
  
  var i;
  
  // Find the selected Options in reverse order
  // and delete them from the 'from' Select.
  if (select_all == true)
  {

for(i=selLength-1; i>=0; i--)
  {
      selectedText[selectedCount] = theSelFrom.options[i].text;
      selectedValues[selectedCount] = theSelFrom.options[i].value;
	  if (destroy == true )
	  {
      	deleteOption(theSelFrom, i);
	  }
      selectedCount++;
  }

  }  //select all
  else
  {
for(i=selLength-1; i>=0; i--)
  {
    if(theSelFrom.options[i].selected)
    {
      selectedText[selectedCount] = theSelFrom.options[i].text;
      selectedValues[selectedCount] = theSelFrom.options[i].value;
	  if (destroy == true )
	  {
      	deleteOption(theSelFrom, i);
	  }
      selectedCount++;
    }
  }
  }
  // Add the selected text/values in reverse order.
  // This will add the Options to the 'to' Select
  // in the same order as they were in the 'from' Select.
if (destroy != true)
{
var not_add = Array();

  for(i=selectedCount-1; i>=0; i--)
  {
		if (selectedValues[i] == 0 )
		{
			not_add[i]	 = 1;
		}
		else
		{
		  	for ( d = 0 ; d < theSelTo.options.length ; d++ )
			{
				if (theSelTo.options[d].value == selectedValues[i] )
				{
					not_add[i] = 1;
					break;
				}
			}
		}

		if (not_add[i] != 1 )
		{
			addOption(theSelTo, selectedText[i], selectedValues[i]);
		}
	}
}
  //if(NS4) history.go(0);
}
// dual select menu end



function clearSelectValues(element_id) {
    var len = document.getElementById(element_id).options.length
      for(i = 0; i < len; i++) {
        document.getElementById(element_id).options[0] = null;
        }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function windowPop(url) 
          {
          window.open(url, "", "toolbar=no, location=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=350, height=200");
          }
		  

