var inline_ad=new Array("&lt;br&gt;","</p>")
var tot, b, c;

function doHighlight_inline(bodyText, searchTerm, highlightStartTag, highlightEndTag,index)
{
  // the highlightStartTag and highlightEndTag parameters are optionalBiodiesel - Definition, Glossary, Details
  //alert(index);
  
  var newText = "";
  var i = -1;
  var lcSearchTerm = searchTerm.toLowerCase();
  var lcBodyText = bodyText.toLowerCase();
  var alm, almm, leng, ll, lll;
  var found=0;
  var no_fd;
  //alert(bodyText.length);
		   if(bodyText.length < 5000)
				   {
					   no_fd = 1;
				   } else if(bodyText.length > 5000 && bodyText.length < 15000) {
					   no_fd = 2;
				   } else {
					   no_fd = 3;
				   }
  while (bodyText.length > 0) {
	//alert(i);
	i = lcBodyText.indexOf(lcSearchTerm, i+1);
	
	if (i < 0) {
	  newText += bodyText;
	  bodyText = "";
	} else {
		   if (bodyText.lastIndexOf("/a>", i) >= bodyText.lastIndexOf("<a", i)) {
			    //stip anything inside an table tag
			    if (lcBodyText.lastIndexOf("/table>", i) >= lcBodyText.lastIndexOf("<table", i)) {
		// skip anything inside a <script> block
		if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
				alm = bodyText.substr(i-1, searchTerm.length);
				almm = bodyText.substr(i+1, searchTerm.length);
				//var nmm = bodyText.substring(0, i);
				leng = alm.length;
				//alert(leng);
				ll = alm.charAt(0);
				lll = almm.charAt(leng-1);						   
		  //alert(lll);
		  var txt = bodyText.substring(0, i);
		  var tot_midl_worda = txt.length;
		 //alert(tot_midl_worda);
		  if((found < no_fd) && tot_midl_worda > 3500)
		  {
	  
	   if(found == 0)
	   {
    highlightStartTag = "<center><div id='banner' style='background:#a2b170; border:3px solid #f1f1f1;'>";
	highlightStartTag += "<table id='trbg' align='center' bgcolor='#a2b170'><tr><td>";
	highlightStartTag += "<a href='http://www.plantoils.in/portal/ce/report/cellulosic_ethanol___market___opportunities_and_trends.html' class='banc' title='Know All about the Cellulosic Ethanol Market'>";
	highlightStartTag += "Want the Latest Trends in Cellulosic Ethanol? <font color='#FF0000' size='3' face='Verdana, Arial, Helvetica, sans-serif'>";
	highlightStartTag += "<blink><sup>New</sup></blink></font></a></td></tr><tr><td><a href='http://www.plantoils.in/portal/ce/report/cellulosic_ethanol___market___opportunities_and_trends.html' id='mini' title='Know All about the Cellulosic Ethanol Market'><font size=2.5>Read the Cellulosic Ethanol Report, Now!</font></a></td>";
	highlightEndTag = "</tr></table></div></center><br>";	
	
	   } else if(found == 1) {
			highlightStartTag = "<center><div id='banner' style='background:#63665f; border:3px solid #f1f1f1;'>";
			highlightStartTag += "<table id='trbg' align='center' bgcolor='#63665f'><tr><td>";
			highlightStartTag += "<a href='http://www.plantoils.in/portal/ce/report/cellulosic_ethanol___market___opportunities_and_trends.html' class='banc' title='Know All about the Cellulosic Ethanol Market'>";
			highlightStartTag += "Have You Read the Cellulosic Ethanol Report Yet? <font color='#FF0000' size='3' face='Verdana, Arial, Helvetica, sans-serif'>";
			highlightEndTag = "<blink><sup>New</sup></blink></font></a></td></tr><tr><td><a href='http://www.plantoils.in/portal/ce/report/cellulosic_ethanol___market___opportunities_and_trends.html' id='mini' title='Know All about the Cellulosic Ethanol Market'><font size=2.5>Read the Cellulosic Ethanol Report, Now!</font></a></td></tr></table></div></center>";
	   } else if(found == 2) {
		   highlightStartTag = "<center><div id='banner' style='background:#42453e; border:3px solid #f1f1f1;'>";
			highlightStartTag += "<table id='trbg' align='center' bgcolor='#42453e'><tr><td>";
			highlightStartTag += "<a href='http://www.plantoils.in/portal/ce/report/cellulosic_ethanol___market___opportunities_and_trends.html' class='banc' title='Know All about the Cellulosic Ethanol Market'>";
			highlightStartTag += "Have You Read the Cellulosic Ethanol Report Yet? <font color='#FF0000' size='3' face='Verdana, Arial, Helvetica, sans-serif'>";
			highlightEndTag = "<blink><sup>New</sup></blink></font></a></td></tr><tr><td><a href='http://www.plantoils.in/portal/ce/report/cellulosic_ethanol___market___opportunities_and_trends.html' id='mini' title='Know All about the Cellulosic Ethanol Market'><font size=2.5>Read the Cellulosic Ethanol Report, Now!</font></a></td></tr></table></div></center>";
	   }
		   
   //alert(found);
				newText += bodyText.substring(0, i) + bodyText.substr(i, searchTerm.length)+ highlightStartTag + highlightEndTag;  
				bodyText = bodyText.substr(i + searchTerm.length);
				lcBodyText = bodyText.toLowerCase();
				//alert(i);
				i = -1;
				found++;
				//alert(found);&& (found < 5) && (tot_link < 50)
		  }
		 
		}
		   }
	   }
	}
  }
  return newText;
}
function highlightSearchTerms_inline(warnOnFailure, highlightStartTag, highlightEndTag)
{
	//alert(warnOnFailure);
 if (!document.body || typeof(document.body.innerHTML) == "undefined") {
	  //alert(searchText);
    if (warnOnFailure) {
      alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");
    }
    //return false;
  }
 
  //var bodyText = document.body.innerHTML;
  var bodyText = document.getElementById('entry').innerHTML;
//alert(bodyText.length);
 
  for (var i = 1; i < inline_ad.length; i++) {
    bodyText = doHighlight_inline(bodyText, inline_ad[i], highlightStartTag, highlightEndTag,i);
  }
  document.getElementById('entry').innerHTML = bodyText;
  return true;
}
highlightSearchTerms_inline(false);// JavaScript Document
