var locCount = 0; var GlobalInputID=''
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 lng=myURL.length
if (myURL.substring(lng-1,lng)=='#'){myURL=myURL.substring(0,lng-1)}

var locAddress = myURL+'/Library/'
var locMainAddress = myURL
if(myDomain.toLowerCase().indexOf('websites_ecatalogue') != -1 || myURL.toLowerCase().indexOf('websites_ecatalogue') != -1 ||  myURL.toLowerCase().indexOf('file://') != -1){
   locMainAddress = 'http://196.30.166.51/qaCatalogue'
   locAddress = 'http://196.30.166.51/qaCatalogue/Library/' 
}
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/' 
}
document.write('<sc'+'ript');document.write(' type="text/javascript"');document.write(' language="JavaScript"');document.write(' src="'+locAddress+'JavaScriptWindowEvent.js">');document.write('</sc'+'ript>')
document.write('<sc'+'ript');document.write(' type="text/javascript"');document.write(' language="JavaScript"');document.write(' src="'+locAddress+'JavaScriptLibrary.js">');document.write('</sc'+'ript>')
document.write('<sc'+'ript');document.write(' type="text/javascript"');document.write(' language="JavaScript"');document.write(' src="'+locAddress+'JavaScriptDataFnc.js">');document.write('</sc'+'ript>')
document.write('<sc'+'ript');document.write(' type="text/javascript"');document.write(' language="JavaScript"');document.write(' src="'+locAddress+'JavaScriptTree.js">');document.write('</sc'+'ript>')
document.write('<sc'+'ript');document.write(' type="text/javascript"');document.write(' language="JavaScript"');document.write(' src="'+locAddress+'JavaScriptUtility.js">');document.write('</sc'+'ript>')
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('ECAT_ID')
  if (locData != null){
  	 GlobalTreeMaxLevel = 1
    WindowEventLoad(locMainAddress)
    LocalInit()
  }
  else{setTimeout("TimerLoad()",100)}
}  
function LocalInit(){
   GlobalPopup_XPos = Utility_ScreenMiddle(1,600)
   GlobalPopup_YPos = 150
   GlobalPopup_ProductDetails = 1
   GlobalPopup_Login = 1
   GlobalPopup_Register = 1
	
   var locURL = document.URL.toLowerCase()
 if (locURL.toLowerCase().indexOf('enquiry.html') != -1) {
 var locObj = document.getElementById('Enquiry_Product')
 var locProduct = Utility_URLRetrieveParam('autofill','#')	
 if (locObj != null) {locObj.value = locProduct}

}
   var locTitle = window.location.href
   if (locTitle.toLowerCase().indexOf('competition') != -1){WebDisplay_UserRegister('User_RegisterCompetition.xsl','Divider_RegisterCompetition')}
}
function LocalSearch(pInputID,pKeyEvent){
   if (pKeyEvent!=null){
      var locKey = Utility_EnterKey(event,'txtsearch',1)
      if (locKey != 13){return}
   }   
   GlobalInputID = pInputID
   var locTitle = window.location.href
   var locSearch = document.getElementById('txtsearch')   
   WebDisplay_DataSearch('Search_Item.xsl','Divider_SearchDetails',2,GlobalInputID,'',GlobalMemory_Search,Tree_RowPerPage('Tree_ecat'),1,'','','ID, Name, Code, ChildCount, InfoAmount1, InfoAmount2, ImageName, ImagePath')
}

function Local_TopLink(pInfo1,pInfo2){
   if (pInfo1==1){WebDisplay_ItemDetails(pInfo2)}
	if (pInfo1==2){
		var locObj=document.getElementById('txtsearch')
		locObj.value=pInfo2
		LocalSearch('txtsearch')
	}
}

