/*************************************************************
*  Copyright © iWeBB, 2001-2002                              *
*  Carter BloodCare All rights reserved                      *
**************************************************************/
function moveOver()  
{
var boxLength = document.calform.p_mapptd.length;
var selectedText = document.calform.p_apptdateday.value;
var selectedValue = document.calform.p_appttime.value;

var dispValue = document.calform.p_apptdateday.value+" "+
		document.calform.p_appttime.value+"  "+
		document.calform.p_donation.value+"  "+
		document.calform.p_short_name.value;

var actValue = 	document.calform.p_apptdate.value+":"+
		document.calform.p_schtime.value+":"+
		document.calform.p_center.value+":"+
		document.calform.p_donation.value+":"+
		document.calform.p_don_source.value+":"+
		document.calform.p_remind_call.value+":"+
		document.calform.p_comments.value+":";

var dupvalue =	document.calform.p_apptdate.value;
var i;
var isNew = true;

if (selectedValue == '')
{
	isNew = false;
}
else
{
  if (boxLength != 0) 
  {
	for (i = 0; i < boxLength; i++)
  	{
	  thisitem = document.calform.p_mapptd.options[i].value;

	  if (thisitem.substr(0,10) == dupvalue) 
          {
		alert("Date already exists in Appointment List");
		isNew = false;
		break;
      	  }
	}
  } 
}

if (isNew) 
{
  document.calform.p_apptdate.value = '';
  document.calform.p_apptdateday.value = '';

  document.calform.p_appttime.value = '';
  document.calform.p_comments.value = '';

  newoption = new Option(dispValue, actValue, false, false);
  document.calform.p_mapptd.options[boxLength] = newoption;
}
}


function removeMe() 
{
  var boxLength = document.calform.p_mapptd.length;
  arrSelected = new Array();
  var count = 0;
  if ( boxLength > 0 )
  {
  for (i = 0; i < boxLength; i++) 
  {
    if (document.calform.p_mapptd.options[i].selected) 
    {
      arrSelected[count] = document.calform.p_mapptd.options[i].value;
    }
    count++;
  }
  if ( arrSelected.length > 0 )
  {	
    var x;
    for (i = 0; i < boxLength; i++) 
    {
      for (x = 0; x < arrSelected.length; x++) 
      {
        if (document.calform.p_mapptd.options[i].value == arrSelected[x]) 
        {
          document.calform.p_mapptd.options[i] = null;
        }
      }  
      boxLength = document.calform.p_mapptd.length;
    }
  }
  else
  {
    alert("You have not made any selections");
  }
  }
  else
  {
    alert("You have not made any multiple appointment");
  }
}


function saveMe() 
{
var strValues = "";
var boxLength = document.calform.p_mapptd.length;
var count = 0;

if (boxLength != 0) 
{
  for (i = 0; i < boxLength; i++) 
  {
    if (count == 0) 
    {
     strValues = document.calform.p_mapptd.options[i].value+";";
    }
    else 
    {
     strValues = strValues + document.calform.p_mapptd.options[i].value+";";
    }

    document.calform.p_mappt.value = strValues;
    count++;
  }
}

if (document.calform.p_apptdate.value != '')
{
  if (document.calform.p_appttime.value!='')
  {
    var actValue = 	document.calform.p_apptdate.value+":"+
			document.calform.p_schtime.value+":"+
			document.calform.p_center.value+":"+
			document.calform.p_donation.value+":"+
			document.calform.p_don_source.value+":"+
			document.calform.p_remind_call.value+":"+
			document.calform.p_comments.value+":";

    var dupvalue =	document.calform.p_apptdate.value;

    var isNew = true;

    if (boxLength != 0) 
    {
      for (i = 0; i < boxLength; i++)
      {
	thisitem = document.calform.p_mapptd.options[i].value;

	  if (thisitem.substr(0,10) == dupvalue) 
          {
		isNew = false;
		break;
      	  }
      }
    }

    if (isNew) 
    {
      document.calform.p_mappt.value = document.calform.p_mappt.value+actValue+";";
    }
  }
}
}



function resetMe() 
{
  var boxLength = document.calform.p_mapptd.length;
  arrSelected = new Array();
  var count = 0;

  for (i = boxLength-1; i >= 0; i-- ) 
  {
       document.calform.p_mapptd.options[i] = null;
  }

}
