var myAnim1 = null;var myAnim2 = null;var myAnim3 = null
var GlobalAnim = null;var locCount = 0
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>')
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('MainVariable_(ID)')
  if (locData == null){locData = document.getElementById('CatalogueID)')}
  if (locData != null){
      WindowEventLoad(locMainAddress)
      LocalInit_Anim()
      //LocalLoadSupplier()
      //LocalTreeInit(3)
      //LocalImgBanner_Display(1)
  }else{setTimeout("TimerLoad()",100)}
}  
function LocalInit_Anim(){
 YUI().use('anim', function(Y) {
    myAnim1 = new Y.Anim({node: '#Div_Top1',from: { opacity: 0},to: { opacity: 1 },easing: Y.Easing.backIn});
    myAnim2 = new Y.Anim({node: '#Div_Top2',from: { opacity: 0},to: { opacity: 1 },easing: Y.Easing.backIn});
    myAnim3 = new Y.Anim({node: '#Div_Top3',from: { opacity: 0},to: { opacity: 1 },easing: Y.Easing.backIn});
    function handleEnd1(){
	var locObjDiv = document.getElementById('Div_Top2')
	locObjDiv.style.visibility = 'visible'   
    	 myAnim2.run()
    }
    function handleEnd2(){
	var locObjDiv = document.getElementById('Div_Top3')
	locObjDiv.style.visibility = 'visible'   
    	
    	 myAnim3.run()
    }
    myAnim1.set('duration',0.5); 
    myAnim2.set('duration',0.5); 
    myAnim3.set('duration',0.5); 
	GlobalAnim = Y
	Y.one('#Div_Top1').setStyle('opacity',0)				
	Y.one('#Div_Top2').setStyle('opacity',0)		
	myAnim1.set('from', { xy:[1,65] , opacity:0 });	
	myAnim1.set('to', { xy: [470,65], opacity:1 });
	myAnim2.set('from', { xy:[1,95] , opacity:0 });	
	myAnim2.set('to', { xy: [470,95], opacity:1 });
	myAnim3.set('from', { xy:[1,95] , opacity:0 });	
	myAnim3.set('to', { xy: [470,125], opacity:1 });
	var locObjDiv = document.getElementById('Div_Top1')
	locObjDiv.style.visibility = 'visible'   
	myAnim1.run()
	myAnim1.on('end',handleEnd1)		
	myAnim2.on('end',handleEnd2)
  })
}

function LocalEnquiry(pMode){
    if (pMode == 1){
	   var locURL = Utility_URL()
	   alert('Thank you for downloading our catalogue. This Download may take a few minutes.')
	   var lrt = WebDisplay_EnquiryForm('DwnCat_Divider',1)		   
	   window.location.href = locURL+'/Cat_2009/Catalogue 2009 Electrahertz.pdf'
	}
	else{
	   //-------- Download price list ---------
	   var locURL = Utility_URL()
	   alert('Thank you for downloading our price list. This Download may take a few minutes.')
	   var lrt = WebDisplay_EnquiryForm('DwnPrice_Divider',1)
	   window.location.href = locURL+'/Download/WEB PRICE 2010.pdf'
	}
}
function LocalDisplayCategory(pType,pSection){
   LocalDisplayTree(1)
   Utility_DividerAll(2,1)
   Utility_Divider(2,'otherPages',1)
   var locObjSpan=document.getElementById('span_title')
   var locSection=pSection
   if(locSection.length==0){locSection='General Wholesaling'}
   Utility_ObjectWrite(locObjSpan,locSection)
   var locObjTree = document.getElementById('Tree_ecat')
   locObjTree.innerHTML=''
   var locTreeParam = Utility_TreeParam(0,locObjTree)
   locTreeParam = UtilityText_Replace(locTreeParam,'INIT[0]','INIT[1]')
   Utility_TreeParam(1,locObjTree,locTreeParam)
   if (pType==2){
      locStatement = 'SELECT ID,PARENTID,NAME FROM dbo.Company WHERE (Name = \''+pSection+'\')'
      xmlString = DataFnc_LoadSQL('COMPANY',1,'',16,locStatement,0,0)
      var locParentID = UtilityXML_ExtractValue(xmlString,'id')          
      locStatement = 'SELECT ID,PARENTID,NAME,ISLEAF,CHILDCOUNT,ITEMLEVEL FROM dbo.Product WHERE (CompanyID = \''+locParentID+'\' AND PARENTID IS NULL)'
      xmlString = DataFnc_LoadSQL('PRODUCT',1,'',16,locStatement,0,0)
   	WebDisplay_TreeSectionInsert(xmlString,'TreeBase','Tree_ecat',2,1,Guid_Empty)
   }
   if (pType==3){
     Tree_ParentSection('Tree_ecat',pSection)
     WebDisplay_TreeInit('Tree_ecat',1)
   }
}
function LocalDisplayTree(pMode){
  var locObjTree=document.getElementById('Tree_ecat')
  var locObjTD=document.getElementById('TD_tree')
  if (pMode==1){
  	  locObjTD.style.width='300px'
  	  Utility_Divider(1,'Divider_Catalogue',1)
  }	  
  if (pMode==2){
  	  locObjTD.style.width='1px'
  	  Utility_Divider(2,'Divider_Catalogue',1)  	  
  }
}
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)   
 WebDisplay_DataSearch('Search_Item.xsl','Divider_SearchDetails',2,GlobalInputID,'',GlobalMemory_Search,Tree_RowPerPage('Tree_ecat'),1,'','','ID, Name, Code, ChildCount, InfoAmount1, InfoAmount2, ImageName, ImagePath')
}	

