var THOUSANDSEP = ",";
var DECIMALSEP = ".";

var book="BOOKS";
var gift="GIFTS";
var music="MUSIC";
var stationery="STATIONERY";
var multimedia="MULTIMEDIA";
var searchClearDivItemId="";
//changes by rahul jain for ratings
var searchClearDivItemName="";
var searchimageSrc="";
var searchauthorName="";
var searchitemPrice="";
var searchitemPriceUsd="";
var searchshippingInfo="";
var searchbindingInfo="";

var itemIdData = new Array();
var itemNameData = new Array();
var imageSrc = new Array();
var authorName = new Array();
var itemPrice = new Array();
var itemPriceUsd = new Array();
var shippingInfo =  new Array();
var bindingInfo = new Array();
var itemlPriceData = new Array();
var itemlDiscountedPrice = new Array();
//upto here by rahul jain for ratings

//function to replace CDATA from the response
function replace(str)
{	
	var string="";	
	var newstr = str.replace(/<!\[CDATA\[/, string);
	newstr=newstr.replace(/\]\]>/, string);	
	return newstr;
}
//function to replace CDATA from the response and split them by " $%&@$%&@ " for displaying the results....
function replaceGetSearchResult(str)
{	
	var string="";
	var newstr = str.replace(/<!\[CDATA\[/, string);
	newstr=newstr.replace(/\]\]>/, string);
	newstr = newstr.split(" $%&@$%&@ ");	
	return newstr;
}
//function to clear the dynamically cretaed divs before the result page is populated again...
function removePreviousRecords()
{
	var parent="";
	var children="";
	parent = document.getElementById("categoryResult");
	children = parent.childNodes.length;
	for(var count=0;count<children;count++)
	{
		parent.removeChild(parent.childNodes[0]);
	}
	
	parent = document.getElementById("SearchTR");
	children = parent.childNodes.length;
	for(var count=0;count<children;count++)
	{
		parent.removeChild(parent.childNodes[0]);
	}
	
	parent = document.getElementById("ItemDescriptionTableTd");
	children = parent.childNodes.length;
	for(var count=0;count<children;count++)
	{
		parent.removeChild(parent.childNodes[0]);
	}

	parent = document.getElementById("pageLabels");
	children = parent.childNodes.length;
	for(var count=0;count<children;count++)
	{
		parent.removeChild(parent.childNodes[0]);
	}

	parent = document.getElementById("searchCondition");
	children = parent.childNodes.length;
	for(var count=0;count<children;count++)
	{
		parent.removeChild(parent.childNodes[0]);
	}
	parent = document.getElementById("authorDescriptionTd");
	children = parent.childNodes.length;
	for(var count=0;count<children;count++)
	{
		parent.removeChild(parent.childNodes[0]);
	}
	parent = document.getElementById("FeedBackTableTd");
	children = parent.childNodes.length;
	for(var count=0;count<children;count++)
	{
		parent.removeChild(parent.childNodes[0]);
	}
}

//function for paging.....and  displaying the no of results and keyword. on which search is made......
function showPages(isPrevious,previousID,isNext,nextID,pageStart,totalAllowedPages,totalPages,totalRecords,pageNo,allowedRecords,inputKeyword,flag)
{
	var recordStart="";
	var recordEnd="";	
	recordStart = pageNo==0?1:(eval(pageNo)*eval(allowedRecords)+1);
	var recordEnd = (eval(recordStart)+eval(allowedRecords)-1)>eval(totalRecords)?eval(totalRecords):(eval(recordStart)+eval(allowedRecords)-1);
	var element="";
	var font="";
	var Strong="";
	var page = document.getElementById("pageLabels");

	var searchCondition = document.getElementById("searchCondition");
	if(totalRecords == null || totalRecords == "null" || totalRecords == "" || totalRecords == "0")
	{
		totalRecords = "0.";
		document.getElementById("pageLabels").style.display = 'none';		
	}
	else
	{
		document.getElementById("pageLabels").style.display = 'block';
	}	
	if(totalRecords==1)
	{
		element = document.createTextNode("Results "+recordStart+" of "+totalRecords);
	}
	else
	{
		element = document.createTextNode("Results "+recordStart+" - "+recordEnd+" of "+totalRecords);
	}

	searchCondition.appendChild(element);	
	var text="";

	if(inputKeyword!='')
	{		
		font = document.createElement("font");
		font.className="recordsText";
		text = document.createTextNode(" for \"");
		font.appendChild(text);
		searchCondition.appendChild(font);
		font = document.createElement("font");
		font.className="searchCondition";
		text = document.createTextNode(inputKeyword+"\"");
		font.appendChild(text);
		searchCondition.appendChild(font);		
	}	
	var count = 0;	
	if(isPrevious=='true')
	{
		var childElement = document.createElement("a");		
		if(flag=="true")
		var js = "javascript:onclick=itemSearchResult(\"" + previousID +"\",\"\",\"true\")";
		if(flag=="false")
		var js = "javascript:onclick=itemSearchResult(\"" + previousID +"\",\"\",\"false\")";
		childElement.setAttribute("href",js);
		childElement.className = "pagestext";
		var nodeVal = "<<" + "  ";
		var textNode = document.createTextNode(nodeVal);
		childElement.appendChild(textNode);
		page.appendChild(childElement);
	}
	for(count=eval(pageStart);count<totalAllowedPages;count++)
	{
		var	aLinkpageNo = document.createElement("a");
		if(flag=="true")
		var js = "javascript:onclick=itemSearchResult(\"" + count +"\",\"\",\"true\")";
		if(flag=="false")
		var js = "javascript:onclick=itemSearchResult(\"" + count +"\",\"\",\"false\")";
		var textNode ="";
		var font="";
		aLinkpageNo.setAttribute("href",js);				
		aLinkpageNo.className = "pagestext";
		if(count==pageNo)
		{
			font = document.createElement("FONT");
			font.setAttribute("color","#FF0000");
			textNode = document.createTextNode(count + 1);
			font.appendChild(textNode);
			aLinkpageNo.appendChild(font);
			if(count<totalAllowedPages-1)
			{
				textNode = document.createTextNode(" |");
				aLinkpageNo.appendChild(textNode);
			}
		}
		else
		{
			textNode = document.createTextNode(count + 1);
			aLinkpageNo.appendChild(textNode);
			if(count<totalAllowedPages-1)
			{
				textNode = document.createTextNode(" |");
				aLinkpageNo.appendChild(textNode);
			}
		}

		var spaceNode = document.createTextNode("  ");		
		page.appendChild(aLinkpageNo);
		page.appendChild(spaceNode);
	}
	if(isNext=='true')
	{
		var childElement = document.createElement("a");
		if(flag=="true")
		var js = "javascript:onclick=itemSearchResult(\"" + nextID +"\",\"\",\"true\")";
		if(flag=="false")
		var js = "javascript:onclick=itemSearchResult(\"" + nextID +"\",\"\",\"false\")";
		childElement.setAttribute("href",js);
		childElement.className = "pagestext";
		var nodeVal = "  " + ">>";
		var textNode = document.createTextNode(' ' + ">>");
		childElement.appendChild(textNode);
		page.appendChild(childElement);
	}
}


