var myAnim1 = null;var myAnim2 = null;var myAnim3 = null;var myAnim4 = null;var myAnim5 = null;var myAnim6 = null                    
var myAnim7 = null;var myAnim8 = null;var myAnim9 = null;var myAnim10 = null;var GlobalPage=0; 
var GlobalInputID = 'txtsearch';var GlobalHomePage = 0;var GlobalImgBanner_Max = 2;var GlobalImgNew = '';var GlobalHTML = '';var GlobalSidBtnSelect = 0
var myAnimCounter = 0;var myAnimInactive = 0;var AnimArray = new Array();var locCount = 0
var TimerSidBtn = 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('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+'JavaScriptAnimation.js">');document.write('</sc'+'ript>')	
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>')
setTimeout("TimerLoad()",1000)
	
function TimerLoad(){
  var locData = document.getElementById('ProgressBar')
  if (locData != null){
      var locObjDiv = document.getElementById('Div_ImgBanner1')
      if (locObjDiv != null) {GlobalHomePage = 1}
      GlobalImgBanner_Array.push('images/banner/Banner_1.jpg')
      GlobalImgBanner_Array.push('images/banner/Banner_2.jpg')    
      LocalInit_Anim()  	  	        
      //GlobalDisplayDivider.push('Divider_Branding_ABUS')
      //GlobalDisplayDivider.push('Divider_Branding_SILCA')      
      WindowEventLoad(locMainAddress)
      LocalInit()
  }
  else{setTimeout("TimerLoad()",100)}
}  
function LocalInit(){
   GlobalPopup_XPos = Utility_ScreenMiddle(1,400)
   GlobalPopup_YPos = 100
   GlobalPopup_ProductDetails = 1
   GlobalPopup_Login = 1
   GlobalPopup_Register = 1
   var locURL = document.URL.toLowerCase()
   if (locURL.indexOf('newproduct.html') != -1){ 
   	  LocalTree_DisplaySection('NEW PRODUCTS')
   }	     
   if (locURL.indexOf('enquiry.html') != -1){ 
        var locObj = document.getElementById('Enquiry_Product')
        var locProduct = Utility_URLRetrieveParam('autofill','#')	
        if (locObj != null) {locObj.value = locProduct}
   }	              
   if (GlobalHomePage == 1) {Utility_Divider(1,'Divider_Main')}
   set_cookie('HomePage',GlobalHomePage)
}
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 LocalPage(pMode){
   Utility_Divider(2,'otherPages',1)		       
   Local_Hide()
   GlobalPage=0
	if (pMode == 1){
	   Utility_DividerAll(2,1) 
	   GlobalSidBtnSelect = 1
	   LocalCatalogueDisplaySummary(3,'Domestic Security')
	}
	if (pMode == 2){
       Utility_DividerAll(2,1)       
       GlobalSidBtnSelect = 2		
       LocalCatalogueDisplaySummary(3,'Commercial Security')
	}
	if (pMode == 3){
	   //--------- ABUS -------
	   GlobalPage=3
       Utility_DividerAll(2,1)       
       GlobalSidBtnSelect = 4
       LocalCatalogueDisplaySummary(2,'ABUS')
	}
	if (pMode == 4){
	   GlobalPage=4
       Utility_DividerAll(2,1)
	   LocalTree_DisplayProduct('SILCA','Product_Children.xsl')       
       setTimeout("LocalTimer_DisplaySILCA()",200)
       GlobalSidBtnSelect = 3
	}
	
}
function Local_WindowActionAfter(){
	Utility_Divider(2,'Divider_Branding_ABUS')	       
	Utility_Divider(2,'Divider_Branding_SILCA')	       
	if (GlobalPage==3){//ABUS
	  Utility_Divider(1,'Divider_Branding_ABUS')	       
    }		
	if (GlobalPage==4){//SILCA
	  Utility_Divider(1,'Divider_Branding_SILCA')	       
    }		
}	
function LocalCatalogueDisplaySummary(pType,pSection){
   var locID=null
   if (pSection==null||pSection.length==0){locID=Guid_Empty}
   var locStatement='';var xmlString=''
   if (locID==null||locID.length==0){
   	  if (pType=='2'){
         locStatement = 'SELECT ID,NAME,PARENTID FROM dbo.Product WHERE (NAME = \''+pSection+'\' AND ITEMLEVEL <= 1)'
         xmlString = DataFnc_LoadSQL('PRODUCT',1,'',16,locStatement,0,0)
   	  }
   	  if (pType=='3'){
         locStatement = 'SELECT ID,NAME,PARENTID FROM dbo.Category WHERE (NAME = \''+pSection+'\' AND ITEMLEVEL <= 3)'
         xmlString = DataFnc_LoadSQL('CATEGORY',1,'',16,locStatement,0,0)
      }
      var 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 LocalTimer_DisplaySILCA(){
   Utility_Divider(1,'Divider_Branding_SILCA')
}
function Local_Hide(){
  if (GlobalHomePage==1){
  	GlobalAnim_Page = 0
  	document.getElementById('Div_Banner').style.visibility='hidden'
  	document.getElementById('Div_Banner').style.position='absolute'
  	document.getElementById('Div_ImgBanner1').style.visibility='hidden'
  	document.getElementById('Div_ImgBanner1').style.position='absolute'
  	document.getElementById('Div_ImgBanner2').style.visibility='hidden'
  	document.getElementById('Div_ImgBanner2').style.position='absolute'
  }
}	
function LocalDirectHTML(pPage){
   var locVal = get_cookie('HomePage')
   GlobalHTML = ''
   if (locVal == 1 && pPage != 'index.html' && GlobalMainClosed == 0){
      GlobalHTML = pPage
      //Local_Hide()
      return
   }
   Utility_URLRedirect(pPage)   
}
function LocalTree_DisplaySection(pText){
	var locSection = pText
    var locStatement = 'SELECT ID,NAME,ISLEAF,WINSTYLE,CHILDCOUNT,ITEMLEVEL FROM dbo.Product WHERE (NAME = \''+locSection+'\' AND ITEMLEVEL <= 2)'
	var xmlString_Parent = DataFnc_LoadSQL('PRODUCT',1,'',16,locStatement,0,0)
	if (UtilityXML_isEmpty(xmlString_Parent)==false){
		var locParentID = UtilityXML_ExtractValue(xmlString_Parent,'id')
		var locName = UtilityXML_ExtractValue(xmlString_Parent,'name')
		WebFnc_TransformItemSummary(2,'Product_ChildrenSummary.xsl','Divider_ProductDetails',locParentID,locName,'ID,NAME,CODE,PARENTID,CHILDCOUNT,ISLEAF,IMAGENAME,IMAGEPATH')
	}	
}
function LocalTree_DisplayProduct(pText,pStylesheet){
	Local_Hide()
	var locText = pText
    var xmlString = DataFnc_LoadSQL(2,6,locText,4,'',990)
    //---------- Remove Child Count > 0 ---------------------
    xmlString = Utility_AjaxAdd(xmlString)
    var locLocate = '<parentname>'+pText+'</parentname>'
    var pos1 = xmlString.indexOf(locLocate)
    var pos2 = xmlString.indexOf('</response>',pos1)
    var pos3 = Utility_TextLocate(xmlString,'<response>',pos1)
    var locResponse = xmlString.substring(pos3,pos2)
    var locParentID = UtilityXML_ExtractValue(locResponse,'parentid')
    GlobalTimerParam1 = xmlString
    GlobalTimerParam2 = locText
    GlobalTimerParam3 = pStylesheet    
    GlobalTimerParam4 = locParentID
    ProgressImageDisplay(true)
    setTimeout("LocalTimer_Display()",100)
}
function LocalTimer_Display(){
    WebFnc_TransformItemChildren(GlobalTimerParam3,'Divider_ProductDetails',GlobalTimerParam1,980,200,1,0,GlobalTimerParam4,GlobalTimerParam2)		
    ProgressImageDisplay(false)
}
function LocalTreeTitle(pTitle){
	var locObj = document.getElementById('span_TreeTitle')
	if (locObj != null){locObj.innerHTML = pTitle}
}
function LocalSearch(pInputID,pKeyEvent){
  GlobalInputID = pInputID	
  if (pKeyEvent != null){
    if (pKeyEvent != null && pKeyEvent != 0){
    var locKey = Utility_EnterKey(pKeyEvent,'',1)
    if (locKey != 13) {return}
  } } 
  GlobalPage=0
  Local_Hide()
  ProgressImageDisplay(true)
  setTimeout("TimerSearch1()",100)	
}
function TimerSearch1(){
    var locFilter = '' 	
	WebDisplay_DataSearch('Search_Item.xsl','Divider_SearchDetails',2,GlobalInputID,locFilter,GlobalMemory_Search,Tree_RowPerPage('Tree_ecat'),1,'navsearch',null,'',0)
    ProgressImageDisplay(false)	
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

