function alternate(id, bflag)
		{
			
			if(document.getElementsByTagName)
			{

			var table = document.getElementById(id);
			var rows = table.getElementsByTagName("tr");
			var altercolor;
			var altercolorpre;
			var totalcols;
			var c;
		if (bflag == true) {
			if (rows.length>1 ) 
				{
				rows[1].className="white";
				c=rows[0].childNodes;
				totalcols=c.length;
				} //end of if

			altercolor = '0';
			altercolorpre = '0';

			for(i=1;i<rows.length;i++)
				{
				c=rows[i].childNodes;
				c1 = rows[i-1].childNodes;

				// Append empty cell if this row has less cell than header row.
				if (c.length < totalcols)
					{
					for (var k=c.length;k<totalcols;k++)
						{
						// creates an element whose tag name is TD
						mycurrent_cell=document.createElement("td");
						// creates a Text Node
						currenttext=document.createTextNode(" ");
						// appends the Text Node we created into the cell TD
						mycurrent_cell.appendChild(currenttext);
						// appends the cell TD into the row TR
						rows[i].appendChild(mycurrent_cell);
						} //end of for
					 } //end of if

				for (var k=0;k<(c.length-1);k++)
					{
					// compare each cell of this row to the previous row cells
					if ( (c[k].innerHTML != c1[k].innerHTML))
						{
						if (altercolorpre=='1') 
							{
							altercolor='0';
							break;
							}
							else 
							{
							altercolor='1';
							break;
							}
						} //end of if
					} //end of for

				if (altercolor=="0" )
					{
					rows[i].className="gray";
					}
				else
					{
					rows[i].className="white";
					}

				altercolorpre=altercolor;

				} //end of for


			} // end of bflag = true
		else 	{
			for(i=1;i<rows.length;i++)
				{
				rows[i].className = "white";
				}

			}
			} //end of if
		} //end of function