//function for atoz search
function fnAZSearch(itemAlphabet)
{
	document.AddToCart.itemnameatoz.value = itemAlphabet;
	document.AddToCart.submit();

}
//function that is called on click of paging....
function itemSearchResultPaging(pageNo)
{
	document.AddToCart.pageNo.value = pageNo;
	document.AddToCart.submit();
}
// this function displays the result of search.....
function displaySearchResultsNew(http_requestSearchItem,pageNo,flag,inputKeyword,bookId,flagidentity,allChild)
{
	
	if (http_requestSearchItem.readyState == 4)
	{
		 if (http_requestSearchItem.status == 200)
		 {	
			if(flagidentity==0)
                     setAtoZSearch();
			removePreviousRecords();
                    
		 	var responseDoc = http_requestSearchItem.responseXML; 			
			var pagingDetails = responseDoc.documentElement;
			
			var isPrevious=pagingDetails.getAttribute("isPrevious");
			var previousID=pagingDetails.getAttribute("previousID");
			var isNext=pagingDetails.getAttribute("isNext");
			var nextID=pagingDetails.getAttribute("nextID");
			var pageStart=pagingDetails.getAttribute("pageStart");
			var totalAllowedPages=pagingDetails.getAttribute("totalAllowedPages");
			var totalPages=pagingDetails.getAttribute("totalPages");
			var totalRecords=pagingDetails.getAttribute("totalRecords");
			var allowedRecords=pagingDetails.getAttribute("allowedRecords");

			var docs = responseDoc.getElementsByTagName("DOCUMENT");					 	
		 	var noOfDocuments = docs.length;
			var pagingDetails = document.getElementById("pagingDetails");
			var searchResults = document.getElementById("searchResults");
			if(noOfDocuments==0)
			{	
				document.getElementById('noResults').style.display='block';				
				document.getElementById('searchResults').style.display='none';	
				document.getElementById('pagingsResults').style.display='none';					
				
				var searchCond = document.getElementById("noResultsText");
				if(inputKeyword!='')
				{
					var text="";
					text = document.createTextNode(" for \"");
					searchCond.appendChild(text);
					text = document.createTextNode(inputKeyword+" \"");
					searchCond.appendChild(text);
				}				
			}
			else
			{					
				document.getElementById('noResults').style.display='none';				
				document.getElementById('searchResults').style.display='block';		
				
			}
		 	var fields;
			var getTD = document.getElementById("SearchTR");
		
			var isbnNo1Data = new Array();
			var author1Data = new Array();
			var publisher1Data = new Array();
			var bindingId1Data = new Array();
			var authorProfile1Data = new Array();
			var bindingDescription1Data = new Array();
			var bindingPrice1Data = new Array();
			var itemDescriptionData = new Array();
			var itemPriceData = new Array();
			var itemLeadTimeData = new Array();
			var itemTypeIdData = new Array();
			var itemTypeNameData = new Array();
			var itemTypeDescriptionData = new Array();
			var imageidData = new Array();
			var imageDescriptionData = new Array();
			var imageHeightData = new Array();
			var imageWidthData = new Array();
			var imageDefaultData = new Array();
			var relatedItemIdData = new Array();
			var relatedItemNameData = new Array();
			var catogeryIdData = new Array();
			var categoryDescriptionData = new Array();
			var categoryNameData = new Array();
			var isbnNo1DataData = new Array();			
			var imagePathData = new Array();
			var	itemHeight1Data = new Array();
			var	itemWidth1Data = new Array();
			var	itemLength1Data = new Array();
			var	itemDimensionUnit1Data = new Array();
			var	itemWeight1Data = new Array();
			var	itemWeightUnit1Data = new Array();
			var	itemKeywordData = new Array();
			var itemActualKeywordData = new Array();
			var	itemPageNoData = new Array();
			var	itemPublicationDateData = new Array();
			var	relaltedItemName = new Array();
			var	relaltedItemId = new Array();
			var	itemDiscountedPrice = new Array();
            var USDConversionRate=0;
			var artistData = new Array();
			var	releasedByData = new Array();
			var	formatData = new Array();
			var	companyData = new Array();
			var	dateOfReleaseDateData = new Array();
         
			for(count=0;count<noOfDocuments;count++)
		 	{
				
				fields = docs[count].getElementsByTagName("FIELD");
		 		for(fieldCount=0;fieldCount<fields.length;fieldCount++)
		 		{
					
					var fieldName = fields[fieldCount].getAttribute("name");			


					if(fieldName=='itemid')
					{
						itemIdData[count] = fields[fieldCount].firstChild.nodeValue;							
						itemIdData[count] = replaceGetSearchResult(itemIdData[count]);												
					}
					
					if(fieldName=='itemname')
					{
						itemNameData[count] = fields[fieldCount].firstChild.nodeValue;						
						itemNameData[count] = replaceGetSearchResult(itemNameData[count]);						
					}
					if(fieldName=='itemdescription')
					{
						itemDescriptionData[count] = fields[fieldCount].firstChild.nodeValue;						
						itemDescriptionData[count] = replaceGetSearchResult(itemDescriptionData[count]);						
					}
					if(fieldName=='itemdiscountedprice')
					{
						itemDiscountedPrice[count] = fields[fieldCount].firstChild.nodeValue;						
						itemDiscountedPrice[count] = replaceGetSearchResult(itemDiscountedPrice[count]);
                        itemlDiscountedPrice[count] = "Rs. "+itemDiscountedPrice[count];
					}
					
					if(fieldName=='itemprice')
					{
						itemPriceData[count] = fields[fieldCount].firstChild.nodeValue;						
						itemPriceData[count] = replaceGetSearchResult(itemPriceData[count]);	
						itemPriceData[count] = itemPriceData[count].toString();
						itemPriceData[count] = removeZeros(itemPriceData[count]);	
						itemlPriceData[count] = "Rs. "+itemPriceData[count];
					}
					
					if(fieldName=='itemleadtime')
					{
						itemLeadTimeData[count] = fields[fieldCount].firstChild.nodeValue;						
						itemLeadTimeData[count] = replaceGetSearchResult(itemLeadTimeData[count]);						
					}
					if(fieldName=='itemkeyword')
					{
						itemKeywordData[count] = fields[fieldCount].firstChild.nodeValue;						
						itemKeywordData[count] = replaceGetSearchResult(itemKeywordData[count]);						
					}
					if(fieldName=='itemtypeid')
					{
						itemTypeIdData[count] = fields[fieldCount].firstChild.nodeValue;						
						itemTypeIdData[count] = replaceGetSearchResult(itemTypeIdData[count]);						
					}
					if(fieldName=='itemtypename')
					{
						itemTypeNameData[count] = fields[fieldCount].firstChild.nodeValue;						
						itemTypeNameData[count] = replaceGetSearchResult(itemTypeNameData[count]);						
					}
					if(fieldName=='itemtypedescription')
					{
						itemTypeDescriptionData[count] = fields[fieldCount].firstChild.nodeValue;						
						itemTypeDescriptionData[count] = replaceGetSearchResult(itemTypeDescriptionData[count]);						
					}

					if(fieldName=='imageid')
					{
						imageidData[count] = fields[fieldCount].firstChild.nodeValue;						
						imageidData[count] = replaceGetSearchResult(imageidData[count]);						
					}
					if(fieldName=='imagedescription')
					{
						imageDescriptionData[count] = fields[fieldCount].firstChild.nodeValue;						
						imageDescriptionData[count] = replaceGetSearchResult(imageDescriptionData[count]);
					}
					if(fieldName=='imagepath')
					{
						
						imagePathData[count] = fields[fieldCount].firstChild.nodeValue;							
						imagePathData[count] = replaceGetSearchResult(imagePathData[count]);						
					}
					if(fieldName=='imageheight')
					{
						imageHeightData[count] = fields[fieldCount].firstChild.nodeValue;						
						imageHeightData[count] = replaceGetSearchResult(imageHeightData[count]);						
					}
					if(fieldName=='imagewidth')
					{
						imageWidthData[count] = fields[fieldCount].firstChild.nodeValue;						
						imageWidthData[count] = replaceGetSearchResult(imageWidthData[count]);					
					}
					if(fieldName=='imagedefault')
					{
						imageDefaultData[count] = fields[fieldCount].firstChild.nodeValue;						
						imageDefaultData[count] = replaceGetSearchResult(imageDefaultData[count]);						
					}
					if(fieldName=='relateditemid')
					{
						relatedItemIdData[count] = fields[fieldCount].firstChild.nodeValue;
						relatedItemIdData[count] = replaceGetSearchResult(relatedItemIdData[count]);		
						relaltedItemId[count] = fields[fieldCount].firstChild.nodeValue;	
						relaltedItemId[count] = replace(relaltedItemId[count]);
					}
					if(fieldName=='relateditemname')
					{
						relatedItemNameData[count] = fields[fieldCount].firstChild.nodeValue;
						relatedItemNameData[count] = replaceGetSearchResult(relatedItemNameData[count]);
						relaltedItemName[count] = fields[fieldCount].firstChild.nodeValue;
						relaltedItemName[count] = replace(relaltedItemName[count]);
											
					}
					if(fieldName=='catogeryid')
					{
						catogeryIdData[count] = fields[fieldCount].firstChild.nodeValue;						
						catogeryIdData[count] = replaceGetSearchResult(catogeryIdData[count]);						
					}
					if(fieldName=='categorydescription')
					{
						categoryDescriptionData[count] = fields[fieldCount].firstChild.nodeValue;						
						categoryDescriptionData[count] = replaceGetSearchResult(categoryDescriptionData[count]);						
					}
					if(fieldName=='categoryname')
					{
						categoryNameData[count] = fields[fieldCount].firstChild.nodeValue;						
						categoryNameData[count] = replaceGetSearchResult(categoryNameData[count]);							
					}
								
					if(fieldName=='isbnbk')
					{
						isbnNo1Data[count]= fields[fieldCount].firstChild.nodeValue;
						isbnNo1Data[count] = replaceGetSearchResult(isbnNo1Data[count]);						
					}
							
					if(fieldName=='authorbk')
					{
						author1Data[count]= fields[fieldCount].firstChild.nodeValue;
						author1Data[count] = replaceGetSearchResult(author1Data[count]);
						//alert("author1Data[count]......"+author1Data[count]);
					}

					if(fieldName=='publisherbk')
					{
						publisher1Data[count]= fields[fieldCount].firstChild.nodeValue;
						publisher1Data[count] = replaceGetSearchResult(publisher1Data[count]);						
					}

					
					if(fieldName=='author_descriptionbk')
					{
						authorProfile1Data[count]= fields[fieldCount].firstChild.nodeValue;
						authorProfile1Data[count] = replaceGetSearchResult(authorProfile1Data[count]);						
					}
					if(fieldName=='bindingbk')
					{
						bindingDescription1Data[count]= fields[fieldCount].firstChild.nodeValue;
						bindingDescription1Data[count] = replaceGetSearchResult(bindingDescription1Data[count]);						
					}

					
					if(fieldName=='unit_of_measurementbk')
					{
						itemDimensionUnit1Data[count]= fields[fieldCount].firstChild.nodeValue;
						itemDimensionUnit1Data[count] = replaceGetSearchResult(itemDimensionUnit1Data[count]);						
					}	
					
						
					if(fieldName=='no._of_pagesbk')
					{
						itemPageNoData[count]= fields[fieldCount].firstChild.nodeValue;
						itemPageNoData[count] = replaceGetSearchResult(itemPageNoData[count]);						
					}
					if(fieldName=='itemactualkeyword')
					{
						itemActualKeywordData[count]= fields[fieldCount].firstChild.nodeValue;
						itemActualKeywordData[count] = replaceGetSearchResult(itemActualKeywordData[count]);						
					}					
					if(fieldName=='publication_datebk')
					{
						itemPublicationDateData[count]= fields[fieldCount].firstChild.nodeValue;
						itemPublicationDateData[count] = replaceGetSearchResult(itemPublicationDateData[count]);						
					}

					if(fieldName=='artist/bandgf')
					{
						artistData[count]= fields[fieldCount].firstChild.nodeValue;
						artistData[count] = replaceGetSearchResult(artistData[count]);						
					}
					if(fieldName=='released_bygf')
					{
						releasedByData[count]= fields[fieldCount].firstChild.nodeValue;
						releasedByData[count] = replaceGetSearchResult(releasedByData[count]);						
					}					
					if(fieldName=='formatgf')
					{
						formatData[count]= fields[fieldCount].firstChild.nodeValue;
						formatData[count] = replaceGetSearchResult(formatData[count]);						
					}
					if(fieldName=='companygf')
					{
						companyData[count]= fields[fieldCount].firstChild.nodeValue;
						companyData[count] = replaceGetSearchResult(companyData[count]);						
					}					
					if(fieldName=='date_of_releasegf')
					{
						dateOfReleaseDateData[count]= fields[fieldCount].firstChild.nodeValue;
						dateOfReleaseDateData[count] = replaceGetSearchResult(dateOfReleaseDateData[count]);						
					}
					
					if(fieldName=='usdconversionrate')
					{
						
						USDConversionRate=fields[fieldCount].firstChild.nodeValue;
						USDConversionRate = replaceGetSearchResult(USDConversionRate);
					}
					
				}	
			}
			
		for(count=0;count<noOfDocuments;count++)
		 	{
				//Outer table that is reffered from statically created below......
				var staticTable="";
				var staticTbody="";
				var staticTr="";
				var staticTd="";

				var tableouter = "";				
				var tbodyouter = "";			
				var trouter = "";
				var tdouter = "";

				staticTable = document.getElementById("SearchTR");				
				staticTbody = document.createElement("TBODY");				
				staticTr = document.createElement("TR");
				staticTd = document.createElement("TD");

				
				tableouter = document.createElement("TABLE");				
				tbodyouter = document.createElement("TBODY");				
				trouter = document.createElement("TR");
				var div="";
				var table="";
				var tbody="";
				var tr="";
				var td="";
				var image="";
				var alinkItemDesc="";
				var funcItemDescription="";
				var data="";
				var text="";
				var aLink="";
				var baseTable="";
				var baseTd="";
				var baseTr="";
				var baseTbody="";
				var span="";
			    				
				
				//Adding itemno image (arrow mark )in the 1st TD....	
				tdouter = document.createElement("TD");
				tdouter.setAttribute("id","abc");
				tdouter.setAttribute("width","4%");
				tdouter.setAttribute("valign",'top');
				image = document.createElement("IMG");
				image.setAttribute("src",'/dotcom/'+gOrgFolder+'/images/arrow_categories.gif');
				image.setAttribute("hspace","8");
				image.setAttribute("vspace","5");
				//tdouter.appendChild(image);
				trouter.appendChild(tdouter);

				
				//Adding item image in the 2nd TD....	
				tdouter = document.createElement("TD");
				tdouter.setAttribute("width","7%");
				//tdouter.className="search_result_image";
				var width = "";
				var height = "";
				aLink = document.createElement("A");				
				
				var itemImage = document.createElement("IMG");
				itemImage.setAttribute("id","itemImage"+itemIdData[count]);
				itemImage.className="search_result_image";
				itemImage.setAttribute("border","0");
				if(imageDefaultData[count]!='')
				{					
					for(var v=0;v<imageDefaultData[count].length;v++)
					{
						// commenting if ,lets check first available images
						//if(imageDefaultData[count][v]=='y' || imageDefaultData[count][v]=='Y')
						//{					
							height = "140";//imageHeightData[count][v];
							width = "90";//imageWidthData[count][v];
						    /*var oImg=new Image; 
						    oImg.onload=Function("document.getElementById('itemImage"+itemIdData[count]+"').src=oImg.src; imageSrc[count] = oImg.src;");
						    oImg.onerror=Function("document.getElementById('itemImage"+itemIdData[count]+"').src='/dotcom/"+gOrgFolder+"/images/oxford_logo.jpg'; imageSrc[count] = '/dotcom/"+gOrgFolder+"/images/oxford_logo.jpg';");
						    oImg.src='/dotcom/'+gOrgFolder+'/'+imagePathData[count][v];      
							//image.setAttribute("src",'/dotcom/'+gOrgFolder+'/'+imagePathData[count][v]);
							//imageSrc[count] = '/dotcom/'+gOrgFolder+'/'+imagePathData[count][v];*/
							SearchImgLoad(itemImage,'/dotcom/'+gOrgFolder+'/'+imagePathData[count][v], itemIdData[count], imageSrc[count]);
							break;
						//}


						
					}
					itemImage.setAttribute("width",width);
					itemImage.setAttribute("height",height);
				}
				else
				{
					itemImage.setAttribute("src",'/dotcom/'+gOrgFolder+'/images/oxford_logo.jpg');
					itemImage.setAttribute("width","90");
					itemImage.setAttribute("height","140");
					imageSrc[count] = '/dotcom/'+gOrgFolder+'/images/oxford_logo.jpg';
				}
				aLink.appendChild(itemImage);

				var func = "javascript:onclick=fnShowDetails('"+itemIdData[count]+"','"+itemNameData[count]+"','"+imageSrc[count]+"','"+author1Data[count]+"','"+itemlPriceData[count]+"','"+itemlDiscountedPrice[count]+"','"+itemLeadTimeData[count]+"','"+bindingDescription1Data[count]+"')";
				aLink.setAttribute("href",func);

				tdouter.appendChild(aLink);
				trouter.appendChild(tdouter);

				// blank space between image n description
				tdouter = document.createElement("TD");
				tdouter.setAttribute("width","1%");
				trouter.appendChild(tdouter);

				//adding details				
				tdouter = document.createElement("TD");
				tdouter.setAttribute("width",'41%');
				tdouter.setAttribute("valign",'top');

				// inner table....... for item name  author and rating,.....
				table = document.createElement("TABLE");
				table.setAttribute("width","100%");
				table.setAttribute("border","0");
				table.setAttribute("cellspacing","0");
				table.setAttribute("cellpadding","0");
				tbody = document.createElement("TBODY");

				//blank td for spacing.....
				tr  = document.createElement("TR");
				td  = document.createElement("TD");
				td.setAttribute("width","60%");
				var itemTable="";
				var itemTbody="";
				var itemTr="";
				var itemTd="";

				itemTable = document.createElement("TABLE");
				itemTable.setAttribute("width","100%");
				itemTable.setAttribute("border","0");
				itemTable.setAttribute("cellspacing","0");
				itemTable.setAttribute("cellpadding","0");
				itemTbody = document.createElement("TBODY");
				itemTr = document.createElement("TR");


				// item Name......
				itemTd  = document.createElement("TD");
				itemTd.setAttribute("align","left");
				itemTd.setAttribute("noWrap","true");
				itemTd.className="searchresults_booktitle";
				aLink = document.createElement("A");				
				var func = "javascript:onclick=fnShowDetails('"+itemIdData[count]+"','"+itemNameData[count]+"','"+imageSrc[count]+"','"+author1Data[count]+"','"+itemPriceData[count]+"','"+itemDiscountedPrice[count]+"','"+itemLeadTimeData[count]+"','"+bindingDescription1Data[count]+"')";
				aLink.setAttribute("href",func);
				aLink.className="searchresults_booktitle";
				data = itemNameData[count];
				data = data.toString();
				data = data.toUpperCase();
				text = document.createTextNode(data);					
				aLink.appendChild(text);
				itemTd.appendChild(aLink);
				itemTr.appendChild(itemTd);
				itemTbody.appendChild(itemTr);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);				

				//author........				
				if(author1Data[count]!='' && author1Data[count]!= null && author1Data[count]!="null")
				{
					itemTable = document.createElement("TABLE");
					itemTable.setAttribute("width","100%");
					itemTable.setAttribute("border","0");
					itemTable.setAttribute("cellspacing","0");
					itemTable.setAttribute("cellpadding","0");
					itemTbody = document.createElement("TBODY");
					itemTr = document.createElement("TR");				
					
					itemTd  = document.createElement("TD");
					itemTd.setAttribute("width","6%");
					itemTr.appendChild(itemTd);

					itemTd  = document.createElement("TD");
					itemTd.setAttribute("align","left");							
					//alinkItemDesc = document.createElement("A");
					//alinkItemDesc.setAttribute("href","#");
					//alinkItemDesc.className="tooltip";
					text = document.createTextNode("By "+author1Data[count]);
					//alinkItemDesc.appendChild(text);
					itemTd.appendChild(text);
					//var bold = document.createElement("B");
					//var em = document.createElement("EM");
					//bold.appendChild(em);
					/*if(authorProfile1Data[count]!='' && authorProfile1Data[count]!=null && authorProfile1Data[count]!="null")
					{
						text = document.createTextNode(authorProfile1Data[count]);
						bold.appendChild(text);
					}
					else
					{
						text = document.createTextNode("Author Description Not Available");
						bold.appendChild(text);
					}*/
					//alinkItemDesc.appendChild(bold);
					//itemTd.appendChild(alinkItemDesc);
					itemTr.appendChild(itemTd);
					itemTbody.appendChild(itemTr);
					itemTable.appendChild(itemTbody);
					td.appendChild(itemTable);	
				}
				
				tr.appendChild(td);

				//add to cart image
				td  = document.createElement("TD");
				td.setAttribute("width","40%");
				itemTable = document.createElement("TABLE");
				itemTable.setAttribute("width","100%");
				itemTable.setAttribute("border","0");
				itemTable.setAttribute("cellspacing","0");
				itemTable.setAttribute("cellpadding","0");
				itemTbody = document.createElement("TBODY");
				itemTr = document.createElement("TR");				
				itemTd  = document.createElement("TD");
				td.setAttribute("align","left");
				alinkItemDesc = document.createElement("A");
				var func = "javascript:onclick=AddToCart('"+itemIdData[count]+"')";
				alinkItemDesc.setAttribute("href",func);
				image = document.createElement("IMG");
				image.setAttribute("src",'/dotcom/'+gOrgFolder+'/images/addtocart.gif');
				image.setAttribute("border","0");
				image.setAttribute("alt","Add To Cart");
				//alinkItemDesc.appendChild(image);
				//itemTd.appendChild(alinkItemDesc);
				itemTr.appendChild(itemTd);
				itemTbody.appendChild(itemTr);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);
				tr.appendChild(td);
				tbody.appendChild(tr);
				table.appendChild(tbody);

				tdouter.appendChild(table);
				trouter.appendChild(tdouter);
				
				//blank spacing between 2 tds for a item (name   and price....)
				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","1%");
				trouter.appendChild(tdouter);

				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","44%");
				tdouter.setAttribute("valign","top");

				table = document.createElement("TABLE");
				table.setAttribute("width","100%");
				table.setAttribute("border","0");
				table.setAttribute("cellspacing","0");
				table.setAttribute("cellpadding","0");
				tbody = document.createElement("TBODY");

				tr  = document.createElement("TR");
				td  = document.createElement("TD");
				td.setAttribute("align","left");
				span = document.createElement("SPAN");
				span.className="productdetails";
				//USD Price....
				var markedPriceUF = itemPriceData[count].replace(",","");
				var usd = parseFloat(markedPriceUF)/USDConversionRate;
				usd=(Math.round(usd*100)/100).toFixed(2);
				text = document.createTextNode("List Price: ");
				span.appendChild(text);
				td.appendChild(span);
				span = document.createElement("SPAN");


				var itemPriceNew=itemPriceData[count] ;
				var discountNew="" + itemDiscountedPrice[count];
				if (discountNew!=null && discountNew!='' && discountNew!="null")
				{
				
				var sellingPriceUF = discountNew.replace(",","");

				if(parseFloat(sellingPriceUF) < parseFloat(markedPriceUF))
				{
					span.className="productdetails_listPrice";
				}
				else
				{
					span.className="productdetails_orange";
				}

				}
				else
				{
					span.className="productdetails_orange";
				}


				text = document.createTextNode("Rs. "+itemPriceData[count]+" | $ "+usd+"*");
                //itemlPriceData ="RS."+ itemPriceData[count];
				span.appendChild(text);
				td.appendChild(span);
				tr.appendChild(td);
				tbody.appendChild(tr);

				itemPrice[count] =itemPriceData[count] ;
                itemPriceUsd[count]= usd;

				//our discounted price
				if(discountNew!=null && discountNew!='' && discountNew!="null")
                {					
					var sellingPriceUF = discountNew.replace(",","");
	            if(parseFloat(sellingPriceUF) < parseFloat(markedPriceUF))
                {

				tr  = document.createElement("TR");
				td  = document.createElement("TD");
				td.setAttribute("align","left");
				span = document.createElement("SPAN");
				span.className="productdetails";
				//USD Price....
				var usd = parseFloat(sellingPriceUF)/USDConversionRate;
				usd=(Math.round(usd*100)/100).toFixed(2);
				text = document.createTextNode("Our Price: ");
				span.appendChild(text);
				td.appendChild(span);
				span = document.createElement("SPAN");
				span.className="productdetails_orange";
				text = document.createTextNode("Rs. "+itemDiscountedPrice[count]+" | $ "+usd+"*");
				span.appendChild(text);
				td.appendChild(span);
				tr.appendChild(td);
				tbody.appendChild(tr);


// You Save
					var tr = document.createElement("TR");
					var td = document.createElement("TD");
					td.setAttribute("noWrap",'true');
					td.className = "productdetails";
					var text = document.createTextNode("You Save: ");
					var span = document.createElement("SPAN");
					span.className="productdetails_orange";
					//alert(parseFloat(markedPrice.replace(",","")));
					//alert(parseFloat(sellingPrice.replace(",","")));
					//alert("you save: " +(parseFloat(markedPrice.replace(",","")) - parseFloat(sellingPrice.replace(",",""))));
					var youSave = (parseFloat(itemPriceNew) - parseFloat(sellingPriceUF)).toFixed(2);
					var usd = parseFloat(youSave)/USDConversionRate;
					usd=(Math.round(usd*100)/100).toFixed(2);
					youSave = formatNumber(youSave,2,THOUSANDSEP,DECIMALSEP,"","","-","");
					var textSave = document.createTextNode(" Rs. " + youSave + " | $ " + usd + "*");
					span.appendChild(textSave);
					td.appendChild(text);
					td.appendChild(span);
					tr.appendChild(td);				
					tbody.appendChild(tr);

					}
				}



				// lead Time details.....
				/*if(itemLeadTimeData[count]!='' && itemLeadTimeData[count]!=null && itemLeadTimeData[count]!="null")
				{
					tr  = document.createElement("TR");
					td  = document.createElement("TD");
					td.setAttribute("align","left");
					span = document.createElement("SPAN");
					span.className="productdetails";
					text = document.createTextNode("Shipping: ");
					span.appendChild(text);
					td.appendChild(span);
					span = document.createElement("SPAN");
					span.className="productdetails_orange";
					text = document.createTextNode(itemLeadTimeData[count]+" week(s)(minimum)");
					span.appendChild(text);
					td.appendChild(span);
					tr.appendChild(td);
					tbody.appendChild(tr);
				}*/

				tr  = document.createElement("TR");
				td  = document.createElement("TD");
				td.setAttribute("align","left");
				td.setAttribute("height","10");
				tr.appendChild(td);
				tbody.appendChild(tr);

				itemTr = document.createElement("TR");				
				itemTd  = document.createElement("TD");
				itemTd.setAttribute("align","left");
				itemTd.setAttribute("noWrap","true");
				var image1 = document.createElement("IMG");
				image1.setAttribute("src",'/dotcom/'+gOrgFolder+'/images/checkstock.gif');
				image1.setAttribute("height","21");
				image1.setAttribute("width","100");
				image1.setAttribute("hspace",'0');
				image1.setAttribute("border",'0');
				//itemTd.appendChild(image1);
				//var spanStock = document.createElement("SPAN");
				//spanStock.className="links";
				var aLink = document.createElement("a");
				aLink.setAttribute("border",0);
				var func ="javascript:onclick=checkStock('"+itemIdData[count]+"');";
				aLink.setAttribute("href",func);
				//aLink.className = 'links';
				//var text=document.createTextNode("  Check Stock");
				//aLink.appendChild(text);
				aLink.appendChild(image1);
				itemTd.appendChild(aLink);
				//spanStock.appendChild(aLink);
				//var spanStockQty = document.createElement("SPAN");
				//spanStockQty.setAttribute("id","spanStockQty"+itemIdData[count])
				//spanStockQty.className="productdetails_orange";

				var text=document.createTextNode("  ");
				itemTd.appendChild(text);

				var image1 = document.createElement("IMG");
				image1.setAttribute("src",'/dotcom/'+gOrgFolder+'/images/addtocart_big.gif');
				image1.setAttribute("height","21");
				image1.setAttribute("width","100");
				image1.setAttribute("hspace",'0');
				image1.setAttribute("border",'0');
				var aLink = document.createElement("a");
				aLink.setAttribute("border",0);
				var func ="javascript:onclick=AddToCart('"+itemIdData[count]+"');";
				aLink.setAttribute("href",func);
				aLink.appendChild(image1);
				itemTd.appendChild(aLink);

				//itemTd.appendChild(spanStock);
				//itemTd.appendChild(spanStockQty);
				itemTr.appendChild(itemTd);
				tbody.appendChild(itemTr);	

				tr  = document.createElement("TR");
				tr.setAttribute("id","TRStockQty"+itemIdData[count]);
				td  = document.createElement("TD");
				td.setAttribute("id","TDStockQty"+itemIdData[count]);
				td.setAttribute("align","left");
				td.setAttribute("noWrap","true");
				//td.setAttribute("height","10");
				tr.appendChild(td);
				tbody.appendChild(tr);

				table.appendChild(tbody);
				tdouter.appendChild(table);
				trouter.appendChild(tdouter);
			
				//blank spacing between last  and border
				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","2%");
				trouter.appendChild(tdouter);
				tbodyouter.appendChild(trouter);
				tableouter.appendChild(tbodyouter);

				staticTd.appendChild(tableouter);
				staticTr.appendChild(staticTd);
				staticTbody.appendChild(staticTr);

				// blank space between between 2 records....
				staticTr = document.createElement("TR");
				staticTd = document.createElement("TD");
				tableouter = document.createElement("TABLE");
				tbodyouter = document.createElement("TBODY");
				trouter = document.createElement("TR");
				tdouter  = document.createElement("TD");
				tdouter.setAttribute("height","10");
				trouter.appendChild(tdouter);
				tbodyouter.appendChild(trouter);
				tableouter.appendChild(tbodyouter);
				staticTd.appendChild(tableouter);
				staticTr.appendChild(staticTd);
				staticTbody.appendChild(staticTr);
				if(count!=noOfDocuments-1)
				{

					staticTr = document.createElement("TR");
					staticTd = document.createElement("TD");
					tableouter = document.createElement("TABLE");
					tableouter.setAttribute("width","100%");

					tbodyouter = document.createElement("TBODY");
					trouter = document.createElement("TR");
					tdouter  = document.createElement("TD");
					tdouter.setAttribute("height","2");
					tdouter.setAttribute("width","2%");
					trouter.appendChild(tdouter);				
					
					tdouter  = document.createElement("TD");
					tdouter.setAttribute("height","2");
					tdouter.setAttribute("width","96%");
					tdouter.setAttribute("background",'/dotcom/'+gOrgFolder+'/images/Serach_results_seperator.jpg');
					trouter.appendChild(tdouter);	
					
					tdouter  = document.createElement("TD");
					tdouter.setAttribute("height","2");
					tdouter.setAttribute("width","2%");
					trouter.appendChild(tdouter);
					tbodyouter.appendChild(trouter);
					tableouter.appendChild(tbodyouter);
					staticTd.appendChild(tableouter);
					staticTr.appendChild(staticTd);
					staticTbody.appendChild(staticTr);
				}
				staticTable.appendChild(staticTbody);
				
				
				//  description starts here.......					
				staticTable = document.getElementById("ItemDescriptionTableTd");
				var descriptionDiv = document.createElement("DIV"); 
				descriptionDiv.setAttribute("id",itemIdData[count]);
											
				staticTr = document.createElement("TR");
				staticTd = document.createElement("TD");

				
				tableouter = document.createElement("TABLE");				
				tbodyouter = document.createElement("TBODY");				
				trouter = document.createElement("TR");

				//arrow image here....
				tdouter = document.createElement("TD");
				tdouter.setAttribute("id","abc");
				tdouter.setAttribute("width","4%");
				tdouter.setAttribute("valign",'top');
				image = document.createElement("IMG");
				image.setAttribute("src",'/dotcom/'+gOrgFolder+'/images/arrow_categories.gif');
				image.setAttribute("hspace","8");
				image.setAttribute("vspace","5");
				//tdouter.appendChild(image);
				trouter.appendChild(tdouter);

				//item image...
				var tdouter = document.createElement("TD");
				tdouter.setAttribute("width","7%");
				//tdouter.className="search_result_image";
				var width = "";
				var height = "";				
				var itemImage = document.createElement("IMG");
				itemImage.setAttribute("id","itemImage"+itemIdData[count]);
				itemImage.className="search_result_image";
				itemImage.setAttribute("border","0");
				if(imageDefaultData[count]!='')
				{
					for(var v=0;v<imageDefaultData[count].length;v++)
					{
					//	if(imageDefaultData[count][v]=='y' || imageDefaultData[count][v]=='Y')
					//	{					
							height = "140";//imageHeightData[count][v];
							width = "90";//imageWidthData[count][v];
						    /*var oImg=new Image; 
						    oImg.onload=Function("document.getElementById('itemImage"+itemIdData[count]+"').src=oImg.src");
						    oImg.onerror=Function("document.getElementById('itemImage"+itemIdData[count]+"').src='/dotcom/"+gOrgFolder+"/images/oxford_logo.jpg'");
						    oImg.src='/dotcom/'+gOrgFolder+'/'+imagePathData[count][v]; 
							//itemImage.setAttribute("src",'/dotcom/'+gOrgFolder+'/'+imagePathData[count][v]);*/
							ImgLoad(itemImage,'/dotcom/'+gOrgFolder+'/'+imagePathData[count][v], itemIdData[count]);
							break;
					//	}
						
					}
					itemImage.setAttribute("width",width);
					itemImage.setAttribute("height",height);
				}
				else
				{
					itemImage.setAttribute("src",'/dotcom/'+gOrgFolder+'/images/oxford_logo.jpg');
					itemImage.setAttribute("width","90");
					itemImage.setAttribute("height","140");
				}				
				tdouter.appendChild(itemImage);
				trouter.appendChild(tdouter);
				
				//blank space..
				tdouter = document.createElement("TD");
				tdouter.setAttribute("width","1%");
				trouter.appendChild(tdouter);

				tdouter = document.createElement("TD");
				tdouter.setAttribute("width",'41%');
				tdouter.setAttribute("valign",'top');

				// inner table....... for item name  author and rating,.....
				table = document.createElement("TABLE");
				table.setAttribute("width","100%");
				table.setAttribute("border","0");
				table.setAttribute("cellspacing","0");
				table.setAttribute("cellpadding","0");
				tbody = document.createElement("TBODY");

				//blank td for spacing.....
				tr  = document.createElement("TR");
				td  = document.createElement("TD");
				td.setAttribute("width","80%");
				var itemTable="";
				var itemTbody="";
				var itemTr="";
				var itemTd="";

				itemTable = document.createElement("TABLE");
				itemTable.setAttribute("width","100%");
				itemTable.setAttribute("border","0");
				itemTable.setAttribute("cellspacing","0");
				itemTable.setAttribute("cellpadding","0");
				itemTbody = document.createElement("TBODY");
				itemTr = document.createElement("TR");


				// item Name......
				itemTd  = document.createElement("TD");
				itemTd.setAttribute("align","left");
				itemTd.setAttribute("noWrap","true");
				itemTd.className="searchresults_booktitle";
				data = itemNameData[count];
				data = data.toString();
				data = data.toUpperCase();
				text = document.createTextNode(data);					
				itemTd.appendChild(text);
				itemTr.appendChild(itemTd);
				itemTbody.appendChild(itemTr);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);
				//author........				
				if(author1Data[count]!='' && author1Data[count]!=null && author1Data[count]!="null")
				{
					itemTable = document.createElement("TABLE");
					itemTable.setAttribute("width","100%");
					itemTable.setAttribute("border","0");
					itemTable.setAttribute("cellspacing","0");
					itemTable.setAttribute("cellpadding","0");
					itemTbody = document.createElement("TBODY");
					itemTr = document.createElement("TR");				
					
					itemTd  = document.createElement("TD");
					itemTd.setAttribute("width","6%");
					itemTr.appendChild(itemTd);

					itemTd  = document.createElement("TD");
					itemTd.setAttribute("align","left");	
					//alinkItemDesc = document.createElement("A");
					//alinkItemDesc.setAttribute("href","#");
					//alinkItemDesc.className="tooltip";							
					text = document.createTextNode("By "+author1Data[count]);
					//alinkItemDesc.appendChild(text);
					itemTd.appendChild(text);
					//var bold = document.createElement("B");
					//var em = document.createElement("EM");
					//bold.appendChild(em);
					/*if(authorProfile1Data[count]!='' && authorProfile1Data[count]!=null && authorProfile1Data[count]!="null")
					{
						text = document.createTextNode(authorProfile1Data[count]);
						bold.appendChild(text);
					}
					else
					{
						text = document.createTextNode("Author Description Not Available");
						bold.appendChild(text);
					}*/
					//alinkItemDesc.appendChild(bold);
					//itemTd.appendChild(alinkItemDesc);
					itemTr.appendChild(itemTd);
					itemTbody.appendChild(itemTr);
					itemTable.appendChild(itemTbody);
					td.appendChild(itemTable);					
				}

				//changes made by rahul Jain for dispalying current RATING 
				
                itemTable = document.createElement("TABLE");
				itemTable.setAttribute("width","100%");
				itemTable.setAttribute("border","0");
				itemTable.setAttribute("cellspacing","0");
				itemTable.setAttribute("cellpadding","0");
				itemTbody = document.createElement("TBODY");
				itemTr = document.createElement("TR");
				itemTd  = document.createElement("TD");
				itemTd.setAttribute("align","left");

                var fddiv=document.createElement("DIV");
                fddiv.className="itemname";					
				
				var id="AddEdit"+itemIdData[count];
				fddiv.setAttribute("id",id);
              	itemTd.appendChild(fddiv);
				itemTr.appendChild(itemTd);
				itemTbody.appendChild(itemTr);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);

				//upto here



				//price......
				itemTable = document.createElement("TABLE");
				itemTable.setAttribute("width","100%");
				itemTable.setAttribute("border","0");
				itemTable.setAttribute("cellspacing","0");
				itemTable.setAttribute("cellpadding","0");
				itemTbody = document.createElement("TBODY");
				itemTr = document.createElement("TR");
				itemTd  = document.createElement("TD");
				itemTd.setAttribute("align","left");
				itemTd.setAttribute("noWrap","true");

				span = document.createElement("SPAN");
				span.className="productdetails";
				//USD Price....
				var markedPriceUF = itemPriceData[count].replace(",","");
				var usd = parseFloat(markedPriceUF)/USDConversionRate;
				usd=(Math.round(usd*100)/100).toFixed(2);
				text = document.createTextNode("Price: ");
				span.appendChild(text);
				itemTd.appendChild(span);
				span = document.createElement("SPAN");


				var itemPriceNew=itemPriceData[count] ;
				var discountNew="" + itemDiscountedPrice[count];
				//our discounted price
				if(discountNew!=null && discountNew!='' && discountNew!="null")
                {					
				var sellingPriceUF = discountNew.replace(",","");


				if(parseFloat(sellingPriceUF) < parseFloat(markedPriceUF))
				{
					span.className="productdetails_listPrice";
				}
				else
				{
					span.className="productdetails_orange";
				}
				}
				else
				{
					span.className="productdetails_orange";
				}



				text = document.createTextNode("Rs. "+itemPriceData[count]+" | $ "+usd+"*");
				span.appendChild(text);
				itemTd.appendChild(span);
				itemTr.appendChild(itemTd);

                           //shivani 

                          

                           //
				itemTbody.appendChild(itemTr);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);
                          
                           
                  //rahul
				searchitemPrice=  itemPriceData[count];
                 searchitemPriceUsd = usd;

				  //upto here
				//our price.....
				
				
				//our discounted price
				if(discountNew!=null && discountNew!='' && discountNew!="null")
                {					
				var sellingPriceUF = discountNew.replace(",","");
                if(parseFloat(sellingPriceUF) < parseFloat(markedPriceUF))
                {
                itemTable = document.createElement("TABLE");
				itemTable.setAttribute("width","100%");
				itemTable.setAttribute("border","0");
				itemTable.setAttribute("cellspacing","0");
				itemTable.setAttribute("cellpadding","0");
				itemTbody = document.createElement("TBODY");
				itemTr = document.createElement("TR");
				itemTd  = document.createElement("TD");
				itemTd.setAttribute("align","left");
				itemTd.setAttribute("style","white-space:nowrap;");
				span = document.createElement("SPAN");
				span.className="productdetails";
				//USD Price....
				var usd = parseFloat(sellingPriceUF)/USDConversionRate;
				usd=(Math.round(usd*100)/100).toFixed(2);
				text = document.createTextNode("Our Price: ");
				span.appendChild(text);
				itemTd.appendChild(span);
				span = document.createElement("SPAN");

				span.className="productdetails_orange";
		
				text = document.createTextNode("Rs. "+itemDiscountedPrice[count]+" | $ "+usd+"*");
				span.appendChild(text);
				itemTd.appendChild(span);
				itemTr.appendChild(itemTd);
				itemTbody.appendChild(itemTr);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);

// You Save
                itemTable = document.createElement("TABLE");
				itemTable.setAttribute("width","100%");
				itemTable.setAttribute("border","0");
				itemTable.setAttribute("cellspacing","0");
				itemTable.setAttribute("cellpadding","0");
				itemTbody = document.createElement("TBODY");


				var tr1 = document.createElement("TR");
				var td1 = document.createElement("TD");
				td.setAttribute("noWrap",'true');
				td.className = "productdetails";
				var text = document.createTextNode("You Save: ");
				var span = document.createElement("SPAN");
				span.className="productdetails_orange";
				//alert(parseFloat(markedPrice.replace(",","")));
				//alert(parseFloat(sellingPrice.replace(",","")));
				//alert("you save: " +(parseFloat(markedPrice.replace(",","")) - parseFloat(sellingPrice.replace(",",""))));
				var youSave = (parseFloat(itemPriceNew) - parseFloat(sellingPriceUF)).toFixed(2);
				var usd = parseFloat(youSave)/USDConversionRate;
				usd=(Math.round(usd*100)/100).toFixed(2);
				youSave = formatNumber(youSave,2,THOUSANDSEP,DECIMALSEP,"","","-","");
				var textSave = document.createTextNode(" Rs. " + youSave + " | $ " + usd + "*");
				span.appendChild(textSave);
				td1.appendChild(text);
				td1.appendChild(span);
				tr1.appendChild(td1);				


				itemTbody.appendChild(tr1);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);

				}
				}

				// shipping....
				itemTable = document.createElement("TABLE");
				itemTable.style.display="none";
				itemTable.setAttribute("id","ShipTimeTable"+itemIdData[count]);
				itemTable.setAttribute("width","100%");
				itemTable.setAttribute("border","0");
				itemTable.setAttribute("cellspacing","0");
				itemTable.setAttribute("cellpadding","0");
				itemTbody = document.createElement("TBODY");
				itemTr = document.createElement("TR");
				itemTd  = document.createElement("TD");
				itemTd.setAttribute("align","left");
				span = document.createElement("SPAN");
				span.className="productdetails";					
				text = document.createTextNode("Shipping: ");
				span.appendChild(text);
				itemTd.appendChild(span);
				span = document.createElement("SPAN");
				span.className="productdetails_orange";
				span.setAttribute("id","ShipTimeSpan"+itemIdData[count]);
				itemTd.appendChild(span);
				itemTr.appendChild(itemTd);
				itemTbody.appendChild(itemTr);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);

				if(bindingDescription1Data[count]!='' && bindingDescription1Data[count]!=null && bindingDescription1Data[count]!="null")
				{
					searchbindingInfo = bindingDescription1Data[count];
					itemTable = document.createElement("TABLE");
					itemTable.setAttribute("width","100%");
					itemTable.setAttribute("border","0");
					itemTable.setAttribute("cellspacing","0");
					itemTable.setAttribute("cellpadding","0");
					itemTbody = document.createElement("TBODY");
					itemTr = document.createElement("TR");
					itemTd  = document.createElement("TD");
					itemTd.setAttribute("align","left");
					span = document.createElement("SPAN");
					span.className="productdetails";					
					text = document.createTextNode("Binding: ");
					span.appendChild(text);
					itemTd.appendChild(span);
					span = document.createElement("SPAN");
					span.className="productdetails_orange";
					text = document.createTextNode(bindingDescription1Data[count]);
					span.appendChild(text);
					itemTd.appendChild(span);
					itemTr.appendChild(itemTd);
					itemTbody.appendChild(itemTr);
					itemTable.appendChild(itemTbody);
					td.appendChild(itemTable);
				}
				tr.appendChild(td);
			
				tbody.appendChild(tr);
				table.appendChild(tbody);
				tdouter.appendChild(table);
				trouter.appendChild(tdouter);



				itemTable = document.createElement("TABLE");
				itemTable.setAttribute("width","100%");
				itemTable.setAttribute("border","0");
				itemTable.setAttribute("cellspacing","0");
				itemTable.setAttribute("cellpadding","0");
				itemTbody = document.createElement("TBODY");


				itemTr = document.createElement("TR");
				itemTr.setAttribute("height","20");
				itemTd  = document.createElement("TD");
				itemTd.setAttribute("align","left");



				itemTbody.appendChild(itemTr);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);

				tr.appendChild(td);
				tbody.appendChild(tr);
				table.appendChild(tbody);
				tdouter.appendChild(table);
				trouter.appendChild(tdouter);





				itemTr = document.createElement("TR");
				itemTd  = document.createElement("TD");
				itemTd.setAttribute("align","left");



				alinkItemDesc = document.createElement("A");
				var func = "javascript:onclick=AddToCart('"+itemIdData[count]+"')";
				alinkItemDesc.setAttribute("href",func);
				image = document.createElement("IMG");
				image.setAttribute("src",'/dotcom/'+gOrgFolder+'/images/addtocart.gif');
				image.setAttribute("border","0");
				image.setAttribute("alt","Add To Cart");
				alinkItemDesc.appendChild(image);


				itemTd.appendChild(alinkItemDesc);
				itemTr.appendChild(itemTd);
				itemTbody.appendChild(itemTr);
				itemTable.appendChild(itemTbody);
				td.appendChild(itemTable);

				tr.appendChild(td);
				tbody.appendChild(tr);
				table.appendChild(tbody);
				tdouter.appendChild(table);
				trouter.appendChild(tdouter);



				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","1%");
				trouter.appendChild(tdouter);
				

				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","44%");
				tdouter.setAttribute("valign","top");

				table = document.createElement("TABLE");
				table.setAttribute("width","100%");
				table.setAttribute("border","0");
				table.setAttribute("cellspacing","0");
				table.setAttribute("cellpadding","0");
				tbody = document.createElement("TBODY");
				tr  = document.createElement("TR");
				td  = document.createElement("TD");
				var break1 = document.createElement("BR");
				td.appendChild(break1);
                           tr.appendChild(td);
			       tbody.appendChild(tr);
                           tr  = document.createElement("TR");
				td  = document.createElement("TD");
				var break1 = document.createElement("BR");
				td.appendChild(break1);
                           tr.appendChild(td);
				tbody.appendChild(tr);



			if(itemActualKeywordData[count]!=''||relatedItemIdData[count]!=''||isbnNo1Data[count]!=''||publisher1Data[count]!=''||itemPublicationDateData[count]!='')
				{
					tr  = document.createElement("TR");
					td  = document.createElement("TD");
					td.setAttribute("align","left");
					td.className="advancesearch_text";
                                   bold=document.createElement("b");
					text = document.createTextNode("Additional Information");
                                   bold.appendChild(text);
					td.appendChild(bold);
					tr.appendChild(td);
					tbody.appendChild(tr);

					tr  = document.createElement("TR");
					td  = document.createElement("TD");
					td.setAttribute("height","8");
					tr.appendChild(td);
					tbody.appendChild(tr);

					if(isbnNo1Data[count]!='' && isbnNo1Data[count]!=null && isbnNo1Data[count]!="null")
					{
						tr  = document.createElement("TR");
						td  = document.createElement("TD");
						td.setAttribute("align","left");
						span =document.createElement("SPAN"); 
						span.className="productdetails";
						text = document.createTextNode("ISBN: ");
						span.appendChild(text);
						td.appendChild(span);
						span =document.createElement("SPAN"); 
						span.className="productdetails_orange";
						text = document.createTextNode(isbnNo1Data[count]);
						span.appendChild(text);
						td.appendChild(span);
						tr.appendChild(td);
						tbody.appendChild(tr);
					}

					if(publisher1Data[count]!='' && publisher1Data[count]!=null && publisher1Data[count]!="null")
					{
						tr  = document.createElement("TR");
						td  = document.createElement("TD");
						td.setAttribute("align","left");
						span =document.createElement("SPAN"); 
						span.className="productdetails";
						text = document.createTextNode("Publisher: ");
						span.appendChild(text);
						td.appendChild(span);
						span =document.createElement("SPAN"); 
						span.className="productdetails_orange";
						text = document.createTextNode(publisher1Data[count]);
						span.appendChild(text);
						td.appendChild(span);
						tr.appendChild(td);
						tbody.appendChild(tr);
					}

					if(itemPublicationDateData[count]!='' && itemPublicationDateData[count]!=null && itemPublicationDateData[count]!="null")
					{
						tr  = document.createElement("TR");
						td  = document.createElement("TD");
						td.setAttribute("align","left");
						span =document.createElement("SPAN"); 
						span.className="productdetails";
						text = document.createTextNode("YEAR OF PUBLICATION : ");
						span.appendChild(text);
						td.appendChild(span);
						span =document.createElement("SPAN"); 
						span.className="productdetails_orange";
						text = document.createTextNode(itemPublicationDateData[count]);
						span.appendChild(text);
						td.appendChild(span);
						tr.appendChild(td);
						tbody.appendChild(tr);
					}

					if(itemActualKeywordData[count]!='' && itemActualKeywordData[count]!=null && itemActualKeywordData[count]!="null")
					{
						itemActualKeywordData[count] = itemActualKeywordData[count].toString();
						var keywordNo = itemActualKeywordData[count].split(",");

						tr  = document.createElement("TR");
						td  = document.createElement("TD");
						td.setAttribute("align","left");
						span =document.createElement("SPAN"); 
						span.className="productdetails";
						text = document.createTextNode("KEYWORD: ");
						span.appendChild(text);
						td.appendChild(span);
						span =document.createElement("SPAN"); 
						span.className="productdetails_orange";
						for(var noOfKeyword=0;noOfKeyword<keywordNo.length;noOfKeyword++)
						{
							if(keywordNo[noOfKeyword]!='')
							{
								var	aLink = document.createElement("a");
								var js = "javascript:onclick=searchRelatedItem('','"+keywordNo[noOfKeyword]+"')";
								aLink.setAttribute("href",js);				
								aLink.className = "productdetails_orange";
								data = document.createTextNode(keywordNo[noOfKeyword]);		
								aLink.appendChild(data);	
								span.appendChild(aLink);	
								if(noOfKeyword<keywordNo.length-1)
								{
									data = document.createTextNode(" | ");		
									span.appendChild(data);
								}

							}
						}					
						td.appendChild(span);
						tr.appendChild(td);
						tbody.appendChild(tr);
					}

					if(relatedItemIdData[count]!='' && relatedItemIdData[count]!=null && relatedItemIdData[count]!="null")
					{
						tr  = document.createElement("TR");
						td  = document.createElement("TD");
						td.setAttribute("align","left");
						span =document.createElement("SPAN"); 
						span.className="productdetails";
						text = document.createTextNode("RELATED ITEMS:");
						span.appendChild(text);
						td.appendChild(span);
						span =document.createElement("SPAN"); 
						span.className="productdetails_orange";
						for(var relItemNo=0; relItemNo<relatedItemNameData[count].length;relItemNo++)
						{
							if(relatedItemNameData[count][relItemNo]!='')
							{
								var	aLink = document.createElement("a");
								var js = "javascript:onclick=searchRelatedItem('"+relatedItemIdData[count][relItemNo] + "','')";
								aLink.setAttribute("href",js);				
								aLink.className = "productdetails_orange";							
								data = document.createTextNode(relatedItemNameData[count][relItemNo]);		
								aLink.appendChild(data);	
								span.appendChild(aLink);	
								if(relItemNo<relatedItemNameData[count].length-2)
								{
									data = document.createTextNode(" | ");		
									span.appendChild(data);
								}
							}		
						}
						td.appendChild(span);
						tr.appendChild(td);
						tbody.appendChild(tr);
					}
				}
				table.appendChild(tbody);
				tdouter.appendChild(table);
				trouter.appendChild(tdouter);

				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","2%");
				trouter.appendChild(tdouter);
				tbodyouter.appendChild(trouter);
				tableouter.appendChild(tbodyouter);
				descriptionDiv.appendChild(tableouter);

				// blank space between between 2 records....
				tableouter = document.createElement("TABLE");
				tbodyouter = document.createElement("TBODY");
				trouter = document.createElement("TR");
				tdouter  = document.createElement("TD");
				tdouter.setAttribute("height","10");
				trouter.appendChild(tdouter);
				tbodyouter.appendChild(trouter);
				tableouter.appendChild(tbodyouter);
				descriptionDiv.appendChild(tableouter);

				if(itemDescriptionData[count]!='' && itemDescriptionData[count]!=null && itemDescriptionData[count]!="null")
				{
					tableouter = document.createElement("TABLE");
					tbodyouter = document.createElement("TBODY");
					trouter = document.createElement("TR");
					tdouter  = document.createElement("TD");
					tdouter.setAttribute("width","4%");	
					trouter.appendChild(tdouter);
					tdouter  = document.createElement("TD");
					tdouter.setAttribute("width","94%");	
					tdouter.className="advancesearch_text";
                                   bold  = document.createElement("b");
					text = document.createTextNode("Description:");
                                   bold.appendChild(text);
					tdouter.appendChild(bold);
					trouter.appendChild(tdouter);

					tdouter  = document.createElement("TD");
					tdouter.setAttribute("width","2%");	
					trouter.appendChild(tdouter);
					tbodyouter.appendChild(trouter);

					trouter = document.createElement("TR");
					tdouter  = document.createElement("TD");
					tdouter.setAttribute("width","4%");	
					trouter.appendChild(tdouter);

					tdouter  = document.createElement("TD");
					tdouter.setAttribute("width","94%");	
					innerDiv = document.createElement("DIV");		
					innerDiv.innerHTML = itemDescriptionData[count];
					tdouter.appendChild(innerDiv);
					trouter.appendChild(tdouter);

					tdouter  = document.createElement("TD");
					tdouter.setAttribute("width","2%");	
					trouter.appendChild(tdouter);
					tbodyouter.appendChild(trouter);
                                  tbodyouter.appendChild(trouter);
					tableouter.appendChild(tbodyouter);
					descriptionDiv.appendChild(tableouter);


					
				}

				// blank space between between 2 records....
				tableouter = document.createElement("TABLE");
				tbodyouter = document.createElement("TBODY");
				trouter = document.createElement("TR");
				tdouter  = document.createElement("TD");
				tdouter.setAttribute("height","10");
				trouter.appendChild(tdouter);
				tbodyouter.appendChild(trouter);
				tableouter.appendChild(tbodyouter);
				descriptionDiv.appendChild(tableouter);
     //----------------------------------------------------------------------
                           if(author1Data[count]!='' && author1Data[count]!= null && author1Data[count]!="null")
				{

                                  tableouter = document.createElement("TABLE");
				       tbodyouter = document.createElement("TBODY");
                           		trouter = document.createElement("TR");
					tdouter  = document.createElement("TD");
					tdouter.setAttribute("width","4%");	
					trouter.appendChild(tdouter);
                    
					tdouter  = document.createElement("TD");
					tdouter.setAttribute("width","94%");	
					innerDiv = document.createElement("DIV");		
					var aLink =  document.createElement("a");
					var func ="javascript:onclick=setAuthor('"+author1Data[count]+"')";
					aLink.setAttribute("href",func);
					aLink.className = "productdetails_orange";	
					var text2 = document.createTextNode("Other Books by this Author");
					aLink.appendChild(text2);
					innerDiv.appendChild(aLink);
					tdouter.appendChild(innerDiv);
					trouter.appendChild(tdouter);

					tdouter  = document.createElement("TD");
					tdouter.setAttribute("width","2%");	
					trouter.appendChild(tdouter);
					tbodyouter.appendChild(trouter);
					tableouter.appendChild(tbodyouter);
					descriptionDiv.appendChild(tableouter);
                            }
    //-----------------------------------------------------------------------
                             // blank space between between 2 records....
				tableouter = document.createElement("TABLE");
				tbodyouter = document.createElement("TBODY");
				trouter = document.createElement("TR");
				tdouter  = document.createElement("TD");
				tdouter.setAttribute("height","10");
				trouter.appendChild(tdouter);
				tbodyouter.appendChild(trouter);
				tableouter.appendChild(tbodyouter);
				descriptionDiv.appendChild(tableouter);


				//Customers who bought this also bought
				tableouter = document.createElement("TABLE");
				tableouter.setAttribute("id","RelatedItemsTable"+itemIdData[count]);
				tableouter.style.display="none"
				tbodyouter = document.createElement("TBODY");
				trouter = document.createElement("TR");
				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","4%");	
				trouter.appendChild(tdouter);
				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","94%");	
				tdouter.className="searchresults_page";
				text = document.createTextNode("Customers who bought this item also bought:");
				tdouter.appendChild(text);
				trouter.appendChild(tdouter);

				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","2%");	
				trouter.appendChild(tdouter);
				tbodyouter.appendChild(trouter);

				trouter = document.createElement("TR");
				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","4%");	
				trouter.appendChild(tdouter);

				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","94%");	
				innerDiv = document.createElement("DIV");	
				innerDiv.className="relatedcategories";
				innerDiv.setAttribute("id","RelatedItemsDIV"+itemIdData[count]);
				tdouter.appendChild(innerDiv);
				trouter.appendChild(tdouter);

				tdouter  = document.createElement("TD");
				tdouter.setAttribute("width","2%");	
				trouter.appendChild(tdouter);
				tbodyouter.appendChild(trouter);



				tbodyouter.appendChild(trouter);
				tableouter.appendChild(tbodyouter);
				descriptionDiv.appendChild(tableouter);

				staticTable.appendChild(descriptionDiv);
				document.getElementById(itemIdData[count]).style.display='none';				

				//  FeedBack starts here.......				

				staticTable = document.getElementById("FeedBackTableTd");
				var feedbackDiv = document.createElement("DIV"); 
				var id="AddEdit1"+itemIdData[count];
				feedbackDiv.setAttribute("id",id);
				staticTable.appendChild(feedbackDiv);

				staticTable = document.getElementById("RecommendTableTd");
				var feedbackDiv = document.createElement("DIV"); 
				var id="RecommendItem"+itemIdData[count];
				feedbackDiv.setAttribute("id",id);
				staticTable.appendChild(feedbackDiv);
		    }
	 
		
        
             if(flagidentity==0)
             {
		if(noOfDocuments!=0)
		{
			 showPages(isPrevious,previousID,isNext,nextID,pageStart,totalAllowedPages,totalPages,totalRecords,pageNo,allowedRecords,inputKeyword,flag);
		}
		//Calling the fnGetRealetdCategories in getSearchResult.jsp to make the ajax call for related categories....

		fnGetRealetdCategories(http_requestSearchItem,flag,allChild);
              }
