// JavaScript Document
	///////////////////////////////////////////////////
	var page=0;
	function SelectUnselectAllNEW(PresentState, totalcell, pageno)
	{   
		 page=pageno;
		
		//alert(page);
		for(i=1;i<=totalcell;i++)
		{
			$('chk_'+(i)).checked=PresentState;
			selDselNEW(PresentState, i);
		}
		selDselButtons(totalcell);
	}
	function selDselNEW(PresentState, row, totalcell)
	{
		//alert(PresentState+" "+row+"  "+totalcell);
		
		for(j=1;j<7;j++)
		{
			if(document.getElementById("Row_"+row+'_'+j) != null)
			if(PresentState==true){
				document.getElementById("Row_"+row+'_'+j).className='BgColor_SelectDeselect_Cell TDClass';
			}else{
				document.getElementById("Row_"+row+'_'+j).className='TDClass';
			}
		}
		if(PresentState==false){$('SelectAllChekBox').checked=false}
		selDselButtons(row);
	}
	
	 function selDselButtons(totalcell)
	 {
		  //alert(totalcell);
		  var ttlChecked=0;
		  var ttlUnChecked=0;
		  for(x=1;x<=totalcell;x++)
		  {
			   
			   if($('chk_'+(x)) != undefined)
			   {
					//alert('chk_'+(x+page));
					if($('chk_'+(x)).checked==true)
					{
						ttlChecked++;
						document.frmList.Delete.disabled=false;
						document.frmList.Activate.disabled=false;
						document.frmList.Deactivate.disabled=false;
					}else{
						ttlUnChecked++;
						document.frmList.Delete.disabled=false;//true
						document.frmList.Activate.disabled=false;
						document.frmList.Deactivate.disabled=false;
					}
			   }
		  }
		  if(ttlUnChecked>0)
		  {
			   $('SelectAllChekBox').checked = false;
		  }
		  if(ttlChecked>0)
		  {
			   //alert("in do ");
			   //document.frmList.Delete.disabled=false;//true
			   document.frmList.Activate.disabled = false;
			   document.frmList.Deactivate.disabled = false;
		  }
		  else
		  {
			   document.frmList.Activate.disabled = true;
			   document.frmList.Deactivate.disabled = true;
		  }
		  if(ttlChecked == totalcell)
		  {
			   $('SelectAllChekBox').checked=true;
		  }
	}
	
	
		
	function ChangePageSize(PageName,Show,PageIndex)
	  {
 		location.href=PageName+"?show="+Show+"&pagesize="+document.frmList.PageSize.value;
 	  }
			
	function Exports()
	  {	
		var confirmstatuschange = window.confirm("Are you sure you want to export the result to excel sheet");
		if (confirmstatuschange)
		  {
			document.frmList.action="save_as_excel.php";
			document.frmList.submit();
		  }
	  }//end function
	
	 function ShowImagePreview(FormName,TextBoxName,ButtonName,DivName)
	 {
		  eval(DivName+".innerHTML='<br><img src="+eval(FormName+'.'+TextBoxName+'.value')+" border=1 alt=Close width=75 height=90>'");
	 }
	 function ChangeStatus(Status,Message)
	 {
		  //--
		  //alert("start ChangeStatus")
		  var confirmdelete = window.confirm("Are you sure you want to " + Message + " the selected item(s)?\n")
		  if (confirmdelete)
		  {
			document.frmList.t_status.value=Status;
			document.frmList.submit();
		  }
		  //alert("end ChangeStatus")
	 }
function findObj(theObj, theDoc)
{

  var p, i, foundObj;

  

  if(!theDoc) theDoc = document;

  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)

  {

    theDoc = parent.frames[theObj.substring(p+1)].document;

    theObj = theObj.substring(0,p);

  }

  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];

  for (i=0; !foundObj && i < theDoc.forms.length; i++) 

    foundObj = theDoc.forms[i][theObj];

  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 

    foundObj = findObj(theObj,theDoc.layers[i].document);

  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

  

  return foundObj;

}


