function GetObj()
	    {
	        objleft=document.getElementById("ctl00_ContentPlaceHolder1_fromList");
		    objlefttext=document.getElementById("ctl00_ContentPlaceHolder1_txtfrom");
		    objright=document.getElementById("ctl00_ContentPlaceHolder1_toList");								
		    objrighttext=document.getElementById("ctl00_ContentPlaceHolder1_txtto");

	    }
function searchcheck(frmObj)
{
	if (frmObj.txtSearch.value=="")
	{
		alert("-- Enter Search keyword")
		return false;
	}
	else
		return true;
}

function checkall(frmObj)
{
	var elm;
	for(i = 0; i < frmObj.elements.length; i++) 
	{	
		elm = frmObj.elements[i]
		if (elm.type == "checkbox" && !isNaN(elm.name)) 
		{
			elm.checked = true;
		}
	}
}

function clearall(frmObj)
{
	var elm;
	for(i = 0; i < frmObj.elements.length; i++) 
	{	
		elm = frmObj.elements[i]
		if (elm.type == "checkbox" && !isNaN(elm.name)) 
		{
			elm.checked = false;
		}
	}
}
// General Check Uncheck All CheckBox
function checked(frmObj)
{
	var elm;
	for(i = 0; i < frmObj.elements.length; i++) 
	{	
		elm = frmObj.elements[i]
		if (elm.type == "checkbox" ) 
		{
			
			elm.checked = true;
		}
	}
}

function unchecked(frmObj)
{
	var elm;
	for(i = 0; i < frmObj.elements.length; i++) 
	{	
		elm = frmObj.elements[i]
		if (elm.type == "checkbox") 
		{
			elm.checked = false;
		}
	}
}
function selectcheck(frmObj,strtype)
{
	var flag = 0;
	var strid = "0";
	for(i = 0; i < frmObj.elements.length; i++) 
		{	
			elm = frmObj.elements[i]
			if (elm.type == "checkbox") 
			{
				if (elm.checked)
				{
					if (flag==0)
					{
						flag = 1;
					}
					strid = strid+"#"+elm.name;
				}
			}
		}
	if (flag == 1)
	{
	   
		frmObj.hdnID.value=strid;
		if (strtype == "Delete" )
			return delconfirm();
		else if (strtype ==" ")
			return delconfirm();
		else
			return true;
	}
	else
	{
		alert("-- Select At Least One Record");
		return false;
	}
}



function select6check(frmObj,strtype)
{
	var flag = 0;
	var count =0;
	var strid = "0";
	for(i = 0; i < frmObj.elements.length; i++) 
		{	
			elm = frmObj.elements[i]
			if (elm.type == "checkbox") 
			{
				if (elm.checked)
				{
					if (flag==0)
					{
						flag = 1;						
					}
					strid = strid+","+elm.name;
					count = count + 1;
				}
			}
		}
	if (flag == 1)
	{
		frmObj.hdnID.value=strid;
		if (count > 6)
			{
				alert("-- Select only 6 records");
				return false;
			}
		
		else // equal to 6 records
			return true ;
	}
	else
	{
		alert("-- Select At Least One Record");
		return false;
	}
}


function delconfirm()
{
	 return confirm('Are you sure you want to delete?');
}

//''''''Below functions are used for moving the value left<>rigth from listbox''''''
var objleft,objlefttext,objright,objrighttext ;

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 , intSell;
		//intSell=1;
		//for(var i=0;i< objright.length;i++)
		//	if(objleft.value ==objright(i).value)
			//	intSell=0;
		
		newOption= new Option(objleft.options[objleft.selectedIndex].text, objleft.value,0,0);
		objright.options[objright.length] = newOption;
		objleft.remove(objleft.selectedIndex);			
		all_array();			
	}	
}
function RemoveOne()
{
	if(objright.selectedIndex >= 0)
	{
		var newOption,intSell;
		//intSell=1;
	
		newOption= new Option(objright.options[objright.selectedIndex].text, objright.value,0,0);
		objleft.options[objleft.length] = newOption;
		objright.remove(objright.selectedIndex);
		all_array();
	}
}
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;
	//all_array();
}
function AddAll()
{
	var newOption ;
	for(var i=0;i<objleft.length;i++)
	{
		objleft.selectedIndex=i;
		newOption= new Option(objleft(objleft.selectedIndex).innerText, 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;							
	//all_array();
}	

//'''''''''''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;
	//alert(strRet)
}


function selcheck(frmObj,strtype,obj)
{
	var flag = 0;
	var strid = "0";
	for(i = 0; i < frmObj.elements.length; i++) 
		{	
			elm = frmObj.elements[i]
			if (elm.type == "checkbox" && !isNaN(elm.name)) 
			{
			
				if (elm.checked)
				{
					if (flag==0)
					{
						flag = 1;
					}
					strid = strid + "#" + elm.name;
			}
			}
		}
	if (flag == 1)
	{
	    	
	    if (obj)
	    {
	        document.getElementById(obj).value=strid;
	       
	    }
	    else
	    {
		    frmObj.hdnID.value=strid;
		} 		    
		if (strtype == "Delete")
		   return confirm('Are you sure you want to delete?');   		    
		else 
		   return true;
	}
	else
	{
		alert("Select At Least One Record");
		return false;
	}
}
