/**
 * Springer 1.0 
 * @ File Name : $ searchindex.js
 * 
 *
 *///charCodeAt
window.onload = loadIndex;
var flag = "true"; // var for paging
var xmlDoc;
var searchType = "COMMON";
var ATitle="";
var AuthName="";
var searchBol=false;//14/12/2007
var tabStr="<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
var pageDispRange=50;//added globally for page range value
//alert(searchType );
function loadIndex() { // load indexfile
// most current browsers support document.implementation
	if (document.implementation && document.implementation.createDocument) 
	{
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.load("temp.xml");
	}
// MSIE uses ActiveX
	else if (window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async = "false";
		xmlDoc.load("temp.xml");
	}
	else
	{
		alert("Could not established connection due to network failure");
	}
}
function winClose()
{
window.close();
}

function getTitleF()
{
      
	if (!xmlDoc)
	{
		loadIndex();
	}

   
	var searchtitle = xmlDoc.getElementsByTagName("ArticleInfo");
	var searchHeader = xmlDoc.getElementsByTagName("ArticleHeader");
	
	var AId="";
	
	
   for (var i=0;i<searchtitle.length;i++) 
	{
        var allitemChildLength_a=searchtitle[i].childNodes.length
        if(allitemChildLength_a==3)
		 {
			   chNode=searchtitle[i].childNodes[0];
			   if(searchtitle[i].childNodes[0]!=null)
				 {
						AId = searchtitle[i].childNodes[0].text;
				 }
				 if(searchtitle[i].childNodes[1]!=null)
				 {
				   if(searchtitle[i].childNodes[1] !=null)
						ATitle = searchtitle[i].childNodes[1].text
					   //alert(ATitle+"aaa");
				 }
		 }
	}

//var row =  "<table border = '0' cellpadding= '0'  align='left' width='100%'>"

	for (var i=0;i<searchHeader.length;i++) 
	{
        var allitemChildLength_b=searchHeader[i].childNodes.length
        if(allitemChildLength_b==3)
		 {
			   chNode=searchHeader[i].childNodes[0];
			   if(searchHeader[i].childNodes[0]!=null)
			    {
				      var AuthName1=searchHeader[i].childNodes[0];
						for (var j=0;j<AuthName1.childNodes.length;j++) 
						{
							var AuthName2=AuthName1.childNodes[j];
							if(AuthName2.childNodes.length>0)
							{
							for (var k=0;k<AuthName2.childNodes.length;k++) 
							{
							  AuthName=AuthName+AuthName2.childNodes[k].text+"<br>"
							}
							}else
							{
							AuthName=AuthName+AuthName1.childNodes[j].text+"<br>"
							}
						}
                       // alert(AuthName)
				}
		 }
	}
}