//rahul jain
		 //window.setTimeout('RatingsGet()',300);

	}//end of request status 200
	}//end of readystate 4
}

function RatingsGet()//itemIdData,noOfDocuments)
{	
	for(count=0;count<itemIdData.length;count++)
	{
    	addfeedback(itemIdData[count],itemNameData[count]);	
	}
}
//upto here by Rahul Jain

// function to display the related categorioes...
function displaySearchResultsCategory(http_requestSearchCategory,forwardURL,allChild)
{
	if (http_requestSearchCategory.readyState == 4)
	{
		 if (http_requestSearchCategory.status == 200)
		 {	
			var responseDoc = http_requestSearchCategory.responseXML; 			
			var root = responseDoc.documentElement;				 	
			var docs = responseDoc.getElementsByTagName("DOCUMENT");					 	
		 	var noOfDocuments = docs.length;
		 	var categoryNameData = new Array();
		 	var catID = "";
			tdCategory = document.getElementById("categoryResult");
			var aLink ="";
			var span="";
			var func="";
			var text="";
			var firstRecord=0;//variable count to print "Related Categories-" as text in the jsp..
			if(noOfDocuments>0)
			{
				document.getElementById("relatedCategories").style.display = 'block';
		 		for(count=0;count<noOfDocuments;count++)
		 		{
					fields = docs[count].getElementsByTagName("FIELD");
					for(fieldCount=0;fieldCount<fields.length;fieldCount++)
					{
						//changes here for child category
						if(allChild=="0")
						{
							var ifHomePage = fields[fieldCount].getAttribute("name");								
							if(ifHomePage == 'catviewifhomepage')
							{
								var ifHomePageData = fields[fieldCount].firstChild.nodeValue; 							
								ifHomePageData = replace(ifHomePageData);
								if(ifHomePageData == 'y'||ifHomePageData == 'Y')	
								{		
									for(namecount=0;namecount<fields.length;namecount++)
									{
										var fieldName = fields[namecount].getAttribute("name");
										if(fieldName=='catviewcategoryid')
										{
											catID = fields[namecount].firstChild.nodeValue;							
											catID = replaceGetSearchResult(catID);
										}
										if(fieldName=='catviewcategoryname')
										{
											if(firstRecord==0)
											{
												text = document.createTextNode("Related Categories -"); 
												tdCategory.appendChild(text);
											}
											firstRecord++;
											categoryNameData[count] = fields[namecount].firstChild.nodeValue;				
											categoryNameData[count] = replaceGetSearchResult(categoryNameData[count]);
											span = document.createElement("SPAN");
											span.className="relatedcategories";
											aLink = document.createElement("a");
											//aLink.className = "relatedcategories";
											func ="javascript:onclick=categoryItemSearch('"+catID+"','"+categoryNameData[count]+"','"+forwardURL+"');";
											aLink.setAttribute("href",func);
											text = document.createTextNode(categoryNameData[count]); 
											aLink.appendChild(text);
											span.appendChild(aLink);
											tdCategory.appendChild(span);			
											if(count < (noOfDocuments - 1))
											{
												text = document.createTextNode(" | "); 	
												tdCategory.appendChild(text);
											}
										}
									 }
								}
							}
						}
						else if(allChild=="1")
						{
							var fieldName = fields[fieldCount].getAttribute("name");
							if(fieldName=='catviewcategoryid')
							{
								catID = fields[fieldCount].firstChild.nodeValue;							
								catID = replaceGetSearchResult(catID);
							}
							if(fieldName=='catviewcategoryname')
							{
								if(firstRecord==0)
								{
									text = document.createTextNode("Related Categories -"); 
									tdCategory.appendChild(text);
								}
								firstRecord++;
								categoryNameData[count] = fields[fieldCount].firstChild.nodeValue;				
								categoryNameData[count] = replaceGetSearchResult(categoryNameData[count]);
								span = document.createElement("SPAN");
								span.className="relatedcategories";
								aLink = document.createElement("a");
								//aLink.className = "relatedcategories";
								func ="javascript:onclick=categoryItemSearch('"+catID+"','"+categoryNameData[count]+"','"+forwardURL+"');";
								aLink.setAttribute("href",func);
								text = document.createTextNode(categoryNameData[count]); 
								aLink.appendChild(text);
								span.appendChild(aLink);
								tdCategory.appendChild(span);			
								if(count < (noOfDocuments - 1))
								{
									text = document.createTextNode(" | "); 	
									tdCategory.appendChild(text);
								}
							}						
						}
					}
				}
			}
		 }
	}
}

