var myAnim1 = null;var myAnim2 = null;var myAnim3 = null; var Global_HomePage=0;
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 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('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('ECAT_ID')
  if (locData != null){
      WindowEventLoad(locMainAddress)
      LocalInit()
      LocalInit_Anim()
  }else{setTimeout("TimerLoad()",100)}
}  
function LocalInit(){
   GlobalPopup_XPos = Utility_ScreenMiddle(1,400)
   GlobalPopup_YPos = 150
   GlobalPopup_ProductDetails = 1
   GlobalPopup_Login = 1
   GlobalPopup_Register = 1
   var locURL = document.URL.toLowerCase()	    
   if (locURL.indexOf('enquiry.html') != -1) { 
      var locObj = document.getElementById('Enquiry_Product')
      var locProduct = Utility_URLRetrieveParam('autofill','#')	
      if (locObj != null) {locObj.value = locProduct}
   }	     
   LocalDate()
   if (document.getElementById('Divider_Home')!=null){Global_HomePage=1}
}
function LocalDate(){var mydate=new Date();var year=mydate.getYear();if (year < 1000){year+=1900}
var day=mydate.getDay();var month=mydate.getMonth();var daym=mydate.getDate();if (daym<10){daym="0"+daym}
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var retDate = dayarray[day]+", "+montharray[month]+" "+daym+", "+year
document.getElementById('date').innerHTML=retDate
}


function LocalInit_Anim(){
   if (Global_HomePage==0){
     //document.getElementById('#Div_Top1').style.visibility='visible'
     //document.getElementById('#Div_Top2').style.visibility='visible'     
          return
   }	
 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)		
	
	var locObjTD=document.getElementById('TD_Main')	
	var x=Utility_getXpos(locObjTD)
	myAnim1.set('from', { xy:[1,65] , opacity:0 });	
	myAnim1.set('to', { xy: [x+275,65], opacity:1 });
	myAnim2.set('from', { xy:[1,95] , opacity:0 });	
	myAnim2.set('to', { xy: [x+275,95], opacity:1 });
	//myAnim3.set('from', { xy:[1,95] , opacity:0 });	
	//myAnim3.set('to', { xy: [x+275,125], opacity:1 });
	var locObjDiv = document.getElementById('Div_Top1')
	locObjDiv.style.visibility = 'visible'   
	myAnim1.run()
	myAnim1.on('end',handleEnd1)		
	myAnim2.on('end',handleEnd2)
  })
}

function Local_TopLink(pInfo1,pInfo2){
 if (pInfo1==1){WebDisplay_ItemDetails(pInfo2)}
 if (pInfo1==2){
	var locObj=document.getElementById('txtsearch')
	locObj.value=pInfo2
	LocalSearch('txtsearch')
}}
function Local_WindowAction(){
	LocalHide()
}
function LocalHide(){
 Utility_Hide('Div_Top1')
 Utility_Hide('Div_Top2')
 //Utility_Hide('Div_Top3')
}

function LocalEnquiry(pMode){
    if (pMode == 1){
	   var locURL = Utility_URL()
	   var lrt = WebDisplay_EnquiryForm('DwnCat_Divider',0,'',0,1)		   
	   if (lrt==1){
	      alert('Thank you for downloading our catalogue. This Download may take a few minutes.')	   
	      window.location.href = locURL+'/electrical_supplies_catalogue/Catalogue 2009 Electrahertz.pdf'
	   }   
	}
	else{
	   //-------- Download price list ---------
	   var locURL = Utility_URL()
	   var lrt = WebDisplay_EnquiryForm('DwnPrice_Divider',0,'',0,1)
	   if (lrt==1){	   
	      alert('Thank you for downloading our price list. This Download may take a few minutes.')	   
	      window.location.href = locURL+'/Download/WEB PRICE 2010.pdf'
	   }   
	}
}
function LocalCatalogueDisplaySummary(pType,pSection){
   var locID=null
   if (pSection==null||pSection.length==0||pSection==' '){locID=Guid_Empty}
   if (locID==null||locID.length==0){
   	  var locStatement = ''; var xmlString=''
   	  var locID = Guid_Empty
   	  if (pSection.length>0){
   	  	if (pType==3){
   	  		locStatement = 'SELECT ID,NAME,PARENTID FROM dbo.Category WHERE (NAME LIKE \'%'+pSection+'%\' AND ITEMLEVEL <= 2)'
            xmlString = DataFnc_LoadSQL('CATEGORY',1,'',16,locStatement,0,0)
        }    
   	  	if (pType==2){
   	  		locStatement = 'SELECT ID,NAME,PARENTID FROM dbo.Product WHERE (NAME LIKE \'%'+pSection+'%\' AND ITEMLEVEL <= 2)'
            xmlString = DataFnc_LoadSQL('PRODUCT',1,'',16,locStatement,0,0)
        }    

        locID = UtilityXML_ExtractValue(xmlString,'id')
   	  }
   }
   if (locID!=null&&locID.length>0){
      WebFnc_TransformItemSummary(pType,'Product_ChildrenSummary.xsl','Divider_ProductDetails',locID,pSection,'ID,PARENTID,CHILDCOUNT,ISLEAF,NAME,SEQUENCE,IMAGENAME,IMAGEPATH')
   }
}
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')
}	


