<!--
function $(id){
	return document.getElementById(id);
}

function checkall(frmObj){
    if(typeof frmObj != "object")
        frmObj = $(frmObj);
    var input = frmObj.getElementsByTagName("input");
    
	for(i = 0; i < input.length; i++){
		if (input[i].type == "checkbox"){
			input[i].checked = true;
		}
	}
	return false;
}

function clearall(frmObj){
	if(typeof frmObj != "object")
        frmObj = $(frmObj);
    var input = frmObj.getElementsByTagName("input");
    
	for(i = 0; i < input.length; i++){
		if (input[i].type == "checkbox"){
			input[i].checked = false;
		}
	}
	return false;
}

function headerChecked(srcObj, frmObj){
    if(srcObj.checked){ checkall(frmObj); }
    else{ clearall(frmObj); }
}

function selectcheck(frmObj, strtype, obj)
{
    if(typeof frmObj != "object")
        frmObj = $(frmObj);
    var input = frmObj.getElementsByTagName("input");
	var flag = 0;
	var strid = "0";
	for(i = 0; i < input.length; i++) 
	{
		if (input[i].type == "checkbox" && !isNaN(input[i].name)) 
		{
			if (input[i].checked)
			{
				if (flag == 0)
					flag = 1;
				if(input[i].name != "")
				    strid = strid + "#" + input[i].name;
		    }
		}
	}
    strid = strid.substring(2);
	if(flag == 1)
	{
	    if(obj)
	        document.getElementById(obj).value = strid;
	    else
	    {
	        if(document.getElementById('hdnID') != null)
		        document.getElementById('hdnID').value = strid;
		}		
		if(strtype == "Delete")
			return confirm("Are you sure you want to delete selected records?");
		else
			return true;
	}
	else
	{
		alert("Select at least one record from list.");
		return false;
	}
}

function removeHeaderCheck(obj)
{   
    $(obj).checked = false;
}

function selectcheckHierarchy(frmObj, strtype, obj)
{
	if(typeof frmObj != "object")
        frmObj = $(frmObj);
    var input = frmObj.getElementsByTagName("input");
	var flag = 0;
	var strid = "0";
	for(i = 0; i < input.length; i++) 
	{
		if (input[i].type == "checkbox" && !isNaN(input[i].name)) 
		{
			if (input[i].checked)
			{
				if (flag == 0)
					flag = 1;
				if(input[i].name != "")
				    strid = strid + "#" + input[i].name;
		    }
		}
	}
    strid = strid.substring(2);
    
	if (flag == 1)
	{
	    if(obj)
	        $(obj).value = strid;
	    else
	    {
	        if($(hdnID) != null)
		        $(hdnID).value = strid;
		}
		
		if (strtype == "Delete")
			return confirm('Are you sure you want to delete selected records?');
		else if(strtype == "Active")
			 return confirm("Activating selected categories, It will also active child categories, are you sure?");
		else if(strtype == "Inactive")
		    return confirm("Inactivating selected categories, It will also inactive child categories, are you sure?");
	}
	else
	{
		alert("Select at least one record from list.");
		return false;
	}
}

//Random String Generator//
function RamdomString(intLen)
{
	var strRet = "";
	var iCntr  = 0;
	var rndNo  = 0;
	var arrCharacters = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
	for (iCntr = 0; iCntr < intLen; iCntr++)
	{
		rndNo = Math.floor((61 - 1 + 1) * Math.random() + 1);
		strRet = strRet + arrCharacters[rndNo];
	}
	return strRet;
}

//Below functions are used to move the values left <==> rigth from listbox
var objleft, objlefttext, objright, objrighttext;

function AssignObjValue(fList, tfrom, tList, tTo)
{
    objleft = $(fList);
	objlefttext = $(tfrom);
	objright = $(tList);
	objrighttext = $(tTo);
}

function generateListArray()
{
    all_array();
    return true;
}
function all_array()
{
	objrighttext.value = "";
	for(var i=0; i < objright.length; i++)
		objrighttext.value = objrighttext.value + '#' + objright.options[i].value;

	objlefttext.value ="";
	for(var i=0; i < objleft.length; i++)
		objlefttext.value = objlefttext.value + '#' + objleft.options[i].value;
	
	if (objlefttext.value.length > 0)
		objlefttext.value = objlefttext.value.substring(1, objlefttext.value.length);
	if (objrighttext.value.length > 0)
		objrighttext.value = objrighttext.value.substring(1, objrighttext.value.length);
}

function AddOne()
{
	if(objleft.selectedIndex >= 0)
	{
		var newOption;
		newOption = new Option(objleft.options[objleft.selectedIndex].text, objleft.value, 0, 0);
		objright.options[objright.length] = newOption;
		objleft.remove(objleft.selectedIndex);
	}
}

function RemoveOne()
{
	if(objright.selectedIndex >= 0)
	{
		var newOption;
		newOption= new Option(objright.options[objright.selectedIndex].text, objright.value, 0, 0);
		objleft.options[objleft.length] = newOption;
		objright.remove(objright.selectedIndex);
	}
}

function RemoveAll()
{
	var newOption;
	for(var i=0; i < objright.length; i++)
	{
		objright.selectedIndex = i;
		newOption= new Option(objright.options[objright.selectedIndex].text, objright.value, 0, 0);
		objleft.options[objleft.length] = newOption;
	}
	for(var i=(objright.length-1); i >= 0; i--)
		objright.options[i] = null;
	objright.selectedIndex = -1;
}

function AddAll()
{
	var newOption;
	for(var i=0; i < objleft.length; i++)
	{
		objleft.selectedIndex = i;
		newOption= new Option(objleft.options[objleft.selectedIndex].text, objleft.value, 0, 0);
		objright.options[objright.length] = newOption;
	}
	for(var i=(objleft.length-1); i >= 0; i--)
		objleft.options[i] = null;
	objleft.selectedIndex = -1;
}
//-->