function SearchImgLoad(myobj,imagePath, itemID, imageSource) 
{ 
   var oImg=new Image; 
   oImg.onload=function(){myobj.src=imagePath; imageSource = imagePath}
   oImg.onerror=function(){SearchImgLoad_Images(myobj, '/dotcom/'+gOrgFolder+'/images/'+itemID+'.jpg', imageSource);}
   oImg.src=imagePath;             
}

function SearchImgLoad_Images(myobj,imagePath, imageSource) 
{ 
   var oImg=new Image; 
   oImg.onload=function(){myobj.src=imagePath; imageSource = imagePath}
   oImg.onerror=function(){myobj.src='/dotcom/'+gOrgFolder+'/images/oxford_logo.jpg'; imageSource = '/dotcom/'+gOrgFolder+'/images/oxford_logo.jpg';}
   oImg.src=imagePath;             
}

function ImgLoad(myobj,imagePath, itemID) 
{ 
   var oImg=new Image; 
   oImg.onload=function(){myobj.src=imagePath} 
   oImg.onerror=function(){ImgLoad_Images(myobj, '/dotcom/'+gOrgFolder+'/images/'+itemID+'.jpg');}
   oImg.src=imagePath;             
}

function ImgLoad_Images(myobj, imagePath) 
{ 
   var oImg=new Image; 
   oImg.onload=function(){myobj.src=imagePath; imageSource = imagePath}
   oImg.onerror=function(){myobj.src='/dotcom/'+gOrgFolder+'/images/oxford_logo.jpg'} 
   oImg.src=imagePath;             
}

