function clear()
{
		document.frm1.reset()
		document.getElementById('duplicatelist1').style.display='none';	
		document.getElementById('duplicatelist').style.display='none';	
		document.getElementById('list5').style.display='none';	
		document.getElementById('list6').style.display='none';
}
function filterIt(){
			
		
		if(document.frm1.list1.value==''){
		  alert("Please enter List 1");
		  return false;
		}
		document.getElementById('list5').style.display='';	
		document.getElementById('list6').style.display='';
			if(document.frm1.duplicate.checked==true){
				document.getElementById('duplicatelist1').style.display='';	
				document.getElementById('duplicatelist').style.display='';	
			}
			else {
				document.getElementById('duplicatelist1').style.display='none';	
				document.getElementById('duplicatelist').style.display='none';	
				}
		/*if(document.frm1.list2.value==''){
		  alert("Please enter List 2");
		  return false;
		}*/
	var Mlist11=	document.frm1.list1.value;
	
	var Mlist1=	document.frm1.list1.value;
	
	/*var Mlist2=	document.frm1.list2.value;	
	var Mlist22=	document.frm1.list2.value;	*/
	
	if(1==2){
		
		var found=0;
		var unique=0;
		
		Mlist1=Mlist1.split("\n");
		document.frm1.list3.value='';
		document.frm1.list7.value='';
		document.frm1.getbtn.disabled=true;
	
		var str='';
		for( var i=0;i<Mlist1.length;i++){
			
			Mlist1[i]=Mlist1[i].replace(/\n/g, "");
			Mlist1[i]=Mlist1[i].replace(/\r/g, "");
			}
		
		for( var i=0;i<Mlist1.length;i++){
			found=0;
			for(var j=0;j<Mlist1.length;j++){
	
				if( i==j) continue;
				
				if(Mlist1[i]==Mlist1[j]){
					found=1;
					break;
				}
			}
		/*	if(found==0 && Mlist1[i]!=''){
				unique++;
				document.frm1.list3.value=document.frm1.list3.value+Mlist1[i]+"\n";
			}*/	
			
		}
		if(parseInt(unique) == 0){
		document.frm1.list3.value+="No record found"+"\n";
		}else{
		//document.frm1.list3.value+="("+unique+")"+ "record found"+"\n";
		}
		document.frm1.getbtn.disabled=false;
	}else{//duplicate
	
		var found=0;
		var unique=0;
		var foundArray=Array();
		var foundArray1=Array();
		Mlist1=Mlist1.split("\n");
		document.frm1.list3.value='';
		document.frm1.list7.value='';
		document.frm1.getbtn.disabled=true;
	
		var str='';
		for( var i=0;i<Mlist1.length;i++){
			Mlist1[i]=Mlist1[i].replace(/\n/g, "");
			Mlist1[i]=Mlist1[i].replace(/\r/g, "");
		}

		for( var i=0;i<Mlist1.length;i++){
			
			//new changes
			found=0;
			for(var k=0;k<foundArray.length;k++){
				if(Mlist1[i]==foundArray[k] && Mlist1[i]!=''){
					unique++;
					found=1;
					break;
				}  
			}
			if(Mlist1[i]!=''){
				
			if(found == 0 ){
			foundArray.push(Mlist1[i]);
			var length1=foundArray.length;
			}
			else{
				foundArray1.push(Mlist1[i]);
				var length2=foundArray1.length;
				
				}
			}
	
			if(parseInt(unique) != 0){
			var length=length1 + length2;	
			}
			else
			{
			var length=length1;
			}
	}
	
			for(var k=0;k<foundArray.length;k++){
				document.frm1.list3.value=document.frm1.list3.value+foundArray[k]+"\n";
			}	
		for(var k=0;k<foundArray1.length;k++){
				document.frm1.list7.value=document.frm1.list7.value+foundArray1[k]+"\n";
			}
		if(parseInt(unique) == 0){
			document.getElementById('list5').innerHTML="("+length+")"+ " record found";
			document.getElementById('list6').innerHTML="No duplicate record found";
		//document.frm1.list6.value+="No duplicate record found"+"\n";
		}else{
			document.getElementById('list5').innerHTML="("+length+")"+ " record found";
			document.getElementById('list6').innerHTML="("+unique+")"+ " duplicate record found";
		//document.frm1.list6.value+="("+unique+")"+ " duplicate record found"+"\n";
		}
	
	document.frm1.getbtn.disabled=false;
	
	}
}

