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 openwin(theURL,winName,features) 
{ 
  window.open(theURL,winName,features);
}

function searchcheck(obj)
{ 
obj = document.getElementById(obj);

	if (obj.value=="")
	{
		alert("-- Enter Search keyword")
		return false;
	}
	else
		return true;
}



function KeyCheck(evt,txtSearch,btnSearch) {



evt = (evt) ? evt : ((event) ? event : null);
var evver = (evt.target) ? evt.target : ((evt.srcElement)
?evt.srcElement : null );
var keynumber = evt.keyCode;
if(keynumber==13){      
    if(searchCriteria(document.getElementById(txtSearch))==false)    
        return false;
    else
    { 
        document.getElementById(btnSearch).focus();
        document.getElementById(btnSearch).focus();        
    }
}
}

function searchCriteria(SearchCtrl)
{ 
	if (SearchCtrl.value.replace(/\s*$/, '')=="")
	{
		alert("-- Enter Search keyword")
		return false;
	}
	else
		return true;
}


function removeHeaderCheck(obj)
{   
    document.getElementById(obj).checked = false;
}


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.name.indexOf('JBN')>=0 ) && elm.disabled==false  ) 
		{
			
			elm.checked = true;
		}
	}
}

// created by krunal 6-oct-07
// start here
function SelectProfilecheck(frmObj,strtype)
{
	var flag = 0;
	var strid = "";
	for(i = 0; i < frmObj.elements.length; i++) 
		{	
			elm = frmObj.elements[i]
			if (elm.type == "checkbox") 
			{
			
				if (elm.checked)
				{
					if (flag==0)
					{
						flag = 1;
					}					
			    }
			}
		}
	if (flag == 1)
	{		      				  
		   return true;
	}
	else
	{
		alert("-- Select At Least One Record");
		return false;
    }  
    return true;  
}

function clearallForProfile(frmObj)
{
	var elm;
	for(i = 0; i < frmObj.elements.length; i++) 
	{	
		elm = frmObj.elements[i]
		if (elm.type == "checkbox") 
		{
			elm.checked = false;
		}
	}
}

function checkallForProfile(frmObj)
{
	
	var elm;
	for(i = 0; i < frmObj.elements.length; i++) 
	{	
		elm = frmObj.elements[i]
		if (elm.type == "checkbox"  && elm.disabled==false) 
		{
			
			elm.checked = true;
		}
	}
}

// end here 
//

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.name.indexOf('JBN')>=0)) 
		{
			elm.checked = false;
		}
	}
}
//created by shweta=02/10/2007


function selectcheckusers(frmObj,strtype)
{
   
	var flag = 0;
	var strid = "0";
	var strtyp="";
	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;
					strtyp = strtyp + "#" + elm.id;
				}
			}
		}
	if (flag == 1)
	{
		frmObj.hdnID.value=strid;
		frmObj.hdnTyp.value = strtyp;
		if (strtype == "Delete")
			return delconfirm();
		else
			return true;
	}
	else
	{
		alert("-- Select At Least One Record");
		return false;
	}
}




function selectforumcheck(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
	   // {
		    document.getElementById(obj).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;
}
}
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
			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)
}


//For Help Management
function selecthelpcheck(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)
	{
	    //alert(frmObj.obj);
	    if (obj)
	    {
	        document.getElementById(obj).value=strid;
	    }
	    else
	    {
		     document.getElementById(obj).value=strid;
		} 
		if (strtype == "Delete")
			return delconfirm();
		else
			return true;
	}
	else
	{
		alert("--Select At Least One Record");
		return false;
	}
}
function delconfirm()
{
	 return confirm('Are you sure you want to delete?');
}
function removeHeaderCheck(obj)
{   
    document.getElementById(obj).checked = false;
}




// Added by Sweta
function moveddl(fromList, toList,ddl) {
	
	var arrFrom = new Array();
	var arrTo = new Array();
	var arrLookup = new Array();

	for (var i=0; i < toList.options.length; i++) {
		arrLookup[toList.options[i].text] = toList.options[i].value;
		arrTo[i] = toList.options[i].text;
		}
	var fLength = 0;
	var tLength = arrTo.length;
	for(var i=0; i < fromList.options.length; i++) {
		arrLookup[fromList.options[i].text] = fromList.options[i].value;
		if (fromList.options[i].selected && fromList.options[i].value != "") {
			arrTo[tLength] = fromList.options[i].text;
			tLength++;
		}
		else {
			arrFrom[fLength] = fromList.options[i].text;
			fLength++;
		}
	}
	
	arrFrom.sort(); 
	//arrTo.sort(); 
	fromList.length = 0;
	toList.length = 0;
	for(var j=0; j < arrFrom.length; j++) {
		var newList = new Option();
		newList.value = arrLookup[arrFrom[j]];
		newList.text = arrFrom[j];
		fromList[j] = newList;
	}
	//alert(arrTo.length)
	if(arrTo.length>=2)
	{
	    var newList = new Option();
		newList.value = arrLookup[arrTo[0]];
		newList.text = arrTo[0];
	    fromList[arrFrom.length]=newList;
	        
	    var newList = new Option();
	    newList.value = arrLookup[arrTo[1]];
	    newList.text = arrTo[1];
	    toList[0] = newList;
	        
	}
	else
	{
	    for(var j=0; j < arrTo.length; j++) {
		    var newList = new Option();
		    newList.value = arrLookup[arrTo[j]];
		    newList.text = arrTo[j];
		    toList[j] = newList;
	    }
	}
	var ddl=document.getElementById("ctl00_ContentPlaceHolder1_toList");
	var hdn=document.getElementById("ctl00_ContentPlaceHolder1_fromList");
	//alert(hdn.value);
	if (hdn.value!='')
		{
			var temp='' + hdn.value ;	
		}
	else
		{
			var temp='';	
		}
	
//alert('temp set ' + temp);
temp='';
for(var i=0; i < ddl.options.length; i++) {
		if (i != 0 )
			{
			temp  =  temp + ddl.options[i].value ;
			//alert(temp +' i1' );
			}
		else
			{
			if (temp == '')
				{
				temp  =  ddl.options[i].value ;
				}
			else
				{
				temp  = temp + ddl.options[i].value ;
				}
			//	alert(temp +' i2' );
			}
		
		}
	hdn.value=temp;
	document.getElementById("ctl00_ContentPlaceHolder1_txtto").value=temp;
	
//	alert('FINAL' + hdn.value);
}