//function for add to cart
function AddToCart(ItemID)
{
	var url = '/dotcom/'+gOrgFolder+'/ShoppingCart/jsp/StockCheck.jsp?';
	document.AddToCart.action=url;	
	document.AddToCart.method="post";	
	document.AddToCart.ItemID.value=ItemID;
	document.AddToCart.submit();
}

function requestItem(ItemID)
{
	var url = '/dotcom/'+gOrgFolder+'/ShoppingCart/jsp/RequestItem.jsp?';
	document.AddToCart.action=url;	
	document.AddToCart.method="post";	
	document.AddToCart.ItemID.value=ItemID;
	document.AddToCart.submit();
}

function findItem()
{
	var url = '/dotcom/'+gOrgFolder+'/ShoppingCart/jsp/FindItem.jsp?';	
	document.AddToCart.action=url;	
	document.AddToCart.submit();
}
// ask rahul abt this....
function GiveFeedBack(ItemTypeID, ItemName)
{
	var url = '/dotcom/'+gOrgFolder+'/jsp/search/FeedBack.jsp?';	
	document.AddToCart.action=url;	
	document.AddToCart.ItemTypeID.value=ItemTypeID;
	document.AddToCart.ItemName.value=ItemName;
	document.AddToCart.OrgID.value='<%=Constants.ORGID%>';
	document.AddToCart.submit();
}

function getCustomerRelatedItems(ItemID)
{
	//alert(gOrgID);
	var lRelatedItems="/dotcom/ShoppingCart/CustomerRelatedItemsGet.kar?OrgId="+gOrgID+"&ItemId="+ItemID;
	submitForm(document.AddToCart, lRelatedItems, "POST", handleRelatedItems, 0, null);
}

function handleRelatedItems(pXMLObject)
{
	var lXMLResponse;
	var lBaseEdit;
	var lData;
	var lCount;
	var lSuccess;
	var lValue;
	var lId;
	var lDisplayText;
	var lElement;
	var lTextElement;
	var lBreakElement;
	var lPaymentCode;
	lXMLResponse = pXMLObject.responseXML;
	lBaseEdit = lXMLResponse.documentElement;
	lBaseEdit = copyNodes(lBaseEdit);
	lSuccess = handleResult(lBaseEdit.childNodes[0]);
	if (lSuccess)
	{
		lData = lBaseEdit.childNodes[1];
		if(lData.childNodes != null && lData.childNodes.length > 0)
		{
			for (var lAttributeCount = 0; lAttributeCount < lData.childNodes[0].attributes.length; lAttributeCount++)
			{
				var lAttribute = lData.childNodes[0].attributes[lAttributeCount];
				//alert("lAttribute: " + lAttribute);
				if (!isNodeNull(lAttribute))
				{	
					if (lAttribute.nodeName == "currentitemid")
					{
						lId = lAttribute.value;
						break;
					}
				}
			}
			var relatedItemsTable = document.getElementById("RelatedItemsTable"+lId);
			var relatedItemsDIV = document.getElementById("RelatedItemsDIV"+lId);
			if(relatedItemsDIV.childNodes.length > 0)
			{
				for(var count=relatedItemsDIV.childNodes.length - 1; count >= 0; count--)
				{
					relatedItemsDIV.removeChild(relatedItemsDIV.childNodes[count]);
				}
			}
			for (lCount = 1; lCount < lData.childNodes.length; lCount++)
			{
				relatedItemsTable.style.display="block";
				for (var lAttributeCount = 0; lAttributeCount < lData.childNodes[lCount].attributes.length; lAttributeCount++)
				{
					var lAttribute = lData.childNodes[lCount].attributes[lAttributeCount];
					//alert("lAttribute: " + lAttribute);
					if (!isNodeNull(lAttribute))
					{	
						if (lAttribute.nodeName == "itmmasteritemno")
						{
							lValue = lAttribute.value;
						}
						else if (lAttribute.nodeName == "itmmasteritemname")
						{
							lDisplayText = Url.decode(lAttribute.value);
						}
					}
				}
				lTextElement = document.createTextNode(lDisplayText);
				var span1 = document.createElement("SPAN");
				span1.className="relatedcategories";
				var aLink = document.createElement("A");
				var func ="/dotcom/oxford/jsp/search/getItemdetails.jsp?itemid="+lValue;
				aLink.setAttribute("href",func);
				aLink.appendChild(lTextElement);
				span1.appendChild(aLink);
				relatedItemsDIV.appendChild(span1);
				if(lCount != lData.childNodes.length -1 )
				{
					var lTextElement1 = document.createTextNode(" | ");
					relatedItemsDIV.appendChild(lTextElement1);
				}
			}
		}
	}
}


function getShippingTime(ItemID)
{
	//alert(gOrgID);
	var lShippingTime="/dotcom/ShoppingCart/CheckStock.kar?OrgId="+gOrgID+"&ItemId="+ItemID;
	submitForm(document.AddToCart, lShippingTime, "POST", handleShippingTime, 0, null);
}


function handleShippingTime(pXMLObject)
{
	var lXMLResponse;
	var lRoot;
	var lResult;
	var lSuccess;
	lXMLResponse = pXMLObject.responseXML;
	lRoot = lXMLResponse.documentElement;
	lRoot = copyNodes(lRoot);
	lResult = lRoot.childNodes[0];
	lStatus = lResult.attributes.getNamedItem("STATUS").value;
	//alert("1");
	if (lStatus != null && lStatus == "0")
	{
			if (lResult.attributes.getNamedItem("MESSAGE") != null)
			{
				var lMessage = lResult.attributes.getNamedItem("MESSAGE").value.split("#");
				var lItemId = lMessage[0];
				var lStockQty = lMessage[1];
				var lShipTimeTable = document.getElementById("ShipTimeTable"+lItemId);
				var lShipTimeSpan = document.getElementById("ShipTimeSpan"+lItemId);
				var lStockInt = null;
				//lStockQty = "0";
				try{
					if(lStockQty != null && lStockQty != "" && lStockQty != "null")
						lStockInt = parseInt(lStockQty);
					//alert("1");
				}catch(Exception)
				{}
				//lStockInt = 0;
				if(lStockInt != null && lStockInt != -1)
				{
					if(lShipTimeSpan.childNodes.length > 0)
					{
						for(var count=lShipTimeSpan.childNodes.length - 1; count >= 0; count--)
						{
							lShipTimeSpan.removeChild(lShipTimeSpan.childNodes[count]);
						}
					}
					//alert("1");
					if(lStockInt >= 4)
					{
						//alert(lStockInt + "more than 4");
						lShipTimeTable.style.display="block";
						var text1 = document.createTextNode("48 hrs**");
						lShipTimeSpan.appendChild(text1);
					}else if(lStockInt > 1)
					{
						lShipTimeTable.style.display="block";
						var text1 = document.createTextNode("72 hrs**");
						lShipTimeSpan.appendChild(text1);
					}else if(lStockInt == 1)
					{
						lShipTimeTable.style.display="block";
						var text1 = document.createTextNode("96 hrs**");
						lShipTimeSpan.appendChild(text1);
					}
					//document.getElementById("spanStockQty"+lItemId).appendChild(text);
				}
			}
	}
}


function checkStock(ItemID)
{
	//alert(gOrgID);
	var lCheckStock="/dotcom/ShoppingCart/CheckStock.kar?OrgId="+gOrgID+"&ItemId="+ItemID;
	submitForm(document.AddToCart, lCheckStock, "POST", handleStockCheck, 0, null);
}

