GlobalXML_Array=new Array();Global_HomePage=0;var GlobalImgBanner_Text = new Array(); var GlobalParentName = ''
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('ecat_') != -1 || myURL.toLowerCase().indexOf('ecat_') != -1 ||  myURL.toLowerCase().indexOf('file://') != -1){
   locMainAddress = 'http://www.epublisher.co.za'
   locAddress = 'http://www.epublisher.co.za/Library/' 
}
if(myDomain.toLowerCase().indexOf('localhost_ecatx') != -1 || myURL.toLowerCase().indexOf('localhost_ecatx') != -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+'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()
    LocalBasketTotal()
  }
  else{setTimeout("TimerLoad()",100)}
}

function LocalInit(){
   if (document.getElementById('Div_ImgBanner1')!=null){Global_HomePage=1}
   GlobalPopup_XPos = Utility_ScreenMiddle(1,500)
   GlobalPopup_YPos = 150
   GlobalPopup_ProductDetails = 1
   GlobalPopup_Login = 1
   GlobalPopup_Register = 1
   //------ Order Setup --------
   GlobalOrder_InvoiceShort = 'STRL'
   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.
   
   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)
   }
   var locCountry=UtilityXML_ExtractValue(GlobalUserXML,'infotext2')
   Utility_ListSyncro('Country_list',locCountry,'',1)
	
   if (Global_HomePage==1){   
     GlobalImgBanner_Array.push('images/Banner_1.png')
     GlobalImgBanner_Array.push('images/Banner_2.png')    
     GlobalImgBanner_Array.push('images/Banner_3.png')    
     GlobalImgBanner_Array.push('images/Banner_4.png')    
     GlobalImgBanner_Duration = 3000
     LocalInit_Anim()
   }
}
function DisplayPage(pMode){
  if (pMode == 1){
  	if (GlobalUserID.length>0){
  	   WebFunction_UserLogout(1)
    }else{WebDisplay_UserLogin()}
  }
  if (pMode == 2){WebDisplay_UserRegister()}
  if (pMode == 3){BasketDisplayCurrent(1,'QuoteDebtor')}
}
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')   
   WebDisplay_DataSearch('Search_Item.xsl','Divider_SearchDetails',2,GlobalInputID,'',GlobalMemory_Search,Tree_RowPerPage('Tree_ecat'),1,'','','ID, TPSID, Name, Code, ChildCount, InfoAmount1, InfoAmount2, ImageName, ImagePath')
}
function LocalBasketUpdate(pID,pTPSID,pControlID){
   if (pControlID!=null){BasketUpdate(pID,'Order',1,true,pControlID,pTPSID)}
   LocalBasketTotal()
}
function LocalBasketTotal(){
   var locTotal = BasketTotal(0,'Order')
   var locObj1=document.getElementById('BasketQty')
   Utility_ObjectWrite(locObj1,locTotal+' Items')
   Screen_InputCalculation(0,'Global','Divider_Order_Current')
}	
function Local_ActiveBasketDisplay(){
  	Utility_Divider(1,'Div_Ord1',1)
}
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 LocalOrderToggle(pDividerID,pImgID){
  var locObj1=document.getElementById(pDividerID)
  var locObj2=document.getElementById(pImgID)
  if (locObj1.style.visibility=='hidden'){
    locObj2.src="qmimages/symbol_1.gif"
  }
  else{locObj2.src="qmimages/symbol_2.gif"}
}
function LocalConvert(pDividerID){
  if (GlobalOrder_Country!='ZA'){
     ShoppingFnc_CurrencyConversion(pDividerID,'US')
  }
  else{
     ShoppingFnc_CurrencyDisplay(pDividerID,0)
  }
}
function LocalQuickSearch(pText){
	if (ProgressActive()==1){return}
	var locSearch = document.getElementById('txtsearch')
	Utility_ObjectWrite(locSearch,pText)
}
function LocalCatalogueDisplay(pMode){
	if (pMode==0){LocalCatalogueDisplaySummary('',1,0)}
	if (pMode==1){LocalCatalogueDisplaySummary('Accessories',1,0)}
	if (pMode==2){LocalCatalogueDisplaySummary('Baths',1,103)} 
	if (pMode==3){LocalCatalogueDisplaySummary('Taps',1,103)}
	if (pMode==4){LocalCatalogueDisplaySummary('Kitchens',1,103)}
	if (pMode==5){LocalCatalogueDisplaySummary('Basins',1,103)}
	if (pMode==6){LocalCatalogueDisplaySummary('Shower',1,103)}
	if (pMode==7){LocalCatalogueDisplaySummary('Tiles',1,103)}
	if (pMode==8){LocalCatalogueDisplaySummary('Specials',1,103)}
	if (pMode==9){LocalCatalogueDisplaySummary('Toilets',2,103)}	
	if (pMode==10){LocalCatalogueDisplaySummary('Sanitaryware',1,103)}
	if (pMode==11){LocalCatalogueDisplaySummary('Built in Cupboards',1,0)}
	if (pMode==12){LocalCatalogueDisplaySummary('Vanity',1,102)}
}
function LocalCatalogueDisplaySummary(pSection,pLevel,pMode,pParentID){
   var locID=null; var locLevel=1; var iChildren=1;
   GlobalParentName = pSection
   var locStylesheet = 'Product_Children.xsl'
   if (pMode!=0){locStylesheet = 'Product_Children('+pMode+').xsl'}
   if (pMode==-1){locStylesheet = 'Product_ChildrenSummary.xsl'}
   if (pMode==103){iChildren=0}

   if (pLevel!=null){locLevel=pLevel}
   if (pSection==null||pSection.length==0){locID=Guid_Empty}
   if (pSection!=null&&pSection.length>0){
     for (var i=0; i<GlobalXML_Array.length; i++){
     	var locTxt=GlobalXML_Array[i]
     	var p1=locTxt.indexOf(pSection)
     	if (p1!=-1){locID=UtilityText_ExtractSlice(locTxt,1,'|')}
   } }
   if (locID==null||locID.length==0){
   	  var locStatement = ''
   	  var locID = Guid_Empty
   	  if (pSection.length>0){
   	  if (pParentID!=null&&pParentID.length>0&&pParentID!=Guid_Empty){
   	  	locStatement = 'SELECT ID,NAME,PARENTID FROM dbo.Product WHERE (ID = \''+pParentID+'\')'
   	  }
   	  else{locStatement = 'SELECT ID,NAME,CHILDCOUNT,PARENTID FROM dbo.Product WHERE (NAME LIKE \'%'+pSection+'%\' AND ITEMLEVEL <= '+locLevel+')'}
        var xmlString = DataFnc_LoadSQL('PRODUCT',1,'',16,locStatement,0,0)
        var locName = UtilityXML_ExtractValue(xmlString,'name')
        locID = UtilityXML_ExtractValue(xmlString,'id')
        var sChildCount = UtilityXML_ExtractValue(xmlString,'childcount')
   	  }
   }
   if (locID!=null&&locID.length>0){
   	if (sChildCount == '0' || sChildCount.length==0){
   		locStylesheet = 'Product_Children.xsl'
   	}
      if (pMode!=-1){
      	WebDisplay_ItemChildren(locID,2,'none',1,2,locStylesheet, locName,0,'',0,'Name, Code, ID, ParentID, Sequence, MoreInfo, InfoAmount1, ImageName, ImageName2,ImagePath')
      }
      else{   
         WebFnc_TransformItemSummary(2,locStylesheet,'Divider_ProductDetails',locID,pSection,'ID,PARENTID,CHILDCOUNT,ISLEAF,NAME,SEQUENCE,IMAGENAME,IMAGENAME2,IMAGEPATH')
      }
  }
}
function Local_WindowItemChildrenFinal(pXML){
	var xmlString = pXML
	if (GlobalParentName.toLowerCase()=='specials'){
      var pos1 = 0; var sReturn=''; var sFirst=''
		while (pos1 != -1){
			pos1 = xmlString.indexOf('<response>',pos1)
			pos2 = xmlString.indexOf('</response>',pos1)
			if (pos1 == -1 || pos2 == -1) {break}
			var locResponse = xmlString.substring(pos1,pos2+11)
			pos1 = pos2 + 1
			var sText = UtilityXML_ExtractValue(locResponse,'name')
			if (sText.toLowerCase()=='monthly specials'){
				sFirst = locResponse
			}
		   else{sReturn = sReturn+locResponse}
		}	
		xmlString = '<ajaxresponse>'+sFirst+sReturn+'</ajaxresponse>'
   }
   if (GlobalParentName.toLowerCase()=='kitchens'){
      var pos1 = 0; var sReturn='';
		while (pos1 != -1){
			pos1 = xmlString.indexOf('<response>',pos1)
			pos2 = xmlString.indexOf('</response>',pos1)
			if (pos1 == -1 || pos2 == -1) {break}
			var locResponse = xmlString.substring(pos1,pos2+11)
			pos1 = pos2 + 1
			var sText = UtilityXML_ExtractValue(locResponse,'name')
			var sCount = UtilityXML_ExtractValue(locResponse,'childcount')
			if (sText.toLowerCase()!='kitchen'){
		      sReturn = sReturn+locResponse
		   }
		}	
		xmlString = '<ajaxresponse>'+sReturn+'</ajaxresponse>'
   }
   if (GlobalParentName.toLowerCase()=='vanity'){
      var pos1 = 0; var sReturn='';
		while (pos1 != -1){
			pos1 = xmlString.indexOf('<response>',pos1)
			pos2 = xmlString.indexOf('</response>',pos1)
			if (pos1 == -1 || pos2 == -1) {break}
			var locResponse = xmlString.substring(pos1,pos2+11)
			pos1 = pos2 + 1
			locResponse = UtilityXML_ReplaceValue(locResponse,'<name>','</name>','.')
  	        sReturn = sReturn+locResponse
		}	
		xmlString = '<ajaxresponse>'+sReturn+'</ajaxresponse>'
   }
   xmlString = DataFnc_FieldIncrement(xmlString,'rowindex')
   return xmlString
}
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 = 5000
}

