var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  
//  popUpWin = open(URLStr, 'popUpWin', 'toolbar=0,location=0,directories=0,status=0,menubar=no,scrollbars=1,resizable=1,copyhistory=1,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
  popUpWin = open(URLStr, 'popUpWin', '');
}

function switchOptTo(source, target, repos, ref)
{
    var targetSel = document.getElementById(target);
    var reposElement = document.getElementById(repos);
    var refElement = document.getElementById(ref);
    
    for(var i=0; i < source.options.length; i++){
        
        if(source.options[i].selected == true){
          
            addOption(targetSel, source.options[i].text, source.options[i].value);
            deleteOption(source, i);

            var newListArr = new Array();
            
            for(var j = 0; j < refElement.options.length; j++){
                newListArr[j] = refElement.options[j].value;
            }

            reposElement.value = newListArr.join(',');
        }   
    }
}

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 clearInput(thisId) {
		if (thisId.value == thisId.title || thisId.value == thisId.alt)
			{thisId.value=''};
			
}