function handleStockCheck(pXMLObject)
{
	var lXMLResponse;
	var lRoot;
	var lResult;
	var lSuccess;
	lXMLResponse = pXMLObject.responseXML;
	lRoot = lXMLResponse.documentElement;
	lRoot = copyNodes(lRoot);
	lResult = lRoot.childNodes[0];
	lStatus = lResult.attributes.getNamedItem("STATUS").value;
	if (lStatus != null && lStatus == "0")
	{
			if (lResult.attributes.getNamedItem("MESSAGE") != null)
			{
				var lMessage = lResult.attributes.getNamedItem("MESSAGE").value.split("#");
				//alert("handleStockCheck");
				//var lMessageTemp = "000000000010000375#0"
				//var lMessage = lMessageTemp.split("#");
				var lItemId = lMessage[0];
				var lStockQty = lMessage[1];
				var lstockTR = document.getElementById("TRStockQty"+lItemId);
				var lstockTD = document.getElementById("TDStockQty"+lItemId);
				var lStockInt = null;
				try{
					if(lStockQty != null && lStockQty != "" && lStockQty != "null")
						lStockInt = parseInt(lStockQty);
					
				}catch(Exception)
				{}
				//lStockInt = 0;
				if(lStockInt != null && lStockInt != -1)
				{
					//alert("handleStockCheck2");
					if(lstockTD.childNodes.length > 0)
					{
						for(var count=lstockTD.childNodes.length - 1; count >= 0; count--)
						{
							lstockTD.removeChild(lstockTD.childNodes[count]);
						}
					}
					if(lStockInt >= 5)
					{
						//alert("handleStockCheck3");
						lstockTD.className="stock_available";
						var text1 = document.createTextNode("Status: Available");
						lstockTD.appendChild(text1);
						//var text2 = document.createTextNode("Available");
						//var span = document.createElement("span");
						//span.className="productdetails";
						//span.appendChild(text2);
						//lstockTD.appendChild(span);
						var br1 = document.createElement("BR");
						lstockTD.appendChild(br1);

						//var text1 = document.createTextNode("Item in Stock");
						//lstockTD.appendChild(text1);
						var text2 = document.createTextNode("Item in Stock");
						var span = document.createElement("span");
						span.className="stockdetails";
						span.appendChild(text2);
						lstockTD.appendChild(span);
					}else if(lStockInt > 0)
					{
						lstockTD.className="stock_hurry";
						var text1 = document.createTextNode("Status: Available");
						lstockTD.appendChild(text1);
						//var text2 = document.createTextNode("Available");
						//var span = document.createElement("span");
						//span.className="productdetails";
						//span.appendChild(text2);
						//lstockTD.appendChild(span);
						var br1 = document.createElement("BR");
						lstockTD.appendChild(br1);
						//var br1 = document.createElement("BR");
						//lstockTD.appendChild(br1);

						//var text1 = document.createTextNode("Nos: ");
						//lstockTD.appendChild(text1);
						var text2 = document.createTextNode("Hurry! Less than five copies. Order Soon!!!");
						var span = document.createElement("span");
						span.className="stockdetails";
						span.appendChild(text2);
						lstockTD.appendChild(span);
					}else if(lStockInt == 0)
					{
						lstockTD.className="stock_unavailable";
						var text1 = document.createTextNode("Status: Not Available");
						lstockTD.appendChild(text1);
						//var text2 = document.createTextNode("Not Available");
						//var span = document.createElement("span");
						//span.className="productdetails";
						//span.appendChild(text2);
						//lstockTD.appendChild(span);
						var br1 = document.createElement("BR");
						lstockTD.appendChild(br1);

						/*var text1 = document.createTextNode("Nos: ");
						lstockTD.appendChild(text1);
						var text2 = document.createTextNode(lStockInt);
						var span = document.createElement("span");
						span.className="productdetails";
						span.appendChild(text2);
						lstockTD.appendChild(span);
						var br1 = document.createElement("BR");
						lstockTD.appendChild(br1);*/

						var text1 = document.createTextNode("To request for this item please ");
						var span = document.createElement("span");
						span.className="stockdetails";
						span.appendChild(text1);
						lstockTD.appendChild(span);
						var aLink =  document.createElement("a");
						aLink.className="stock_unavailable_link";
						var func ="javascript:onclick=requestItem('"+lItemId+"');";
						aLink.setAttribute("href",func);
						var text2 = document.createTextNode("Click Here");
						aLink.appendChild(text2);
						//lstockTD.appendChild(text1);
						lstockTD.appendChild(aLink);
						var br1 = document.createElement("BR");
						lstockTD.appendChild(br1);
					}
					//document.getElementById("spanStockQty"+lItemId).appendChild(text);
				}
			}
	}
}

function handleCartDetailsGet(pXMLObject)
{
	var lXMLResponse;
	var lRoot;
	var lResult;
	var lSuccess;
	lXMLResponse = pXMLObject.responseXML;
	lRoot = lXMLResponse.documentElement;
	lRoot = copyNodes(lRoot);
	lSuccess = handleResult(lRoot.childNodes[0], null);
	if (lSuccess)
	{


		lData = lRoot.childNodes[1];
		if(lData != null && lData.firstChild != null)
		{
			var lHomePageCartTR = document.getElementById("HomePageCartTR");
			lHomePageCartTR.style.display="block";
			if(lData.childNodes[0].getAttribute("cartdtlstotalamount")!= null && lData.childNodes[0].getAttribute("cartdtlstotalamount") != "")
			{
				var lCartItemsPrice = document.createTextNode(" " + lData.childNodes[0].getAttribute("cartdtlstotalamount"));


				var markedPriceUF = lData.childNodes[0].getAttribute("cartdtlstotalamount").replace(",","");
				var usd = parseFloat(markedPriceUF)/USDConversionRate;
				//alert("USDConversionRate" + USDConversionRate);
				
				usd=(Math.round(usd*100)/100).toFixed(2);

				var lCartItemsPriceForUSD = document.createTextNode(" " + usd);

				var lhpcartitemprice = document.getElementById("hpcartitemprice");
				if(lhpcartitemprice != null && lhpcartitemprice.childNodes != null)
				{
					for (lCount = lhpcartitemprice.childNodes.length - 1; lCount >= 0; lCount--)
					{
						lhpcartitemprice.removeChild(lhpcartitemprice.childNodes[lCount]);
					}
				}				
				
				lhpcartitemprice.appendChild(lCartItemsPrice);


				var lhpcartitempriceinusd = document.getElementById("hpcartitempriceinusd");
				if(lhpcartitempriceinusd != null && lhpcartitempriceinusd.childNodes != null)
				{
					for (lCount = lhpcartitempriceinusd.childNodes.length - 1; lCount >= 0; lCount--)
					{
						lhpcartitempriceinusd.removeChild(lhpcartitempriceinusd.childNodes[lCount]);
					}
				}				
				
				lhpcartitempriceinusd.appendChild(lCartItemsPriceForUSD);
			}
			if(lData.childNodes[1].getAttribute("cartitemcount")!= null && lData.childNodes[1].getAttribute("cartitemcount") != "")
			{
				var lCartItemsCount = document.createTextNode(lData.childNodes[1].getAttribute("cartitemcount") + " ");

				var lhpcartitemcount = document.getElementById("hpcartitemcount");
				if(lhpcartitemcount != null && lhpcartitemcount.childNodes != null)
				{
					for (lCount = lhpcartitemcount.childNodes.length - 1; lCount >= 0; lCount--)
					{
						lhpcartitemcount.removeChild(lhpcartitemcount.childNodes[lCount]);
					}
				}	
				
				lhpcartitemcount.appendChild(lCartItemsCount);
			}
		}else
		{
				var lCartItemsPrice = document.createTextNode(" 0.00");
                var lCartItemsPriceUSD = document.createTextNode(" 0.00");
				var lhpcartitemprice = document.getElementById("hpcartitemprice");
				if(lhpcartitemprice != null && lhpcartitemprice.childNodes != null)
				{
					for (lCount = lhpcartitemprice.childNodes.length - 1; lCount >= 0; lCount--)
					{
						lhpcartitemprice.removeChild(lhpcartitemprice.childNodes[lCount]);
					}
				}
				lhpcartitemprice.appendChild(lCartItemsPrice);


				var lhpcartitempriceinusd = document.getElementById("hpcartitempriceinusd");
				if(lhpcartitempriceinusd != null && lhpcartitempriceinusd.childNodes != null)
				{
					for (lCount = lhpcartitempriceinusd.childNodes.length - 1; lCount >= 0; lCount--)
					{
						lhpcartitempriceinusd.removeChild(lhpcartitempriceinusd.childNodes[lCount]);
					}
				}				
				
				lhpcartitempriceinusd.appendChild(lCartItemsPriceUSD);

				var lCartItemsCount = document.createTextNode("0 ");
				var lhpcartitemcount = document.getElementById("hpcartitemcount");
				if(lhpcartitemcount != null && lhpcartitemcount.childNodes != null)
				{
					for (lCount = lhpcartitemcount.childNodes.length - 1; lCount >= 0; lCount--)
					{
						lhpcartitemcount.removeChild(lhpcartitemcount.childNodes[lCount]);
					}
				}
				lhpcartitemcount.appendChild(lCartItemsCount);
		}
	}
}

// function that fills categories in the left section
function fillCategory(http_request,forwardURL)
{
	if (http_request.readyState == 4)
	{							
    	 if (http_request.status == 200)
		{
			 var categoryTable = document.getElementById("resultTableCategory");
			 var categoryBody = categoryTable.firstChild;
			 if(categoryBody != null)
			 {
				 categoryTable.removeChild(categoryBody);
			 }
			 var tbodycategory = document.createElement("TBODY");
			 var tr="";
			 var td="";
			 var text="";
			 var table="";
			 var tbody="";
			 var innerTr = "";
			 var innerDiv = "";
			 var innerUl = "";
			 var innerLi = "";
			 var innerTd = "";
			 var img="";
			 
			 var itemtype1;
			 var responseDoc = http_request.responseXML; 			
			 var docs = responseDoc.getElementsByTagName("DOCUMENT");					 	
			 var noOfDocuments = docs.length;
			// alert("noOfDocuments...."+noOfDocuments);
			 var fields;	
			 var lastItemTypeName = "";	
			 var noOfItemType=0;
			 for(count=0;count<noOfDocuments;count++)
			 {
				fields = docs[count].getElementsByTagName("FIELD");	
				for(fieldCount=0;fieldCount<fields.length;fieldCount++)
				{					
					var ifHomePage = fields[fieldCount].getAttribute("name");				
					if(ifHomePage == 'catviewifhomepage')
					{
						var ifHomePageData = fields[fieldCount].firstChild.nodeValue; 							
						ifHomePageData = replace(ifHomePageData);	
						if(ifHomePageData == 'y'||ifHomePageData == 'Y')	
						{
							var try1;
							for(namecount=0;namecount<fields.length;namecount++)
							{
								var fieldname = fields[namecount].getAttribute("name");
								 if (fieldname == 'itmtypmstritemtypename')
								{
									var itemTypeData = fields[namecount].firstChild.nodeValue;
									itemTypeData = replace(itemTypeData);
									itemTypeData = itemTypeData.toString();
									lastItemTypeName = lastItemTypeName.toString();
									if(lastItemTypeName!=itemTypeData)
									{
										// to display more  not for the 1st entry inside this loop
										if(noOfItemType!=0)
										{
											tr = document.createElement("TR");										
											td = document.createElement("TD");
											innerDiv = document.createElement("div");
										    innerDiv.className="categoryheader";	
											var aLink = document.createElement("a");
											var func ="javascript:onclick=setAllCategory('"+lastItemTypeName+"');";
											aLink.setAttribute("href",func);
											text = document.createTextNode("More...");
											aLink.appendChild(text);	
											innerDiv.appendChild(aLink);
											td.appendChild(innerDiv);
											tr.appendChild(td);
											tbodycategory.appendChild(tr);										
										}
										noOfItemType++;
										tr = document.createElement("TR");										
										td = document.createElement("TD");
										innerDiv = document.createElement("div");
										innerDiv.className="categorytopheader";																	
										text = document.createTextNode(itemTypeData.toUpperCase());				
										innerDiv.appendChild(text);										
										td.appendChild(innerDiv);
										innerUl = document.createElement("ul");
										innerUl.className="leftnavigation";
										td.appendChild(innerUl);
                                        tr.appendChild(td);
										tbodycategory.appendChild(tr);									
										
										lastItemTypeName = itemTypeData;
										try1 = itemTypeData;
										
										
									}								
								}
							}	
							for(namecount=0;namecount<fields.length;namecount++)
							{
								var fieldname = fields[namecount].getAttribute("name");
								var catID;
								if(fieldname=='catviewcategoryid')
								{
									catID = fields[namecount].firstChild.nodeValue;							
									catID = replace(catID);
								}
									if(fieldname == 'catviewcategoryname')
								{
									var categoryData = fields[namecount].firstChild.nodeValue;
									categoryData = replace(categoryData);
								
									innerLi= document.createElement("li");
									var aLink = document.createElement("a");									
									var func ="javascript:onclick=categoryItemSearch('"+catID+"','"+categoryData+"','"+forwardURL+"');";
									aLink.setAttribute("href",func);	
									text = document.createTextNode(categoryData);
									aLink.appendChild(text);
									innerLi.appendChild(aLink);		
									innerUl.appendChild(innerLi);
									td.appendChild(innerUl);
									tr.appendChild(td);
									tbodycategory.appendChild(tr);								
									categoryTable.appendChild(tbodycategory);

								}										
							}
						}						
					}							
				}
			}
			// more link for the lastItemType....
			var moreTable = document.getElementById("moreCategoryForLastItemType");
		    var moreBody = moreTable.firstChild;
		    if(moreBody != null)
		    {
				 moreTable.removeChild(moreBody);
		    }
		    var moretbody = document.createElement("TBODY");			
			tr = document.createElement("TR");										
			td = document.createElement("TD");
			
			innerDiv = document.createElement("div");
			innerDiv.className="categoryheader";	
			var aLink = document.createElement("a");			
			
			var func ="javascript:onclick=setAllCategory('"+lastItemTypeName+"');";
			aLink.setAttribute("href",func);
			text = document.createTextNode("More...");
			aLink.appendChild(text);	
			innerDiv.appendChild(aLink);										
			
			td.appendChild(innerDiv);
			tr.appendChild(td);
			moretbody.appendChild(tr);	
			moreTable.appendChild(moretbody);
		}
	}
}


//	function to search items when a category is cliked....		
function categoryItemSearch(categoryID,category,forwardURL)
{	
	document.CategoryListForm.action=forwardURL;
	document.CategoryListForm.categoryID.value= categoryID;
	document.CategoryListForm.category.value= category;
	document.CategoryListForm.allChild.value="1";
	document.CategoryListForm.submit();
}
// functions that is called wen more all browse all is clicked....
function setAllCategory(itemType)
{
	var url = '/dotcom/'+gOrgFolder+'/jsp/search/AllCategory.jsp?';	
	document.CategoryListForm.action=url;
	document.CategoryListForm.itemType.value=itemType;
	document.CategoryListForm.submit();
}

