/*****************************************
 * 
 * Anton Clarke - 2009/04/08
 */

var bc_drop_menu_height_closed = 0;
var bc_drop_menu_height_open = 360;
var bc_drop_menu_anim_speed = 0.5;
var bc_drop_menu_expanded = false;

var bc_controls_height_closed = 40;
var bc_controls_height_open = 272;
var bc_controls_anim_speed = 0.5;
var bc_controls_expanded = false;

var bc_show_control_panel = function()
{
	// referring to bc_controls when it didn't exist was causing javascript to stop execution, killing map displays amongst other things
	var x = document.getElementById('bc_controls');
	if(typeof x != undefined) {
		document.getElementById('bc_controls').style.height = bc_controls_height_closed+'px';
	}
	
};

var bc_drop_menu_panel_ec = function()
{
	if(bc_drop_menu_expanded)
	{
		bc_drop_menu_expanded = false;
		var animation = new YAHOO.util.Anim('bc_drop_menu', {height: {to: bc_drop_menu_height_closed } }, bc_controls_anim_speed, YAHOO.util.Easing.easeIn);
		animation.animate();
	}
	else
	{
		bc_drop_menu_expanded = true;
		var animation = new YAHOO.util.Anim('bc_drop_menu', {height: {to: bc_drop_menu_height_open } }, bc_controls_anim_speed, YAHOO.util.Easing.easeOut);
		animation.animate();
	}
};

var bc_newsmodule_update_overlay = function(el,el1_id,el2_id,el3_id)
{
	var simg = document.getElementById('com_bc_fp_selected_img').value;
	var nsimg = document.getElementById('com_bc_fp_notselected_img').value;
	var a1 = document.getElementById(el1_id);
	var a2 = document.getElementById(el2_id);
	var a3 = document.getElementById(el3_id);
	if(a1!=undefined) a1.style.background = 'transparent url('+nsimg+') repeat-x';
	if(a2!=undefined) a2.style.background = 'transparent url('+nsimg+') repeat-x';
	if(a3!=undefined) a3.style.background = 'transparent url('+nsimg+') repeat-x';
	el.style.background='transparent url('+simg+') repeat-x';
}

var bc_newsmodule_plus = function(start_id,cookie_id)
{
	var current_id = 2; var target_el = '';
	var found = false; var el = null;
	while(!found)
	{
		el = document.getElementById(start_id+'_'+current_id);
		if(!el) return;
		if(el.style.visibility=='hidden')
		{
			el.style.visibility='visible';
			el.style.height='auto';
			
			YAHOO.util.Cookie.setSub('bcfextra',cookie_id,current_id+1,{ expires: new Date("January 12, 2025") });
			return;
		}
		current_id++;
	}
};

var bc_newsmodule_minus = function(start_id,cookie_id)
{
	var current_id = 2; var target_el = '';
	var not_found = false; var el = null;
	while(!not_found)
	{
		el = document.getElementById(start_id+'_'+current_id);
		if(!el) { not_found = true; continue; }
		if(el.style.visibility=='hidden')
		{
			current_id--;
			if(current_id<2) return;
			
			el = document.getElementById(start_id+'_'+current_id);
			el.style.visibility='hidden';
			el.style.height='0px';
			YAHOO.util.Cookie.setSub('bcfextra',cookie_id,current_id,{ expires: new Date("January 12, 2025") });
			return;
		}
		current_id++;
	}
	
	current_id--;
	el = document.getElementById(start_id+'_'+current_id);
	el.style.visibility='hidden';
	el.style.height='0px';
	
	// SAVE THE CURRENT ID HERE.
	YAHOO.util.Cookie.setSub('bcfextra',cookie_id,current_id,{ expires: new Date("January 12, 2025") });
};

