var GlobalXML_Array=new Array();var Global_HomePage=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('ecat_') != -1 || myURL.toLowerCase().indexOf('ecat_') != -1){
   locMainAddress = 'http://www.epublisher.co.za' 
   locAddress = 'http://www.epublisher.co.za/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+'JavaScriptOrder.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+'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+'JavaScriptDataFnc.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()",200)
	
function TimerLoad(){
  var locData = document.getElementById('ECAT_ID')
  if (locData != null){
    WindowEventLoad(locMainAddress)
    LocalInit()
    if (Global_HomePage==1){LocalInit_Anim()}
  }
  else{setTimeout("TimerLoad()",100)}
}

function LocalInit(){
   GlobalPopup_XPos = Utility_ScreenMiddle(1,600)
   GlobalPopup_YPos = 160
   GlobalPopup_ProductDetails = 1
   GlobalPopup_Login = 1
   GlobalPopup_Register = 1
   //------ Order Setup --------
   GlobalOrder_InvoiceShort = 'TIA'
   GlobalOrder_CommissionTaken = 5
   GlobalOrder_PriceInclCommission = 1
   GlobalOrder_PriceInclTax = 1
   GlobalOrder_isTaxRegistered = 0
   GlobalOrder_OverseaDelivery = 0 
   GlobalOrder_LocalMinOrder = 0 //--- excl tax
   GlobalOrder_LocalDelivery = 150 //--- (Rand value) tax incl.
   GlobalOrder_OverseaMinOrder = 300 //--- (in US dollar) tax incl.
   GlobalOrder_OverseaDelivery = 0  //---- (rand Value) tax incl.
   if (document.getElementById('Div_ImgBanner1')!=null){Global_HomePage=1}
   var locObjCty=document.getElementById('country')
   var locValue = Utility_ObjectRead(locObjCty)
   if (locValue.indexOf('(ZA)')==-1){GlobalOrder_Country='';GlobalOrder_TaxPerc=0;GlobalOrder_Currency='$'}
   if (document.getElementById('slogan')!=null){Global_HomePage=1}
    var locURL = document.URL.toLowerCase()	 
    if (locURL.indexOf('contact_us.html') != -1) { 
       var locObj = document.getElementById('Enquiry_Product')
       var locProduct = Utility_URLRetrieveParam('autofill','#')	
       if (locObj != null&&locProduct!=null) {locObj.value = locProduct}
    }
   var p1=locURL.indexOf('(')
   var p2=locURL.indexOf('(')
   if (p1!=-1&&p2!=-1){
   	  var locIndex=UtilityText_ExtractText(locURL,'(',')')
      LocalCatalogueDisplay(locIndex)
   }
   GlobalImgBanner_Array.push('images/banner/Aircon_banner_1.jpg')
   GlobalImgBanner_Array.push('images/banner/Aircon_banner_2.jpg')    
   GlobalImgBanner_Array.push('images/banner/Aircon_banner_3.jpg')    
   GlobalImgBanner_Array.push('images/banner/Aircon_banner_4.jpg')       
}
function LocalLogin(){
    var locLogin=document.getElementById('login')
    if (GlobalUserID.length>0 && locLogin!=null){
       Utility_ObjectWrite(locLogin,'<a href="#" onclick="WebDisplay_UserRegister()">your are login as '+UtilityXML_ExtractValue(GlobalUserXML,'name')+'</a>')
    }
}
function DisplayPage(pMode){
  if (pMode == 1){WebDisplay_UserLogin()}
  if (pMode == 2){WebDisplay_UserRegister()}
  if (pMode == 3){BasketDisplayCurrent(1,'Order')}
}
function LocalQuickSearch(pText){
  if (document.getElementById('ProgressBar').style.visibility!='hidden'){return}
  var locSearch = document.getElementById('txtsearch')   
  Utility_ObjectWrite(locSearch,pText)
}
function LocalSearch(pInputID,pEvent){
   GlobalInputID = pInputID
   if (pEvent != null){
      var locKey = Utility_EnterKey(pEvent,pInputID,1)
      if (locKey != 13){return}
   }
   GlobalInputID = pInputID
   var locTitle = window.location.href
   var locSearch = document.getElementById('txtsearch')   
   var locStylesheet = 'Search_Item.xsl'
   WebDisplay_DataSearch(locStylesheet,'Divider_SearchDetails',2,GlobalInputID,'',GlobalMemory_Search,Tree_RowPerPage('Tree_ecat'),1,'','','ID, TPSID, Name, Code, ChildCount, InfoAmount1, InfoAmount2, ImageName, ImagePath')
}
function LocalCatalogueDisplaySummary(pSection){
   var locID=null
   if (pSection==null||pSection.length==0){locID=Guid_Empty}

   if (locID==null||locID.length==0){
      var locStatement = 'SELECT ID,NAME,PARENTID FROM dbo.Product WHERE (NAME LIKE \'%'+pSection+'%\' AND ITEMLEVEL <= 2)'
      var xmlString = DataFnc_LoadSQL('PRODUCT',1,'',16,locStatement,0,0)
      var locID = UtilityXML_ExtractValue(xmlString,'id')
   }
   if (locID!=null&&locID.length>0){
      WebFnc_TransformItemSummary(2,'Product_ChildrenSummary.xsl','Divider_ProductDetails',locID,pSection,'ID,PARENTID,CHILDCOUNT,ISLEAF,NAME,SEQUENCE,IMAGENAME,IMAGEPATH')
   }
}
function Local_WindowActionAfter(){
  if (GlobalTransform_Last.toLowerCase().indexOf('user_login.xsl')==-1 && GlobalTransform_Last.toLowerCase().indexOf('user_register.xsl')==-1){
     var locObj=document.getElementById('Divider_Main')
     if (locObj!=null){
  	   locObj.style.visibility='hidden'
  	   locObj.style.position='absolute'
  	   document.getElementById('slogan').style.visibility='hidden'
  } }  	   
}
function LocalQuickSearch(pText){
	if (ProgressActive()==1){return}
	var locSearch = document.getElementById('txtsearch')
	Utility_ObjectWrite(locSearch,pText)
}
function LocalCatalogueDisplay(pMode){
	if (pMode==0){LocalCatalogueDisplaySummary('')}
	if (pMode==1){LocalCatalogueDisplaySummary('VRF Market')}
    if (pMode==2){LocalCatalogueDisplaySummary('Package Airconditioner (PAC)')}		
	if (pMode==3){LocalCatalogueDisplaySummary('RAC - Room Airconditioner City Multi')}				
}
function LocalAnim_InsideInit(){
 var locObjDiv=document.getElementById('Divider_Side2')
 if (locObjDiv!=null){
 GlobalAnim.one('#Divider_Side2').setStyle('opacity',0.75)																	    
 locObjDiv.style.visibility='visible'
 }
}
function LocalImgBanner_InsideSelect(){
	   GlobalImgBanner_Duration = 7500
}
function LocalAnim_InsideMainEnd(){
	LocalAnim_InsideBannerEnd()
}
function LocalAnim_InsideBannerEnd(){
}

