	/*
	 * Function Process Request
	 * @desc it evaluates the request and process accordingly
	 * @return array of returned values.
	 */	
	function procRequest(strUrl){
		
		var obReq = sendRequest(strUrl);
		
		if(obReq.status == 200){
			if(obReq.readyState == 4){
				var strRetn = obReq.responseText;				
				if(strRetn.search(":")){
					return strRetn.split(":");
				}
				else{
					return strRetn;
				}
			}
		}
		return null;
	}	
	
	/*
	 * Function Send Request
	 * @desc it generates the request to the XML HTTP Request object.
	 * @param obReq request object.	
	 */	
	function sendRequest(sUrl){
		var obXttp;
		
		if(window.ActiveXObject){
			obXttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else{
			obXttp = new XMLHttpRequest();
		}
		obXttp.open("GET",sUrl,false);
		obXttp.send(null);
		return obXttp;
	}
	
	/*
	 * Function clear List
	 * @desc it clears all the list elements.
	 * @param element object.
	 */	
	 
	 function clearList(obElem){
		if(obElem){
			for(var i = obElem.length; i > 0; i--){
				obElem.options[i]=null;
			}
			
			if(!obElem.length)
				obElem.options[0] = new Option("--Select--",0,'',false);
			obElem.disabled = true;	
		}
	}
	
	function clearList2(obElem){
		//alert(1);
		if(obElem){
			for(var i = obElem.length; i > 0; i--){
				obElem.options[0] = new Option("--Select--",0,'',false);
				obElem.options[i]=null;
			}
			
			if(!obElem.length)
				obElem.options[0] = new Option("--Select--",0,'',false);
			obElem.disabled = true;	
		}
	}
	
	function clearList1(obElem){
		
		if(obElem){
			for(var i = obElem.length; i > 0; i--){
				obElem.options[0] = new Option("----N/A----",'','',false);
				obElem.options[i]=null;
			}
			
			if(!obElem.length)
				obElem.options[0] = new Option("----N/A----",'','',false);
			obElem.disabled = true;	
		}
	}
	
	function clrdef() {
		alert(2);
				
				obElem.options[0] = new Option("----N/A----",0,'',false);
				//obElem.options[i]=null;
	}
	
	/*
	 * Function fillList
	 * @desc it populates the array elements in the combo box.
	 * @param array of values.
	 */	
	function fillList(arrList, obElm,subsubcat){
		if(isEmpty(arrList))	
			return false;
		
		var arrUnits;
		
		for(var i=0; i < arrList.length; i++){
			
			arrUnits = arrList[i].split("-");
			
			obElm.options[i+1] = new Option(arrUnits[1], arrUnits[0], '', false);
		}
		if(obElm){			
			obElm.disabled = false;
		}
		
		if(subsubcat){
			subsubcat.value = "Select";
		}
	}



function fillList1(arrList, obElm){
		
		//alert(arrList.length);
		/*if(isEmpty(arrList))	
			return false;*/

		var arrUnits;		
		for(var i=0; i < arrList.length; i++){
			//alert(arrList[i].split("-"));
			arrUnits = arrList[i].split(",");	
			//alert(arrUnits);
			obElm.options[i+1] = new Option(arrUnits[1], arrUnits[0], '', false);			
		}
		if(obElm){			
			obElm.disabled = false;
		}
	}

function getDynamic(iId,obTar,subsubcat,fndhome)
{
	//alert(iId);
if(iId == 0){
clearList(obTar);
return false;
}
var strUrl;
strUrl = "getsubcat.php?catid="+iId;
var arrVal = procRequest(strUrl);
clearList(obTar);
fillList(arrVal,obTar,subsubcat);
}


/* Ajax dynamic data popultaion*/
function getcity_inAdmin(iId,obTar,subsubcat)
{
if(iId == 0){
clearList(obTar);
return false;
}

var strUrl;
strUrl = "../getsubcat.php?catid="+iId;
//alert(strUrl);
var arrVal = procRequest(strUrl);
//alert(arrVal);
clearList(obTar);
fillList(arrVal,obTar,subsubcat);
}






	