
var allOn = true;
function SelectAll(MyForm,MyBox)
{
	var countBoxes = eval("document."+MyForm+"."+MyBox+".length");
		if(!countBoxes){
			eval("document."+MyForm+"."+MyBox+".checked =  allOn");
		}
		else{
			for (var i=0; i<countBoxes ;i++){
				eval("document."+MyForm+"."+MyBox+"[i].checked =  allOn");
			}
		}
	allOn = !allOn;
}


function selectBoxMove(intDirection, myForm, box1, box2, myHidden)
    {
    	var heading = '';
    	var msg = '';
    	var flag;
    	var arrnew = new Array();

		var moveFrom = eval("document." + myForm + "." + box1);
		var moveTo = eval("document." + myForm + "." + box2);
		var hidden = eval("document." + myForm + "." + myHidden);
		/*alert(moveFrom.length);*/
		
   		if (intDirection)
   		{
   			//Add it to mylocations
   			msg = '';
   			for(var x=0;x<moveFrom.length;x++)
   			{
   				var opt = moveFrom.options[x];
   				if (opt.selected)
   				{
   					flag = 1;
   					//check if option exists if not add it
   					for (var y=0;y<moveTo.length;y++)
   					{
   						var myopt = moveTo.options[y];
   						if (myopt.value == opt.value)
   						{
   							flag = 0;
   						}
   					}
   					if (flag)
   					{
   						//This is not a duplicate so add it to the select box.
   						 moveTo.options[ moveTo.options.length] = new Option(opt.text, opt.value, 0, 0);
   					}
   				}
   			}
   		}
   		else
   		{
   			//Delete it from my locations
   			for(var x= moveTo.length-1;x>=0;x--){
   				var opt =  moveTo.options[x];
   				if (opt.selected){
   					//Remove it from the select box
   					 moveTo.options[x] = null;
   				}
   			}
   		}

   		//Fill hidden field with new values
   		for (var y=0;y< moveTo.length;y++){
   			arrnew[y] =  moveTo.options[y].value
   		}
   		hidden.value = arrnew.join();
}


<!--
function resizeWin(newLoc, newWidth, newHeight) 
{
	newWin = open("",newLoc,"scrollbars=no,resizable=yes,status=no,height=" + newHeight + ",width=" + newWidth);
}
//-->


// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
  cal.sel.value = date; // just update the date in the input field.
  //commented this out becasue we want the calendar to close on a single click
  if (cal.dateClicked) //&& (cal.sel.id == "StartDate" || cal.sel.id == "sel2"))
    // if we add this call we close the calendar on single-click.
    // just to exemplify both cases, we are using this only for the 1st
    // and the 3rd field, while 2nd and 4th will still require double-click.
    cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
  cal.hide();                        // hide the calendar
//  cal.destroy();
  _dynarch_popupCalendar = null;
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime, showsOtherMonths) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, selected, closeHandler);
    // uncomment the following line to hide the week numbers
    // cal.weekNumbers = false;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal;                  // remember it in the global var
    cal.setRange(2000, 2025);        // min/max year allowed.
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el.nextSibling, "Br");        // show the calendar

  return false;
}

// This function allows for changing classes for the given id.
// found at: http://www.adobe.com/devnet/server_archive/articles/revealing_the_hidden_css_visibility.html
function classChange(element,newclass) {
	//document.getElementById(element).className = newclass;
	element.className = newclass;
	}