function searchIndex()
  { // search the index (duh!)
	if (!xmlDoc)
	{
		loadIndex();
	}
	//alert(document.frmSearch.searchType.value);
	// get the search term from a form field with id 'searchme'
	var searchterm = document.getElementById("searchme").value;
	var searchType = document.frmSearch.searchType.value;
	var allitems = xmlDoc.getElementsByTagName("Citation");
	results = new Array;
	citationno= new Array;
	pmidno= new Array;
    //---------boolean search search---------------------
    var boolFlag=document.frmSearch.boolFlag.value;
	var searchterm1 = document.getElementById("Bolsearchme").value;
	var boolterm = document.getElementById("boolme").value;
	//getTitleF()//commented 07.12.07
	if (boolFlag=='BOOL' && ((searchterm.length < 1) || (searchterm1.length<1)))
	{
		alert("Enter boolean search criteria");
	}
	else if(boolFlag!='BOOL' && (searchterm.length < 1))
	{
	    alert("Enter boolean search criteria");
	} 
	else
	{
		
		for (var i=0;i<allitems.length;i++) 
		{
			//--------------------
		   var Citname="";
		   var name="";
		   var pmid="";
		   var tempResult = "";
		   var chNode="";
	       var allitemChildLength=allitems[i].childNodes.length
		  if(allitemChildLength >=3)
		 {

		   chNode=allitems[i].childNodes[1];
		   if((allitems[i].childNodes[0].firstChild)!=null)
	       		Citname = allitems[i].childNodes[0].firstChild.text;
	       	
	       //if(allitems[i].childNodes[2].firstChild !=null)
	    		//name = allitems[i].childNodes[2].firstChild.text
			 if(allitems[i].childNodes[2] !=null)
			 {
	    		name = allitems[i].childNodes[2].text
				//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[2]
                        
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
														 
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																var spos_1=0;
                                                                spos=name.indexOf("[Harefuah",0);
																spos_1=name.indexOf("[Kamyom",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																}
																if(spos_1 !=-1)
																{
                                                                    var val_first=name.substring(0,spos_1);
																	var val_last=name.substring(spos_1,name.length);
																	name=val_first+img+" "+val_last;
																}

															}

													
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

			 }
			//---------------------
				 //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[2];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
		 }
		 else if(allitemChildLength==2)
		 {
			   chNode=allitems[i].childNodes[0];
			   if(allitems[i].childNodes[0]!=null)
				 {
						Citname = allitems[i].childNodes[0].text;
				 }
				 if(allitems[i].childNodes[1]!=null)
				 {
					 var tempImage="";
					name = allitems[i].childNodes[1].text
						
				//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[1]
                        	
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                 {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
														  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
															
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------
				 }
			
			 //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[1];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
		 else if(allitemChildLength==1)
		 {
				 chNode=allitems[i].childNodes[0];
				 if(allitems[i].childNodes[0].tagName=='CitationNumber')
				 {
						Citname = allitems[i].childNodes[0].text
				 }
				 if(allitems[i].childNodes[0].tagName=='BibUnstructured')
				 {

					 	name = allitems[i].childNodes[0].text
						//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[0]
                        
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
															  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																	
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

				 }
					

               //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[0];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
	     if(allitemChildLength >= 3)
		 {					
	    	chNode=allitems[i].childNodes[1];
	    	if(chNode.hasChildNodes)
	    	{
		    	for(var j=0;j<chNode.childNodes.length;j++)
		    	{
			    	if(chNode.childNodes[j].tagName=='Occurrence')
		    		{
			    		//if(chNode.childNodes[j].childNodes[0].tagName=='Handle')
			    		if(chNode.childNodes[j].childNodes[0]!=null)
			    		{
			    			pmid=chNode.childNodes[j].childNodes[0].firstChild.text
							if(name.indexOf(pmid)!=-1)//added to remove duplicate address
								pmid="";
				    	}
				    	/*else
				    	{
        				pmid="NA"	
					    }*/
			    	}
			    }
	    	}
		}//close of allitemChildLength
			//--------------------
// see if the XML entry matches the search term,
// and (if so) store it in an array
			if(searchType == "COMMON")
			{

				var name="";
				if(allitemChildLength >=3)
				 {
				   //if(allitems[i].childNodes[2].firstChild !=null)
						//name = allitems[i].childNodes[2].firstChild.text
					if(allitems[i].childNodes[2] !=null)
					{
					       name = allitems[i].childNodes[2].text
							//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[2]
                        
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
														  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

					}	
					
                    //--------------------------------
				   //found child tag found
					var repTag=allitems[i].childNodes[2];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
				  //----------------------------------
				 }
				 else if(allitemChildLength==2)
				 {
						   if(allitems[i].childNodes[1] !=null)
							{
								name = allitems[i].childNodes[1].text
									//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[1]
                        
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
														  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
															
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

							}

							   //--------------------------------
							 //found child tag found
									var repTag=allitems[i].childNodes[1];
									if(repTag.hasChildNodes)
									{
										for(var j=0;j<repTag.childNodes.length;j++)
										{
											if(repTag.childNodes[j].tagName=="Emphasis")
											{
											  var searchStr = repTag.childNodes[j].text;
											  var replaceStr = "<I>"+searchStr+"</I>";
											  if(repTag.childNodes[j].attributes[0].text=="Italic")
												 replaceStr = "<I>"+searchStr+"</I>";
											  if(repTag.childNodes[j].attributes[0].text=="Bold")
												 replaceStr = "<B>"+searchStr+"</B>";
											  var re = new RegExp(searchStr , "g");
											  name = name.replace(re, replaceStr);	
											}
										}
									}
							//----------------------------------
				 }
				 else if(allitemChildLength==1)
				 {
						 if(allitems[i].childNodes[0].tagName=='BibUnstructured')
							{
								name = allitems[i].childNodes[0].text
						//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[0]
                        
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
															  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

							}
							 //--------------------------------
							 //found child tag found
									var repTag=allitems[i].childNodes[0];
									if(repTag.hasChildNodes)
									{
										for(var j=0;j<repTag.childNodes.length;j++)
										{
											if(repTag.childNodes[j].tagName=="Emphasis")
											{
											  var searchStr = repTag.childNodes[j].text;
											  var replaceStr = "<I>"+searchStr+"</I>";
											  if(repTag.childNodes[j].attributes[0].text=="Italic")
												 replaceStr = "<I>"+searchStr+"</I>";
											  if(repTag.childNodes[j].attributes[0].text=="Bold")
												 replaceStr = "<B>"+searchStr+"</B>";
											  var re = new RegExp(searchStr , "g");
											  name = name.replace(re, replaceStr);	
											}
										}
									}
							//----------------------------------
				 }
							
							if(boolFlag!='BOOL')
							{
							//alert(boolFlag)
								var tempResult=name
								var exp = new RegExp(searchterm,"i");
								if (tempResult.match(exp) != null)
								{
									//var replaceStr = '<font color = red>'+searchterm+'</font>';
									name=searchAndRepaceText(name,searchterm);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
							}
							else
							{
								var tempResult=name
								var exp = new RegExp(searchterm,"i");
								var exp1 = new RegExp(searchterm1,"i");
								if (boolterm=='AND' && (tempResult.match(exp) != null && tempResult.match(exp1) != null))
								{
									//var replaceStr = '<font color = red>'+searchterm+'</font>';
									name=searchAndRepaceText(name,searchterm);
									name=searchAndRepaceText(name,searchterm1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
								if (boolterm=='OR' && (tempResult.match(exp) != null || tempResult.match(exp1) != null))
								{
									name=searchAndRepaceText(name,searchterm);
									name=searchAndRepaceText(name,searchterm1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
								if (boolterm=='NOT' && (tempResult.match(exp) != null && tempResult.match(exp1) == null))
								{
									name=searchAndRepaceText(name,searchterm);
									name=searchAndRepaceText(name,searchterm1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
							}
							//--------------------------------------------
			}
			if(searchType == "Author")
			{
				//var chNode=allitems[i].childNodes[1];
				//alert(chNode.hasChildNodes)//sudhir
				if(chNode.hasChildNodes)
				{
					var local_Author_Array = new Array;
							if(boolFlag!='BOOL')
							{
							//alert(boolFlag)
								var tempResult=name
								var exp = new RegExp(searchterm,"i");
								if (tempResult.match(exp) != null)
								{
									//var replaceStr = '<font color = red>'+searchterm+'</font>';
									name=searchAndRepaceText(name,searchterm);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
							}
							else
							{
								var tempResult=name
								var exp = new RegExp(searchterm,"i");
								var exp1 = new RegExp(searchterm1,"i");
								if (boolterm=='AND' && (tempResult.match(exp) != null && tempResult.match(exp1) != null))
								{
									//var replaceStr = '<font color = red>'+searchterm+'</font>';
									name=searchAndRepaceText(name,searchterm);
									name=searchAndRepaceText(name,searchterm1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
								if (boolterm=='OR' && (tempResult.match(exp) != null || tempResult.match(exp1) != null))
								{
									name=searchAndRepaceText(name,searchterm);
									name=searchAndRepaceText(name,searchterm1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
								if (boolterm=='NOT' && (tempResult.match(exp) != null && tempResult.match(exp1) == null))
								{
									name=searchAndRepaceText(name,searchterm);
									name=searchAndRepaceText(name,searchterm1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
							}
							//--------------------------------------------
				}
			}
			if(searchType == "Volume")
			{
				//alert(searchterm+'(');
				if(chNode.hasChildNodes)
				{
					var sLength = chNode.childNodes.length;
					for(var j=0;j<sLength;j++)
					{
						if(chNode.childNodes[j].tagName == "VolumeID")
						{
							tempResult = chNode.childNodes[j].text
							
							var searchStr = " "+searchterm+'\\(';
							var searchStr1 = " "+searchterm1+'\\(';
							if(boolFlag!='BOOL')
							{
									var exp = new RegExp(searchStr,"i");
									if(name.match(exp)!=null)
									{
										var replaceStr = '<font color = red>'+" "+searchterm+'</font>'+'\(';
										name = name.replace(exp, replaceStr);
										results.push(name);
										citationno.push(Citname);
										pmidno.push(pmid);
								    }
							}
							else
							{
								var exp = new RegExp(searchStr,"i");
								var exp1 = new RegExp(searchStr1,"i");
								if (boolterm=='AND' && (name.match(exp) != null && name.match(exp1) != null))
								{
									var replaceStr = '<font color = red>'+" "+searchterm+'</font>'+'\(';
									var replaceStr1 = '<font color = red>'+" "+searchterm1+'</font>'+'\(';
										name = name.replace(exp, replaceStr);
										name = name.replace(exp1, replaceStr1);
										results.push(name);
										citationno.push(Citname);
										pmidno.push(pmid);
								}
								if (boolterm=='OR' && (name.match(exp) != null || name.match(exp1) != null))
								{
									var replaceStr = '<font color = red>'+" "+searchterm+'</font>'+'\(';
									var replaceStr1 = '<font color = red>'+" "+searchterm1+'</font>'+'\(';
									name = name.replace(exp, replaceStr);
									name = name.replace(exp1, replaceStr1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
								if (boolterm=='NOT' && (name.match(exp) != null && name.match(exp1) == null))
								{
										var replaceStr = '<font color = red>'+" "+searchterm+'</font>'+'\(';
										name = name.replace(exp, replaceStr);
										results.push(name);
										citationno.push(Citname);
										pmidno.push(pmid);
								}
							}
							//--------------------------------------------
						}
					}//close for loop
					
				}//close child nodes check
			}//close volume if	
			if(searchType == "JournalTitle")
			{
				if(chNode.hasChildNodes)
				{
							if(boolFlag!='BOOL')
							{
							//alert(boolFlag)
								var tempResult=name
								var exp = new RegExp(searchterm,"i");
								if (tempResult.match(exp) != null)
								{
									//var replaceStr = '<font color = red>'+searchterm+'</font>';
									name=searchAndRepaceText(name,searchterm);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
							}
							else
							{
								var tempResult=name
								var exp = new RegExp(searchterm,"i");
								var exp1 = new RegExp(searchterm1,"i");
								if (boolterm=='AND' && (tempResult.match(exp) != null && tempResult.match(exp1) != null))
								{
									//var replaceStr = '<font color = red>'+searchterm+'</font>';
									name=searchAndRepaceText(name,searchterm);
									name=searchAndRepaceText(name,searchterm1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
								if (boolterm=='OR' && (tempResult.match(exp) != null || tempResult.match(exp1) != null))
								{
									name=searchAndRepaceText(name,searchterm);
									name=searchAndRepaceText(name,searchterm1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
								if (boolterm=='NOT' && (tempResult.match(exp) != null && tempResult.match(exp1) == null))
								{
									name=searchAndRepaceText(name,searchterm);
									name=searchAndRepaceText(name,searchterm1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
							}
							//--------------------------------------------
				}//close child nodes check
			}//close voume if	
			if(searchType == "Year")
			{
				if(chNode.hasChildNodes)
				{
					var sLength = chNode.childNodes.length;
					for(var j=0;j<sLength;j++)
					{
						if(chNode.childNodes[j].tagName == "Year")
						{
							tempResult = chNode.childNodes[j].text
							//-----------------------------------------
							var searchStr = searchterm;
							var searchStr1 = searchterm1;
							if(boolFlag!='BOOL')
							{
									var exp = new RegExp(searchStr,"i");
									if(name.match(exp)!=null)
									{
										var replaceStr = '<font color = red>'+searchterm+'</font>';
										name = name.replace(exp, replaceStr);
										results.push(name);
										citationno.push(Citname);
										pmidno.push(pmid);
								    }
							}
							else
							{
								var exp = new RegExp(searchStr,"i");
								var exp1 = new RegExp(searchStr1,"i");
								if (boolterm=='AND' && (name.match(exp) != null && name.match(exp1) != null))
								{
									var replaceStr = '<font color = red>'+searchterm+'</font>';
									var replaceStr1 = '<font color = red>'+searchterm1+'</font>';
										name = name.replace(exp, replaceStr);
										name = name.replace(exp1, replaceStr1);
										results.push(name);
										citationno.push(Citname);
										pmidno.push(pmid);
								}
								if (boolterm=='OR' && (name.match(exp) != null || name.match(exp1) != null))
								{
									var replaceStr = '<font color = red>'+searchterm+'</font>';
									var replaceStr1 = '<font color = red>'+searchterm1+'</font>';
									name = name.replace(exp, replaceStr);
									name = name.replace(exp1, replaceStr1);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
								if (boolterm=='NOT' && (name.match(exp) != null && name.match(exp1) == null))
								{
										var replaceStr = '<font color = red>'+searchterm+'</font>';
										name = name.replace(exp, replaceStr);
										results.push(name);
										citationno.push(Citname);
										pmidno.push(pmid);
								}
							}
							//--------------------------------------------
						}
					}
				}
			}//close year if	
			if(searchType == "Citation")
			{

				if(allitems[i].childNodes[0].hasChildNodes)
				{
					var sLength = allitems[i].childNodes.length;
					for(var j=0;j<sLength;j++)
					{
						if(allitems[i].childNodes[j].tagName == "CitationNumber")
						{
							tempResult = allitems[i].childNodes[j].text
							//-----------------------------------------
							if((searchterm.indexOf("[")==-1) && (searchterm.indexOf("]")==-1))
								searchterm='['+searchterm+']';
							if((searchterm1.indexOf("[")==-1) && (searchterm1.indexOf("]")==-1))
								searchterm1='['+searchterm1+']';
							var searchStr = searchterm;
							var searchStr1 = searchterm1;
							if(boolFlag!='BOOL')
							{
									var exp = new RegExp(searchStr,"i");
									if(tempResult.match(exp)!=null)
									{
										if(tempResult.indexOf(searchStr)>-1)
										{
											Citname = "<font color = 'red'>"+Citname+"</red>";
											results.push(name);
											citationno.push(Citname);
											pmidno.push(pmid);
										}
								    }
							}
							else
							{
								if (boolterm=='AND' && (tempResult.indexOf(searchStr)>-1  && tempResult.indexOf(searchStr1)>-1))
								{
										if(tempResult.indexOf(searchStr)>-1)
										{
											Citname = "<font color = 'red'>"+Citname+"</red>";
											results.push(name);
											citationno.push(Citname);
											pmidno.push(pmid);
										}
										if(tempResult.indexOf(searchStr1)>-1)
										{
											Citname = "<font color = 'red'>"+Citname+"</red>";
											results.push(name);
											citationno.push(Citname);
											pmidno.push(pmid);
										}
								}
								if (boolterm=='OR' && (tempResult.indexOf(searchStr)>-1  || tempResult.indexOf(searchStr1)>-1))
								{
									   if(tempResult.indexOf(searchStr)>-1)
										{
											Citname = "<font color = 'red'>"+Citname+"</red>";
											results.push(name);
											citationno.push(Citname);
											pmidno.push(pmid);
										}
										if(tempResult.indexOf(searchStr1)>-1)
										{
											Citname = "<font color = 'red'>"+Citname+"</red>";
											results.push(name);
											citationno.push(Citname);
											pmidno.push(pmid);
										}
								}
								if (boolterm=='NOT' && (tempResult.indexOf(searchStr)>-1  && tempResult.indexOf(searchStr1)==-1))
								{
											Citname = "<font color = 'red'>"+Citname+"</red>";
											results.push(name);
											citationno.push(Citname);
											pmidno.push(pmid);
								}
							}
							//--------------------------------------------
						}
					}
				}
			}
	 }
// send the results to another function that displays them to the user
	showResults(citationno,pmidno,results, searchterm);
	}
}

	//----------------------------------------------------------
	function showResults(citNumbers,pmidNumbers,results, searchterm) 
	{
		var divnew = document.createElement("ul");
		divnew.id = "divnew";
		var val12="";
		//////////// Start Appended code by Nitin Saraswat for Paging//////////////////
		var min = document.frmSearch.min.value;
		var max = document.frmSearch.max.value;
		var len= results.length;
		counter=Math.ceil(len/pageDispRange);
		var pageDisplay="Page:<br>";
		var text= document.getElementById("page");
		text.innerHTML='';
		text.innerText='';
		var textBottom= document.getElementById("pageBottom");
		textBottom.innerHTML='';
		textBottom.innerText='';
		var checkCounter = 0;
		checkCounter = eval(max/pageDispRange);
    
	pageDisplay=pageDisplay+"<table border = '0' width='100%' cellpadding= '0' align='left'><tr>"
	if(counter>1)
	{
	   for(i=1;i<=counter;i++){
			var j=i*pageDispRange;
			if(i%30==0)
		    {
				//pageDisplay = pageDisplay +"</tr><tr>"
				if(flag == "false")
				{
					if(checkCounter == i)
						pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
					else
						pageDisplay = pageDisplay + '<td width=25><a href="#" onClick="goNextOther('+min+','+max+','+j+')">'+i+'</a></td>';
				}
				else if(flag == "tempShow")
				{
					if(checkCounter == i)
						pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
					else
						pageDisplay = pageDisplay + '<td width=25><a href="#" onClick="goNextTemp('+min+','+max+','+j+')">'+i+'</a></td>';
				}
				else
				{
					if(checkCounter == i)
						pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
					else
						pageDisplay = pageDisplay + '<td width=25><a href="#" onClick="goNextLetter('+min+','+max+','+j+')">'+i+'</a></td>';
				}
				pageDisplay = pageDisplay +"</tr><tr>"
		    }
			else
		    {
				if(flag == "false")
				{
					if(checkCounter == i)
						pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
					else
						pageDisplay = pageDisplay + '<td width=25><a href="#" onClick="goNextOther('+min+','+max+','+j+')">'+i+'</a></td>';
				}
				else if(flag == "tempShow")
				{
					if(checkCounter == i)
						pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
					else
						pageDisplay = pageDisplay + '<td width=25><a href="#" onClick="goNextTemp('+min+','+max+','+j+')">'+i+'</a></td>';
				}
				else
				{
					if(checkCounter == i)
						pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
					else
						pageDisplay = pageDisplay + '<td width=25><a href="#" onClick="goNextLetter('+min+','+max+','+j+')">'+i+'</a></td>';
				}
		   }
	}
	pageDisplay=pageDisplay+"</tr></table>"
	text.innerHTML=pageDisplay;
	textBottom.innerHTML='';
	textBottom.innerHTML=pageDisplay;//added for bottom display
	}
		var max2 = 0;
		if(max > results.length)
			max2 = results.length;
		else
			max2 = eval(max);
	///////////////// End Appended Code By Nitin Saraswat ////////////////////////
	if(results.length!=undefined && results.length>0)
	{
		if((ATitle!=null && ATitle.length>0 && ATitle.length!=undefined) || (AuthName!=null && AuthName.length>0 && AuthName.length!=undefined))
		{
		val12 = "<P>"+ATitle+"</P><P>"+AuthName+"</P><table border = '1' cellpadding= '2' width='100%'><tr><th colspan='2' align='left' >Total Entries: "+results.length+"</th></tr><tr><th width='5%'>Citation No.</th><th>Bibliography</th></tr>";
		}
		else
		{
		val12 = "<table border = '1' cellpadding= '2' width='100%'><tr><th colspan='2' align='left' >Total Entries: "+results.length+"</th></tr><tr><th width='5%'>Citation No.</th><th>Bibliography</th></tr>";
		}
		AuthName="";
		for (var i=min;i<max2;i++)
		{
			var Citname="";
			var name="";
			var pmid="";			 
			 if(citNumbers[i]!=null)
				Citname = citNumbers[i];
			 
			 if(results[i]!=null)
				name = results[i];
			 
			 if(pmidNumbers[i]!=null)
				pmid =pmidNumbers[i];
			
			if(name!="")
			{
				//-------amphersands----------//sudhir
				var searchStr = "ampersand";
				var replaceStr = "&";
				var re = new RegExp(searchStr , "g");
				name = name.replace(re, replaceStr);
				//-------semicolons-----------//sudhir
				var searchStr = "semicolon";
				var replaceStr = ";";
				var re = new RegExp(searchStr , "g");
				name = name.replace(re, replaceStr);
				//added for URL Linking
				var NameIndx=name.indexOf("www.")
				if(NameIndx>-1)
				{

					//var TempName=name.substring(NameIndx,name.indexOf("[",NameIndx))
					
					var TempName=name.substring(NameIndx,name.indexOf(" ",NameIndx))
						var tempU=repUrl(name)
						if(tempU!="")
						TempName=tempU

					var RepName="<FONT color=green>"+"<A target='_blank' href=http://"+TempName+">"+TempName+"</A></FONT>";
					if(name.indexOf("http://")>-1)
					{
						NameIndx=name.indexOf("http://")
						TempName=name.substring(NameIndx,name.indexOf(" ",NameIndx))
						var tempU=repUrl(name)
						if(tempU!="")
						TempName=tempU
						//if(Citname.indexOf('1472')>-1)
						//alert(TempName)
						RepName="<FONT color=green>"+"<A target='_blank' href="+TempName+">"+TempName+"</A></FONT>";
					}
					
					var re = new RegExp(TempName , "g");
					name = name.replace(re, RepName);
					name=name.replace("www.<font color = 'red'>","www.");
					name=name.replace("</font>.com",".com");
					//if(Citname.indexOf('1472')>-1)
						//alert(name)

				}
				//------------------------------------
				name=makeUrl(name)
			}
			if(pmid!="")
	        {
		        var pmid_url="";
				pmid_url=getPmidURL(pmid)
				var row = "<tr><td width='15%'>"+Citname+"</td>"+"<td>"+repKwd(name+""+pmid_url)+"</td></tr>";
				//var row = "<tr><td width='15%'>"+Citname+"</td>"+"<td>"+repKwd(jTitleWithPmid(name,pmid_url,allitems[i]))+"</td></tr>";
				val12 = val12+row;
		    }
		    else
		    {
			    var row = "<tr><td width='15%'>"+Citname+"</td>"+"<td>"+repKwd(name)+"</td></tr>";
		    	val12 = val12+row;
		    }
		}
		val12 = val12+"</table>";
	}
	else
	{
		text.innerHTML='';
		text.innerText='';
		val12 = "<font color='red'>No Records</font>";
	}
	var tableId = document.getElementById("resultDIV");
	tableId.innerHTML = "";
	tableId.innerHTML = val12;
}
//////////////// Start Functions for paging by Nitin Saraswat//////////////////////////////

function searchIt()
{
	document.frmSearch.min.value = 0;
	document.frmSearch.max.value = pageDispRange;
	flag="false";
	searchIndex();
}

function goNext(min1,max1,i)
{
	var min2=0;
	max1 = i-pageDispRange;
	min2 = i;
	document.frmSearch.min.value = max1;
	document.frmSearch.max.value = min2;
	getAll();
}
function goNextOther(min1,max1,i)
{
	var min2=0;
	max1 = i-pageDispRange;
	min2 = i;
	document.frmSearch.min.value = max1;
	document.frmSearch.max.value = min2;
	searchIndex();
}
function goNextLetter(min1,max1,i)
{
	var min2=0;
	max1 = i-pageDispRange;
	min2 = i;
	document.frmSearch.min.value = max1;
	document.frmSearch.max.value = min2;
	val = document.frmSearch.letter.value;
	searchLetter(val);
}
function searchLetterF(val)
{
	for(var i=0;i<document.getElementById('first').childNodes.length;i++)
	{
		var textVal=document.getElementById('first').childNodes[i].id;		
		if(textVal == val)
		{
			var td_ID = document.getElementById(textVal);
			td_ID.className = "";
			td_ID.className = "ptMenuTabSelected";
			//td_ID.style.fontcolor = '#330099';
		}
		else
		{
			var td_ID = document.getElementById(textVal);
			td_ID.className = "";
			td_ID.className = "ptMenuTabText";
			//td_ID.style.fontcolor = '#ffffff';
		}
	}
	document.frmSearch.min.value = 0;
	document.frmSearch.max.value = pageDispRange;
	document.frmSearch.letter.value = val;
	flag = "letter";
	searchLetter(val);
}
function goNextTemp(min1,max1,i)
{
	var min2=0;
	max1 = i-pageDispRange;
	min2 = i;
	document.frmSearch.min.value = max1;
	document.frmSearch.max.value = min2;
	tempShow();
}
//////////////// End Functions for paging by Nitin Saraswat//////////////////////////////
function getAll()
{
//--------------//Nitin

if (!xmlDoc)
	{
		loadIndex();
	}
//--------------Start Appended code by Nitin Saraswat For paging ///////////////////////
	//-----added by sudhir-----------
	var pallete_visualilty=document.frmSearch.temp.value
	if(pallete_visualilty==' ')
	{
		//searchBol
		
		document.frmSearch.temp.value='home'
		
	}
document.getElementById('divColor1').style.display = 'none';
document.getElementById('divColor2').style.display = 'none';
	
	disableEnablePallete();
	
	//-------------------------------
	var min = document.frmSearch.min.value;
	var max = document.frmSearch.max.value;
	var counter=0;
	var allitems = xmlDoc.getElementsByTagName("Citation");
	var divnew = document.createElement("div");
	divnew.id = "divnew";
	var len= allitems.length;
	counter=Math.ceil(len/pageDispRange);
    var val12 = "<table border = '1' cellpadding= '2' width='100%'>";
	//val12 = val12+"<tr><th colspan='2' align='left' >"+"PDF LINKS: <a href='./CH-19.pdf' target='_blank'>pdf</a>"+"</th></tr>";
	val12 = val12+"<tr><th colspan='2' align='left' >Total Entries: "+allitems.length+"</th></tr>";
	val12 = val12+"<tr ><th width='5%'>Citation No.</th><th>Bibliography</th></tr>";
    var pageDisplay='Page:<br>';
	var checkCounter = 0;//max/pageDispRange;
	
	checkCounter = eval(max/pageDispRange);
	pageDisplay=pageDisplay+"<table border = '0' cellpadding= '0'  align='left' width='100%'><tr>"
	if(counter>1)
	{
		//--------------------------------
	   for(var i=1;i<=counter;i++)
	   {
			var j=i*pageDispRange;
			if(i%30==0)
		    {
				//pageDisplay = pageDisplay +"</tr><tr>"
				if(checkCounter == i)
				pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
				else
				pageDisplay = pageDisplay + '<td width=25><a href="javascript:void(0)" onClick="goNext('+min+','+max+','+j+')">'+i+'</a></td>';
				pageDisplay = pageDisplay +"</tr><tr>"
		    }
			else
		   {
			if(checkCounter == i)
				pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
			else
				pageDisplay = pageDisplay + '<td width=25><a href="javascript:void(0)" onClick="goNext('+min+','+max+','+j+')">'+i+'</a></td>';
		   }
		   //added to bottom display
		var textBottom = document.getElementById("pageBottom");
	   }
		//--------------------------------
	    i=0;
	   	pageDisplay=pageDisplay+"</tr></table>"
		var text = document.getElementById("page");
		text.innerHTML='';
		text.innerHTML=pageDisplay;
		var textBottom = document.getElementById("pageBottom");
		textBottom.innerHTML='';
		textBottom.innerHTML=pageDisplay;
	}
		var max2 = 0;
		if(max>allitems.length)	
			max2 = allitems.length;
		else
			max2 = max;	
			max2 = eval(max2)
	
//--------------End Appended code by Nitin Saraswat For paging ///////////////////////
    //for (var i=0;i<allitems.length;i++)
	for (var i=min;i<max2;i++)
	 {
	   //-------------
	   var Citname="";
	   var name="";
	   var pmid="";
	   var chNode="";
	   var allitemChildLength=allitems[i].childNodes.length
		 if(allitemChildLength >=3)
		 {
		   chNode=allitems[i].childNodes[1];
		   if((allitems[i].childNodes[0].firstChild)!=null)
	       		Citname = allitems[i].childNodes[0].firstChild.text;
	       	
	       //if(allitems[i].childNodes[2].firstChild !=null)
	    		//name = allitems[i].childNodes[2].firstChild.text
			 if(allitems[i].childNodes[2] !=null)
			 {
	    		name = allitems[i].childNodes[2].text
					//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[2]
                        
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
															  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																var spos_1=0;
                                                                spos=name.indexOf("[Harefuah",0);
																spos_1=name.indexOf("[Kamyom",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																}
																if(spos_1 !=-1)
																{
                                                                    var val_first=name.substring(0,spos_1);
																	var val_last=name.substring(spos_1,name.length);
																	name=val_first+img+" "+val_last;
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

			 }
			//--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[2];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  //alert(repTag.childNodes[j].attributes[0].text)
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);
							}
						}
					}
			//----------------------------------
		 }
		 else if(allitemChildLength==2)
		 {
			   chNode=allitems[i].childNodes[0];
			   if(allitems[i].childNodes[0]!=null)
				 {
						Citname = allitems[i].childNodes[0].text;
				 }
				 if(allitems[i].childNodes[1]!=null)
				 {
						name = allitems[i].childNodes[1].text
                       //----------image tag----------
                        var rootNameTag=allitems[i].childNodes[1]
                       
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							               {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
															  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																	
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

				 }
              //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[1];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
		 else if(allitemChildLength==1)
		 {
				 chNode=allitems[i].childNodes[0];
				 if(allitems[i].childNodes[0].tagName=='CitationNumber')
				 {
						Citname = allitems[i].childNodes[0].text
				 }
				 if(allitems[i].childNodes[0].tagName=='BibUnstructured')
				 {
						name = allitems[i].childNodes[0].text
						//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[0]
                          
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
														  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

				 }
				 //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[0];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
	     if(allitemChildLength >= 3)
		 {
	    	chNode=allitems[i].childNodes[1];
	    	if(chNode.hasChildNodes)
	    	{
		    	for(var j=0;j<chNode.childNodes.length;j++)
		    	{
			    	if(chNode.childNodes[j].tagName=='Occurrence')
		    		{
			    		//if(chNode.childNodes[j].childNodes[0].tagName=='Handle')
			    		if(chNode.childNodes[j].childNodes[0]!=null)
			    		{
			    			pmid=chNode.childNodes[j].childNodes[0].firstChild.text
							if(name.indexOf(pmid)!=-1)//added to remove duplicate address
								pmid="";
				    	}
				    	/*else
				    	{
        				pmid="NA"	
					    }*/
			    	}
			    }
	    	}	
		 }
		   //-------------
			
	        if(name!=null && name!="" && name!='undefined')
	        {	
				
				//-------amphersands----------//sudhir
		        var searchStr = "ampersand";
		        var replaceStr = "&";
		        var re = new RegExp(searchStr , "g");
		        name = name.replace(re, replaceStr);
		        //-------semicolons-----------//sudhir
		        var searchStr = "semicolon";
		        var replaceStr = ";";
		        var re = new RegExp(searchStr , "g");
		        name = name.replace(re, replaceStr);
				//added for URL Linking
				/////////////////////////////
				//added for URL Linking
				var NameIndx=name.indexOf("www.")
				if(NameIndx>-1)
				{
					//var TempName=name.substring(NameIndx,name.indexOf("[",NameIndx))
				    var TempName=name.substring(NameIndx,name.indexOf(" ",NameIndx+"www.".length))
					var RepName="<FONT color=green>"+"<A target='_blank' href=http://"+TempName+" >"+TempName+"</A></FONT>";
					if(name.indexOf("http://")>-1 )//&& name.indexOf(" http://")==-1)
					{
						NameIndx=name.indexOf("http://")
						TempName=name.substring(NameIndx,name.indexOf(" ",NameIndx+"http://".length))
						RepName="<FONT color=green>"+"<A target='_blank' href="+TempName+" >"+TempName+"</A></FONT>";
					}
					var re = new RegExp(TempName , "g");
					//name = name.replace(re, RepName);
					name = name.replace(TempName, RepName);
					//if(Citname=="[1190]")
					//alert("<---->"+RepName)
				}
				//------------------------------------
				name=makeUrl(name)
	    	}
	        if(pmid!="" && pmid!=null && pmid!="undefined")
	        {
		        var pmid_url="";
				pmid_url=getPmidURL(pmid)
				var row = "<tr><td width='15%'>"+Citname+"</td>"+"<td>"+repKwd(name+""+pmid_url)+"</td></tr>";
				//var row = "<tr><td width='15%'>"+Citname+"</td>"+"<td>"+repKwd(jTitleWithPmid(name,pmid_url,allitems[i]))+"</td></tr>";
				val12 = val12+row;
		    }
		    else
		    {
			    var row = "<tr><td width='15%'>"+Citname+"</td>"+"<td>"+repKwd(name)+"</td></tr>";
		    	val12 = val12+row;
		    }
			//alert((allitems.length)+"<-->"+i)
    }
    val12 = val12+"</table>";
    var tableId = document.getElementById("resultDIV");
	tableId.innerText = "";
	tableId.innerHTML = "";
	tableId.innerHTML = val12;
}
function getREF()
{
//--------------//Nitin
 
if (!xmlDoc)
	{
		loadIndex();
	}
//--------------Start Appended code by Nitin Saraswat For paging ///////////////////////
	//-----added by sudhir-----------
	var pallete_visualilty=document.frmSearch.temp.value
	if(pallete_visualilty==' ')
	{
		
	}
//document.getElementById('divColor1').style.display = 'none';
//document.getElementById('divColor2').style.display = 'none';
	var min = document.frmSearch.min.value;
	var max = document.frmSearch.max.value;
	var counter=0;
	var allitems = xmlDoc.getElementsByTagName("Citation");
	var divnew = document.createElement("div");
	divnew.id = "divnew";
	var len= allitems.length;
	counter=Math.ceil(len/pageDispRange);
    var val12 = "<table border = '1' cellpadding= '2' width='100%'>";
	//val12 = val12+"<tr><th colspan='2' align='left' >"+"PDF LINKS: <a href='./CH-19.pdf' target='_blank'>pdf</a>"+"</th></tr>";
	val12 = val12+"<tr><th colspan='2' align='left' >Total Entries: "+allitems.length+"</th></tr>";
	val12 = val12+"<tr ><th width='5%'>Citation No.</th><th>Bibliography</th></tr>";
    var pageDisplay='Page:<br>';
	var checkCounter = 0;//max/pageDispRange;
	
	checkCounter = eval(max/pageDispRange);
	pageDisplay=pageDisplay+"<table border = '0' cellpadding= '0'  align='left' width='100%'><tr>"
	if(counter>1)
	{
		//--------------------------------
	   for(var i=1;i<=counter;i++)
	   {
			var j=i*pageDispRange;
			if(i%30==0)
		    {
				//pageDisplay = pageDisplay +"</tr><tr>"
				if(checkCounter == i)
				pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
				else
				pageDisplay = pageDisplay + '<td width=25><a href="javascript:void(0)" onClick="goNext('+min+','+max+','+j+')">'+i+'</a></td>';
				pageDisplay = pageDisplay +"</tr><tr>"
		    }
			else
		   {
			if(checkCounter == i)
				pageDisplay = pageDisplay + '<td width=25><font color="red">'+i+'</font></td>';
			else
				pageDisplay = pageDisplay + '<td width=25><a href="javascript:void(0)" onClick="goNext('+min+','+max+','+j+')">'+i+'</a></td>';
		   }
		   //added to bottom display
		var textBottom = document.getElementById("pageBottom");
	   }
		//--------------------------------
	    i=0;
	   	pageDisplay=pageDisplay+"</tr></table>"
		var text = document.getElementById("page");
		text.innerHTML='';
		text.innerHTML=pageDisplay;
		var textBottom = document.getElementById("pageBottom");
		textBottom.innerHTML='';
		textBottom.innerHTML=pageDisplay;
	}
		var max2 = 0;
		if(max>allitems.length)	
			max2 = allitems.length;
		else
			max2 = max;	
			max2 = eval(max2)
	
//--------------End Appended code by Nitin Saraswat For paging ///////////////////////
    //for (var i=0;i<allitems.length;i++)
	for (var i=min;i<max2;i++)
	 {

	   //-------------
	   var Citname="";
	   var name="";
	   var pmid="";
	   var chNode="";
	   var allitemChildLength=allitems[i].childNodes.length
    	 if(allitemChildLength >=3)
		 {
		   chNode=allitems[i].childNodes[1];
		   if((allitems[i].childNodes[0].firstChild)!=null)
	       		Citname = allitems[i].childNodes[0].firstChild.text;
	       	
	       //if(allitems[i].childNodes[2].firstChild !=null)
	    		//name = allitems[i].childNodes[2].firstChild.text
			 if(allitems[i].childNodes[2] !=null)
			 {
	    		name = allitems[i].childNodes[2].text
					//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[2]
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
								   if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
															  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

			 }
			//--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[2];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  //alert(repTag.childNodes[j].attributes[0].text)
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);
							}
						}
					}
			//----------------------------------
		 }
		 else if(allitemChildLength==2)
		 {
			   chNode=allitems[i].childNodes[0];
			   if(allitems[i].childNodes[0]!=null)
				 {
						Citname = allitems[i].childNodes[0].text;
				 }
				 if(allitems[i].childNodes[1]!=null)
				 {
						name = allitems[i].childNodes[1].text
					   //----------image tag----------
                        var rootNameTag=allitems[i].childNodes[1]
                       
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {
                                  var imgTag=rootNameTag.childNodes[g]
								  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							               {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
															  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{

																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																	
																}
																
															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

				 }
              //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[1];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
		 else if(allitemChildLength==1)
		 {
				 chNode=allitems[i].childNodes[0];
				 if(allitems[i].childNodes[0].tagName=='CitationNumber')
				 {
						Citname = allitems[i].childNodes[0].text
				 }
				 if(allitems[i].childNodes[0].tagName=='BibUnstructured')
				 {
						name = allitems[i].childNodes[0].text
						//----------image tag----------
                        var rootNameTag=allitems[i].childNodes[0]
                          
                        if(rootNameTag.hasChildNodes)
                            for(var g=0;g<rootNameTag.childNodes.length;g++)
                              {

                                  var imgTag=rootNameTag.childNodes[g]
                                  if(imgTag!=null)
                                      {
                                           var temp='';
                                           if(imgTag.tagName=='InlineMediaObject')
							                {
                                                   if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                                                   {
													   var tempText=imgTag.childNodes[0].attributes[0].text
														  
                                                        var img="<img src='"+tempText+"' />"
													    if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
														{ 
															if(g==0)
															{
																name=img+name;
															}
															else if(g==2)
															{
																var spos=0;
																spos=name.indexOf(". With English",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+val_last;
																}

															}
															else if(g==4)
															{
																
																var spos=0;
																spos=name.indexOf("[Harefuah",0);
																if(spos !=-1)
																{
																	var val_first=name.substring(0,spos);
																	var val_last=name.substring(spos,name.length);
																	name=val_first+img+" "+val_last;
																}

															}
														}
														
                                                     }
													
							  }
                                        }
										
                           }
				//---------------------

				 }
				 //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[0];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
	     if(allitemChildLength >= 3)
		 {
	    	chNode=allitems[i].childNodes[1];
	    	if(chNode.hasChildNodes)
	    	{
		    	for(var j=0;j<chNode.childNodes.length;j++)
		    	{
			    	if(chNode.childNodes[j].tagName=='Occurrence')
		    		{
			    		//if(chNode.childNodes[j].childNodes[0].tagName=='Handle')
			    		if(chNode.childNodes[j].childNodes[0]!=null)
			    		{
			    			pmid=chNode.childNodes[j].childNodes[0].firstChild.text
							if(name.indexOf(pmid)!=-1)//added to remove duplicate address
								pmid="";
				    	}
				    	/*else
				    	{
        				pmid="NA"	
					    }*/
			    	}
			    }
	    	}	
		 }
		   //-------------
			
	        if(name!=null && name!="" && name!='undefined')
	        {	
				
				//-------amphersands----------//sudhir
		        var searchStr = "ampersand";
		        var replaceStr = "&";
		        var re = new RegExp(searchStr , "g");
		        name = name.replace(re, replaceStr);
		        //-------semicolons-----------//sudhir
		        var searchStr = "semicolon";
		        var replaceStr = ";";
		        var re = new RegExp(searchStr , "g");
		        name = name.replace(re, replaceStr);
				//added for URL Linking
				/////////////////////////////
				//added for URL Linking
				var NameIndx=name.indexOf("www.")
				if(NameIndx>-1)
				{
					//var TempName=name.substring(NameIndx,name.indexOf("[",NameIndx))
				    var TempName=name.substring(NameIndx,name.indexOf(" ",NameIndx+"www.".length))
					var RepName="<FONT color=green>"+"<A target='_blank' href=http://"+TempName+" >"+TempName+"</A></FONT>";
					if(name.indexOf("http://")>-1 )//&& name.indexOf(" http://")==-1)
					{
						NameIndx=name.indexOf("http://")
						TempName=name.substring(NameIndx,name.indexOf(" ",NameIndx+"http://".length))
						RepName="<FONT color=green>"+"<A target='_blank' href="+TempName+" >"+TempName+"</A></FONT>";
					}
					var re = new RegExp(TempName , "g");
					//name = name.replace(re, RepName);
					name = name.replace(TempName, RepName);
					//if(Citname=="[1190]")
					//alert("<---->"+RepName)
				}
				//------------------------------------
				name=makeUrl(name)
	    	}
	        if(pmid!="" && pmid!=null && pmid!="undefined")
	        {
		        var pmid_url="";
				pmid_url=getPmidURL(pmid)
				var row = "<tr><td width='15%'>"+Citname+"</td>"+"<td>"+repKwd(name+""+pmid_url)+"</td></tr>";
				//var row = "<tr><td width='15%'>"+Citname+"</td>"+"<td>"+repKwd(jTitleWithPmid(name,pmid_url,allitems[i]))+"</td></tr>";
				val12 = val12+row;
		    }
		    else
		    {
			    var row = "<tr><td width='15%'>"+Citname+"</td>"+"<td>"+repKwd(name)+"</td></tr>";
		    	val12 = val12+row;
		    }
			//alert((allitems.length)+"<-->"+i)
    }
    val12 = val12+"</table>";
    var tableId = document.getElementById("resultDIV");
	tableId.innerText = "";
	tableId.innerHTML = "";
	tableId.innerHTML = val12;
}
function change(id)
{

	var textHome=document.getElementById('home');
	var textSearch=document.getElementById('search')
	var BoltextSearch=document.getElementById('BolSearch')
	//	alert("textHome : "+textHome+"\ntextSearch : "+textSearch+"\nBoltextSearch : "+BoltextSearch)
	document.frmSearch.temp.value=id

	if(id =='home' )
	{
		document.getElementById("searchme").value="";
		textHome.className = "ptMenuTabSelected";
		textSearch.className = "ptMenuTabText";
		BoltextSearch.className = "ptMenuTabText";
		document.getElementById('divColor1').style.display = '';
		document.getElementById('divColor2').style.display = '';
		location.href = "index.html";
		document.frmSearch.boolFlag.value = '';//sudhir
	}
	if(id =='BolSearch' )
	{
		document.getElementById("searchme").value="";
		//alert("0-----"+id)
		//BolSearchCheck();
		//set bool flag
		document.frmSearch.boolFlag.value = 'BOOL';//sudhir
		BoltextSearch.className = "ptMenuTabSelected";
		textSearch.className = "ptMenuTabText";
		textHome.className = "ptMenuTabText";
		disableEnablePallete();
		//location.href = "index.html";
		
	}
	else if(id =='Keyword' )
	{
		document.getElementById("searchme").value="";
		getREF()
		document.frmSearch.boolFlag.value = '';//sudhir
		var textID = document.getElementById("TextTD")
	    textID.innerText = "e.g. interleukin"//commented for not to dispaly
		for(var i=0;i<document.getElementById('trCondition').childNodes.length;i=i+2)
		{
			var textVal=document.getElementById('trCondition').childNodes[i].id;		
			if(textVal == id)
			{
				
				var td_ID = document.getElementById(textVal);
				td_ID.className = "";
				td_ID.className = "ptMenuTabSelected";
				//td_ID.style.fontcolor = '#330099';
			}
			else
			{
				var td_ID = document.getElementById(textVal);
				td_ID.className = "";
				td_ID.className = "ptMenuTabText";
				//td_ID.style.fontcolor = '#ffffff';
			}
		}
		document.frmSearch.searchType.value = "COMMON"; 
		var searchTDID = document.getElementById("searchTD")
		searchTDID.innerHTML="Keyword";
	//	location.href = "index.html"; 
	  //document.getElementById('Keyword').className = "ptMenuTabSelected";		
		
	}
	else
	{
	    document.frmSearch.boolFlag.value = '';//sudhir
		disableEnablePallete()
		BoltextSearch.className = "ptMenuTabText";
		textHome.className = "ptMenuTabText";
		textSearch.className = "ptMenuTabSelected";
		document.getElementById('divColor1').style.display = 'none';
		document.getElementById('divColor2').style.display = 'none';
	}
}
function BolSearchCheck()
{
	document.getElementById('divColor1').style.display = 'block';
	document.getElementById('divColor2').style.display = 'block';

}
function changeSearchCond(searchCondition)
{
		for(var j=0;j<document.getElementById('first').childNodes.length;j++)
		{
			var textVal1=document.getElementById('first').childNodes[j].id;		
				var td_ID1 = document.getElementById(textVal1);
				td_ID1.className = "";
				td_ID1.className = "ptMenuTabText";
				//td_ID.style.fontcolor = '#330099';
		}
		for(var i=0;i<document.getElementById('trCondition').childNodes.length;i=i+2)
		{
			var textVal=document.getElementById('trCondition').childNodes[i].id;		
			if(textVal == searchCondition)
			{
				var td_ID = document.getElementById(textVal);
				td_ID.className = "";
				td_ID.className = "ptMenuTabSelected";
				//td_ID.style.fontcolor = '#330099';
			}
			else
			{
				var td_ID = document.getElementById(textVal);
				td_ID.className = "";
				td_ID.className = "ptMenuTabText";
				//td_ID.style.fontcolor = '#ffffff';
			}
		}

	var text= document.getElementById("page");
	text.innerHTML='';
	text.innerText='';
	document.frmSearch.searchType.value = searchCondition; 
	searchType = searchCondition;
	document.frmSearch.searchme.value = "";
	var tableId = document.getElementById("resultDIV");
	var searchTDID = document.getElementById("searchTD")
	var textID = document.getElementById("TextTD")
	//textID.innerText = "e.g. 15"
	tableId.innerHTML = "";
	searchTDID.innerText = searchCondition;
	
	if(searchCondition=='Volume')
	{
		textID.innerText = "e.g. 20"
		document.getElementById('letterTable').style.display='none';
		document.frmSearch.temp.value = 'Volume';
		document.frmSearch.min.value = 0;
		document.frmSearch.max.value = pageDispRange;
		//tempShow();
		getREF()
	}
	if(searchCondition=='Author')
	{
		textID.innerText = "e.g. Alestig"
		document.getElementById('letterTable').style.display='';
		document.frmSearch.temp.value = 'Author';
		document.frmSearch.min.value = 0;
		document.frmSearch.max.value = pageDispRange;
		//tempShow();
		getREF()
	}
	if(searchCondition=='Year')
	{
		textID.innerText = "e.g. 1998"
		document.getElementById('letterTable').style.display='none';
		document.frmSearch.min.value = 0;
		document.frmSearch.max.value = pageDispRange;
		document.frmSearch.temp.value = 'Year';
		//tempShow();
		getREF()
	}
	if(searchCondition=='JournalTitle')
	{
		textID.innerText = "e.g. The American Journal of Tropical Medicine"
		document.getElementById('letterTable').style.display='';
		document.frmSearch.temp.value = 'JournalTitle';
		document.frmSearch.min.value = 0;
		document.frmSearch.max.value = pageDispRange;
		//tempShow();
		getREF()
	}
	if(searchCondition=='Citation')
	{
		textID.innerText = "e.g. 15"
		document.getElementById('letterTable').style.display='none';
		document.frmSearch.temp.value = 'Citation';
		document.frmSearch.min.value = 0;
		document.frmSearch.max.value = pageDispRange;
		//tempShow();
		getREF()
	}
	
}
function disableEnablePallete()
{
	var criteria=document.frmSearch.temp.value;
	
	if(criteria=='home')
	{
		//alert("ravicccccccc  "+criteria)
		document.getElementById('letterTable').style.display='none';
		//document.frmSearch.temp.value = 'Author';
		//document.frmSearch.min.value = 0;
		//document.frmSearch.max.value = 20;
		document.getElementById('divColor1').style.display = 'none';
		document.getElementById('divColor2').style.display = 'none';
		document.frmSearch.searchType.value = "COMMON"; 
		
	}
	if(criteria=='search')
	{
		document.getElementById('letterTable').style.display='';
		//document.frmSearch.temp.value = 'search';
		//document.frmSearch.min.value = 0;
		//document.frmSearch.max.value = 20;
		document.getElementById('divColor1').style.display = 'none';
		document.getElementById('divColor2').style.display = 'none';
		document.frmSearch.searchType.value = "Author"; 
	}
	if(criteria=='BolSearch')
	{
		//alert("----"+criteria)
		document.getElementById('letterTable').style.display='none';
		//document.frmSearch.temp.value = 'search';
		//document.frmSearch.min.value = 0;
		//document.frmSearch.max.value = 20;
		document.getElementById('divColor1').style.display = 'block';
		document.getElementById('divColor2').style.display = 'block';
		
		document.frmSearch.searchType.value = "COMMON"; 
	}
}
//////// Start Function for trap Enter Key //// Nitin  /////////
function goResult1()
{
	var text = document.getElementById("page");
	var keyCODE1 = event.keyCode;
	if(window.event) // IE
	{
		if(keyCODE1 == 13)
		{
			text.InnerHTML = '';
			text.InnerTEXT = '';
			searchIt();
		}
	}
	else 
	{
		if(keyCODE1 == 13)
		{
			text.InnerHTML = '';
			text.InnerTEXT = '';
			searchIt();
		}
	}
}
//////// End Function for trap Enter Key //// Nitin  /////////



function searchLetter() 
	{ // search the index (duh!)
		if (!xmlDoc) 
		{
			loadIndex();
		}
	var val = document.frmSearch.letter.value;
	var searchterm = val;
	var searchType = document.frmSearch.searchType.value;
	var allitems = xmlDoc.getElementsByTagName("Citation");
	results = new Array;
	citationno= new Array;
	pmidno= new Array;
		for (var i=0;i<allitems.length;i++) 
		{
			//--------------------
		   var Citname="";
		   var name="";
		   var pmid="";
		   var tempResult = "";
		   var chNode="";
	     var allitemChildLength=allitems[i].childNodes.length
		 if(allitemChildLength >=3)
		 {
			 chNode=allitems[i].childNodes[1];
		   if((allitems[i].childNodes[0].firstChild)!=null)
	       		Citname = allitems[i].childNodes[0].firstChild.text;
	       	
	       //if(allitems[i].childNodes[2].firstChild !=null)
	    		//name = allitems[i].childNodes[2].firstChild.text
			if(allitems[i].childNodes[2] !=null)
	    		name = allitems[i].childNodes[2].text

				//--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[2];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
		 else if(allitemChildLength==2)
		 {
			   chNode=allitems[i].childNodes[0];
			   if(allitems[i].childNodes[0]!=null)
				 {
						Citname = allitems[i].childNodes[0].text;
				 }
				 if(allitems[i].childNodes[1]!=null)
				 {
				   if(allitems[i].childNodes[1] !=null)
						name = allitems[i].childNodes[1].text
				 }

				   //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[1];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
		 else if(allitemChildLength==1)
		 {
				chNode=allitems[i].childNodes[0];
				 if(allitems[i].childNodes[0].tagName=='CitationNumber')
				 {
						Citname = allitems[i].childNodes[0].text
				 }
				 if(allitems[i].childNodes[0].tagName=='BibUnstructured')
				 {
						name = allitems[i].childNodes[0].text
				 }

						//--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[0];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
	     if(allitemChildLength >= 3)
		 {
	    	chNode=allitems[i].childNodes[1];
	    	if(chNode.hasChildNodes)
	    	{
		    	for(var j=0;j<chNode.childNodes.length;j++)
		    	{
			    	if(chNode.childNodes[j].tagName=='Occurrence')
		    		{
			    		//if(chNode.childNodes[j].childNodes[0].tagName=='Handle')
			    		if(chNode.childNodes[j].childNodes[0]!=null)
			    		{
			    			pmid=chNode.childNodes[j].childNodes[0].firstChild.text
							if(name.indexOf(pmid)!=-1)//added to remove duplicate address
								pmid="";
				    	}
				    	/*else
				    	{
        				pmid="NA"	
					    }*/
			    	}
			    }
	    	}	
			//--------------------
// see if the XML entry matches the search term,
// and (if so) store it in an array
			if(searchType == "Author")
			{
				if(allitems[i].childNodes[1].childNodes[0]!=null)
				{
					for(var j=0;j<allitems[i].childNodes[1].childNodes.length;j++)
					{
						var bibName1 = allitems[i].childNodes[1].childNodes[j].tagName;
						if(bibName1 == "BibAuthorName")
						{
							if(allitems[i].childNodes[1].childNodes[j].childNodes[1]!=null)
							{
								tempResult = allitems[i].childNodes[1].childNodes[j].childNodes[1].text;
								if(tempResult.charAt(0).toLowerCase() == searchterm.toLowerCase())
								{
									var searchStr = tempResult;
									var replaceStr = '<font color = red>'+tempResult+'</font>';
									var re = new RegExp(searchStr , "g");
									name = name.replace(re, replaceStr);
								}
							}
						}
					}
					if(name.indexOf("</font>")!=-1)
					{
						results.push(name);
						citationno.push(Citname);
						pmidno.push(pmid);
					}
				}
			}

			if(searchType == "JournalTitle")
			{
				if(allitems[i].childNodes[1].childNodes[0]!=null)
				{
					for(var j=0;j<allitems[i].childNodes[1].childNodes.length;j++)
					{
						var bibName1 = allitems[i].childNodes[1].childNodes[j].tagName;
						if(bibName1 == "JournalTitle")
						{
							if(allitems[i].childNodes[1].childNodes[j].childNodes[0]!=null)
							{
								tempResult = allitems[i].childNodes[1].childNodes[j].childNodes[0].text;
								if(tempResult.charAt(0).toLowerCase() == searchterm.toLowerCase())
								{
									var searchStr = tempResult;
									var replaceStr = '<font color = red>'+tempResult+'</font>';
									var re = new RegExp(searchStr , "g");
									name = name.replace(searchStr, replaceStr);
									results.push(name);
									citationno.push(Citname);
									pmidno.push(pmid);
								}
							}
						}
					}
				}
			}
		 }//close allitemChildLength
		}
// send the results to another function that displays them to the user
	showResults(citationno,pmidno,results, searchterm);
	
}
function tempShow()
{

	
	var val = document.frmSearch.temp.value;
	flag = "tempShow";
	var allitems = xmlDoc.getElementsByTagName("Citation");
	results = new Array;
	citationno= new Array;
	pmidno= new Array;
	for (var i=0;i<allitems.length;i++) 
	{
			//--------------------
		var Citname="";
		var name="";
		var pmid="";
		var tempResult = "";
		var chNode="";
		var allitemChildLength=allitems[i].childNodes.length
		 if(allitemChildLength >=3)
		 {
		   chNode=allitems[i].childNodes[1];
		   if((allitems[i].childNodes[0].firstChild)!=null)
	       		Citname = allitems[i].childNodes[0].firstChild.text;
	       	
	       //if(allitems[i].childNodes[2].firstChild !=null)
	    		//name = allitems[i].childNodes[2].firstChild.text
			if(allitems[i].childNodes[2] !=null)
	    		name = allitems[i].childNodes[2].text
             
             //----------image tag----------
  
             var rootNameTag=allitems[i].childNodes[2]
                        
              if(rootNameTag.hasChildNodes)
              for(var g=0;g<rootNameTag.childNodes.length;g++)
               {  //1

                   var imgTag=rootNameTag.childNodes[g]

                   if(imgTag!=null)
                    { //2
                        var temp='';
                        if(imgTag.tagName=='InlineMediaObject')
                        {  //3
                           if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                            {  //4
	                            var tempText=imgTag.childNodes[0].attributes[0].text
			                    	  
                                var img="<img src='"+tempText+"' />"
					            if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
  			                     {  //5
				                   if(g==0)
				                   {
					                    name=img+name;
								  }
				                   else if(g==2)
				                   {
					                    var spos=0;
				                        spos=name.indexOf(". With English",0);
			                        	if(spos !=-1)
					                     {
				                            	var val_first=name.substring(0,spos);
						                        var val_last=name.substring(spos,name.length);
						                        name=val_first+img+val_last;
					                     }
				                  }
				                  else if(g==4)
				                  {
											
  				                       var spos=0;
				                       spos=name.indexOf("[Harefuah",0);
				                       if(spos !=-1)
				                       {
					                        var val_first=name.substring(0,spos);
					                         var val_last=name.substring(spos,name.length);
					                         name=val_first+img+" "+val_last;
											
				                        }

				                  }
												
			                    } //5
														
                           } //4
													
		               } //3
                 } //2
	     } //1
	

			//---------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[2];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
		 else if(allitemChildLength==2)
		 {
			   chNode=allitems[i].childNodes[0];
			   if(allitems[i].childNodes[0]!=null)
				 {
						Citname = allitems[i].childNodes[0].text;
				 }
				 if(allitems[i].childNodes[1]!=null)
				 {
				   if(allitems[i].childNodes[1] !=null)
						name = allitems[i].childNodes[1].text
				 }

				   //----------image tag----------
  
             var rootNameTag=allitems[i].childNodes[1]
                        
              if(rootNameTag.hasChildNodes)
              for(var g=0;g<rootNameTag.childNodes.length;g++)
               {  //1

                   var imgTag=rootNameTag.childNodes[g]

                   if(imgTag!=null)
                    { //2
                        var temp='';
                        if(imgTag.tagName=='InlineMediaObject')
                        {  //3
                           if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                            {  //4
	                            var tempText=imgTag.childNodes[0].attributes[0].text
			                     
                                var img="<img src='"+tempText+"' />"
					            if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
  			                     {  //5
				                   if(g==0)
				                   {
					                    name=img+name;
								   }
				                   else if(g==2)
				                   {
					                    var spos=0;
				                        spos=name.indexOf(". With English",0);
			                        	if(spos !=-1)
					                     {
				                            	var val_first=name.substring(0,spos);
						                        var val_last=name.substring(spos,name.length);
						                        name=val_first+img+val_last;
					                     }
				                  }
				                  else if(g==4)
				                  {
											
  				                       var spos=0;
				                       spos=name.indexOf("[Harefuah",0);
				                       if(spos !=-1)
				                       {
					                        var val_first=name.substring(0,spos);
					                         var val_last=name.substring(spos,name.length);
					                         name=val_first+img+" "+val_last;
											
				                        }

				                  }
												
			                    } //5
														
                           } //4
													
		               } //3
                 } //2
	     } //1
				
			 //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[1];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
		 else if(allitemChildLength==1)
		 {
				 chNode=allitems[i].childNodes[0];
				 if(allitems[i].childNodes[0].tagName=='CitationNumber')
				 {
						Citname = allitems[i].childNodes[0].text
				 }
				 if(allitems[i].childNodes[0].tagName=='BibUnstructured')
				 {
						name = allitems[i].childNodes[0].text
				 }

						//----------image tag----------
  
             var rootNameTag=allitems[i].childNodes[0]
                        
              if(rootNameTag.hasChildNodes)
              for(var g=0;g<rootNameTag.childNodes.length;g++)
               {  //1

                   var imgTag=rootNameTag.childNodes[g]

                   if(imgTag!=null)
                    { //2
                        var temp='';
                        if(imgTag.tagName=='InlineMediaObject')
                        {  //3
                           if(imgTag.childNodes[0]!=null && imgTag.childNodes[0].tagName=='ImageObject')
                            {  //4
	                            var tempText=imgTag.childNodes[0].attributes[0].text
			                      
                                var img="<img src='"+tempText+"' />"
					            if(Citname=='[3232]*'||Citname=='[3233]'||Citname=='[3234]'||Citname=='[3235]*'||Citname=='[3236]*')
  			                     {  //5
				                   if(g==0)
				                   {
					                    name=img+name;
							      }
				                   else if(g==2)
				                   {
					                    var spos=0;
				                        spos=name.indexOf(". With English",0);
			                        	if(spos !=-1)
					                     {
				                            	var val_first=name.substring(0,spos);
						                        var val_last=name.substring(spos,name.length);
						                        name=val_first+img+val_last;
					                     }
				                  }
				                  else if(g==4)
				                  {
											
  				                       var spos=0;
				                       spos=name.indexOf("[Harefuah",0);
				                       if(spos !=-1)
				                       {
					                        var val_first=name.substring(0,spos);
					                         var val_last=name.substring(spos,name.length);
					                         name=val_first+img+" "+val_last;
											
				                        }

				                  }
												
			                    } //5
														
                           } //4
													
		               } //3
                 } //2
	     } //1
				
               //--------------------------------
			 //found child tag found
					var repTag=allitems[i].childNodes[0];
					if(repTag.hasChildNodes)
					{
						for(var j=0;j<repTag.childNodes.length;j++)
						{
							if(repTag.childNodes[j].tagName=="Emphasis")
							{
							  var searchStr = repTag.childNodes[j].text;
							  var replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Italic")
							     replaceStr = "<I>"+searchStr+"</I>";
							  if(repTag.childNodes[j].attributes[0].text=="Bold")
							     replaceStr = "<B>"+searchStr+"</B>";
							  var re = new RegExp(searchStr , "g");
							  name = name.replace(re, replaceStr);	
							}
						}
					}
			//----------------------------------
		 }
	     if(allitemChildLength >= 3)
		 {			
		chNode=allitems[i].childNodes[1];
		if(chNode.hasChildNodes)
		{
			for(var j=0;j<chNode.childNodes.length;j++)
			{
				if(chNode.childNodes[j].tagName=='Occurrence')
				{
					//if(chNode.childNodes[j].childNodes[0].tagName=='Handle')
					if(chNode.childNodes[j].childNodes[0]!=null)
					{
						pmid=chNode.childNodes[j].childNodes[0].firstChild.text
						if(name.indexOf(pmid)!=-1)//added to remove duplicate address
							pmid="";
					}
					/*else
					{
					pmid="NA"	
					}*/
				}
			}
		}	
              			
			//--------------------
// see if the XML entry matches the search term,
// and (if so) store it in an array
             
           
			if(val == "Author")
			{
				if(allitems[i].childNodes[1].childNodes[0]!=null)
				{
					var authorCount = 0;
					for(var j=0;j<allitems[i].childNodes[1].childNodes.length;j++)
					{
						var bibName1 = allitems[i].childNodes[1].childNodes[j].tagName;
						if(bibName1 == "BibAuthorName")
						{
							tempResult = allitems[i].childNodes[1].childNodes[j].childNodes[1].text;
							tempResultFinal = "<font color = 'red'>"+tempResult+"</font>";
							name = name.replace(tempResult, tempResultFinal);
						}
					}
					results.push(name);
					citationno.push(Citname);
					pmidno.push(pmid);
				}
			}
			if(val == "Volume")
			{
				var tempResultFinal = "";
				if(allitems[i].childNodes[1].childNodes[0]!=null)
				{
					var authorCount = 0;
					for(var j=0;j<allitems[i].childNodes[1].childNodes.length;j++)
					{
						var bibName1 = allitems[i].childNodes[1].childNodes[j].tagName;
						if(bibName1 == "VolumeID")
						{
							//comment for all volume related links
							/*tempResult = allitems[i].childNodes[1].childNodes[j].text;
							tempResultFinal = "<font color = 'red'>"+tempResult+"</font>";
							name = name.replace(tempResult, tempResultFinal);*/
							//---------------------------------------
							tempResult = allitems[i].childNodes[1].childNodes[j].text;
							var searchStr = " "+tempResult+'\\(';
							//var searchStr = " "+tempResult;
							var replaceStr = '<font color = red>'+" "+tempResult+'</font>'+'\(';
							var re = new RegExp(searchStr , 'g');
							name = name.replace(re, replaceStr);
						}
					}
						//new code added for volume related search
						tempResultFinal=="";
						results.push(name);
						citationno.push(Citname);
						pmidno.push(pmid);
						//---------------------------------------
				}
				//comment for all volume related links
				/*if(tempResultFinal.indexOf("</font>")!=-1)
				{
					tempResultFinal=="";
					results.push(name);
					citationno.push(Citname);
					pmidno.push(pmid);
				}*/
				//---------------------------------------
			}
			if(val == "Year")
			{
				if(allitems[i].childNodes[1].hasChildNodes)
				{
					var sLength = allitems[i].childNodes[1].childNodes.length;
					for(var j=0;j<sLength;j++)
					{
						var bibName1 = allitems[i].childNodes[1].childNodes[j].tagName;
						if(bibName1 == "Year")
						{
							tempResult = allitems[i].childNodes[1].childNodes[j].text;
							var searchStr = tempResult;
							var replaceStr = '<font color = red>'+tempResult+'</font>';
							var re = new RegExp(searchStr , 'g');
							name = name.replace(re, replaceStr);
						}
					}
					results.push(name);
					citationno.push(Citname);
					pmidno.push(pmid);
				}
			}
			if(val == "JournalTitle")
			{
				if(allitems[i].childNodes[1].childNodes[0]!=null)
				{
					var authorCount = 0;
					for(var j=0;j<allitems[i].childNodes[1].childNodes.length;j++)
					{
						var bibName1 = allitems[i].childNodes[1].childNodes[j].tagName;
						if(bibName1 == "JournalTitle")
						{
							tempResult = allitems[i].childNodes[1].childNodes[j].text;
							tempResultFinal = "<font color = 'red'>"+tempResult+"</font>";
							name = name.replace(tempResult, tempResultFinal);
						}
					}
					results.push(name);
					citationno.push(Citname);
					pmidno.push(pmid);
				}
			}
			if(val == "Citation")
			{
				if(allitems[i].childNodes[0]!=null)
				{
					var authorCount = 0;
					for(var j=0;j<allitems[i].childNodes.length;j++)
					{
						var bibName1 = allitems[i].childNodes[j].tagName;
						if(bibName1 == "CitationNumber")
						{
							Citname = "<font color = 'red'>"+Citname+"</font>";
						}
					}
					results.push(name);
					citationno.push(Citname);
					pmidno.push(pmid);
				}
			}
		 }//close of allitemChildLength if block
        
		else if(allitemChildLength <=2)//main block
			{
			
				if(val == "Citation")
				{
				Citname = "<font color = 'red'>"+Citname+"</font>";
				results.push(name);
				citationno.push(Citname);
				pmidno.push(pmid);
				}
			}
	}
	showResults(citationno,pmidno,results,' ');
}

function searchAndRepace(tempStr,text)
{
	var MainStr=tempStr;
	var NameIndx=-1;
	var p=MainStr.indexOf(text)
	//var tmp_name=text
	var RepName="";
	while(p>-1)
	{
		NameIndx=MainStr.indexOf(text,NameIndx+(RepName.length))
		if(NameIndx>-1)
		{
			var TempName=text;
			RepName="<font color = 'red'>"+text+"</font>";
			MainStr = MainStr.replace(TempName, RepName);
			NameIndx=NameIndx+1
		}
		p=NameIndx;
	}//close while
	//alert(MainStr)
	return MainStr;
}
function searchAndRepaceText(tempStr,text)//to be added 14.12.07
{
	var name=tempStr
	var searchterm=text
	searchterm=searchterm.toLowerCase()
	name=searchAndRepace(name,searchterm);
	name=searchAndRepace(name,searchterm.toUpperCase());
	var firstCap=searchterm;
	firstCap=firstCap.charAt(0).toUpperCase()+searchterm.substring(1,searchterm.length);
	name=searchAndRepace(name,firstCap);
	return name;
}
function repKwd(name)//to be added 14.12.07
{
var searchStr = "Russian translation:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Book review:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Comment:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Previous editions:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Published:";
name = searchAndRepaceKwd(name,searchStr)

name = searchAndRepaceKwd(name,searchStr)

if(name.indexOf("Chinese translation of the article's abstract:")>-1)
   name = searchAndRepaceKwd(name,"Chinese translation of the article's abstract:")
else if(name.indexOf("Reprint of the Spanish abstract:")>-1)
   name = searchAndRepaceKwd(name,"Reprint of the Spanish abstract:")
//else if(name.indexOf("With English abstract:")>-1)
   //name = searchAndRepaceKwd(name,"With English abstract:")
else if(name.indexOf("English abstract:")>-1 && name.indexOf("With English abstract:")==-1)
//else if(name.indexOf("English abstract:")>-1)
   name = searchAndRepaceKwd(name,"English abstract:")
else if(name.indexOf("Abstract:")>-1)
   name = searchAndRepaceKwd(name,"Abstract:")

var searchStr = "This chapter replaces:";
name = searchAndRepaceKwd(name,searchStr)


//if(name.indexOf("In:")>-1)
   //name = searchAndRepaceKwd(name,"In:")

if(name.indexOf("Reprint and French translation:")>-1)
   name = searchAndRepaceKwd(name,"Reprint and French translation:")
//else if(name.indexOf("With French translation:")>-1)
   //name = searchAndRepaceKwd(name,"With French translation:")
else if(name.indexOf("French translation:")>-1 && name.indexOf("With French translation:")==-1)
   name = searchAndRepaceKwd(name,"French translation:")


if(name.indexOf("Partial reprint:")>-1)
   name = searchAndRepaceKwd(name,"Partial reprint:")
else if(name.indexOf("Reprint:")>-1)
   name = searchAndRepaceKwd(name,"Reprint:")

var searchStr = "Abridged version:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "French translation of the article's abstract:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "This is an updated version of:";
name = searchAndRepaceKwd(name,searchStr)

if(name.indexOf("Abridged Spanish translation:")>-1)
   name = searchAndRepaceKwd(name,"Abridged Spanish translation:")
else if(name.indexOf("Spanish translation:")>-1)
   name = searchAndRepaceKwd(name,"Spanish translation:")

var searchStr = "Adapted from:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Announcement of this special issue:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Discussion:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Reply:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Summary:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Thesis proposal:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Corrigendum:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Abridged German translation:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Abridged version in English:";
name = searchAndRepaceKwd(name,searchStr)

var searchStr = "Edited English translation:";
name = searchAndRepaceKwd(name,searchStr)

return name;
}
function tabKwd(MainStr,text)
{
  var tabStr1="<br>"
  var searchStr = text;
  var replaceStr = tabStr1+text
  var re = new RegExp(searchStr , "g");
  if(MainStr.match(re) != null)
	{
		MainStr = MainStr.replace(re, replaceStr);
	}
  return MainStr
}
function searchAndRepaceKwd(MainStr,text)//to be added 14.12.07
{
	var tabIntends="<table border = '0' width='90%' cellpadding= '0' align='center'><tr><td>"
//	var tabIntends="<div>"
	var MainStrOriginal=MainStr;
	
	var NameIndx=-1
	   var RepName="";
		NameIndx=MainStr.indexOf(text)
			if(NameIndx>-1)
			{
				//----------------------------
				    var temp1=MainStr.substring(0,NameIndx)
					var temp2=MainStr.substring(NameIndx,MainStr.length)
					var searchStr = text;
					var replaceStr = "<BR>"+text+"";
					var re = new RegExp(text , "g");
					if(temp2.match(re) != null)
					{
						temp2 = temp2.replace(re, replaceStr);
					}
					 MainStrOriginal=temp1+""+temp2
                     MainStrOriginal=temp1+""+tabIntends+""+temp2+"</td></tr></table>"
				//----------------------------
			}
	//MainStrOriginal=tabKwd(MainStrOriginal,text)	
	return MainStrOriginal;
}

function jTitleWithPmid(name,pmid,mainNameStr)
{  
	var nmStr=mainNameStr.childNodes[1]
	for(var j=0;j<nmStr.childNodes.length;j++)
	{
		var bibName1 = nmStr.childNodes[j].tagName;
		if(bibName1 == "JournalTitle")
		{
			var tempResult = nmStr.childNodes[j].text;
			var tempResultFinal = tempResult+" "+pmid;
			name = name.replace(tempResult, tempResultFinal);
		}
	}
	nmStr=mainNameStr.childNodes[0]
	for(var j=0;j<nmStr.childNodes.length;j++)
	{
		var bibName1 = nmStr.childNodes[j].tagName;
		if(bibName1 == "JournalTitle")
		{
			var tempResult = nmStr.childNodes[j].text;
			var tempResultFinal = tempResult+" "+pmid;
			name = name.replace(tempResult, tempResultFinal);
		}
	}
	return name;
}

function getPmidURL(pmid)//to be added 14.12.07
{
	var pmid_url='';
	if(pmid!="" && pmid!=null && pmid!="undefined")
	{
		var pmid_url="";
		if(pmid.indexOf("www.")!=-1 && pmid.indexOf("http://")==-1)
		{
			pmid_url="<FONT color=green>"+"<A target='_blank' href=http://"+pmid+" >"+pmid+"</A></FONT>";
		}
		else
		if(pmid.indexOf("http://")>-1)
		{
			pmid_url="<FONT color=green>"+"<A target='_blank' href="+pmid+" >"+pmid+"</A></FONT>";
		}
		else
		{
			pmid_url="<FONT color=green> PMID:</font>"+"<A target='_blank' href=http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids="+pmid+" >"+pmid+"</A>";
		}
	}
	return pmid_url;
}

function repUrl(name)
{
 var TempName="";
 var NameIndx=name.indexOf("www.<font color")
 if(NameIndx>-1)
	{
		if(name.indexOf(" [",NameIndx)>-1)
		TempName=name.substring(NameIndx,name.indexOf(" [",NameIndx))
		else
        TempName=name.substring(NameIndx,name.indexOf(" ",NameIndx))
		var findStr=TempName.substring(TempName.indexOf("<font color"),TempName.indexOf(">",TempName.indexOf("<font color"))+1)
		TempName=TempName.replace(findStr,"")
		TempName=TempName.replace("</font>","")
	}//added by sudhir
		return TempName
}

function makeUrl(name)
{
	var tmp_name=name
	if(name.indexOf(" http://")>-1 )
	{
		var NameIndx=-1;
		var p=name.indexOf(" http://")
			NameIndx=tmp_name.indexOf(" http://",NameIndx)
			if(NameIndx>-1)
			{
				var Lastindx=-1;
				if(tmp_name.indexOf(" [",NameIndx)>-1)
					Lastindx=tmp_name.indexOf(" [",NameIndx)
				else if(tmp_name.indexOf(" ",NameIndx)>-1)
					Lastindx=tmp_name.indexOf(" ",NameIndx)
				var TempName=tmp_name.substring(NameIndx,Lastindx)
				var RepName="<FONT color=green>"+"<A target='_blank' href="+TempName+" >"+TempName+"</A></FONT>";
				NameIndx=NameIndx+RepName.length
				var re = new RegExp(TempName , "g");
				name = name.replace(re, RepName);
				NameIndx=NameIndx+1
			}
			p=NameIndx;
	}
	return name
}
//----------------------------------------------------------