//displays the results when browse all or more is clicked.....
function displayAllCategories(http_requestSearchNew,forwardURL)
{
	if (http_requestSearchNew.readyState == 4)
	{
		 if (http_requestSearchNew.status == 200)
		 {
		 	var responseDoc = http_requestSearchNew.responseXML; 
		 
			var docs = responseDoc.getElementsByTagName("DOCUMENT");					 	
		 	var noOfDocuments = docs.length;
		 	var fields;	
		 	var lastItemTypeName = "";	
			var noOfItemType=0;
			var noOfCategory=0;
			var count1=0;
			var categoryNoArray = new Array();
			var categoryNoArray1 = new Array();
			var itemTypeArray = new Array();
			var itemTypeImagePathArray = new Array();
			var categoryNames = new Array();
			var catID = new Array();
			var itemType = "";
			var rowState="";
			var categoryName = "";
			var itemTypeData = "";
			var catIDs = "";
			var table = "";
			var tr = "";
			var td = "";
			var tbody = "";
			var text = "";
			var font = "";
			var beforeSpace = "";
			var afterSpace = "";
			var catIDs = "";
			var categoryNameData = "";
			var br = "";
			var img = "";
			var linkTag = "";


			var itemtypeimage = new Array();
			var itemtypeimagepath = "";
			var itemtypeimagepathData = "";


			for(count=0;count<noOfDocuments;count++)			
		 	{				
				fields = docs[count].getElementsByTagName("FIELD");	
				for(fieldCount=0;fieldCount<fields.length;fieldCount++)
		 		{		 				
					itemType = fields[fieldCount].getAttribute("name");												
					if(itemType == 'itmtypmstritemtypename')
					{						
						itemTypeData = fields[fieldCount].firstChild.nodeValue;			
						itemTypeData = replace(itemTypeData);							
						if(lastItemTypeName!=itemTypeData)
						{
							categoryNoArray[count1] = noOfCategory;
							count1++;							
							noOfCategory=0;																	
							lastItemTypeName = itemTypeData;
							itemTypeArray[noOfItemType] = itemTypeData;

							// chnages for image of itemtype
							for (imagecount=0;imagecount<fields.length;imagecount++)
							{					
								itemtypeimagepath = fields[imagecount].getAttribute("name");
								if(itemtypeimagepath=="itmtypmstritemtypeimagepath")
								{
									itemtypeimagepathData = fields[imagecount].firstChild.nodeValue;
									itemtypeimagepathData = replace(itemtypeimagepathData);	
									itemtypeimage[noOfItemType] = itemtypeimagepathData;
								}								
							}

							noOfItemType++;							
						}
					}
				}			
				for(fieldCount=0;fieldCount<fields.length;fieldCount++)
		 		{						
					categoryName = fields[fieldCount].getAttribute("name");												
					if(categoryName=='catviewcategoryid')
					{
						catIDs = fields[fieldCount].firstChild.nodeValue;							
						catIDs = replace(catIDs);						
						catID[count]=catIDs;
					}				
					if(categoryName == 'catviewcategoryname')
					{						
						categoryNameData = fields[fieldCount].firstChild.nodeValue;						
						categoryNameData = replace(categoryNameData);						
						noOfCategory++;						
						categoryNames[count]=categoryNameData;										
					}
				}
			}
									 
			categoryNoArray[count1] = noOfCategory;		
			var sum = new Array();			
			sum[0] = 0;
			var catLength = 1;
			var sumArrLength = categoryNoArray.length + categoryNoArray.length;
			for(var a=0;a<sumArrLength;a=a+2)
			{				
				sum[a+1]=sum[a]+categoryNoArray[catLength];	
				sum[a+2]=sum[a+1];
				catLength = catLength + 1;
			}
			var last=sum.length;			
			sum[last-1]=count;		

			var categoryResult = document.getElementById("categoryResult");			
			var itemDetailsLength = noOfItemType + noOfItemType;
			var maintable = "";
			var maintr = "";
			var maintd = "";
			var maintbody = "";
			var itemTypeLength = 0;
			var mainfont="";
			var img = "";
			var font="";
			var div="";
			for(var print=0;print<itemDetailsLength;print=print+2)
			 {
				maintable = document.createElement("TABLE");
				maintable.setAttribute("width","100%");
				maintable.setAttribute("border","0");
				maintable.setAttribute("cellspacing","0");
				maintable.setAttribute("cellpadding","0");
				maintbody = document.createElement("TBODY");
				maintr = document.createElement("TR");
				maintd = document.createElement("TD");				
				maintd.setAttribute("width","20%");
				maintd.setAttribute("align","left");
				maintd.className="border_newreleases";

				var innerTable="";
				var innerTbody="";
				var innerTr="";
				var innerTd="";
				var span="";
				innerTable = document.createElement("TABLE");
				innerTable.setAttribute("width","100%");
				innerTable.setAttribute("border","0");
				innerTable.setAttribute("cellspacing","0");
				innerTable.setAttribute("cellpadding","0");
				innerTable.setAttribute("height","23");
				innerTbody = document.createElement("TBODY");
				innerTr = document.createElement("TR");
				innerTd = document.createElement("TD");
				innerTd.setAttribute("align","center");
				//innerTd.className="border_newreleases";
				span = document.createElement("SPAN");
				span.className="newreleaseheader";

				//Add ITEMTYPE name....				
				text = document.createTextNode(itemTypeArray[itemTypeLength].toUpperCase());	
				span.appendChild(text);
				innerTd.appendChild(span);
				innerTr.appendChild(innerTd);
				innerTbody.appendChild(innerTr);
				innerTable.appendChild(innerTbody);
				maintd.appendChild(innerTable);
				maintr.appendChild(maintd);
				
				maintd = document.createElement("TD");
				maintd.setAttribute("width","80%");
				maintd.className="bottom_border";
				innerTable = document.createElement("TABLE");
				innerTable.setAttribute("width","100%");
				innerTable.setAttribute("border","0");
				innerTable.setAttribute("cellspacing","0");
				innerTable.setAttribute("cellpadding","0");
				innerTable.setAttribute("height","23");
				//innerTable.className="bottom_border";
				innerTbody = document.createElement("TBODY");
				innerTr = document.createElement("TR");
				innerTd = document.createElement("TD");
				innerTr.appendChild(innerTd);
				innerTbody.appendChild(innerTr);
				innerTable.appendChild(innerTbody);
				maintd.appendChild(innerTable);
				maintr.appendChild(maintd);
				maintbody.appendChild(maintr);

				maintable.appendChild(maintbody);
				categoryResult.appendChild(maintable);
				//itemtype over.....

				maintable = document.createElement("TABLE");
				maintable.className="three_sides_greyborder";
				maintable.setAttribute("width","100%");
				maintable.setAttribute("border","0");
				maintable.setAttribute("cellspacing","0");
				maintable.setAttribute("cellpadding","0");
				maintbody = document.createElement("TBODY");
				maintr = document.createElement("TR");
				maintd = document.createElement("TD");
				maintd.setAttribute("width","100%");
				maintd.setAttribute("colspan","2");
				maintd.setAttribute("valign","top");
				innerTable = document.createElement("TABLE");
				innerTable.setAttribute("width","100%");
				innerTable.setAttribute("border","0");
				innerTable.setAttribute("cellspacing","0");
				innerTable.setAttribute("cellpadding","0");
				//innerTable.className="three_sides_greyborder";
				innerTbody = document.createElement("TBODY");
				innerTr = document.createElement("TR");
				innerTd = document.createElement("TD");
				var categoryTable="";
				var categoryTbody = "";
				var categoryTr = "";
				var categoryTd = "";
				var outerDiv="";
				var innerDiv="";

				categoryTable = document.createElement("TABLE");
				categoryTable.setAttribute("width","100%");
				categoryTable.setAttribute("border","0");
				categoryTable.setAttribute("cellspacing","0");
				categoryTable.setAttribute("cellpadding","0");
				categoryTbody = document.createElement("TBODY");
				categoryTr = document.createElement("TR");
				categoryTd = document.createElement("TD");
				categoryTd.setAttribute("width","2%");
				categoryTr.appendChild(categoryTd);

				categoryTd = document.createElement("TD");
				categoryTd.setAttribute("align","center");
				categoryTd.setAttribute("valign","top");
				categoryTd.setAttribute("width","8%");
				outerDiv = document.createElement("DIV");
				outerDiv.className="image_border_outer";
				innerDiv = document.createElement("DIV");
				innerDiv.className="image_border_outer";
				img = document.createElement("img");
				/*if(itemTypeArray[itemTypeLength].toUpperCase() == book)
				{
					img.setAttribute("src","/dotcom/"+gOrgFolder+"/images/booksicon.jpg");
				}
				else if(itemTypeArray[itemTypeLength].toUpperCase() == gift)
				{
					 img.setAttribute("src","/dotcom/"+gOrgFolder+"/images/giftsicon.jpg");
				}
				else if(itemTypeArray[itemTypeLength].toUpperCase() == music)
				{
					img.setAttribute("src","/dotcom/"+gOrgFolder+"/images/musicicon.jpg");
				}
				else if(itemTypeArray[itemTypeLength].toUpperCase() == multimedia)
				{
					 img.setAttribute("src","/dotcom/"+gOrgFolder+"/images/multimediaicon.jpg");
				}
				else if(itemTypeArray[itemTypeLength].toUpperCase() == stationery)
				{
					 img.setAttribute("src","/dotcom/"+gOrgFolder+"/images/stationaryicon.jpg");
				}*/
				img.setAttribute("src","/dotcom/"+gOrgFolder+"/DynamicAdmin/ImgGallery/"+itemtypeimage[itemTypeLength]);
img.setAttribute("width","160px");
				innerDiv.appendChild(img);
				outerDiv.appendChild(innerDiv);
				categoryTd.appendChild(outerDiv);				
				categoryTr.appendChild(categoryTd);
				
				categoryTd = document.createElement("TD");
				categoryTd.setAttribute("width","4%");
				categoryTr.appendChild(categoryTd);


				//displaying categories....
				categoryTd = document.createElement("TD");
				categoryTd.setAttribute("align","left");
				categoryTd.setAttribute("valign","top");
				categoryTd.setAttribute("width","86%");
				var allCategoryTable="";
				var allCategoryTbody="";
				var allCategoryTr="";
				var allCategoryTd="";
				allCategoryTable = document.createElement("TABLE");
				allCategoryTable.setAttribute("width","100%");
				allCategoryTable.setAttribute("border","0");
				allCategoryTable.setAttribute("cellspacing","0");
				allCategoryTable.setAttribute("cellpadding","0");
				allCategoryTbody = document.createElement("TBODY");
				allCategoryTr = document.createElement("TR");
				var categoryBlockTable="";
				var categoryBlockTbody="";
				var categoryIndividualTr="";
				var categoryIndividualTd="";				
				var colsInRow = 3;

				for(var got=sum[print];got<sum[print+1];got++)
				{				
					if(colsInRow == 0)
					{
						allCategoryTbody.appendChild(allCategoryTr);
						allCategoryTr = document.createElement("TR");
						colsInRow = 3;
					}			
					allCategoryTd = document.createElement("TD");
					allCategoryTd.setAttribute("width","33%");
					categoryBlockTable = document.createElement("TABLE");
					categoryBlockTable.setAttribute("width","100%");
					categoryBlockTable.setAttribute("border","0");
					categoryBlockTable.setAttribute("cellspacing","0");
					categoryBlockTable.setAttribute("cellpadding","0");
					categoryBlockTbody = document.createElement("TBODY");
					categoryIndividualTr = document.createElement("TR");
					categoryIndividualTd = document.createElement("TD");
					categoryIndividualTd.setAttribute("width","12%");
					img = document.createElement("img");					
					img.setAttribute("src","/dotcom/"+gOrgFolder+"/images/arrow_categories.gif");
					img.setAttribute("hspace","6");
					img.setAttribute("vspace","4");	
					categoryIndividualTd.appendChild(img);
					categoryIndividualTr.appendChild(categoryIndividualTd);

					categoryIndividualTd = document.createElement("TD");
					categoryIndividualTd.setAttribute("width","88%");
					linkTag = document.createElement("a");
					linkTag.setAttribute("href","javascript:onclick=categoryItemSearch('"+catID[got]+"','"+categoryNames[got]+"','"+forwardURL+"');");
					linkTag.className="categories_header";					
					text = document.createTextNode(categoryNames[got]);	
					linkTag.appendChild(text);				
					categoryIndividualTd.appendChild(linkTag);
					categoryIndividualTr.appendChild(categoryIndividualTd);
					categoryBlockTbody.appendChild(categoryIndividualTr);
					categoryBlockTable.appendChild(categoryBlockTbody);
					allCategoryTd.appendChild(categoryBlockTable);
					allCategoryTr.appendChild(allCategoryTd);
					colsInRow = colsInRow - 1;					 
				 }
				
				//end of displaying categories				
				allCategoryTbody.appendChild(allCategoryTr);
				allCategoryTable.appendChild(allCategoryTbody);
				categoryTd.appendChild(allCategoryTable);

				categoryTr.appendChild(categoryTd);
				categoryTbody.appendChild(categoryTr);
				categoryTable.appendChild(categoryTbody);
				innerTd.appendChild(categoryTable);

				innerTr.appendChild(innerTd);
				innerTbody.appendChild(innerTr);
				innerTable.appendChild(innerTbody);
				maintd.appendChild(innerTable);


				maintr.appendChild(maintd);
				maintbody.appendChild(maintr);
				maintable.appendChild(maintbody);
				categoryResult.appendChild(maintable);				
				itemTypeLength = itemTypeLength + 1;	

			}				
		}		
	}
}

//function that fills the itemtype drop down on the home page....			
function fillItemType(http_request)
{
if (http_request.readyState == 4)
	{						
		if (http_request.status == 200)
		 {
			var i=1;
			var itemtypelist= document.ItemForm.itemType;
			itemtypelist.options[0]= new Option("All Products","All Products");
			var responseDoc= http_request.responseXML;
		 	var docs = responseDoc.getElementsByTagName("DOCUMENT");	
			var noOfDocuments = docs.length;
			var fields;	
			for(count=0;count<noOfDocuments;count++)			
		 	{				
				fields = docs[count].getElementsByTagName("FIELD");	
				for(fieldCount=0;fieldCount<fields.length;fieldCount++)
				{				
					var itemType = fields[fieldCount].getAttribute("name");	
					if(itemType == 'itmtypmstritemtypename')
					{						
						var itemTypeData = fields[fieldCount].firstChild.nodeValue;						
						itemTypeData = replace(itemTypeData);	
						if(itemTypeData.constructor == Array)
							itemTypeData = itemTypeData[0];
						allItemType[i-1] = itemTypeData;
						//itemTypeData = itemTypeData.toUpperCase();
						itemtypelist.options[i]= new Option(itemTypeData,itemTypeData);
						i++;
					}	
				}				
			}			
		}								 	
	}
}
// function called on click of seach button...		
function fnSearch(itemAlphabet,forwardURL,itemTypeId)
 {
	 itemAlphabet = itemAlphabet.toLowerCase();
	if(document.ItemForm.itemType.value == 'All Products' && document.ItemForm.keyword.value=="")
	 {
		setAllCategory('');
	 }
	 else
	{
		 if(document.ItemForm.itemType.value == 'All Products')
		 {
			document.ItemForm.itemType.value = "";
		 }
		 var keyword = document.ItemForm.keyword.value;
		 keyword= replaceScript(keyword);
		 // removing dependencies of ato z search from keyword....
		 if(itemAlphabet=="" || itemAlphabet==null)
		{
			  document.ItemForm.keyword.value=keyword;		 
		 }
		 else
		{
		 document.ItemForm.keyword.value="";
		}
		 
		document.ItemForm.itemnameatoz.value = itemAlphabet;
		document.ItemForm.bookItemTypeId.value = itemTypeId;
		document.ItemForm.allChild.value="0";
		document.ItemForm.action=forwardURL;	
		document.ItemForm.submit();
		tagcloudImpl(keyword);
	}
}

// function that displays the AtoZSearch Div
function setAtoZSearch()
{
	if(document.ItemForm.itemType.value == 'All Products' && document.ItemForm.keyword.value=="")
	 {
		 document.getElementById('atozsearch').style.display='none';
	 }
	 else
	{
	document.getElementById('atozsearch').style.display='block';
	}
}
// function that hides the AtoZSearch Div
function fnCloseAtoZSearch()
{
	document.getElementById('atozsearch').style.display='none';
}

// ask bhavisa abt this.....
function fngetCurrDateTime()
{
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	var hours = currentTime.getHours();
	var minutes = currentTime.getMinutes();
	var seconds = currentTime.getSeconds();
	if (minutes < 10)
	minutes = "0" + minutes;
	if (seconds < 10)
	seconds = "0" + seconds;
	var dateTime=day+"/"+month+"/"+year+"/"+hours+"/"+minutes+"/"+seconds;
	return dateTime;
}

