/*======================================================================*\
|| #################################################################### ||
|| # vBulletin Custom File - Licence Number L4648f56
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2006 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/

mass_filter_check = function(domasscheck)
{
	ff_filter_container = fetch_object(domasscheck + 'filters');
	total = 0;
	ischecked = 0;
	checks = fetch_tags(ff_filter_container, 'input');

	for (c = 0; c < checks.length; c++)
	{
		if (checks[c].type == 'checkbox')
		{
			if (checks[c].checked)
			{
				ischecked++;
			}

			total++;
		}
	}

	filter_disable_apply();

	fetch_object(domasscheck + 'mass').checked = ischecked == total;
}

filter_disable_apply = function()
{
	ff_filter_container = fetch_object('calfilters_menu');
	inputs = fetch_tags(ff_filter_container, 'input');
	submitkey = 0;
	any_impact = false;
	any_currency = false;
	all_impact = 0;
	all_currency = 0;
	total_impact = 0;
	total_currency = 0;

	for (i = 0; i < inputs.length; i++)
	{

		if (inputs[i].type == 'submit' || inputs[i].value == 'Apply Filter')
		{
			submitkey = i;
		}

		if (inputs[i].name.match(/currency/))
		{
			total_currency++;
		}

		if (inputs[i].name.match(/impact/))
		{
			total_impact++;
		}

		if (inputs[i].checked)
		{
			if (inputs[i].name.match(/currency/))
			{
				any_currency = true;
				all_currency++;
			}

			if (inputs[i].name.match(/impact/))
			{
				any_impact = true;
				all_impact++;
			}
		}
	}

	if ((any_impact && any_currency) && !(all_impact == total_impact && all_currency == total_currency))
	{
		inputs[submitkey].disabled = false;
	}
	else
	{
		inputs[submitkey].disabled = true;
	}
}

filter_setting = function(cbox, domasscheck)
{
	if (domasscheck)
	{
		mass_filter_check(domasscheck)
	}
}

mass_filter_setting = function(cbox, ff_filter_containerid)
{
	ff_filter_container = fetch_object(ff_filter_containerid)
	tocheck = cbox.checked
	checks = fetch_tags(ff_filter_container, 'input')

	for (c = 0; c < checks.length; c++)
	{
		if (checks[c].type == 'checkbox')
		{
			checks[c].checked = tocheck
			filter_setting(checks[c], false)
		}
	}

	filter_disable_apply();
}

function calhigh(id, high)
{
	var dohigh = true;
	var newclass = fetch_object('title_' + id).parentNode.className.split(' ')[0] == 'alt1' ? 'alt2' : 'alt1';

	if (fetch_object('calendar_rowhigh') && !fetch_object('calendar_rowhigh').checked)
	{
		dohigh = false;	
	}

	if (dohigh)
	{
		//fetch_object('title_' + id).style.backgroundColor = high ? '#fff' : '';
		fetch_object('title_' + id).className = high ? newclass + ' smallfont' : 'smallfont';
/*
		fetch_object('title_' + id).parentNode.className = newclass + ' espace';
		fetch_object('title_' + id).parentNode.parentNode.cells[4].className = newclass + ' espace';
		fetch_object('title_' + id).parentNode.parentNode.cells[5].className = newclass + ' espace';
		fetch_object('title_' + id).parentNode.parentNode.cells[6].className = newclass + ' espace';
		fetch_object('title_' + id).parentNode.parentNode.cells[7].className = newclass + ' espace';
		fetch_object('title_' + id).parentNode.parentNode.cells[8].className = newclass + ' espace';
		fetch_object('title_' + id).parentNode.parentNode.cells[9].className = newclass + ' espace';
*/
	}
}

/*======================================================================*\
|| ####################################################################
|| # SVN: $RCSfile$ - $Rev$
|| ####################################################################
\*======================================================================*/

