function TileCalc(){
	MyValue=(document.A2B.MQty.value*document.A2B.QtyM2.value)
	MyTest=MyValue+""
	if (MyTest.indexOf(".") > 0){
			MyValue=parseInt(MyValue)+1
	} 
	document.A2B.Qty.value=MyValue
	MyPrice=(Math.round((document.A2B.Qty.value*document.A2B.MyPrice.value)*100)/100)
	MyPrice=MyPrice.toFixed(2); 
	document.A2B.DisplayPrice.value=MyPrice
}

function M2Calc(){
	MyValue=(document.A2B.Qty.value/document.A2B.QtyM2.value)
	document.A2B.MQty.value=Math.round(MyValue*100)/100
	MyPrice=(Math.round((document.A2B.Qty.value*document.A2B.MyPrice.value)*100)/100)
	MyPrice=MyPrice.toFixed(2); 
	document.A2B.DisplayPrice.value=MyPrice
}

function NonTileCalc(){
	MyValue=(document.A2B.Qty.value)
	MyPrice=(Math.round((document.A2B.Qty.value*document.A2B.MyPrice.value)*100)/100)
	MyPrice=MyPrice.toFixed(2); 
	document.A2B.DisplayPrice.value=MyPrice
}


function SearchChange()
{
	MySearch=""
		
	if (TileSearch.Colour.options[TileSearch.Colour.selectedIndex].value!="")
	{
		MySearch=MySearch+" AND SearchColour='"+TileSearch.Colour.options[TileSearch.Colour.selectedIndex].value+"'";
	}
	
	if (TileSearch.Size.options[TileSearch.Size.selectedIndex].value!="")
	{
		MySearch=MySearch+" AND OTSsize='"+TileSearch.Size.options[TileSearch.Size.selectedIndex].value+"'";
	}
	
	if (TileSearch.Application.options[TileSearch.Application.selectedIndex].value!="")
	{
		MySearch=MySearch+" AND Application='"+TileSearch.Application.options[TileSearch.Application.selectedIndex].value+"'";
	}
	
	
	
	TileSearch.SearchArg.value=MySearch
	
	TileSearch.submit();
}

 function noAlpha(obj,tiles){
	reg = /[^0-9]/g;
	obj.value =  obj.value.replace(reg,"");
	if (tiles=='True') {M2Calc()} else {NonTileCalc()}
 }

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];}
}

function SwapImage(ImgID,fname,Bigfname) {
		// MM_swapImage(ImgID,'',fname,1);
		RangeImage.src=fname;
		lnk=document.getElementById("bigpiclink");
		lnk.href = Bigfname
}

function PopCalc(PackSize,PackPrice)
{
	safewin=window.open('/Calculator.asp?PackSize=' + PackSize + '&PackPrice=' + PackPrice, 'Calcwin', 'width=610, height=305, toolbar=0, directories=0, menubar=0, status=0, resizable=0, location=0, scrollbars=0, copyhistory=0')
}
