//######### MULTISEARCH>JS USE FOR MULTISEARCHING TREE FUNCANALITY #############
// Developed By Rajdip Ghosh

function removeSearch(sel_id)
{
var remove_sel = sel_id;

//var x = document.getElementById(remove_sel);
var query_string = '<?php echo $_SERVER['QUERY_STRING']?>';

var query_arr = query_string.split("&");//create the array for  each num value pair from query string

	frm = document.createElement("form");
	frm.setAttribute("method","GET");
	frm.setAttribute("name","frmPost");
	frm.setAttribute("action","index.php");
	
	for(var j=0;j<query_arr.length;j++)
	{
	var inp_element = query_arr[j]; //get the array element. 
	var num_val = inp_element.split("="); //separete the num and value from the num value pair
	var num = num_val[0]; //num
	if(num == remove_sel)//if the numvalue match with the delete attribute
	var val = '';
	else
	var val = num_val[1]; //val
	if(num != "subm"){
		input = document.createElement("input"); //create the element using DOM
		input.setAttribute("type","hidden");
		input.setAttribute("name",num);
		if(num == 's')
		input.setAttribute("value",'%');
		else
		input.setAttribute("value",val);
		frm.appendChild(input);
		}
	}
	
	document.getElementById("setFrm").appendChild(frm);
	document.frmPost.submit();




x.value = "";
//document.frm_multiple.submit();
}


function addSearch(block_id,sel_id)
{
var query_string = '<?php echo $_SERVER['QUERY_STRING']?>';


var search_str = "";
	if(eval(block_id) == 0)
	{
	
	search_str = 'multisearch_0='+eval(sel_id);
	query_string = query_string.replace('multisearch_0=',search_str);
	}
	else if(eval(block_id) == 1)
	{
	search_str = 'multisearch_1='+eval(sel_id);
	query_string = query_string.replace('multisearch_1=',search_str);
	}
	else if(eval(block_id) == 2)
	{
	search_str = 'multisearch_2='+eval(sel_id);
	query_string = query_string.replace("multisearch_2=",search_str);
	
	}
	else if(eval(block_id) == 3)
	{
	search_str = 'multisearch_3='+eval(sel_id);
	query_string = query_string.replace('multisearch_3=',search_str);
	}
	else if(eval(block_id) == 4)
	{
	search_str = 'multisearch_4='+eval(sel_id);
	query_string = query_string.replace('multisearch_4=',search_str);
	}
	
	var query_arr = query_string.split("&");//create the array for  each num value pair from query string
	//alert(query_arr[0]);
	//alert(query_arr[1]);
	

	frm = document.createElement("form");
	frm.setAttribute("method","GET");
	frm.setAttribute("name","frmPost");
	frm.setAttribute("action","index.php");
	
	for(var j=0;j<query_arr.length;j++)
	{
	var inp_element = query_arr[j]; //get the array element. 
	var num_val = inp_element.split("="); //separete the num and value from the num value pair
	var num = num_val[0]; //num
	var val = num_val[1]; //val
	if(num != "subm"){
		input = document.createElement("input"); //create the element using DOM
		input.setAttribute("type","hidden");
		input.setAttribute("name",num);
		if(num == 's')
		input.setAttribute("value",'%');
		else
		input.setAttribute("value",val);
		frm.appendChild(input);
		}
	}
	
	document.getElementById("setFrm").appendChild(frm);
	document.frmPost.submit();
	
}