// this function is called when serach is made from the get search result.jsp
//ie. related item search or keyword search
function searchRelatedItem(itemId,keyword)
{	
	//for search from here flag false is passed ....
	document.ItemForm.keyword.value=keyword;	
	document.getElementById('searchResultsTable').style.display='block';	
	document.getElementById('ItemDescriptionTable').style.display='none';
	document.getElementById(searchClearDivItemId).style.display='none';
	document.getElementById('additionalDetails').style.display='none';		
	document.getElementById('feedback').style.display='none';
	document.getElementById('recommend').style.display='none';
	document.getElementById('additionalDetailsLink').className="";
	document.getElementById('allSearchResultsOnlyLink').className="current";
	itemSearchResult("0",itemId,"false");
}
// function that fills the attributes in the book layout/gift layout etc.....
function fillSelectedItemType(http_request_setItemType,requiredItemType,orgID,entityTypeId)
{
	if (http_request_setItemType.readyState == 4)
	{			
		if (http_request_setItemType.status == 200)
		 {
			var itemtypelist= document.ItemForm.itemType;
			itemtypelist.options[0]= new Option(requiredItemType,requiredItemType);		
			var responseDoc= http_request_setItemType.responseXML;
			var docs = responseDoc.getElementsByTagName("DOCUMENT");	
			var noOfDocuments = docs.length;
			var fields;
			var i=1;
			var j =1;
			for(count=0;count<noOfDocuments;count++)			
		 	{				
				fields = docs[count].getElementsByTagName("FIELD");				
				for(fieldCount=0;fieldCount<fields.length;fieldCount++)
			 	{		 					
					var itemType = fields[fieldCount].getAttribute("name");	
					if(itemType == 'itmtypmstritemtypeid')
					{
						book_ItemType_ID = fields[fieldCount].firstChild.nodeValue;
						book_ItemType_ID = replace(book_ItemType_ID);
					}
					if(itemType == 'attributes')
					{						
				 		var attributes = fields[fieldCount].firstChild.nodeValue;	
						if(!attributes == "")
						{
							attributes = replace(attributes);	
							var attribute = attributes.split("#");
							for(attCount=0;attCount<attribute.length-1;attCount++)
							{
								if(attribute[attCount].toLowerCase()=='author' || attribute[attCount].toLowerCase()=='publisher' ||  attribute[attCount].toLowerCase()=='isbn')
								{
									//attribute[attCount] = attribute[attCount].toUpperCase();
									itemtypelist.options[j]= new Option(attribute[attCount],attribute[attCount]);
									j++;
								}
								i++;
							}


				   		}										 	
					}
				}
			}
		 }			
	}
}
// function that removes zeros from the price that were  added to make the range search work....
function removeZeros(dataFromIndex){	
	var len = dataFromIndex.length;
	var value1 = '';
	var findIndex = -1;
	if(dataFromIndex == '000000000000000000000000000.00')
	{
		dataFromIndex = '0';	
		return dataFromIndex;
	}
	for(j=0;j<len;j++){
		value1 = dataFromIndex.substring(j,j+1);				
		if(eval(value1) != 0){			
			findIndex = dataFromIndex.indexOf(value1);			
			break;
		}
	}

	dataFromIndex = dataFromIndex.substring(findIndex);	
	return dataFromIndex;
}

// function that replaces "</script>" from keyword....
function replaceScript(str)
{	
	str=str.toLowerCase();
	var string="";	
	var newstr = str.replace("<script>", "script");
	newstr=newstr.replace("</script>", "script");
	return newstr;
}
//function that decides whetere to show the AtoZsearch div in inner layout...
// for isbn author it is not diplayed for book music it is displayed....
function setAtoZSearchLayout(itemtype)
{
	var selectedValue = document.ItemForm.itemType.value;
	selectedValue = selectedValue.toLowerCase();
	itemtype = itemtype.toLowerCase();
	if(selectedValue == itemtype)
	 {
		 document.getElementById('atozsearch').style.display='block';
	 }
	 else
	{
	document.getElementById('atozsearch').style.display='none';
	}
}

//on click of advanced search this function is called
function showAdvancedSearchPage()
{
	var url = '/dotcom/'+gOrgFolder+'/jsp/search/AdvancedSearch.jsp?';	
	document.ItemForm.action=url;	
	document.ItemForm.submit();
}
// function that fills the itemtype in the advanced search page.....
function fillAdvancedItemType(http_request)
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		 {			
			var i=1;		
			var itemtypelistAdvanced= document.AdvancedSearchPageForm.itemType;		
			itemtypelistAdvanced.options[0]= new Option("All Products","All Products");
			var responseDoc= http_request.responseXML;
		 	var docs = responseDoc.getElementsByTagName("DOCUMENT");	
			var noOfDocuments = docs.length;
			var fields;	
			for(count=0;count<noOfDocuments;count++)			
		 	{				
				fields = docs[count].getElementsByTagName("FIELD");				
				for(fieldCount=0;fieldCount<fields.length;fieldCount++)
			 	{						
					
					var itemType = fields[fieldCount].getAttribute("name");									
					if(itemType == 'itmtypmstritemtypename')
					{						
						var itemTypeData = fields[fieldCount].firstChild.nodeValue;						
						itemTypeData = replace(itemTypeData);	
						allItemType[i-1] = itemTypeData;	
						//itemTypeData = itemTypeData.toUpperCase();					
						itemtypelistAdvanced.options[i]= new Option(itemTypeData,itemTypeData);	
						i++;
					}
				}				
			}
		}
	}
}
// function that fills the categories in the advanced search page.....	
function fillCategoryInAdvancedSearch(http_request_category)
{	
	if (http_request_category.readyState == 4)
	{			
		if (http_request_category.status == 200)
		 {
			var i=1;
			var categoryList= document.AdvancedSearchPageForm.categoryID;
			categoryList.options.length=0;
			categoryList.options[0]= new Option("All Category","All Category");	
			var responseDoc= http_request_category.responseXML;		 
			var docs = responseDoc.getElementsByTagName("DOCUMENT");	
			var noOfDocuments = docs.length;		
			var fields;	
			var categoryIdData = new Array();
			var categoryNameData = new Array();
			for(count=0;count<noOfDocuments;count++)			
		 	{				
				fields = docs[count].getElementsByTagName("FIELD");				
				for(fieldCount=0;fieldCount<fields.length;fieldCount++)
			 	{					
					var categoryName = fields[fieldCount].getAttribute("name");		
					if(categoryName == 'catviewcategoryid')
					{
						categoryIdData[count] = fields[fieldCount].firstChild.nodeValue;
						categoryIdData[count] = replace(categoryIdData[count]);
						//categoryIdData[count] = categoryIdData[count].toUpperCase();
					}
					if(categoryName == 'catviewcategoryname')
					{
						categoryNameData[count] = fields[fieldCount].firstChild.nodeValue;
						categoryNameData[count] = replace(categoryNameData[count]);
						//categoryNameData[count] = categoryNameData[count].toUpperCase();
	
					}					
					categoryList.options[i]= new Option(categoryNameData[count],categoryIdData[count]);
				}
				i++;							
			}			
		}
	}					
}
// method that display the addtional search criteria depending upon the itemtype selected....
function fnShowHideDivInAdvancedSearch(selectedItemType)
{	
	//alert("recieved..selectedItemType..."+selectedItemType);
	document.getElementById('books').style.display='none';
	document.getElementById('gifts').style.display='none';
	document.getElementById('music').style.display='none';
	document.getElementById('multimedia').style.display='none';
	document.getElementById('stationery').style.display='none';
	document.getElementById('gobutton').style.display='none';

	if(selectedItemType=="All Products")
	{
		document.getElementById('gobutton').style.display='block';
	}
	else
	{
		selectedItemType = selectedItemType.toString();
		selectedItemType = selectedItemType.toLowerCase();
		//alert("selectedItemType..."+selectedItemType);
		if (document.getElementById(selectedItemType).style.display=='block')
		{
		  document.getElementById(selectedItemType).style.display='none';
		 
		}
		else
		{
		  document.getElementById(selectedItemType).style.display='block';
		  document.getElementById('gobutton').style.display='block';	
		  
		}
	}
	 
	// seting all previous selected values to blank......
	document.AdvancedSearchPageForm.title1.value='';
	document.AdvancedSearchPageForm.author1.value='';
	document.AdvancedSearchPageForm.publisher1.value='';
	document.AdvancedSearchPageForm.isbn1.value='';;

	// setting the radio button depending upon the itemtype selected from the drop down...
	//var fieldLen = document.AdvancedSearchPageForm.RadioGroup1.length;	
	//for(count=0;count<fieldLen;count++)
	//{
		//if(document.AdvancedSearchPageForm.RadioGroup1[count].value.toLowerCase()==selectedItemType)
		//{
			//document.AdvancedSearchPageForm.RadioGroup1[count].checked=true;
		//}
		//else
		//{
		//document.AdvancedSearchPageForm.RadioGroup1[count].checked=false;
		//}
	//}
}
// function that sets the itemtype and other search criteria depending upon the radio button selected.....
function setAdvacedSeacrhItemType()
{
	
	//var fieldLen = document.AdvancedSearchPageForm.RadioGroup1.length;	
	//var itemtype="";
	//for(count=0;count<fieldLen;count++)
	//{		
		//if(document.AdvancedSearchPageForm.RadioGroup1[count].checked)
		//{
			//itemtype = document.AdvancedSearchPageForm.RadioGroup1[count].value;
			//break;
		//}
	//}	
	
	var itemtypeLen = document.AdvancedSearchPageForm.itemType.options.length;
	for(count=0;count<itemtypeLen;count++)
	{
		
		
		itemtype = itemtype.toLowerCase();
		if(document.AdvancedSearchPageForm.itemType.options[count].value.toLowerCase()==itemtype)
		{
			document.AdvancedSearchPageForm.itemType.options[count].selected=true;
			break;
		}
	}
	setCategoryInAdvancedSearch(itemtype);
}

//function thats called on click of advanced search....

function fnSearchFromAdvancedSearch(forwardURL)
 {
	if(document.AdvancedSearchPageForm.itemType.value=='All Products' && document.AdvancedSearchPageForm.categoryID.value == '-1' && document.AdvancedSearchPageForm.price.value=="-1" && document.AdvancedSearchPageForm.keyword.value=="" && document.AdvancedSearchPageForm.title1.value=="" && document.AdvancedSearchPageForm.author1.value=="" && document.AdvancedSearchPageForm.publisher1.value=="" && document.AdvancedSearchPageForm.isbn1.value=="")
	 {
		setAllCategory('');
	 }
	 else
	 {
	 	document.AdvancedSearchPageForm.isFromAdvancedSearch.value="1";
		 if(document.AdvancedSearchPageForm.itemType.value=='All Products')
	 	{
			document.AdvancedSearchPageForm.itemType.value = "";
		 } 
		 if(document.AdvancedSearchPageForm.categoryID.value == 'All Category' || document.AdvancedSearchPageForm.categoryID.value == '-1')
	 	{
			document.AdvancedSearchPageForm.categoryID.value = "";
			document.AdvancedSearchPageForm.category.value = "";
			document.AdvancedSearchPageForm.allChild.value = "0";
		 } 
	 	else
	 	{
			document.AdvancedSearchPageForm.category.value = document.AdvancedSearchPageForm.categoryID[document.AdvancedSearchPageForm.categoryID.selectedIndex].text; 
			document.AdvancedSearchPageForm.allChild.value = "1";
	 	}
	 
		if(document.AdvancedSearchPageForm.price.value == '[Select One]' || document.AdvancedSearchPageForm.price.value=="-1")
		{
			document.AdvancedSearchPageForm.price.value = "";
		}			
		 var keyword = document.AdvancedSearchPageForm.keyword.value;
		 keyword= replaceScript(keyword);
		 document.AdvancedSearchPageForm.keyword.value=keyword;	
		 var title1 = document.AdvancedSearchPageForm.title1.value;
		 title1= replaceScript(title1);
		 document.AdvancedSearchPageForm.title1.value=title1;	
	 	var author1 = document.AdvancedSearchPageForm.author1.value;
		 author1= replaceScript(author1);
		 document.AdvancedSearchPageForm.author1.value=author1;	
		 var publisher1 = document.AdvancedSearchPageForm.publisher1.value;
		 publisher1= replaceScript(publisher1);
		 document.AdvancedSearchPageForm.publisher1.value=publisher1;	
		 var isbn1 = document.AdvancedSearchPageForm.isbn1.value;
		 isbn1= replaceScript(isbn1);
		 document.AdvancedSearchPageForm.isbn1.value=isbn1;		
		document.AdvancedSearchPageForm.action=forwardURL;
		document.AdvancedSearchPageForm.submit();
	}
}
//function thats called when some one clicks on the itemimage to see item description.....
function fnShowDetails(itemID,itemName,imageSrc,authorName,itemPrice,itemPriceUsd,shippingInfo,bindingInfo)
{

if (authorName && authorName!='UNKNOWN')
{
	document.title = itemName + " By " + authorName;
}
else
{
	document.title = itemName ;
}

searchClearDivItemId=itemID;
searchClearDivItemName=itemName;
searchimageSrc = imageSrc;
searchauthorName= authorName;
searchitemPrice= itemPrice;
searchitemPriceUsd= itemPriceUsd;
searchshippingInfo= shippingInfo;
searchbindingInfo=bindingInfo;
//imageSrc = ;
//authorName = ;
//itemPrice = ;
//itemPriceUsd = ;
//shippingInfo = ;
//bindingInfo = ;






document.getElementById('searchResultsTable').style.display='none';		
document.getElementById('ItemDescriptionTable').style.display='block';
document.getElementById(itemID).style.display='block';
document.getElementById('additionalDetails').style.display='block';		
document.getElementById('feedback').style.display='block';
document.getElementById('recommend').style.display='block';
document.getElementById('additionalDetailsLink').className="current";
document.getElementById('allSearchResultsOnlyLink').className="";
document.getElementById('pageLabels').style.display='none';	
//rahul
	addfeedback(itemID,itemName);	
	getShippingTime(itemID);
	getCustomerRelatedItems(itemID);
}
//funvtion that is called when some one clicks on the my serch link.. from the description page...
function fnDisplaySerachResultsOnly()
{
document.getElementById('searchResultsTable').style.display='block';	
document.getElementById('ItemDescriptionTable').style.display='none';
document.getElementById(searchClearDivItemId).style.display='none';
document.getElementById('additionalDetails').style.display='none';		
document.getElementById('feedback').style.display='none';
document.getElementById('recommend').style.display='none';
document.getElementById('additionalDetailsLink').className="";
document.getElementById('allSearchResultsOnlyLink').className="current";
document.getElementById('pageLabels').style.display='block';	
document.getElementById('feedbackLink').className="";
document.getElementById('recommendLink').className="";
document.getElementById('FeedBackTable').style.display='none';
document.getElementById('RecommendTable').style.display='none';
clearDIV('AddEdit1'+searchClearDivItemId);
clearDIV('RecommendItem'+searchClearDivItemId);
}
function feedbackCall()
{
document.getElementById('additionalDetailsLink').className="";
document.getElementById('feedbackLink').className="current";
document.getElementById('recommendLink').className="";
document.getElementById('FeedBackTable').style.display='block';
clearDIV('AddEdit1'+searchClearDivItemId);
clearDIV('RecommendItem'+searchClearDivItemId);
addfeedbackAdd(searchClearDivItemId,searchClearDivItemName);
}
function fnDisplayItemDescriptionOnly()
{
	document.getElementById('FeedBackTable').style.display='none';
		document.getElementById('RecommendTable').style.display='none';
	document.getElementById('additionalDetails').style.display='block';
	document.getElementById('additionalDetailsLink').className="current";
document.getElementById('allSearchResultsOnlyLink').className="";
document.getElementById('feedbackLink').className="";
document.getElementById('recommendLink').className="";
}
function recommendCall()
{
document.getElementById('additionalDetailsLink').className="";
document.getElementById('feedbackLink').className="";
document.getElementById('recommendLink').className="current";
document.getElementById('RecommendTable').style.display='block';
clearDIV('RecommendItem'+searchClearDivItemId);
clearDIV('AddEdit1'+searchClearDivItemId);
recommenditem(searchClearDivItemId,searchClearDivItemName,searchimageSrc,searchauthorName,searchitemPrice,searchitemPriceUsd,searchshippingInfo,searchbindingInfo);

}







function tagcloudImpl(keyword)
	{
        
		var requestProcessed = false;
        var xmlHttp;
 
    //try {
  //  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
   // } catch (e) {
  //  alert("Permission UniversalBrowserRead denied.");
  // }

    try
    {  
        // Firefox, Opera 8.0+, Safari  
        xmlHttp = new XMLHttpRequest();  
    }
    catch (e)
    {  // Internet Explorer  
        try
        {    
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");    
        }
        catch (e)
        {    
            try
            {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");      
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");      
                return false;
            }    
        }  
    }
    
    		//   alert('overe here');
     xmlHttp.open("POST","/dotcom/tagIndexAction.do?keyword="+keyword,true);
     xmlHttp.send(null);
     

	}

function setAuthor(authorname)
{
	
	document.AddToCart.author1.value=authorname;
	document.AddToCart.action="/dotcom/oxford/jsp/search/GetSearchResults.jsp";
       document.AddToCart.submit();
	
}

	

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) 
{	
	var x = Math.round(num * Math.pow(10,dec));
	if (x >= 0) 
		n1=n2='';
	var y = (''+Math.abs(x)).split('');
	var z = y.length - dec; 
	if (z<0) z--; 
	for(var i = z; i < 0; i++) y.unshift('0');
	y.splice(z, 0, pnt); 
	if(y[0] == pnt) y.unshift('0'); 
	while (z > 3) {
		z-=3; 
		y.splice(z,0,thou);
	}
	var r = curr1+n1+y.join('')+n2+curr2;
	return r;
}