//-------------------------------------------------------------------------------
//  page event.js
//	Event handling classes. Allows to associate multiple event handlers
//	with one event.
//
//History:
//	21/02/2001	Rob Ruijter	Created
//  26/02/2001  Rob Ruijter new checkTextBox
//-------------------------------------------------------------------------------

//Dispatches event to any number of	event listeners.
	function EventSource() {
		this.listeners = new Array();
		this.addListener = function (oListener) {
			this.listeners[this.listeners.length] = oListener;
		}
		this.notify = function (oSource) {
			var bBoolValue = true;			//return value is a boolean
			var returnValue = true;			//return value
			var newValue;
				
			for (var i in this.listeners) {
				newValue = this.listeners[i](oSource);
				if (bBoolValue) {
					if ((newValue == null) || (typeof(newValue) == 'boolean'))
						returnValue = newValue && returnValue;
					else
						bBoolValue = false;
				}
				if (!bBoolValue)
					returnValue = newValue;
			}
			return returnValue;
		}
	}


//@func bool | checkTextBox | The function <f checkTextBox> checks if the text, 
//				if it is required, has a correct value.
//@parm char | sValue | The value of the uservariable to be checked.
//@parm char | sText | Value filled by user.


//Check textbox 	
	function checkTextBox(sFile,bValue,sText){
		
		if (bValue == "Y"){
			document.location=sFile+"?Value="+bValue+"&strValue="+sText.value;
		}
		
		if (bValue == "N"){
			alert("false"); 
			sText.focus();
			sText.value="";
		}
	}	


	
function MM_preloadImages() { //v2.0
  if (document.images) {
    var imgFiles = MM_preloadImages.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
  } }
}

function MM_swapImgRestore() { //v2.0
  if (document.MM_swapImgData != null)
    for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)
      document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];
}

function MM_swapImage() { //v2.0
  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;
  for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {
    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
    obj = eval(objStr);
    if (obj != null) {
      swapArray[j++] = obj;
      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
      obj.src = MM_swapImage.arguments[i+2];
  } }
  document.MM_swapImgData = swapArray; //used for restore
}

function showHidePart(name, tag)
{
	var e;
	var aDivs = document.body.all.tags("DIV");
	for(i = 0; i < aDivs.length; i++)
	{
		e=aDivs[i];
		if (e.id.substring(0, tag.length) == tag)
		{
			document.all["span_" + e.id.substring(0, name.length)].style.display='none';
			document.all["anchor_" + e.id.substring(0, name.length)].style.display='';
			e.style.display='none';
		}
	}
	document.all["span_" + name].style.display='';
	document.all["anchor_" + name].style.display='none';
	document.all[name].style.display='';
	document.all["SHOWHIDEPART"].value = name.substring(name.length-1, name.length);
}
function pop(url){
	popwin = window.open(url,"Details","left=20, screenX=20, top=20, screenY=20, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, copyhistory=no, width=640, height=450");
}
