
var tfd_mw_left_selected=0;
var tfd_mw_answers=[null,null,null,null,null];

function tfd_mw_click_a(b) 
{
//	alert(b);
   	document.getElementById('tfd_mw_left').style.visibility='hidden';
	document.getElementById('tfd_mw_right').style.visibility='';
	//document.getElementById(b).style.border='1px red solid';
	tfd_mw_left_selected=b.substr(5, 1);
	
};

function tfd_mw_click_b(b,val) 
{
	//alert (b);
	//alert (val);
	document.getElementById('tfd_mw_left').style.visibility='';
	document.getElementById('tfd_mw_right').style.visibility='hidden';
	//alert("previous"+b);
	var match=b.substr(5, 1);
	//alert("after"+match); 
	for (var i=0;i<5;i++) 
	{
		
		//alert("tfd_mw_answers["+i+"]: "+tfd_mw_answers[i]+"----------------MATCH: "+match);
		if (tfd_mw_answers[i]==match)
		{
		tfd_mw_answers[i]=null;
		}
		else
		{
			//alert ("IN ELSE ");
		}
			document.getElementById('tfd_b'+i).className='td_white';
		
	}
	tfd_mw_answers[tfd_mw_left_selected]=match;
	//alert ("tfd_mw_answers[tfd_mw_left_selected]:" +tfd_mw_answers[tfd_mw_left_selected]);
	for (var i=0;i<5;i++)
	{
		if (tfd_mw_answers[i]!=null) 
		{
			document.getElementById('tfd_b'+tfd_mw_answers[i]).className=document.getElementById('tfd_a'+i).className;
			//document.getElementById('tfd_a'+i).style.border='';
			var temp = 'tfd_b'+tfd_mw_answers[i];
			
			
		}
		
	}
	if(match==0)
	{
		document.frmQuizzes.tfd_b0.value = val;
	}
	if(match==1)
	{
		document.frmQuizzes.tfd_b1.value = val;
	}
	if(match==2)
	{
		document.frmQuizzes.tfd_b2.value = val;
	}
	if(match==3)
	{
		document.frmQuizzes.tfd_b3.value = val;
	}
	if(match==4)
	{
		document.frmQuizzes.tfd_b4.value = val;
	}
	
	//alert(tfd_mw_answers);
};

function tfd_mw_clear() 
{
	tfd_mw_answers=[null,null,null,null,null];
	for (var i=0;i<5;i++) 
		document.getElementById('tfd_b'+i).className='td_white';
};
