    var locCount = 0
    var GlobalInputID = 'txtsearch'		            
	var myDomain = document.domain 
	var myURL = document.URL 
	if (myURL.toLowerCase().indexOf('.htm') != -1)
	{
	   var pu1 = myURL.lastIndexOf('/')  
	   var pu2 = myURL.lastIndexOf('\\')  
	   if (pu1 != -1 && pu1 > pu2)
	   {
		  myURL = myURL.substring(0,pu1) 
	   }
	   else
	   {
		  myURL = myURL.substring(0,pu2) 	   
	   }
	}
	var locAddress = myURL+'/Library/'
	var locMainAddress = myURL
	if(myDomain.toLowerCase().indexOf('localhost_ecat') != -1 || myURL.toLowerCase().indexOf('localhost_ecat') != -1)
	{
    	locMainAddress = 'http://localhost/onlinecatalogue/electronic%20catalogue' 
	    locAddress = 'http://localhost/onlinecatalogue/electronic%20catalogue/Library/' 
	}
	if(myDomain.toLowerCase().indexOf('websites_ecatalogue') != -1 || myURL.toLowerCase().indexOf('websites_ecatalogue') != -1)
	{
        locMainAddress = 'http://196.30.166.51/qaCatalogue'
        locAddress = 'http://196.30.166.51/qaCatalogue/Library/' 
	}
	document.write('<sc'+'ript')
	document.write(' type="text/javascript"')
	document.write(' language="JavaScript"')
	document.write(' src="'+locAddress+'JavaScriptWindowEvent.js">')
	document.write('</sc'+'ript>')
   //------------ JavaScriptLibrary.js ---------------
   document.write('<sc'+'ript')
   document.write(' type="text/javascript"')
   document.write(' language="JavaScript"')
   document.write(' src="'+locAddress+'JavaScriptLibrary.js">')
   document.write('</sc'+'ript>')
   //------------ JavaScriptDataFnc.js ---------------
   document.write('<sc'+'ript')
   document.write(' type="text/javascript"')
   document.write(' language="JavaScript"')
   document.write(' src="'+locAddress+'JavaScriptDataFnc.js">')
   document.write('</sc'+'ript>')
   //------------ JavaScriptTree.js ---------------
   document.write('<sc'+'ript')
   document.write(' type="text/javascript"')
   document.write(' language="JavaScript"')
   document.write(' src="'+locAddress+'JavaScriptTree.js">')
   document.write('</sc'+'ript>')
   //------------ JavaScriptUtility.js ---------------
   document.write('<sc'+'ript')
   document.write(' type="text/javascript"')
   document.write(' language="JavaScript"')
   document.write(' src="'+locAddress+'JavaScriptUtility.js">')
   document.write('</sc'+'ript>')
   //------------ JavaScriptBasket.js ---------------
   document.write('<sc'+'ript')
   document.write(' type="text/javascript"')
   document.write(' language="JavaScript"')
   document.write(' src="'+locAddress+'JavaScriptBasket.js">')
   document.write('</sc'+'ript>')
   setTimeout("TimerLoad()",1000)
	
function TimerLoad()
{
  var locData = document.getElementById('MainVariable_(ID)')
  if (locData == null)
  {
     locData = document.getElementById('CatalogueID)')
  }
  if (locData != null)
  {
      WindowEventLoad(locMainAddress)
      GlobalPopup_XPos = Utility_ScreenMiddle(1,400)
      GlobalPopup_YPos = 30
      LocalLoadSupplier()      
   }
  else
  {
          setTimeout("TimerLoad()",100)
  }
}  
function LocalTreeTitle(pTitle)
{
	var locObj = document.getElementById('span_TreeTitle')
	if (locObj != null)
	{
		locObj.innerHTML = pTitle
	}
}
function LocalTreeParentName(pTreeID,pSection)
{
	var locObjTree = document.getElementById(pTreeID)
	if (locObjTree != null)
	{
	   var locTreeParam = Utility_TreeParam(0,locObjTree)
	   var locTreeParent = UtilityText_ExtractText(locTreeParam,'TreeParentName(',')') 
	   if (locTreeParent.length == 0)
	   {
	   	  locTreeParam = locTreeParam+'TreeParentName('+pSection+')'
	   }
       else
       {
       	  locTreeParam = UtilityText_Replace(locTreeParam,'TreeParentName('+locTreeParent+')','TreeParentName('+pSection+')')
       }
 	   Utility_TreeParam(1,locObjTree,locTreeParam)
	}
}
function LocalTree(pTreeID,pSection)
{
	LocalTreeTitle(pSection)
	LocalTreeParentName(pTreeID,pSection)
 	WebDisplay_TreeInit(pTreeID)	
}
function LocalSearch(pInputID,pKeyEvent){
	GlobalInputID = pInputID
	if (pKeyEvent != null)
	{
       if (pKeyEvent != null && pKeyEvent != 0)
       {
         var locKey = Utility_EnterKey(pKeyEvent,'',1)
         if (locKey != 13) {return}
       } 
    } 
   var locTitle = window.location.href
   var locSearch = document.getElementById(GlobalInputID)   
   if (locTitle.toLowerCase().indexOf('products') == -1 && locTitle.toLowerCase().indexOf('lighting') == -1 && locTitle.toLowerCase().indexOf('gallery') == -1)
   {
       setTimeout("LocalOnLoad()", 1000);
	   var locURL = Utility_URL()
       window.location.href = locURL+'/products.html?autosearch='+locSearch.value
   }    
   else{
	  WebSearch_Clear()
	  var locFilter = ''
	  var locList = document.getElementById('supplist')
	  if (locList != null)
	  {
		 var locIndex = locList.selectedIndex
		 if (locIndex > 0)
		 {
			locFilter = locList.options[locIndex].text
			locFilter = 'CompanyName = \''+locFilter+'\''
		 }   
	  }
	  WebDisplay_DataSearch('Search_Item.xsl','Divider_SearchDetails',2,GlobalInputID,locFilter,GlobalMemory_Search,Tree_RowPerPage('Tree_ecat'),1)
   }
}
function LocalLoadSupplier()
{
   var xmlString = DataFnc_LoadSQL('COMPANY',100,'',16,'SELECT ID,NAME,ParentID FROM dbo.Company WHERE (ParentID is NULL AND DATABASEID = \'EC-ZA-0-47\')',1)
   xmlString = DataFnc_FieldSort(xmlString,'name')
   Utility_ListFillXML('supplist',xmlString)
   locList = document.getElementById('supplist')
   if (locList != null)
   {
       var elOptNew = document.createElement('option')
       elOptNew.text = 'All Suppliers'
       elOptNew.value = ''
       locList.options.add(elOptNew,0)
       locList.selectedIndex = 0
   }   
}
