function hssPager()
{
	this.epp  = 10;
	this.isIE = true;
	this.varName = 'Pager';
	this.objTbl = null;
	
	this.col1 = 0;	this.col2 = 0;	this.col3 = 0;
	this.filtervalue1 = '';	this.filtervalue2 = '';	this.filtervalue3 = '';
	this.DataObj = null;
	
	this.range1 = 0;
	this.range2 = 0;
	
	
	this.Attach = function( Tbl )
	{
		this.objTbl = Tbl;
		if(navigator.appName == "Microsoft Internet Explorer")
			this.isIE = true;
		else
			this.isIE = false;
	}
	
	this.SetEpp = function( rows )
	{
		this.epp = rows;
	}
	
	this.SetData = function( DataObj )
	{
		this.DataObj = DataObj;
	}
	
	this.Navigation = function( pageNum, classNameLink, fnName)
	{
		if( this.isIE )
		{
			sLink     = "javascript:" + fnName + "(" + this.varName + ", " + pageNum + ");";
			aLINK     = document.createElement('<a href="javascript:;" >');
			aLINK.setAttribute("href", sLink);
			aLINK.className = classNameLink;
			aLINKTEXT = document.createTextNode( pageNum );
			aLINK.appendChild( aLINKTEXT );
		}
		else
		{
			sLink = fnName + "(" + this.varName + ", " + pageNum + ");";
			
			aLINK = document.createElement('a');
			
			aLINK.href='javascript:;';
			aLINK.className = classNameLink;
			aLINKTEXT    =  document.createTextNode( pageNum );
			
			aLINK.onclick = new Function( sLink );
			
			aLINK.appendChild( aLINKTEXT );
			
		}
		return aLINK;
	}
	
	this.CountPages = function()
	{
		iFilteredCount = 0;
		
		for( i = 0; i < this.DataObj.Count(); i++ )
		{
			bshow = this.Compare(i);
			if( bshow == true )
			{
				iFilteredCount++;
			}
		}
		
		if( iFilteredCount == 0 )	return 0;
		rest = iFilteredCount % this.epp;
		Cnt = Math.floor( iFilteredCount / this.epp );
		if( rest != 0 )	Cnt ++; 
		
		return Cnt;
	}
	
	this.SetFilter = function(col1, filtervalue1, col2, filtervalue2, col3, filtervalue3)
	{
		this.col1 = col1;
		this.col2 = col2;
		this.col3 = col3;
		
		this.filtervalue1 = filtervalue1;
		this.filtervalue2 = filtervalue2;
		this.filtervalue3 = filtervalue3;
	}
	
	this.RemoveRows = function(StartRow, EndRow)
	{
		tbl = this.objTbl;
		
		if( this.isIE == true )
		{
			if(EndRow == -1 ) EndRow = tbl.rows.length-1;
			for( r = EndRow; r >= StartRow; r--)
			{
				tbl.deleteRow( r );
			}
		}
		else
		{
			allTr = tbl.getElementsByTagName("tr");
			if(EndRow == -1 ) EndRow = allTr.length - 1;
			for( r = EndRow; r >= StartRow; r--)
			{
				tr = allTr[r];
				tr.parentNode.removeChild( tr );
			}
		}
	}
	
	this.Compare = function(i)
	{
		if( this.filtervalue1 != '' && this.DataObj.GetData(i, this.col1 ) != this.filtervalue1)
			return false;

		if( this.filtervalue2 != '' && this.DataObj.GetData(i, this.col2 ) != this.filtervalue2)
			return false;

		if( this.filtervalue3 != '' && this.DataObj.GetData(i, this.col3 ) != this.filtervalue3)
			return false;
		
		return true;
	}
	
	this.SetPage = function(pageNum)
	{
		this.range2 = pageNum * this.epp;
		this.range1 = this.range2 - this.epp + 1;
		this.iFilteredCount = 0;
	}
	
	this.IsRow = function(i)
	{
		bshow = this.Compare(i);

		if( bshow == true )
		{
			this.iFilteredCount++;
			if( this.iFilteredCount >= this.range1 && this.iFilteredCount <= this.range2)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	this.AddRow = function()
	{
		if( this.isIE == true )
			tr = this.objTbl.insertRow( this.objTbl.rows.length );
		else
		{
			tr = document.createElement("tr"); // MIST FF !
			//this.objTbl.childNodes[0].appendChild(tr);
			this.objTbl.appendChild(tr);
		}
		return tr;
	}	
}
