
function hideNavLayer(whichLayer) {

	if (document.getElementById) {
	// this is the way the standards work
	document.getElementById(whichLayer).style.visibility = "hidden";	
	document.getElementById(whichLayer).style.position = "absolute";
	}
	else if (document.all) {
	// this is the way old msie versions work
	document.all[whichlayer].style.visibility = "hidden";
	}
	else if (document.layers) {
	// this is the way nn4 works
	document.layers[whichLayer].visibility = "hidden";
	}

}

function showNavLayer(whichLayer) {
	if (document.getElementById) {
	// this is the way the standards work
	document.getElementById(whichLayer).style.visibility = "";
	document.getElementById(whichLayer).style.position = "";	
	}
	else if (document.all) {
	// this is the way old msie versions work
	document.all[whichlayer].style.visibility = "";
	document.all[whichlayer].style.position = "";	
	}
	else if (document.layers) {
	// this is the way nn4 works
	document.layers[whichLayer].visibility = "";
	//document.layers[whichLayer].position = "";	
	}

}

function check_uncheck_all(field,object)
{
	if(field != null) {
		field.checked=object.checked;			
	
		for (i = 0; i < field.length; i++)
			field[i].checked = object.checked ;
	}		
}

function postToLayer(whichLayer,content,frame) {
	if (frame.document.getElementById) {	
		frame.document.getElementById(whichLayer).innerHTML = content;
	}
	else if (frame.document.all) {	
		frame.document.all[whichlayer].innerHTML = content;
	}
	else if (frame.document.layers) {
		lyr.open()
		lyr.write(content)
		lyr.close()
	}
}

/*
Set the mouse cursor to an hour glass icon in the given frame
*/
function setPointerBusy(frame) {
    if (frame.document.all)
        for (var i=0;i < frame.document.all.length; i++)
             frame.document.all(i).style.cursor = 'wait';
}

/*
Reset the mouse pointer to the default icon
*/
function resetPointerFrame(frame) {
    if (frame.document.all)
        for (var i=0;i < frame.document.all.length; i++)
             frame.document.all(i).style.cursor = '';	
}

/*
Set the mouse cursor to an hour glass icon
*/
function setPointerBusy() {
    if (document.all)
        for (var i=0;i < document.all.length; i++)
             document.all(i).style.cursor = 'wait';
}

/*
Reset the mouse pointer to the IE's default icon
*/
function resetPointer() {
    if (document.all)
        for (var i=0;i < document.all.length; i++)
             document.all(i).style.cursor = '';
}

/*
Reset the mouse pointer to the pointer icon
*/
function setPointerBlank() {
    if (document.all)
        for (var i=0;i < document.all.length; i++)
             document.all(i).style.cursor = 'default';
}

/*
Reset the mouse pointer to the pointer icon
*/
function setPointerBlankFrame(frame) {
    if (frame.document.all)
        for (var i=0;i < frame.document.all.length; i++)
             frame.document.all(i).style.cursor = 'default';
}

function alternateImageBasedOnState(image,one_src,two_src,state_one,state_two) {
	
	var object
	
	if (document.getElementById) {
	// this is the way the standards work
		object = document.getElementById(image);
	}
	else if (document.all) {
	// this is the way old msie versions work
		object = document.all[image];
	}
	else if (document.layers) {
	// this is the way nn4 works
		object = document.layers[image];
	}
	
	if (object.object_state == state_one) {
		object.src = two_src;
		object.object_state = state_two;
	}
	else {
		object.src = one_src;	
		object.object_state = state_one;
	}			
}

function window_popup(name,url,width,height,scrollbars,resizeable){
	a=window.open(url,name,'width=' + width + ',height=' + height + ',screenX=100,screenY=100,resizable=' + resizeable + ',scrollbars=' + scrollbars + ',dependent=yes');
}

function controls_to_form_field(control_name,hidden_field) {
	var temp;		
	temp="";
	if(control_name != null) {		
		if (typeof control_name.value != "undefined") {				
			temp = control_name.value;
		}
		else {
			for (i = 0; i < control_name.length; i++) {
				if(control_name[i].checked)				
					temp = temp + control_name[i].value + ',';
				}		
		}
	} else {
		if (control_name.checked)
			temp = control_name.value;	
	}			
	hidden_field.value=temp;
}

function cancelLink () {
  return false;
}
function disableLink (link) {
  if (link.onclick)
    link.oldOnClick = link.onclick;
  link.onclick = cancelLink;
  if (link.style)
    link.style.cursor = 'default';
}
function enableLink (link) {
  link.onclick = link.oldOnClick ? link.oldOnClick : null;
  if (link.style)
    link.style.cursor = 
      document.all ? 'hand' : 'pointer';
}
function toggleLink (link) {
  if (link.disabled) 
    enableLink (link)
  else 
    disableLink (link);
  link.disabled = !link.disabled;
}



var is_popup_calendar;