
// Show more options

function ShowMoreOptions(onoff)
{
	var box1, box2, box3, more_opt_val, end_div;
	
	box1=document.getElementById('moreOptionsBox');
	box2=document.getElementById('moreOptionsLinkBox1');
	box3=document.getElementById('moreOptionsLinkBox2');
	more_opt_val=document.getElementById('more_options_value');
	end_div=document.getElementById('searchTabBarEndDiv');

	if (more_opt_val)
		more_opt_val.value=onoff;

	if (onoff)
	{
		if (box1) box1.style.display='block';
		if (box2) box2.style.display='none';
		if (box3) box3.style.display='block';
		end_div.style.width='260px';
	}
	else
	{
		if (box1) box1.style.display='none';
		if (box2) box2.style.display='block';
		if (box3) box3.style.display='none';
		end_div.style.width='30px';
	}

}


// Calendar update event

function CalendarUpdateEvent(cal)
{
	var nme, box1, box2;
	
	if (!cal || !cal.params || !cal.params.inputField)
		return;

	nme=cal.params.inputField.name;
	if (nme.indexOf('_evdate_from_')>0)
	{
		box1=document.getElementById(nme);
		if (!box1)
			return;

		nme=nme.replace(/_evdate_from_/, '_evdate_to_');
		box2=document.getElementById(nme);
		if (box2)
		{
			if (box1.value=='')
				box2.value='';

			else if (box1.last_value && box1.last_value!=box1.value && box1.last_value==box2.value)
				box2.value=box1.value;

			else if (box2.value!='') //if (box1.value!=box2.value)
			{
				var v1, v2;
				
				v1=''+box1.value;
				v2=''+box2.value;

				v1=v1.substring(6,10)+v1.substring(3,5)+v1.substring(0,2);
				v2=v2.substring(6,10)+v2.substring(3,5)+v2.substring(0,2);
				
				if (v2.length<8 || v2<v1)
					box2.value=box1.value;
			}
		}

		box1.last_value=box1.value;
	}
}

// Add calendar

function AddCalendar(in_id)
{
	Calendar.setup(
	{
		inputField:  in_id,
		ifFormat:    "%d-%m-%Y",
		button:      in_id+'_img',
		singleClick: true,
		onUpdate:    CalendarUpdateEvent
	});
}

function SwitchDateClubBox(tab_num)
{
	var box1, box2, lnk1, lnk2;
	
	box1=document.getElementById('searchDateBox');
	box2=document.getElementById('searchClubBox');
	lnk1=document.getElementById('searchTabBarLink1');
	lnk2=document.getElementById('searchTabBarLink2');

	if (!box1 || !box2)
		return;

	if (tab_num==2)
	{
		box1.style.display='none';
		box2.style.display='block';
		if (lnk1) lnk1.className='stbInactive';
		if (lnk2) lnk2.className='stbActive';
		document.searchform.search_clubs.value='1';
	}
	else
	{
		box1.style.display='block';
		box2.style.display='none';
		if (lnk1) lnk1.className='stbActive';
		if (lnk2) lnk2.className='stbInactive';
		document.searchform.search_clubs.value='0';
	}

	document.searchform.activity.focus();
}

function UpdateInterestsBox(in_val)
{
	var box;

	box=document.getElementById('actIntSection');
	if (!box)
		return;

	//if (in_val.indexOf('Regular Member')>=0)
	if (in_val=='CAT3')
	{
		box.style.display='block';
	}
	else
	{
		box.style.display='none';
	}
}

