// JavaScript Document
	function SelectDeselectRow(RowID,totalcell,CheckBoxValue ,tempcolor, bgcolor,status)
	{
		if(CheckBoxValue)
		{
			document.form.Delete.disabled=false;
			document.form.Activate.disabled=false;
			document.form.Deactivate.disabled=false;
		
			for(s=1;s<=totalcell;s++)
			{
				//eval("Row"+s+RowID+".style.background='"+tempcolor+"'");
				document.getElementById("Row"+s+RowID).className=tempcolor;
			}
		}
			
		else{
		
		document.form.Delete.disabled=true;
		document.form.Activate.disabled=true;
		document.form.Deactivate.disabled=true;

		
			for(s=1;s<=totalcell;s++)
			{
				//eval("Row"+s+RowID+".style.background='"+bgcolor+"'");
				document.getElementById("Row"+s+RowID).className=bgcolor;
			}
	
		}
	}//end function
		
	///////////////////////////////////////////////////
		
	function SelectUnselectAll(PresentState,totalcell)
	{   
		frm=document.form;
		if (PresentState)
		{			
		frm.Delete.disabled=false;
		frm.Activate.disabled=false;
		frm.Deactivate.disabled=false;
		
		for(i=0;i<frm.elements.length;i++)
		  {	
		if(frm.elements[i].type=="checkbox" && frm.elements[i].name != "SelectAll")
		  {
			frm.elements[i].checked=true;			
			SelectDeselectRow(frm.elements[i].value,totalcell,true,'BgColor_SelectDeselect_Cell TDClass',frm.elements[i-1].value);
		  }
		  }	
		}
		else
		  {
			frm.Delete.disabled=true;
			frm.Activate.disabled=true;
			frm.Deactivate.disabled=true;
			
		
		for(i=0;i<frm.elements.length;i++)
		  {
			if(frm.elements[i].type=="checkbox" && frm.elements[i].name != "SelectAll")
			  {
				frm.elements[i].checked=false;
				SelectDeselectRow(frm.elements[i].value,totalcell,false,'BgColor_SelectDeselect_Cell TDClass',frm.elements[i-1].value);
			  }
		  }
	}//end else				
  	}//end function
	
		
	function ChangePageSize(PageName,Show,PageIndex)
	  {
 		location.href=PageName+"?show="+Show+"&pagesize="+document.form.PageSize.value;
 	  }
			
	function Exports()
	  {	
		var confirmstatuschange = window.confirm("Are you sure you want to export the result to excel sheet");
		if (confirmstatuschange)
		  {
			document.form.action="save_as_excel.php";
			document.form.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(URL,Status,Message)
		{	
			
			var confirmdelete = window.confirm("Are you sure you want to " + Message + " the selected item(s)?\n")
			if (confirmdelete)
			  {
				document.form.t_status.value=Status;
				document.form.method="post";
				document.form.action=URL;
				document.form.submit();
			  }
		}	
		
// Example: obj = findObj("image1");

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;

}

