<!--
function jsClientWidth(){
	var intClientWidth;
	(document.body.clientWidth)? intClientWidth = document.body.clientWidth: intClientWidth = document.documentElement.clientWidth;
	return intClientWidth;
}

function jsMinWidth(){
	var tooNarrow, tooWide;
	tooNarrow = jsClientWidth() <= 856;
	tooWide = jsClientWidth() >= 857;
	
	// this strange 2px gap fixes a bug in IEwhen the bottom scrollbar appears and changes the dimension of the window
	if (tooNarrow) document.getElementById('container').style.width = '900px';
	else if (tooWide) document.getElementById('container').style.width = '100%';
}

function jsDealWithTableLikeDisplay(nbCell, isHomePage){
	if(isHomePage) { jsDisplayTableLikeCell(Math.floor(nbCell/2),2,nbCell,280); }
	else with (window.location.toString()) {
		if(search("/shop/categories")>=0 || search("categories_preview.asp")>=0) {
			jsDisplayTableLikeCell(nbCell,3,nbCell,167);
		}
	}
	
}

function jsDisplayTableLikeCell(maxCell, minCell, nbCell, cellWidth){
	var cellPerRow;
	(document.body.clientWidth)?cellPerRow = Math.floor((document.body.clientWidth - 305)/cellWidth):cellPerRow = Math.floor((document.documentElement.clientWidth - 305)/280);
	cellPerRow = Math.min(cellPerRow,maxCell);
	cellPerRow = Math.max(cellPerRow,minCell);
	
	for(i=1;i<=nbCell;i++){
		if(document.getElementById('cellBubble'+i)) {
			with(document.getElementById('cellBubble'+i).style){
				//width = Math.floor(100/cellPerRow) + "%";
				width = (Math.floor(10000/cellPerRow)/100) + "%";
				visibility = "visible";
			}
		}
		if(document.getElementById('cell'+i)) {
			switch(i % cellPerRow) {
			case 0:
				with(document.getElementById('cell'+i).style){
					marginRight = "0px";
					marginLeft = "3px";
				}
				break    
			case 1:
				with(document.getElementById('cell'+i).style){
					marginRight = "3px";
					marginLeft = "0px";
				}
				break
			default:
				with(document.getElementById('cell'+i).style){
					marginRight = "5px";
					marginLeft = "5px";
				}			
			}
		}
	}
}

function jsDisplayStoreFinder(){
	var workPlaceWidth;
	(document.body.clientWidth)?workPlaceWidth = document.body.clientWidth - 305:workPlaceWidth = document.documentElement.clientWidth - 305;
	//alert(workPlaceWidth);
	if(document.getElementById('divStoreInfo')) {
		if(workPlaceWidth>760) {
			with(document.getElementById('divStoreInfo').style){
				//styleFloat = 'right';
				width = '60%';
				marginLeft = '-100px';
				position = 'relative';
				left = '-20px';	
				visibility = 'visible';	
			}
			with(document.getElementById('frmStoreList1').style){
				paddingRight = '60%';
				paddingLeft = '50px';
			}
			with(document.getElementById('divDynamicMap').style){
				styleFloat = 'left';
				width = '40%';
				visibility = 'visible';
				marginRight = '-50px';
			}
			document.getElementById('divDynamicMapHideMe').style.marginTop = '0px';
			
		} else {
			with(document.getElementById('divStoreInfo').style){
				//styleFloat = 'none';
				width = '100%';
				marginLeft = '0px';
				position = 'relative';
				left = '0px';
				visibility = 'visible';
			}
			with(document.getElementById('frmStoreList1').style){
				paddingRight = '0';
				paddingLeft = '0';
			}
			document.getElementById('divDynamicMap').style.visibility = 'hidden';
			document.getElementById('divDynamicMapHideMe').style.marginTop = '-500px';
		}
	}
}

function jsSwitchPriceTo() {
	var i, strVATOld, strVATNew;
	with(document.getElementById('ancSwitchPrice')){
		if(innerHTML) {
			(trimAll(innerHTML) == "Show Inc VAT prices")? strVATNew = "Inc": strVATNew = "Exc";
		} else {
			(trimAll(innerText) == "Show Inc VAT prices")? strVATNew = "Inc": strVATNew = "Exc";
		}
	}
	
	i = 1;
	(strVATNew == 'Inc')? strVATOld = "Exc": strVATOld = "Inc";
	while ((document.getElementById('priceIncVAT' + i)) && (document.getElementById('priceExcVAT' + i))){
		document.getElementById('price' + strVATOld + 'VAT' + i).style.visibility = 'hidden';
		document.getElementById('price' + strVATNew + 'VAT' + i).style.visibility = 'visible';
		i++;
	}
	(strVATNew == "Exc")?strVATNew = "Ex": strVATOld = "Ex";
	with(document.getElementById('priceHeader')){
		(innerHTML)? innerHTML = "Price " + strVATNew + ".&#160;VAT": innerText = "Price " + strVATNew + ".&#160;VAT";
	}
	with(document.getElementById('ancSwitchPrice')){
		(innerHTML)? innerHTML = "Show  " + strVATOld + " VAT prices": innerText = "Show  " + strVATOld + " VAT prices";
	}
}

function leftTrim(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	return sString;
}

function rightTrim(sString) {
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function replacePlus(sString, sOld, sNew) {
	while (sString.match(sOld)) {
		sString = sString.substring(0,sString.indexOf(sOld)) + sNew + sString.substring(sString.indexOf(sOld) + sOld.length);
	}
	return sString
}

function trimAll(sString) {
	sString = escape(sString).toString();
	sString = sString.replace("\n", ' ');
	sString = sString.replace("\t", ' ');
	sString = replacePlus(sString,"%20"," ");
	sString = replacePlus(sString,"%09"," ");
	sString = replacePlus(sString,"%0A"," ");
	sString = rightTrim(leftTrim(sString));
	while (sString.match("  ")) {
		sString = sString.replace("  ", " ");
	}
	
	return sString
}
//-->

