var arrLocationIds=new Array();
var arrLocationNames=new Array();
var arrLocationDistricts=new Array();
arrLocationIds[0]='5';arrLocationNames[0]='aluva';arrLocationDistricts[0]='31';
arrLocationIds[1]='6';arrLocationNames[1]='kazhakkootam';arrLocationDistricts[1]='30';
arrLocationIds[2]='7';arrLocationNames[2]='Irinjalakuda';arrLocationDistricts[2]='33';


function swapSublist(frm,sel,sublistname,location_check)
{
 var newArray=Array();
 var arrayindex=Array();
var selected_count=0;
var selCount=0;
var count=0;
var flag=0;
var selectedArray=Array();
sublist=frm.elements[sublistname];



var sub_len = sublist.options.length;
for (i=0; i<sub_len; i++) {
sublist.remove(0);
}



if(typeof(sel.options)=="undefined")
{
 return;
}



 for (var j=0; j < sel.options.length;j++ )
{
if(sel.options[j].selected==true)
{ 
selectedArray[selectedArray.length]=sel.options[j].value;
}
}



for(i=0;i<selectedArray.length;i++)
{
for(j=i+1;j<selectedArray.length;j++)
{
if(selectedArray[i]==selectedArray[j])
{
selectedArray.splice(j,1);
}
}
}






for(var l=0;l<arrLocationDistricts.length;l++)
{
for(var p=0;p<selectedArray.length;p++)
{
if(arrLocationDistricts[l]==selectedArray[p])
{
sublist.options[selCount] = new Option(arrLocationNames[l],arrLocationIds[l]);
selCount++;
}
}
}
}

