// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

// Added by tom to check all 
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}
function SetCheckBoxes(FormName, FieldName, Boxes)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			for(var j = 0; j < Boxes.length; j++)
				if(objCheckBoxes[i].value == Boxes[j])
				objCheckBoxes[i].checked = true;
}

Event.addBehavior.reassignAfterAjax = true;
Event.addBehavior({
    'div.pagination a' : Remote.Link({ 
		onLoading:function() { 
			$(this.element.parentNode.id + '_spinner').show(); 
			this.element.parentNode.hide(); 
		} 
	}) 
})
Event.addBehavior({
	'h2.folder a' : Remote.Link({ 
		onLoading:function() { 
			$(this.element.id + '_spinner').show(); 
		}, 
		onComplete:function() { 
		    $(this.element.id + '_spinner').hide(); 
		} 
	}) 
})
  
  