function moveddl1(fromList, toList) {
	
	var arrFrom = new Array();
	var arrTo = new Array();
	var arrLookup = new Array();

	for (var i=0; i < toList.options.length; i++) {
		arrLookup[toList.options[i].text] = toList.options[i].value;
		arrTo[i] = toList.options[i].text;
		}
	var fLength = 0;
	var tLength = arrTo.length;
	for(var i=0; i < fromList.options.length; i++) {
		arrLookup[fromList.options[i].text] = fromList.options[i].value;
		if (fromList.options[i].selected && fromList.options[i].value != "") {
			arrTo[tLength] = fromList.options[i].text;
			tLength++;
		}
		else {
			arrFrom[fLength] = fromList.options[i].text;
			fLength++;
		}
	}
	
	arrFrom.sort(); 
	//arrTo.sort(); 
	fromList.length = 0;
	toList.length = 0;
	for(var j=0; j < arrFrom.length; j++) {
		var newList = new Option();
		newList.value = arrLookup[arrFrom[j]];
		newList.text = arrFrom[j];
		fromList[j] = newList;
	}
	for(var j=0; j < arrTo.length; j++) {
		var newList = new Option();
		newList.value = arrLookup[arrTo[j]];
		newList.text = arrTo[j];
		toList[j] = newList;
	}
	var ddl=document.getElementById("ctl00_ContentPlaceHolder1_toList");
	var hdn=document.getElementById("ctl00_ContentPlaceHolder1_fromList");
	//alert(ddl.options.length);
	if (hdn.value!='')
		{
			var temp='' + hdn.value +',';	
		}
	else
		{
			var temp='';	
		}
	
//alert('temp set ' + temp);
temp='';
for(var i=0; i < ddl.options.length; i++) {
		if (i != 0 )
			{
			temp  =  temp + ','+ ddl.options[i].value ;
			//alert(temp +' i1' );
			}
		else
			{
			if (temp == '')
				{
				temp  =  ddl.options[i].value + ',';
				}
			else
				{
				temp  = temp + ',' + ddl.options[i].value ;
				}
			//	alert(temp +' i2' );
			}
		
		}
	hdn.value=temp;
//	alert('FINAL' + hdn.value);
}

function selectcheckHierarchy(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 if(strtype == "Active")
			 return confirm('You are Activating The Category,It may have child category ,By Activating this category child category will be Active,Are you sure? ');
		else if(strtype == "Inactive")
			return confirm('You are InActivating The Category,It may have child category ,By Inactivating this category child category will be Inactive,Are you sure? ');
		
	}
	else
	{
		alert("Select At Least One Record");
		return false;
	}
}

function createFlashObject(filePath, width, height)
{
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + width + "' height='" + height + "' align='top'>");
    document.write("<param name='movie' value='" + filePath + "' />");
    document.write("<param name='quality' value='high' />");
    document.write("<param name='wmode' value='transparent' />");
	document.write("<embed src='" + filePath + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "' align='top'></embed></object>");
    //document.write("");
}

// Extra check.....

function ValidateSelected(frmObj, strtype, objfinal)
{
	var flag = 0;
	var strid = "0";
	var Record = frmObj.getElementsByTagName("input");
	for(i = 0; i < Record.length; i++) 
		{	
			elm = Record[i];
			
			if (elm.type == "checkbox" && !isNaN(elm.name)) 
			{			
				if (elm.checked)
				{
					if (flag==0)
					{
						flag = 1;
					}
					strid = strid + "#" + elm.name;
			}
			}
		}
	if (flag == 1)
	{
	    if(objfinal != null)
		    document.getElementById(objfinal).value = strid;
		    
		if (strtype == "Delete")
			return delconfirm();
		else
			return true;
	}
	else
	{
		alert("-- Select at least one record");
		return false;
	}
}

function AllUnchecked(frmObj)
{
	var elm;
	var Record = frmObj.getElementsByTagName("input");
	for(i = 0; i < Record.length; i++) 
	{	
		elm = Record[i]
		if (elm.type == "checkbox" && !isNaN(elm.name)) 
		{
			elm.checked = false;
		}
	}
}

function AllChecked(frmObj)
{
	var elm;
	var Record = frmObj.getElementsByTagName("input");
	for(i = 0; i < Record.length; i++) 
	{	
		elm = Record[i]
		if (elm.type == "checkbox" && !isNaN(elm.name) ) 
		{			
			elm.checked = true;
			
		}
	}
}