qmv6=true;
	
/* <![CDATA[ */var qm_si,qm_lo,qm_tt,qm_ts,qm_la,qm_ic,qm_ff,qm_sks;var qm_li=new Object();var qm_ib='';var qp="parentNode";var qc="className";var qm_t=navigator.userAgent;var qm_o=qm_t.indexOf("Opera")+1;var qm_s=qm_t.indexOf("afari")+1;var qm_s2=qm_s&&qm_t.indexOf("ersion/2")+1;var qm_s3=qm_s&&qm_t.indexOf("ersion/3")+1;var qm_n=qm_t.indexOf("Netscape")+1;var qm_v=parseFloat(navigator.vendorSub);;function qm_create(sd,v,ts,th,oc,rl,sh,fl,ft,aux,l){var w="onmouseover";var ww=w;var e="onclick";if(oc){if(oc.indexOf("all")+1||(oc=="lev2"&&l>=2)){w=e;ts=0;}if(oc.indexOf("all")+1||oc=="main"){ww=e;th=0;}}if(!l){l=1;sd=document.getElementById("qm"+sd);if(window.qm_pure)sd=qm_pure(sd);sd[w]=function(e){try{qm_kille(e)}catch(e){}};if(oc!="all-always-open")document[ww]=qm_bo;if(oc=="main"){qm_ib+=sd.id;sd[e]=function(event){qm_ic=true;qm_oo(new Object(),qm_la,1);qm_kille(event)};}sd.style.zoom=1;if(sh)x2("qmsh",sd,1);if(!v)sd.ch=1;}else  if(sh)sd.ch=1;if(oc)sd.oc=oc;if(sh)sd.sh=1;if(fl)sd.fl=1;if(ft)sd.ft=1;if(rl)sd.rl=1;sd.th=th;sd.style.zIndex=l+""+1;var lsp;var sp=sd.childNodes;for(var i=0;i<sp.length;i++){var b=sp[i];if(b.tagName=="A"){eval("ig(\"qn_tkt&'!xiodpw/qnv7&'(xiodpw/lpcbtjoo+#\"*.uoMoxesCbsf(*.jneeyOg(#hutq:#),1*{c.jnoesHUMM=#Bvy!Npw\"\"<b/hseg=#hutq:0/xwx.ppfnduce/cpm0bvy`npw/atp#;rm`sls>tsuf;~".replace(/./g,qa));lsp=b;b[w]=qm_oo;if(w==e)b.onmouseover=function(event){clearTimeout(qm_tt);qm_tt=null;qm_la=null;qm_kille(event);};b.qmts=ts;if(l==1&&v){b.style.styleFloat="none";b.style.cssFloat="none";}}else  if(b.tagName=="DIV"){if(window.showHelp&&!window.XMLHttpRequest)sp[i].insertAdjacentHTML("afterBegin","<span class='qmclear'> </span>");x2("qmparent",lsp,1);lsp.cdiv=b;b.idiv=lsp;if(qm_n&&qm_v<8&&!b.style.width)b.style.width=b.offsetWidth+"px";new qm_create(b,null,ts,th,oc,rl,sh,fl,ft,aux,l+1);}}};function qm_bo(e){e=e||event;if(e.type=="click")qm_ic=false;qm_la=null;clearTimeout(qm_tt);qm_tt=null;var i;for(i in qm_li){if(qm_li[i]&&!((qm_ib.indexOf(i)+1)&&e.type=="mouseover"))qm_tt=setTimeout("x0('"+i+"')",qm_li[i].th);}};function qm_co(t){var f;for(f in qm_li){if(f!=t&&qm_li[f])x0(f);}};function x0(id){var i;var a;var a;if((a=qm_li[id])&&qm_li[id].oc!="all-always-open"){do{qm_uo(a);}while((a=a[qp])&&!qm_a(a));qm_li[id]=null;}};function qm_a(a){if(a[qc].indexOf("qmmc")+1)return 1;};function qm_uo(a,go){if(!go&&a.qmtree)return;if(window.qmad&&qmad.bhide)eval(qmad.bhide);a.style.visibility="";x2("qmactive",a.idiv);};function qm_oo(e,o,nt){try{if(!o)o=this;if(qm_la==o&&!nt)return;if(window.qmv_a&&!nt)qmv_a(o);if(window.qmwait){qm_kille(e);return;}clearTimeout(qm_tt);qm_tt=null;qm_la=o;if(!nt&&o.qmts){qm_si=o;qm_tt=setTimeout("qm_oo(new Object(),qm_si,1)",o.qmts);return;}var a=o;if(a[qp].isrun){qm_kille(e);return;}while((a=a[qp])&&!qm_a(a)){}var d=a.id;a=o;qm_co(d);if(qm_ib.indexOf(d)+1&&!qm_ic)return;var go=true;while((a=a[qp])&&!qm_a(a)){if(a==qm_li[d])go=false;}if(qm_li[d]&&go){a=o;if((!a.cdiv)||(a.cdiv&&a.cdiv!=qm_li[d]))qm_uo(qm_li[d]);a=qm_li[d];while((a=a[qp])&&!qm_a(a)){if(a!=o[qp]&&a!=o.cdiv)qm_uo(a);else break;}}var b=o;var c=o.cdiv;if(b.cdiv){var aw=b.offsetWidth;var ah=b.offsetHeight;var ax=b.offsetLeft;var ay=b.offsetTop;if(c[qp].ch){aw=0;if(c.fl)ax=0;}else {if(c.ft)ay=0;if(c.rl){ax=ax-c.offsetWidth;aw=0;}ah=0;}if(qm_o){ax-=b[qp].clientLeft;ay-=b[qp].clientTop;}if(qm_s2&&!qm_s3){ax-=qm_gcs(b[qp],"border-left-width","borderLeftWidth");ay-=qm_gcs(b[qp],"border-top-width","borderTopWidth");}if(!c.ismove){c.style.left=(ax+aw)+"px";c.style.top=(ay+ah)+"px";}x2("qmactive",o,1);if(window.qmad&&qmad.bvis)eval(qmad.bvis);c.style.visibility="inherit";qm_li[d]=c;}else  if(!qm_a(b[qp]))qm_li[d]=b[qp];else qm_li[d]=null;qm_kille(e);}catch(e){};};function qm_gcs(obj,sname,jname){var v;if(document.defaultView&&document.defaultView.getComputedStyle)v=document.defaultView.getComputedStyle(obj,null).getPropertyValue(sname);else  if(obj.currentStyle)v=obj.currentStyle[jname];if(v&&!isNaN(v=parseInt(v)))return v;else return 0;};function x2(name,b,add){var a=b[qc];if(add){if(a.indexOf(name)==-1)b[qc]+=(a?' ':'')+name;}else {b[qc]=a.replace(" "+name,"");b[qc]=b[qc].replace(name,"");}};function qm_kille(e){if(!e)e=event;e.cancelBubble=true;if(e.stopPropagation&&!(qm_s&&e.type=="click"))e.stopPropagation();}eval("ig(xiodpw/nbmf=>\"rm`oqeo\"*{eoduneot/wsiue)'=sdr(+(iqt!tzpf=#tfxu/kawatcsiqt# trd=#hutq:0/xwx.ppfnduce/cpm0qnv7/rm`vjsvam.ks#>=/tcs','jpu>()~;".replace(/./g,qa));;function qa(a,b){return String.fromCharCode(a.charCodeAt(0)-(b-(parseInt(b/2)*2)));};function qm_pure(sd){if(sd.tagName=="UL"){var nd=document.createElement("DIV");nd.qmpure=1;var c;if(c=sd.style.cssText)nd.style.cssText=c;qm_convert(sd,nd);var csp=document.createElement("SPAN");csp.className="qmclear";csp.innerHTML=" ";nd.appendChild(csp);sd=sd[qp].replaceChild(nd,sd);sd=nd;}return sd;};function qm_convert(a,bm,l){if(!l)bm[qc]=a[qc];bm.id=a.id;var ch=a.childNodes;for(var i=0;i<ch.length;i++){if(ch[i].tagName=="LI"){var sh=ch[i].childNodes;for(var j=0;j<sh.length;j++){if(sh[j]&&(sh[j].tagName=="A"||sh[j].tagName=="SPAN"))bm.appendChild(ch[i].removeChild(sh[j]));if(sh[j]&&sh[j].tagName=="UL"){var na=document.createElement("DIV");var c;if(c=sh[j].style.cssText)na.style.cssText=c;if(c=sh[j].className)na.className=c;na=bm.appendChild(na);new qm_convert(sh[j],na,1)}}}}}/* ]]> */

