var borderColor="solid 1px #CCCCCC";var borderErrorColor="#FF0000";var borderGreenColor="#009900";var usrOrganizerListId;var usrOrganizerListName;var orgListEstimateId;var preferredChannelCode;var metricDefaults={'feet':{'door':{'height':7,'width':3,'trim':7,'other':4},'window':{'height':5,'width':3,'trim':4},'baseboard':{'height':6,'label':'Baseboards'},'shutter':{'height':5,'width':1}},'meters':{'door':{'height':2.1,'width':.9,'trim':17,'other':10},'window':{'height':1.5,'width':.9,'trim':18},'baseboard':{'height':16,'label':'Baseboards'},'shutter':{'height':1.5,'width':0.3}},'centimeter':{},'inch':{}};metricDefaults.feet.measurement=400;metricDefaults.meters.measurement=37.2;metricDefaults.centimeter.measurement=(37.2*100);metricDefaults.inch.measurement=(400*12);var intWallIDLabel={'roomDimL':'Length','roomDimW':'Width','roomDimH':'Height'};function createNewEstimator(parentListId){usrOrganizerListId=parentListId;estSteps.step=0;overlayWindow.showDiv({url:'/en/my-projects/estimator.html?usrOrganizerListId='+parentListId});}
var estWorker={getRec:function(index){if(index==undefined){index=myEstimator.dataIndex;}
return myEstimator.data[index];},isInterior:function(){return(myEstimator.dataIndex===0);},isExterior:function(){return(myEstimator.dataIndex===1);},setMyEstimator:function(myNewEstimator){myEstimator=myNewEstimator||{};if(myEstimator.isIntExt==undefined){myEstimator['isIntExt']='interior';}
if(myEstimator.isMetersFeet==undefined){if((vReqBean.domainCode==='valspar_lowes_ca')||(vReqBean.domainCode==='valspar_bandq_uk'))
myEstimator['isMetersFeet']='meters';else
myEstimator['isMetersFeet']='feet';}
if(vReqBean.domainCode==='valspar_bandq_uk'){var el=document.getElementById('calcExtWrap');if(el)el.style.visibility="hidden";}
if(myEstimator.hide_estimate_paint_primer==undefined){myEstimator['hide_estimate_paint_primer']=false;}
if(myEstimator.hide_estimate_contrasting_colors==undefined){myEstimator['hide_estimate_contrasting_colors']=false;}
if(myEstimator.hide_estimate_items_prep==undefined){myEstimator['hide_estimate_items_prep']=false;}
if(myEstimator.hide_estimate_items_paint==undefined){myEstimator['hide_estimate_items_paint']=false;}
if(myEstimator.dataIndex==undefined){myEstimator['dataIndex']=0;}
if(myEstimator.data==undefined){myEstimator['data']=[{id:"interior",walls:[],doors:[],windows:[],windowsDim:[],ceilingDim:[],floorDim:[],doorsDim:[],painting:[],roomDim:[],baseboardDim:[]},{id:"exterior",walls:[],doors:[],windows:[],windowsDim:[],ceilingDim:[],floorDim:[],doorsDim:[],painting:[],trim:[],fasciaDim:[],shuttersDim:[],shutters:[]}];}
if((usrOrganizerListName!=undefined)&&(usrOrganizerListName!=="")){$('#projectCalculationDiv').html('PROJECT CALCULATION for '+usrOrganizerListName);}else{$('#projectCalculationDiv').html('PROJECT CALCULATION');}},createShoppingListFromEstimate:function(){checkValsparUserCookie(function(){var jsonDocument=$.toJSON(myEstimator);shoppingList.createNew(usrOrganizerListId,jsonDocument);});},saveToOrganizer:function(){checkValsparUserCookie(function(){var thisClips;if(typeof clips!="undefined")
thisClips=clips;estWorker.ajaxSaveToOrganizer(function(){animateItemAdded.show();if(thisClips){thisClips.refreshShow(usrOrganizerListId);}});});},ajaxSaveToOrganizer:function(callback){var jsonDocument=$.toJSON(myEstimator);var data={localeId:vReqBean.localeId,estimateData:jsonDocument};if(usrOrganizerListId>0){data['usrOrganizerListId']=usrOrganizerListId;}
if(orgListEstimateId>0){data['listEstimateId']=orgListEstimateId;}
$.ajax({url:"/vservice/json/user/saveestimate",type:"POST",cache:false,async:false,data:(data),success:function(msg){var responseData;if((typeof(msg)=='object')&&msg.requestStatus){responseData=msg;}else{responseData=$.secureEvalJSON(msg);}
if(!responseData){alert("ERROR\n"+msg);}else if(responseData.requestStatus=="ok"){var alreadySet=orgListEstimateId;usrOrganizerListId=responseData.usrOrganizerListId;orgListEstimateId=responseData.organizerItemId;if(callback){callback.call();}
if(alreadySet!=orgListEstimateId){var n=topNav.addOneItem();var id_txt=document.getElementById("project"+usrOrganizerListId+"amount");if(id_txt){id_txt.innerHTML='('+n+')';clips.show(usrOrganizerListId);}
vReqBean.userCartCount=n;}}else{alert("ERROR2\n"+msg);}},error:function(XMLHttpRequest,textStatus,errorThrown){alert(errorThrown);}});},radio:function(obj){myEstimator.isMetersFeet=obj.id;changeMetrics();var inputList=allInputs();for(var i=0;i<inputList.length;i++){if(inputList[i].id=="doorDimH"){inputList[i].value=metricDefaults[obj.id].door.height;}else if(inputList[i].id=="doorDimW"){inputList[i].value=metricDefaults[obj.id].door.width;}else if(inputList[i].id=="doorDimT"){inputList[i].value=metricDefaults[obj.id].door.trim;}else if(inputList[i].id.slice(0,5)=="doorH"){inputList[i].value=metricDefaults[obj.id].door.height;}else if(inputList[i].id.slice(0,5)=="doorW"){inputList[i].value=metricDefaults[obj.id].door.width;}else if(inputList[i].id.slice(0,5)=="doorT"){inputList[i].value=metricDefaults[obj.id].door.trim;}else if(inputList[i].id=="winDimH"){inputList[i].value=metricDefaults[obj.id].window.height;}else if(inputList[i].id=="winDimW"){inputList[i].value=metricDefaults[obj.id].window.width;}else if(inputList[i].id=="winDimT"){inputList[i].value=metricDefaults[obj.id].window.trim;}else if(inputList[i].id.slice(0,4)=="winH"){inputList[i].value=metricDefaults[obj.id].window.height;}else if(inputList[i].id.slice(0,4)=="winW"){inputList[i].value=metricDefaults[obj.id].window.width;}else if(inputList[i].id.slice(0,4)=="winT"){inputList[i].value=metricDefaults[obj.id].window.trim;}else if(inputList[i].id=="BaseboardH"){inputList[i].value=metricDefaults[obj.id].baseboard.height;}else if(inputList[i].id=="shutterDimH"){inputList[i].value=metricDefaults[obj.id].shutter.height;}else if(inputList[i].id=="shutterDimW"){inputList[i].value=metricDefaults[obj.id].shutter.width;}}},addWall:function(){createWalls();changeMetrics();},removeWall:function(id){for(var i in estWorker.getRec(0).walls){if(i==id){estWorker.getRec(0)['walls'].splice(i,1);this.displayWalls();break;}}},displayWalls:function(){createWalls(true);changeMetrics();},addWallDim:function(obj){if(obj.value===""){if(obj.id.slice(0,5)=="wallL"){obj.value="Length";}else{obj.value="Height";}
obj.style.border=borderColor;}else{obj.style.border=borderColor;objL=document.getElementById('wallL'+obj.id.slice(5));objH=document.getElementById('wallH'+obj.id.slice(5));if((objL.value!=="")&&(objH.value!=="")){estWorker.getRec(0).walls[obj.id.slice(5)]=({length:objL.value,height:objH.value});}}},clearField:function(obj){if(isNaN(obj.value)){obj.style.border=borderColor;obj.focus();obj.value="";}},addDoor:function(){createDoors();changeMetrics();},addDoorDim:function(obj){if(obj.value===""){if(obj.id.slice(0,5)=="doorH"){obj.value=metricDefaults[myEstimator.isMetersFeet].door.height;}else if(obj.id.slice(0,5)=="doorW"){obj.value=metricDefaults[myEstimator.isMetersFeet].door.width;}else{obj.value=metricDefaults[myEstimator.isMetersFeet].door.other;}
obj.style.border=borderColor;}else{obj.style.border=borderColor;objH=document.getElementById('doorH'+obj.id.slice(5));objW=document.getElementById('doorW'+obj.id.slice(5));objT=document.getElementById('doorT'+obj.id.slice(5));if((objH.value!=="")&&(objW.value!=="")&&(objT.value!=="")){estWorker.getRec().doors[obj.id.slice(5)]=({height:objH.value,width:objW.value,trim:objT.value});}}},clearDoorField:function(obj){obj.style.border=borderColor;obj.focus();obj.value="";},removeDoor:function(id){for(var i in estWorker.getRec().doors){if(i==id){estWorker.getRec()['doors'].splice(i,1);this.displayDoors();return false;}}},displayDoors:function(){createDoors(true);changeMetrics();},addWindow:function(){createWindows();changeMetrics();},addWinDim:function(obj){if(obj.value===""){if(obj.id.slice(0,4)=="winH"){obj.value=metricDefaults[myEstimator.isMetersFeet].window.height;}else if(obj.id.slice(0,4)=="winW"){obj.value=metricDefaults[myEstimator.isMetersFeet].window.width;}else{obj.value=metricDefaults[myEstimator.isMetersFeet].window.trim;}
obj.style.border=borderColor;}else{obj.style.border=borderColor;objH=document.getElementById('winH'+obj.id.slice(4));objW=document.getElementById('winW'+obj.id.slice(4));objT=document.getElementById('winT'+obj.id.slice(4));if((objH.value!=="")&&(objW.value!=="")&&(objT.value!=="")){estWorker.getRec().windows[obj.id.slice(4)]=({height:objH.value,width:objW.value,trim:objT.value});}}},clearWinField:function(obj){obj.style.border=borderColor;obj.focus();obj.value="";},removeWindow:function(id){for(var i in estWorker.getRec().windows){if(i==id){estWorker.getRec()['windows'].splice(i,1);this.displayWindows();break;}}},displayWindows:function(){createWindows(true);changeMetrics();},clearRoomField:function(obj){obj.style.border=borderColor;obj.focus();obj.value="";},addRoomDim:function(obj){if(obj.value===""){if(obj.id=="roomDimL"){obj.value=intWallIDLabel.roomDimL;}else if(obj.id=="roomDimW"){obj.value=intWallIDLabel.roomDimW;}else{obj.value=intWallIDLabel.roomDimH;}
obj.style.border=borderColor;}else{obj.style.border=borderColor;objL=document.getElementById('roomDimL');objW=document.getElementById('roomDimW');objH=document.getElementById('roomDimH');if((objL.value!=="")&&(objW.value!=="")&&(objH.value!=="")){estWorker.getRec(0).roomDim[0]=({length:objL.value,width:objW.value,height:objH.value});}}},clearDoorsField:function(obj){if(obj.id=="doorDimQ"){obj.style.border=borderColor;obj.focus();obj.value="";}else{obj.style.border=borderColor;obj.focus();obj.value="";}},addDoorsDim:function(obj){if(obj.value===""){if(obj.id=="doorDimQ"){obj.value="How many?";obj.style.border=borderColor;}else if(obj.id=="doorDimH"){obj.value=metricDefaults[myEstimator.isMetersFeet].door.height;obj.style.border=borderColor;}else if(obj.id=="doorDimW"){obj.value=metricDefaults[myEstimator.isMetersFeet].door.width;obj.style.border=borderColor;}else{obj.value=metricDefaults[myEstimator.isMetersFeet].door.trim;obj.style.border=borderColor;}}else{if(obj.id=="doorDimQ"){obj.style.border=borderColor;}else if(obj.id=="doorDimH"){obj.style.border=borderColor;}else if(obj.id=="doorDimW"){obj.style.border=borderColor;}else{obj.style.border=borderColor;}
objQ=document.getElementById('doorDimQ');objH=document.getElementById('doorDimH');objW=document.getElementById('doorDimW');objT=document.getElementById('doorDimT');if((objQ.value!=="")&&(objH.value!=="")&&(objW.value!=="")&&(objT.value!=="")){estWorker.getRec().doorsDim[0]=({QTY:objQ.value,height:objH.value,width:objW.value,trim:objT.value});}}},clearWinssField:function(obj){if(obj.id=="winDimQ"){obj.style.border=borderColor;obj.focus();obj.value="";}else{obj.style.border=borderColor;obj.focus();obj.value="";}},addWinssDim:function(obj){if(obj.value===""){if(obj.id=="winDimQ"){obj.value="How many?";obj.style.border=borderColor;}else if(obj.id=="winDimH"){obj.value=metricDefaults[myEstimator.isMetersFeet].window.height;obj.style.border=borderColor;}else if(obj.id=="winDimW"){obj.value=metricDefaults[myEstimator.isMetersFeet].window.width;obj.style.border=borderColor;}else{obj.value=metricDefaults[myEstimator.isMetersFeet].window.trim;obj.style.border=borderColor;}}else{if(obj.id=="winDimQ"){obj.style.border=borderColor;}else if(obj.id=="winDimH"){obj.style.border=borderColor;}else if(obj.id=="winDimW"){obj.style.border=borderColor;}else{obj.style.border=borderColor;}
objQ=document.getElementById('winDimQ');objH=document.getElementById('winDimH');objW=document.getElementById('winDimW');objT=document.getElementById('winDimT');if((objQ.value!=="")&&(objH.value!=="")&&(objW.value!=="")&&(objT.value!=="")){estWorker.getRec().windowsDim[0]=({QTY:objQ.value,height:objH.value,width:objW.value,trim:objT.value});}}},createCeiling:function(){createCeiling();changeMetrics();},clearCeilingField:function(obj){if(isNaN(obj.value)){obj.style.border=borderColor;obj.focus();obj.value="";}},addCeilingDim:function(obj){if(obj.value===""){if(obj.id=="ceilingL"){obj.value="Length";}else{obj.value="Width";}
obj.style.border=borderColor;}else{obj.style.border=borderColor;objL=document.getElementById('ceilingL');objW=document.getElementById('ceilingW');if((objL.value!=="")&&(objW.value!=="")){estWorker.getRec().ceilingDim[0]=({length:objL.value,width:objW.value});}}},createFloor:function(){createFloor();changeMetrics();},clearFloorField:function(obj){if(isNaN(obj.value)){obj.style.border=borderColor;obj.focus();obj.value="";}},addFloorDim:function(obj){if(obj.value===""){if(obj.id=="floorL"){obj.value="Length";}else{obj.value="Width";}
obj.style.border=borderColor;}else{obj.style.border=borderColor;objL=document.getElementById('floorL');objW=document.getElementById('floorW');if((objL.value!=="")&&(objW.value!=="")){estWorker.getRec().floorDim[0]=({length:objL.value,width:objW.value});}}},createBaseboard:function(){createBaseboard();changeMetrics();},clearBaseboardField:function(obj){obj.style.border=borderColor;obj.focus();obj.value="";},addBaseboardDim:function(obj){if(obj.value===""){obj.value=metricDefaults[myEstimator.isMetersFeet].baseboard.height;obj.style.border=borderColor;}else{obj.style.border=borderColor;if(obj.value!==""){estWorker.getRec(0).baseboardDim[0]=({height:obj.value});}}},addWallExt:function(){createWallsExt();changeMetrics();},removeWallExt:function(id){for(var i in estWorker.getRec().walls){if(i==id){estWorker.getRec()['walls'].splice(i,1);this.displayWallsExt();break;}}},displayWallsExt:function(){createWallsExt(true);changeMetrics();},addWallDimExt:function(obj){if(obj.value===""){if(obj.id.slice(0,5)=="wallL"){obj.value="Length";}else{obj.value="Height";}
obj.style.border=borderColor;}else{obj.style.border=borderColor;objL=document.getElementById('wallL'+obj.id.slice(5));objH=document.getElementById('wallH'+obj.id.slice(5));if(objL.value!==""){estWorker.getRec().walls[obj.id.slice(5)].length=objL.value;}
if(objH.value!==""){estWorker.getRec().walls[obj.id.slice(5)].height=objH.value;}}},addWallExtGable:function(obj){if(obj.checked){estWorker.getRec().walls[obj.id.slice(5)].gable=true;}else{estWorker.getRec().walls[obj.id.slice(5)].gable=false;}},clearFieldExt:function(obj){if(isNaN(obj.value)){obj.style.border=borderColor;obj.focus();obj.value="";}},createFascia:function(){createFascia();changeMetrics();},clearFasciaField:function(obj){obj.style.border=borderColor;obj.focus();obj.value="";},addFasciaDim:function(obj){if(obj.value===""){obj.value="Depth";obj.style.border=borderColor;}else{obj.style.border=borderColor;if(obj.value!==""){estWorker.getRec(1).fasciaDim[0]=({height:obj.value});}}},clearShuttersField:function(obj){obj.style.border=borderColor;obj.focus();obj.value="";},addShuttersDim:function(obj){if(obj.value===""){if(obj.id=="shutterDimQ"){obj.value="How many?";obj.style.border=borderColor;}else if(obj.id=="shutterDimH"){obj.value=metricDefaults[myEstimator.isMetersFeet].shutter.height;obj.style.border=borderColor;}else{obj.value=metricDefaults[myEstimator.isMetersFeet].shutter.width;obj.style.border=borderColor;}}else{if(obj.id=="shutterDimQ"){obj.style.border=borderColor;}else if(obj.id=="shutterDimH"){obj.style.border=borderColor;}else{obj.style.border=borderColor;}
objQ=document.getElementById('shutterDimQ');objH=document.getElementById('shutterDimH');objW=document.getElementById('shutterDimW');if((objQ.value!=="")&&(objH.value!=="")&&(objW.value!=="")){estWorker.getRec().shuttersDim[0]=({QTY:objQ.value,height:objH.value,width:objW.value});}}},createShuttersDim:function(){createShuttersDim();changeMetrics();},addShutter:function(){createShutters();changeMetrics();},addShutterDim:function(obj){if(obj.value===""){if(obj.id.slice(0,8)=="shutterH"){obj.value=metricDefaults[myEstimator.isMetersFeet].shutter.height;}else{obj.value=metricDefaults[myEstimator.isMetersFeet].shutter.width;}
obj.style.border=borderColor;}else{obj.style.border=borderColor;objH=document.getElementById('shutterH'+obj.id.slice(8));objW=document.getElementById('shutterW'+obj.id.slice(8));if((objH.value!=="")&&(objW.value!=="")){estWorker.getRec().shutters[obj.id.slice(8)]=({height:objH.value,width:objW.value});}}},clearShutterField:function(obj){obj.style.border=borderColor;obj.focus();obj.value="";},removeShutter:function(id){for(var i in estWorker.getRec().shutters){if(i==id){estWorker.getRec()['shutters'].splice(i,1);this.displayShutters();return false;}}},displayShutters:function(){createShutters(true);changeMetrics();},validateFields:function(){var errors=0;var inputList=allInputs();for(var i=0;i<inputList.length;i++){var element=$('#'+inputList[i].id);var attr=element.attr('type');if(element.is(':visible')&&attr!="radio"&&attr!="button"&&attr!="checkbox"&&(!element.is(':disabled'))){if(isNaN(element.val())){element.css('border-color',borderErrorColor);errors++;}}else if(element.is(':hidden')&&attr!="radio"&&attr!="button"&&attr!="checkbox"){element.value=0;}}
if(errors===0){$('#estimatorFieldError').html('');estSteps.next();}else{$('#estimatorFieldError').css({'color':'#FF0000','font-weight':'bold'}).html('Some fields require your attention.');}},validatePainting:function(){if(estWorker.getRec().painting.length===0){$('#estimatorPaintingError').css({'color':'#FF0000','font-weight':'bold'}).html('Please select an item to paint.');}else{$('#estimatorPaintingError').html('');estSteps.next();}}};var myEstimator=estWorker.setMyEstimator({});function disableFields(obj){var fields=["roomDimL","roomDimW","roomDimH"];for(var i=0;i<fields.length;i++){document.getElementById(fields[i]).disabled=obj.disable;if(obj.disable){document.getElementById(fields[i]).className="estimatorInputLDisabled";document.getElementById('estimatorStepBAddWall').style.display="none";document.getElementById('estimatorStepBAddWallInfo').style.display="none";document.getElementById(fields[i]).value=intWallIDLabel[fields[i]];}else{document.getElementById('estimatorStepBAddWall').style.display="block";document.getElementById('estimatorStepBAddWallInfo').style.display="block";document.getElementById(fields[i]).className="estimatorInputL";}}}
function createElemWalls(obj){var div=document.createElement('div');div.setAttribute('id','estimatorAddWalls');div.className="estimatorLayout";var divA=document.createElement('div');divA.className="estimatorItemsTxt";divA.innerHTML="<b>wall "+(Number(obj.index)+1)+"</b>";div.appendChild(divA);var divB=document.createElement('div');divB.className="estimatorItems";div.appendChild(divB);var inputL=document.createElement('input');inputL.setAttribute('id','wallL'+obj.index);inputL.setAttribute('name','wallL'+obj.index);inputL.setAttribute('value',obj.length);inputL.setAttribute('onchange',"estWorker.addWallDim(this)");inputL.setAttribute('onfocus',"estWorker.clearField(this)");inputL.setAttribute('onblur',"estWorker.addWallDim(this)");if(document.all){if(checkIEVersion()){inputL.setAttribute('onchange','estWorker.addWallDim(this)');inputL.setAttribute('onfocus','estWorker.clearField(this)');inputL.setAttribute('onblur','estWorker.addWallDim(this)');}else{inputL.setAttribute('onchange',function(){estWorker.addWallDim(this);});inputL.setAttribute('onfocus',function(){estWorker.clearField(this);});inputL.setAttribute('onblur',function(){estWorker.addWallDim(this);});}}
inputL.className="estimatorInputL";divB.appendChild(inputL);var divC=document.createElement('div');divC.className="estimatorRoomMF";divC.innerHTML="meters";div.appendChild(divC);var divD=document.createElement('div');divD.className="estimatorItemsTxt";divD.innerHTML="  ";div.appendChild(divD);var divBB=document.createElement('div');divBB.className="estimatorItems";div.appendChild(divBB);var inputW=document.createElement('input');inputW.setAttribute('id','wallH'+obj.index);inputW.setAttribute('name','wallH'+obj.index);inputW.setAttribute('value',obj.height);inputW.setAttribute('onchange',"estWorker.addWallDim(this)");inputW.setAttribute('onblur',"estWorker.addWallDim(this)");inputW.setAttribute('onfocus',"estWorker.clearField(this)");if(document.all){if(checkIEVersion()){inputW.setAttribute('onchange','estWorker.addWallDim(this)');inputW.setAttribute('onblur','estWorker.addWallDim(this)');inputW.setAttribute('onfocus','estWorker.clearField(this)');}else{inputW.setAttribute('onchange',function(){estWorker.addWallDim(this);});inputW.setAttribute('onblur',function(){estWorker.addWallDim(this);});inputW.setAttribute('onfocus',function(){estWorker.clearField(this);});}}
inputW.className="estimatorInputL";divBB.appendChild(inputW);var divE=document.createElement('div');divE.className="estimatorRoomMF";divE.innerHTML="meters";div.appendChild(divE);var divF=document.createElement('div');divF.className="estimatorItemsX";divF.innerHTML='<a href="javascript: estWorker.removeWall('+obj.index+');void(0);" class="estimatorItemsXHref">- Remove wall</a>';div.appendChild(divF);return div;}
function createElemWallsExt(obj){var div=document.createElement('div');div.setAttribute('id','estimatorAddWalls');div.className="estimatorLayout";var divA=document.createElement('div');divA.className="estimatorItemsTxt";divA.innerHTML="<b>wall "+(Number(obj.index)+1)+"</b>";div.appendChild(divA);var divB=document.createElement('div');divB.className="estimatorItems";div.appendChild(divB);var inputL=document.createElement('input');inputL.setAttribute('id','wallL'+obj.index);inputL.setAttribute('name','wallL'+obj.index);inputL.setAttribute('value',obj.length);inputL.setAttribute('onchange',"estWorker.addWallDimExt(this)");inputL.setAttribute('onblur',"estWorker.addWallDimExt(this)");inputL.setAttribute('onfocus',"estWorker.clearFieldExt(this)");if(document.all){if(checkIEVersion()){inputL.setAttribute('onchange','estWorker.addWallDimExt(this)');inputL.setAttribute('onblur','estWorker.addWallDimExt(this)');inputL.setAttribute('onfocus','estWorker.clearFieldExt(this)');}else{inputL.setAttribute('onchange',function(){estWorker.addWallDimExt(this);});inputL.setAttribute('onblur',function(){estWorker.addWallDimExt(this);});inputL.setAttribute('onfocus',function(){estWorker.clearFieldExt(this);});}}
inputL.className="estimatorInputL";divB.appendChild(inputL);var divC=document.createElement('div');divC.className="estimatorRoomMF";divC.innerHTML="meters";div.appendChild(divC);var divD=document.createElement('div');divD.className="estimatorItemsTxt";divD.innerHTML="  ";div.appendChild(divD);var divBB=document.createElement('div');divBB.className="estimatorItems";div.appendChild(divBB);var inputW=document.createElement('input');inputW.setAttribute('id','wallH'+obj.index);inputW.setAttribute('name','wallH'+obj.index);inputW.setAttribute('value',obj.height);inputW.setAttribute('onchange',"estWorker.addWallDimExt(this)");inputW.setAttribute('onblur',"estWorker.addWallDimExt(this)");inputW.setAttribute('onfocus',"estWorker.clearFieldExt(this)");if(document.all){if(checkIEVersion()){inputW.setAttribute('onchange','estWorker.addWallDimExt(this)');inputW.setAttribute('onblur','estWorker.addWallDimExt(this)');inputW.setAttribute('onfocus','estWorker.clearFieldExt(this)');}else{inputW.setAttribute('onchange',function(){estWorker.addWallDimExt(this);});inputW.setAttribute('onblur',function(){estWorker.addWallDimExt(this);});inputW.setAttribute('onfocus',function(){estWorker.clearFieldExt(this);});}}
inputW.className="estimatorInputL";divBB.appendChild(inputW);var divE=document.createElement('div');divE.className="estimatorRoomMF";divE.innerHTML="meters";div.appendChild(divE);var divCC=document.createElement('div');divCC.className="estimatorItems";div.appendChild(divCC);var inputCB=document.createElement('input');inputCB.setAttribute('type','checkbox');inputCB.setAttribute('id','gable'+obj.index);inputCB.setAttribute('name','gable'+obj.index);if(obj.gable){inputCB.setAttribute('checked','checked');}
inputCB.setAttribute('onclick',"estWorker.addWallExtGable(this)");if(document.all){if(checkIEVersion()){inputCB.setAttribute('onclick','estWorker.addWallExtGable(this)');}else{inputCB.setAttribute('onclick',function(){estWorker.addWallExtGable(this);});if(obj.gable){inputCB.setAttribute('defaultChecked','defaultChecked');}}}
divCC.appendChild(inputCB);var divF=document.createElement('div');divF.className="estimatorItemsTxt";divF.innerHTML="Wall has gable";div.appendChild(divF);if(obj.index>0){var divG=document.createElement('div');divG.className="estimatorItemsX";divG.innerHTML='<a href="javascript: estWorker.removeWallExt('+obj.index+');void(0);" class="estimatorItemsXHref">- Remove Wall</a>';div.appendChild(divG);}
return div;}
function createWalls(display){stage=document.getElementById('estimatorExtraWallsStage');stage.innerHTML="<div class='estimatorStepBExtH'>Enter wall measurements individualy</div>";stage.style.display="block";var but=document.createElement('div');but.className="estimatorAddMore";but.innerHTML="<a href='javascript: estWorker.addWall();void(0);' class='estimatorAddHref'>+ Add Another Wall</a>";var index=0;if(estWorker.getRec(0).walls.length>0){for(var i in estWorker.getRec(0).walls){stage.appendChild(createElemWalls({length:estWorker.getRec(0).walls[i].length,height:estWorker.getRec(0).walls[i].height,index:i}));index++;}}else{disableFields({name:"walls",disable:false});}
if(display){if(estWorker.getRec(0).walls.length===0){stage.innerHTML="";}else{stage.appendChild(but);}
return false;}
estWorker.getRec(0).walls[index]=({length:"Length",height:"Height"});stage.appendChild(createElemWalls({length:estWorker.getRec(0).walls[index].length,height:estWorker.getRec(0).walls[index].height,index:index}));if(estWorker.getRec(0).walls.length>0){disableFields({name:"walls",disable:true});}
stage.appendChild(but);}
function createWallsExt(display){stage=document.getElementById('estimatorExtraWallsStage');stage.innerHTML="";stage.style.display="block";var but=document.createElement('div');but.className="estimatorAddMore";but.innerHTML="<a href='javascript: estWorker.addWallExt();void(0);' class='estimatorAddHref'>+ Add Another Wall</a>";var index=0;if(estWorker.getRec().walls.length>0){for(var i in estWorker.getRec().walls){var roomDim=estWorker.getRec().walls[i];stage.appendChild(createElemWallsExt({length:roomDim.length,height:roomDim.height,index:i,gable:roomDim.gable}));index++;}}else{disableFields({name:"walls",disable:false});}
if(display){if(estWorker.getRec().walls.length===0){stage.innerHTML="";}else{stage.appendChild(but);}
return false;}
estWorker.getRec().walls[index]=({length:"Length",height:"Height",gable:false});stage.appendChild(createElemWallsExt({length:estWorker.getRec().walls[index].length,height:estWorker.getRec().walls[index].height,index:index,gable:estWorker.getRec().walls[index].gable}));if(estWorker.getRec().walls.length>0){disableFields({name:"walls",disable:true});}
stage.appendChild(but);}
function createElemDoorWin(obj){var div=document.createElement('div');div.setAttribute('id','estimatorAddWalls');div.className="estimatorLayout";var divA=document.createElement('div');divA.className="estimatorItemsTxt";divA.innerHTML="<b>"+obj.label+" "+(Number(obj.index)+1)+"</b>";div.appendChild(divA);var divB=document.createElement('div');divB.className="estimatorItems";div.appendChild(divB);var inputH=document.createElement('input');inputH.setAttribute('id',(obj.idH+obj.index));inputH.setAttribute('name',(obj.idH+obj.index));inputH.setAttribute('value',obj.height);inputH.setAttribute('onchange',obj.fnAdd);inputH.setAttribute('onblur',obj.fnAdd);inputH.setAttribute('onfocus',obj.fnClear);if(document.all){if(checkIEVersion()){inputH.setAttribute('onchange',obj.fnAdd);inputH.setAttribute('onblur',obj.fnAdd);inputH.setAttribute('onfocus',obj.fnClear);}else{inputH.setAttribute('onchange',function(){eval(obj.fnAdd);});inputH.setAttribute('onblur',function(){eval(obj.fnAdd);});inputH.setAttribute('onfocus',function(){eval(obj.fnClear);});}}
inputH.className="estimatorInputN";divB.appendChild(inputH);var divC=document.createElement('div');divC.className="estimatorRoomMF";divC.innerHTML="meters";div.appendChild(divC);var divD=document.createElement('div');divD.className="estimatorItemsTxt";divD.innerHTML="high  X";div.appendChild(divD);var divBB=document.createElement('div');divBB.className="estimatorItems";div.appendChild(divBB);var inputW=document.createElement('input');inputW.setAttribute('id',(obj.idW+obj.index));inputW.setAttribute('name',(obj.idW+obj.index));inputW.setAttribute('value',obj.width);inputW.setAttribute('onchange',obj.fnAdd);inputW.setAttribute('onblur',obj.fnAdd);inputW.setAttribute('onfocus',obj.fnClear);if(document.all){if(checkIEVersion()){inputW.setAttribute('onchange',obj.fnAdd);inputW.setAttribute('onblur',obj.fnAdd);inputW.setAttribute('onfocus',obj.fnClear);}else{inputW.setAttribute('onchange',function(){eval(obj.fnAdd);});inputW.setAttribute('onblur',function(){eval(obj.fnAdd);});inputW.setAttribute('onfocus',function(){eval(obj.fnClear);});}}
inputW.className="estimatorInputN";divBB.appendChild(inputW);var divE=document.createElement('div');divE.className="estimatorRoomMF";divE.innerHTML="meters";div.appendChild(divE);var divF=document.createElement('div');divF.className="estimatorItemsTxt";divF.innerHTML="wide  Trim is";div.appendChild(divF);var divCC=document.createElement('div');divCC.className="estimatorItems";div.appendChild(divCC);var inputT=document.createElement('input');inputT.setAttribute('id',(obj.idT+obj.index));inputT.setAttribute('name',(obj.idT+obj.index));inputT.setAttribute('value',obj.trim);inputT.setAttribute('onchange',obj.fnAdd);inputT.setAttribute('onblur',obj.fnAdd);inputT.setAttribute('onfocus',obj.fnClear);if(document.all){if(checkIEVersion()){inputT.setAttribute('onchange',obj.fnAdd);inputT.setAttribute('onblur',obj.fnAdd);inputT.setAttribute('onfocus',obj.fnClear);}else{inputT.setAttribute('onchange',function(){eval(obj.fnAdd);});inputT.setAttribute('onblur',function(){eval(obj.fnAdd);});inputT.setAttribute('onfocus',function(){eval(obj.fnClear);});}}
inputT.className="estimatorInputN";divCC.appendChild(inputT);var divG=document.createElement('div');divG.className="estimatorRoomInches";divG.innerHTML="cm";div.appendChild(divG);var divH=document.createElement('div');divH.className="estimatorItemsX";divH.innerHTML="<a href='javascript: "+obj.href+"("+obj.index+");void(0);' class='estimatorItemsXHref'>- Remove "+obj.label+"</a>";div.appendChild(divH);return div;}
function createDoors(display){stage=document.getElementById('estimatorExtraDoorsStage');stage.innerHTML="<div class='estimatorStepBExtH'>Enter door measurements individualy</div>";stage.style.display="block";var index=0;if(estWorker.getRec().doors.length>0){for(var i in estWorker.getRec().doors){stage.appendChild(createElemDoorWin({height:estWorker.getRec().doors[i].height,width:estWorker.getRec().doors[i].width,trim:estWorker.getRec().doors[i].trim,index:i,idH:"doorH",idW:"doorW",idT:"doorT",fnAdd:"estWorker.addDoorDim(this)",fnClear:"estWorker.clearDoorField(this)",href:"estWorker.removeDoor",label:"door"}));index++;}}
if(display){if(estWorker.getRec().doors.length===0){stage.innerHTML="";}
return false;}
estWorker.getRec().doors[index]=({height:metricDefaults[myEstimator.isMetersFeet].door.height,width:metricDefaults[myEstimator.isMetersFeet].door.width,trim:metricDefaults[myEstimator.isMetersFeet].door.trim});stage.appendChild(createElemDoorWin({height:estWorker.getRec().doors[index].height,width:estWorker.getRec().doors[index].width,trim:estWorker.getRec().doors[index].trim,index:index,idH:"doorH",idW:"doorW",idT:"doorT",fnAdd:"estWorker.addDoorDim(this)",fnClear:"estWorker.clearDoorField(this)",href:"estWorker.removeDoor",label:"door"}));}
function createWindows(display){stage=document.getElementById('estimatorExtraWinStage');stage.innerHTML="<div class='estimatorStepBExtH'>Enter window measurements individualy</div>";stage.style.display="block";var index=0;if(estWorker.getRec().windows.length>0){for(var i in estWorker.getRec().windows){stage.appendChild(createElemDoorWin({height:estWorker.getRec().windows[i].height,width:estWorker.getRec().windows[i].width,trim:estWorker.getRec().windows[i].trim,index:i,idH:"winH",idW:"winW",idT:"winT",fnAdd:"estWorker.addWinDim(this)",fnClear:"estWorker.clearWinField(this)",href:"estWorker.removeWindow",label:"window"}));index++;}}
if(display){if(estWorker.getRec().windows.length===0){stage.innerHTML="";}
return false;}
estWorker.getRec().windows[index]=({height:metricDefaults[myEstimator.isMetersFeet].window.height,width:metricDefaults[myEstimator.isMetersFeet].window.width,trim:metricDefaults[myEstimator.isMetersFeet].window.trim});stage.appendChild(createElemDoorWin({height:estWorker.getRec().windows[index].height,width:estWorker.getRec().windows[index].width,trim:estWorker.getRec().windows[index].trim,index:index,idH:"winH",idW:"winW",idT:"winT",fnAdd:"estWorker.addWinDim(this)",fnClear:"estWorker.clearWinField(this)",href:"estWorker.removeWindow",label:"window"}));}
function createElemShutters(obj){var div=document.createElement('div');div.setAttribute('id','estimatorAddWalls');div.className="estimatorLayout";var divA=document.createElement('div');divA.className="estimatorItemsTxt";divA.innerHTML="<b>"+obj.label+" "+(Number(obj.index)+1)+"</b>";div.appendChild(divA);var divB=document.createElement('div');divB.className="estimatorItems";div.appendChild(divB);var inputH=document.createElement('input');inputH.setAttribute('id',(obj.idH+obj.index));inputH.setAttribute('name',(obj.idH+obj.index));inputH.setAttribute('value',obj.height);inputH.setAttribute('onchange',obj.fnAdd);inputH.setAttribute('onblur',obj.fnAdd);inputH.setAttribute('onfocus',obj.fnClear);if(document.all){if(checkIEVersion()){inputH.setAttribute('onchange',obj.fnAdd);inputH.setAttribute('onblur',obj.fnAdd);inputH.setAttribute('onfocus',obj.fnClear);}else{inputH.setAttribute('onchange',function(){eval(obj.fnAdd);});inputH.setAttribute('onblur',function(){eval(obj.fnAdd);});inputH.setAttribute('onfocus',function(){eval(obj.fnClear);});}}
inputH.className="estimatorInputN";divB.appendChild(inputH);var divC=document.createElement('div');divC.className="estimatorRoomMF";divC.innerHTML="meters";div.appendChild(divC);var divD=document.createElement('div');divD.className="estimatorItemsTxt";divD.innerHTML="high  X";div.appendChild(divD);var divBB=document.createElement('div');divBB.className="estimatorItems";div.appendChild(divBB);var inputW=document.createElement('input');inputW.setAttribute('id',(obj.idW+obj.index));inputW.setAttribute('name',(obj.idW+obj.index));inputW.setAttribute('value',obj.width);inputW.setAttribute('onchange',obj.fnAdd);inputW.setAttribute('onblur',obj.fnAdd);inputW.setAttribute('onfocus',obj.fnClear);if(document.all){if(checkIEVersion()){inputW.setAttribute('onchange',obj.fnAdd);inputW.setAttribute('onblur',obj.fnAdd);inputW.setAttribute('onfocus',obj.fnClear);}else{inputW.setAttribute('onchange',function(){eval(obj.fnAdd);});inputW.setAttribute('onblur',function(){eval(obj.fnAdd);});inputW.setAttribute('onfocus',function(){eval(obj.fnClear);});}}
inputW.className="estimatorInputN";divBB.appendChild(inputW);var divE=document.createElement('div');divE.className="estimatorRoomMF";divE.innerHTML="meters";div.appendChild(divE);var divH=document.createElement('div');divH.className="estimatorItemsX";divH.innerHTML="<a href='javascript: "+obj.href+"("+obj.index+");void(0);' class='estimatorItemsXHref'>- Remove shutter</a>";div.appendChild(divH);return div;}
function createShutters(display){stage=document.getElementById('estimatorExtraShuttersStage');stage.innerHTML="<div class='estimatorStepBExtH'>Enter shutter measurements individualy</div>";stage.style.display="block";var index=0;if(estWorker.getRec().shutters.length>0){for(var i in estWorker.getRec().shutters){stage.appendChild(createElemShutters({height:estWorker.getRec().shutters[i].height,width:estWorker.getRec().shutters[i].width,index:i,idH:"shutterH",idW:"shutterW",fnAdd:"estWorker.addShutterDim(this)",fnClear:"estWorker.clearShutterField(this)",href:"estWorker.removeShutter",label:"shutter"}));index++;}}
if(display){if(estWorker.getRec().shutters.length===0){stage.innerHTML="";}
return false;}
estWorker.getRec().shutters[index]=({height:metricDefaults[myEstimator.isMetersFeet].shutter.height,width:metricDefaults[myEstimator.isMetersFeet].shutter.width});stage.appendChild(createElemShutters({height:estWorker.getRec().shutters[index].height,width:estWorker.getRec().shutters[index].width,index:index,idH:"shutterH",idW:"shutterW",fnAdd:"estWorker.addShutterDim(this)",fnClear:"estWorker.clearShutterField(this)",href:"estWorker.removeShutter",label:"shutter"}));}
function createElemCeilingFloor(obj){var div=document.createElement('div');div.className="estimatorLayout";var divB=document.createElement('div');divB.className="estimatorItems";div.appendChild(divB);var inputL=document.createElement('input');inputL.setAttribute('id',obj.idL);inputL.setAttribute('name',obj.idL);inputL.setAttribute('value',obj.length);inputL.setAttribute('onchange',obj.fnAdd);inputL.setAttribute('onblur',obj.fnAdd);inputL.setAttribute('onfocus',obj.fnClear);if(document.all){if(checkIEVersion()){inputL.setAttribute('onchange',obj.fnAdd);inputL.setAttribute('onblur',obj.fnAdd);inputL.setAttribute('onfocus',obj.fnClear);}else{inputL.setAttribute('onchange',function(){eval(obj.fnAdd);});inputL.setAttribute('onblur',function(){eval(obj.fnAdd);});inputL.setAttribute('onfocus',function(){eval(obj.fnClear);});}}
inputL.className="estimatorInputL";divB.appendChild(inputL);var divC=document.createElement('div');divC.className="estimatorRoomMF";divC.innerHTML="meters";div.appendChild(divC);var divD=document.createElement('div');divD.className="estimatorItemsTxt";divD.innerHTML="  X";div.appendChild(divD);var divE=document.createElement('div');divE.className="estimatorItems";div.appendChild(divE);var inputH=document.createElement('input');inputH.setAttribute('id',obj.idW);inputH.setAttribute('name',obj.idW);inputH.setAttribute('value',obj.width);inputH.setAttribute('onchange',obj.fnAdd);inputH.setAttribute('onblur',obj.fnAdd);inputH.setAttribute('onfocus',obj.fnClear);if(document.all){if(checkIEVersion()){inputH.setAttribute('onchange',obj.fnAdd);inputH.setAttribute('onblur',obj.fnAdd);inputH.setAttribute('onfocus',obj.fnClear);}else{inputH.setAttribute('onchange',function(){eval(obj.fnAdd);});inputH.setAttribute('onblur',function(){eval(obj.fnAdd);});inputH.setAttribute('onfocus',function(){eval(obj.fnClear);});}}
inputH.className="estimatorInputL";divE.appendChild(inputH);var divF=document.createElement('div');divF.className="estimatorRoomMF";divF.innerHTML="meters";div.appendChild(divF);return div;}
function createCeiling(){stage=document.getElementById('estimatorCeilingStage');stage.innerHTML="<div class='estimatorStepBHL'>Ceiling</div>";stage.style.display="block";var index=0;if(estWorker.getRec().ceilingDim.length>0){stage.appendChild(createElemCeilingFloor({length:estWorker.getRec().ceilingDim[0].length,width:estWorker.getRec().ceilingDim[0].width,idL:"ceilingL",idW:"ceilingW",fnClear:"estWorker.clearCeilingField(this)",fnAdd:"estWorker.addCeilingDim(this)"}));}else{stage.appendChild(createElemCeilingFloor({length:"Length",width:"Width",idL:"ceilingL",idW:"ceilingW",fnClear:"estWorker.clearCeilingField(this)",fnAdd:"estWorker.addCeilingDim(this)"}));}}
function createFloor(){stage=document.getElementById('estimatorFloorStage');stage.innerHTML="<div class='estimatorStepBHL'>Floor</div>";stage.style.display="block";var index=0;if(estWorker.getRec().floorDim.length>0){stage.appendChild(createElemCeilingFloor({length:estWorker.getRec().floorDim[0].length,width:estWorker.getRec().floorDim[0].width,idL:"floorL",idW:"floorW",fnClear:"estWorker.clearFloorField(this)",fnAdd:"estWorker.addFloorDim(this)"}));}else{stage.appendChild(createElemCeilingFloor({length:"Length",width:"Width",idL:"floorL",idW:"floorW",fnClear:"estWorker.clearFloorField(this)",fnAdd:"estWorker.addFloorDim(this)"}));}}
function createElemBaseboard(obj){var div=document.createElement('div');div.className="estimatorLayout";var divB=document.createElement('div');divB.className="estimatorItems";div.appendChild(divB);var inputL=document.createElement('input');inputL.setAttribute('id','BaseboardH');inputL.setAttribute('title',obj.label);inputL.setAttribute('name','BaseboardH');inputL.setAttribute('value',obj.height);inputL.setAttribute('onchange',"estWorker.addBaseboardDim(this)");inputL.setAttribute('onblur',"estWorker.addBaseboardDim(this)");inputL.setAttribute('onfocus',"estWorker.clearBaseboardField(this)");if(document.all){if(checkIEVersion()){inputL.setAttribute('onchange','estWorker.addBaseboardDim(this)');inputL.setAttribute('onblur','estWorker.addBaseboardDim(this)');inputL.setAttribute('onfocus','estWorker.clearBaseboardField(this)');}else{inputL.setAttribute('onchange',function(){estWorker.addBaseboardDim(this);});inputL.setAttribute('onblur',function(){estWorker.addBaseboardDim(this);});inputL.setAttribute('onfocus',function(){estWorker.clearBaseboardField(this);});}}
inputL.className="estimatorInputN";divB.appendChild(inputL);var divC=document.createElement('div');divC.className="estimatorRoomInches";divC.innerHTML="cm";div.appendChild(divC);var divD=document.createElement('div');divD.className="estimatorItemsTxt";divD.innerHTML="tall";div.appendChild(divD);return div;}
function createBaseboard(){stage=document.getElementById('estimatorBaseboardStage');stage.innerHTML="<div class='estimatorStepBHL'>"+stage.title+"</div>";stage.style.display="block";var index=0;if(estWorker.getRec().baseboardDim.length>0){stage.appendChild(createElemBaseboard({height:estWorker.getRec().baseboardDim[0].height,'label':stage.title}));}else{estWorker.getRec(0).baseboardDim[0]=({height:metricDefaults[myEstimator.isMetersFeet].baseboard.height});stage.appendChild(createElemBaseboard({height:metricDefaults[myEstimator.isMetersFeet].baseboard.height,'label':stage.title}));}}
function createElemFascia(obj){var div=document.createElement('div');div.className="estimatorLayout";var divB=document.createElement('div');divB.className="estimatorItems";div.appendChild(divB);var inputL=document.createElement('input');inputL.setAttribute('id','fasciaH');inputL.setAttribute('name','fasciaH');inputL.setAttribute('value',obj.height);inputL.setAttribute('onchange',"estWorker.addFasciaDim(this)");inputL.setAttribute('onblur',"estWorker.addFasciaDim(this)");inputL.setAttribute('onfocus',"estWorker.clearFasciaField(this)");if(document.all){if(checkIEVersion()){inputL.setAttribute('onchange','estWorker.addFasciaDim(this)');inputL.setAttribute('onblur','estWorker.addFasciaDim(this)');inputL.setAttribute('onfocus','estWorker.clearFasciaField(this)');}else{inputL.setAttribute('onchange',function(){estWorker.addFasciaDim(this);});inputL.setAttribute('onblur',function(){estWorker.addFasciaDim(this);});inputL.setAttribute('onfocus',function(){estWorker.clearFasciaField(this);});}}
inputL.className="estimatorInputL";divB.appendChild(inputL);var divC=document.createElement('div');divC.className="estimatorRoomInches";divC.innerHTML="cm";div.appendChild(divC);return div;}
function createFascia(){stage=document.getElementById('estimatorFasciaStage');stage.innerHTML="<div class='estimatorStepBHL'>Fascia/Overhang</div>";stage.style.display="block";var index=0;if(estWorker.getRec().fasciaDim.length>0){stage.appendChild(createElemFascia({height:estWorker.getRec().fasciaDim[0].height}));}else{estWorker.getRec(1).fasciaDim[0]=({height:"Depth"});stage.appendChild(createElemFascia({height:"Depth"}));}}
function createElemShuttersDim(obj){var div=document.createElement('div');div.className="estimatorLayout";var divB=document.createElement('div');divB.className="estimatorItems";div.appendChild(divB);var inputQ=document.createElement('input');inputQ.setAttribute('id','shutterDimQ');inputQ.setAttribute('name','shutterDimQ');inputQ.setAttribute('value',obj.QTY);inputQ.setAttribute('onchange','estWorker.addShuttersDim(this)');inputQ.setAttribute('onblur','estWorker.addShuttersDim(this)');inputQ.setAttribute('onfocus','estWorker.clearShuttersField(this)');if(document.all){if(checkIEVersion()){inputQ.setAttribute('onchange','estWorker.addShuttersDim(this)');inputQ.setAttribute('onblur','estWorker.addShuttersDim(this)');inputQ.setAttribute('onfocus','estWorker.clearShuttersField(this)');}else{inputQ.setAttribute('onchange',function(){estWorker.addShuttersDim(this);});inputQ.setAttribute('onblur',function(){estWorker.addShuttersDim(this);});inputQ.setAttribute('onfocus',function(){estWorker.clearShuttersField(this);});}}
inputQ.className="estimatorInputHM";divB.appendChild(inputQ);var divX=document.createElement('div');divX.className="estimatorItems";div.appendChild(divX);var inputH=document.createElement('input');inputH.setAttribute('id','shutterDimH');inputH.setAttribute('name','shutterDimH');inputH.setAttribute('value',obj.height);inputH.setAttribute('onchange','estWorker.addShuttersDim(this)');inputH.setAttribute('onblur','estWorker.addShuttersDim(this)');inputH.setAttribute('onfocus','estWorker.clearShuttersField(this)');if(document.all){if(checkIEVersion()){inputH.setAttribute('onchange','estWorker.addShuttersDim(this)');inputH.setAttribute('onblur','estWorker.addShuttersDim(this)');inputH.setAttribute('onfocus','estWorker.clearShuttersField(this)');}else{inputH.setAttribute('onchange',function(){estWorker.addShuttersDim(this);});inputH.setAttribute('onblur',function(){estWorker.addShuttersDim(this);});inputH.setAttribute('onfocus',function(){estWorker.clearShuttersField(this);});}}
inputH.className="estimatorInputN";divX.appendChild(inputH);var divC=document.createElement('div');divC.className="estimatorRoomMF";divC.innerHTML="meters";div.appendChild(divC);var divD=document.createElement('div');divD.className="estimatorItemsTxt";divD.innerHTML="  X";div.appendChild(divD);var divE=document.createElement('div');divE.className="estimatorItems";div.appendChild(divE);var inputL=document.createElement('input');inputL.setAttribute('id','shutterDimW');inputL.setAttribute('name','shutterDimW');inputL.setAttribute('value',obj.width);inputL.setAttribute('onchange','estWorker.addShuttersDim(this)');inputL.setAttribute('onblur','estWorker.addShuttersDim(this)');inputL.setAttribute('onfocus','estWorker.clearShuttersField(this)');if(document.all){if(checkIEVersion()){inputL.setAttribute('onchange','estWorker.addShuttersDim(this)');inputL.setAttribute('onblur','estWorker.addShuttersDim(this)');inputL.setAttribute('onfocus','estWorker.clearShuttersField(this)');}else{inputL.setAttribute('onchange',function(){estWorker.addShuttersDim(this);});inputL.setAttribute('onblur',function(){estWorker.addShuttersDim(this);});inputL.setAttribute('onfocus',function(){estWorker.clearShuttersField(this);});}}
inputL.className="estimatorInputN";divE.appendChild(inputL);var divF=document.createElement('div');divF.className="estimatorRoomMF";divF.innerHTML="meters";div.appendChild(divF);var divG=document.createElement('div');divG.className="estimatorItemsTxt";divG.innerHTML="wide";div.appendChild(divG);return div;}
function createShuttersDim(){stage=document.getElementById('estimatorShuttersStage');stage.innerHTML="<div class='estimatorStepBHL'>Shutters</div>";stage.style.display="block";var index=0;if(estWorker.getRec().shuttersDim.length>0){stage.appendChild(createElemShuttersDim({QTY:estWorker.getRec().shuttersDim[0].QTY,height:estWorker.getRec().shuttersDim[0].height,width:estWorker.getRec().shuttersDim[0].width}));}else{stage.appendChild(createElemShuttersDim({QTY:"How many?",height:5,width:1}));}
var divS=document.createElement('div');divS.className="estimatorAddMore";divS.setAttribute('id','estimatorExtraShuttersStage');divS.className='estimatorExtraShuttersStage';stage.appendChild(divS);var divB=document.createElement('div');divB.className="estimatorAddMore";divB.innerHTML="<a href='javascript: estWorker.addShutter()' class='estimatorAddHref'>+ Add Another Shutter</a>";stage.appendChild(divB);}
function _docStyle(obj){$('#'+obj.id).css(obj.style,obj.value);}
function _docValue(obj){document.getElementById(obj.id).value=obj.value;}
function _docInner(obj){$('#'+obj.id).html(obj.value);}
function changeMetrics(){var inputList=allInputs();for(i=0;i<inputList.length;i++){inputList[i].tabIndex=(Number(i)+1);}
if(myEstimator.isMetersFeet=="meters"){$('#disclaimer_US').css('display','none');$('#disclaimer_CA').css('display','block');$('#estimatorMathSwapA_US').css('display','none');$('#estimatorMathSwapA_CA').css('display','block');$('#estimatorMathSwapB_US').css('display','none');$('#estimatorMathSwapB_CA').css('display','block');$('#estimate_items_paint_US').css('display','none');$('#estimate_items_paint_CA').css('display','block');doMetersFeet(true);}else{$('#disclaimer_CA').css('display','none');$('#disclaimer_US').css('display','block');$('#estimatorMathSwapA_CA').css('display','none');$('#estimatorMathSwapA_US').css('display','block');$('#estimatorMathSwapB_CA').css('display','none');$('#estimatorMathSwapB_US').css('display','block');$('#estimate_items_paint_CA').css('display','none');$('#estimate_items_paint_US').css('display','block');doMetersFeet(false);}}
function doMetersFeet(isMetric){var FM="feet";var IC="inches";var GL="gallon(s)";if(isMetric){FM="meters";IC="cm";GL="liters";if(vReqBean.domainCode==="valspar_bandq_uk"){FM="metres";GL="litres";}}
$('.estimatorRoomMF').html(FM);$('.estimatorFinalMF').html(FM);$('.estimatorRoomInches').html(IC);$('.estimatorFinalInches').html(IC);$('.estimatorFinalGL').html(GL);$('.estimatorFinalGLB').html(GL);$('.shoppingRoomMF').html(FM);$('.shoppingFinalMF').html(FM);$('.shoppingGLTxtMF').html(FM);$('.shoppingRoomInches').html(IC);$('.shoppingFinalInches').html(IC);$('.shoppingFinalGL').html(GL);$('.shoppingFinalGLB').html(GL);}
function getIEVersion(){var rv=-1;if(navigator.appName=='Microsoft Internet Explorer'){var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null){rv=parseFloat(RegExp.$1);}}
return rv;}
function checkIEVersion(){var IE=false;var ver=getIEVersion();if(ver>-1){if(ver>=8.0){IE=true;}else{IE=false;}}
return IE;}
var allStageObjects=['estimatorExtraDoorsStage','estimatorExtraWallsStage','estimatorExtraWinStage','estimatorCeilingStage','estimatorFloorStage','estimatorBaseboardStage','estimatorFasciaStage','estimatorShuttersStage'];function clearAllObjects(){for(var i=0;i<allStageObjects.length;i++){stage=document.getElementById(allStageObjects[i]);stage.innerHTML='';}
document.getElementById('roomDimL').value='Length';document.getElementById('roomDimW').value='Width';document.getElementById('roomDimH').value='Height';document.getElementById('doorDimQ').value='How many?';document.getElementById('doorDimH').value=metricDefaults[myEstimator.isMetersFeet].door.height;document.getElementById('doorDimW').value=metricDefaults[myEstimator.isMetersFeet].door.width;document.getElementById('doorDimT').value=metricDefaults[myEstimator.isMetersFeet].door.trim;document.getElementById('winDimQ').value='How many?';document.getElementById('winDimH').value=metricDefaults[myEstimator.isMetersFeet].window.height;document.getElementById('winDimW').value=metricDefaults[myEstimator.isMetersFeet].window.width;document.getElementById('winDimT').value=metricDefaults[myEstimator.isMetersFeet].window.trim;}
var estSteps={step:0,next:function(step){this.step++;estSteps.show();if(this.step==2)
{estWorker.ajaxSaveToOrganizer();}},prev:function(){this.step--;estSteps.show();},show:function(step){if(step!=undefined){estSteps.step=step;}
if(estSteps.step===0){$('#estimatorIcons').css('display','none');$('#project_estimator_step_2').css('display','none');$('#project_estimator_step_3').css('display','none');$('#project_estimator_step_1').css('display','block');if(vReqBean.domainCode==="valspar_bandq_uk")$('#exteriorLabel, #exterior').css('display','none');showStep1();}else if(estSteps.step==1){$('#estimatorIcons').css('display','none');$('#project_estimator_step_1').css('display','none');$('#project_estimator_step_3').css('display','none');$('#project_estimator_step_2').css('display','block');if(vReqBean.domainCode==="valspar_bandq_uk")$('#project_estimator_step_2 .estimatorRoughIdea').css('visibility','hidden');showStep2();}else if(estSteps.step==2){$('#estimatorIcons').css('display','block');$('#project_estimator_step_1').css('display','none');$('#project_estimator_step_2').css('display','none');$('#project_estimator_step_3').css('display','block');showStep3();}else if(estSteps.step=='doView'){showViewPop();}}};function showStep1(){$('#'+myEstimator.isIntExt).attr('checked',true);$('#estimatorPaintingWhatSwapA .whatBox').each(function(){$(this).attr('checked',false);var intExtRec=myEstimator.data[0];for(var s in intExtRec.painting){if($(this).attr('id')==intExtRec.painting[s]){$(this).attr('checked',true);}}});$('#estimatorPaintingWhatSwapB .whatBox').each(function(){$(this).attr('checked',false);var intExtRec=myEstimator.data[1];for(var s in intExtRec.painting){if($(this).attr('id')==intExtRec.painting[s]){$(this).attr('checked',true);}}});}
function showStep2(){clearAllObjects();var trackingParam="";if(estWorker.isInterior()){_docStyle({id:"estimatorStepBAddWall",style:"display",value:"block"});_docStyle({id:"estimatorStepBAddWallInfo",style:"display",value:"block"});_docStyle({id:"estimatorWallDim",style:"display",value:"block"});_docInner({id:"estimatorWallDimH",value:"Room Dimensions"});_docInner({id:"estimatorWallDimHB",style:"display",value:" (to the nearest foot)"});if(estWorker.getRec(0).roomDim.length>0){_docValue({id:"roomDimL",value:estWorker.getRec(0).roomDim[0].length});_docValue({id:"roomDimW",value:estWorker.getRec(0).roomDim[0].width});_docValue({id:"roomDimH",value:estWorker.getRec(0).roomDim[0].height});}
_docStyle({id:"roomDimH",style:"display",value:"block"});if(ifChecked('walls')||ifChecked('baseboards')){_docStyle({id:"estimatorWallsStage",style:"display",value:"block"});}else{_docStyle({id:"estimatorWallsStage",style:"display",value:"none"});}
if(estWorker.getRec(0).walls.length>0){estWorker.displayWalls();disableFields({name:"walls",disable:true});}else{disableFields({name:"walls",disable:false});}
if(ifChecked('baseboards')){_docStyle({id:"estimatorBaseboardStage",style:"display",value:"block"});estWorker.createBaseboard();trackingParam=trackingParam+"baseboards,";_docValue({id:"roomDimH",value:1});_docStyle({id:"roomDimH",style:"display",value:"none"});}
if(ifChecked('floor')){estWorker.createFloor();trackingParam=trackingParam+"floor,";}
if(ifChecked('ceiling')){estWorker.createCeiling();trackingParam=trackingParam+"ceiling,";}}else{_docStyle({id:"estimatorStepBAddWall",style:"display",value:"none"});_docStyle({id:"estimatorStepBAddWallInfo",style:"display",value:"none"});_docStyle({id:"estimatorWallDim",style:"display",value:"none"});_docInner({id:"estimatorWallDimH",style:"display",value:"Wall Dimensions"});_docInner({id:"estimatorWallDimHB",style:"display",value:" (to the nearest foot, measure height to lowest point of roof.)"});if(ifChecked('walls')||ifChecked('fascia')){_docStyle({id:"estimatorWallsStage",style:"display",value:"block"});if(estWorker.getRec(1).walls.length>0){estWorker.displayWallsExt();}else{createWallsExt();}}else{_docStyle({id:"estimatorWallsStage",style:"display",value:"none"});}
if(ifChecked('fascia')){_docStyle({id:"estimatorFasciaStage",style:"display",value:"block"});estWorker.createFascia();trackingParam=trackingParam+"fascia,";}
if(ifChecked('shutters')){trackingParam=trackingParam+"shutters,";_docStyle({id:"estimatorShuttersStage",style:"display",value:"block"});estWorker.createShuttersDim();if(estWorker.getRec(1).shuttersDim.length>0){_docValue({id:"shutterDimQ",value:estWorker.getRec(1).shuttersDim[0].QTY});_docValue({id:"shutterDimH",value:estWorker.getRec(1).shuttersDim[0].height});_docValue({id:"shutterDimW",value:estWorker.getRec(1).shuttersDim[0].width});}
if(estWorker.getRec(1).shutters.length>0){estWorker.displayShutters();}}
if(ifChecked('floor')){trackingParam=trackingParam+"floor,";estWorker.createFloor();}
if(ifChecked('ceiling')){trackingParam=trackingParam+"ceiling,";estWorker.createCeiling();}}
if(ifChecked('walls')){trackingParam=trackingParam+"walls,";}
if(ifChecked('doors')){trackingParam=trackingParam+"doors,";$('#estimatorDoorsStage').css('display','block');$('#estimatorDoorTapeNeeded').css('display','none');}else if(ifChecked('walls')){$('#estimatorDoorsStage').css('display','block');$('#estimatorDoorTapeNeeded').css('display','block');}else{$('#estimatorDoorsStage').css('display','none');}
if(estWorker.getRec().doorsDim.length>0){_docValue({id:"doorDimQ",value:estWorker.getRec().doorsDim[0].QTY});_docValue({id:"doorDimH",value:estWorker.getRec().doorsDim[0].height});_docValue({id:"doorDimW",value:estWorker.getRec().doorsDim[0].width});_docValue({id:"doorDimT",value:estWorker.getRec().doorsDim[0].trim});}
if(estWorker.getRec().doors.length>0){estWorker.displayDoors();}
if(ifChecked('windows')){trackingParam=trackingParam+"windows,";$('#estimatorWinStage').css('display','block');$('#estimatorWindowTapeNeeded').css('display','none');}else if(ifChecked('walls')){$('#estimatorWinStage').css('display','block');$('#estimatorWindowTapeNeeded').css('display','block');}else{$('#estimatorWinStage').css('display','none');}
if(estWorker.getRec().windowsDim.length>0){_docValue({id:"winDimQ",value:estWorker.getRec().windowsDim[0].QTY});_docValue({id:"winDimH",value:estWorker.getRec().windowsDim[0].height});_docValue({id:"winDimW",value:estWorker.getRec().windowsDim[0].width});_docValue({id:"winDimT",value:estWorker.getRec().windowsDim[0].trim});}
if(estWorker.getRec().windows.length>0){estWorker.displayWindows();}
var inputList=allInputs();for(i=0;i<inputList.length;i++){if(inputList[i].id==myEstimator.isMetersFeet){inputList[i].checked=true;}}
trackPaintCalculator(trackingParam)
changeMetrics();}
function showStep3(){showCopy("WallPrimerCopy");showCopy("WallPaintCopy");showCopy("CeilingPrimerCopy");showCopy("CeilingPaintCopy");showCopy("TexturePaintCopy");showCopy("FloorPrimerCopy");showCopy("FloorPaintCopy");showCopy("TrimPaintCopy");showCopy("TrimPrimerCopy");if(myEstimator.hide_estimate_paint_primer){$('#estimate_paint_primer').css('display','none');}
if(myEstimator.hide_estimate_contrasting_colors){$('#estimate_contrasting_colors').css('display','none');}
if(myEstimator.hide_estimate_items_prep){if(myEstimator.hide_estimate_items_paint){$('#estimate_items').css('display','none');}else{$('#estimate_items_prep').css('display','none');}}else if(myEstimator.hide_estimate_items_paint){$('#estimate_items_paint').css('display','none');}
changeMetrics();var stats=getCalculation();if(stats.showWalls){_docStyle({id:"estimatorFinalWalls",style:"display",value:"block"});_docInner({id:"wallSQPrimer",value:stats.wallSq});_docInner({id:"wallSQPaint",value:stats.wallSq});if(myEstimator.isMetersFeet=="meters"){_docInner({id:"wallGallonsPrimer",value:Math.ceil(stats.wallLiters)});_docInner({id:"wallGallonsPaint",value:Math.ceil(stats.wallLiters)});}else{_docInner({id:"wallGallonsPrimer",value:Math.ceil(stats.wallGallons)});_docInner({id:"wallGallonsPaint",value:Math.ceil(stats.wallGallons)});}}else{_docStyle({id:"estimatorFinalWalls",style:"display",value:"none"});}
if(stats.showCeiling){_docStyle({id:"estimatorFinalCeiling",style:"display",value:"block"});_docInner({id:"ceilingSQPrimer",value:stats.ceilingSQ});_docInner({id:"ceilingSQPaint",value:stats.ceilingSQ});if(myEstimator.isMetersFeet=="meters"){_docInner({id:"ceilingGallonsPrimer",value:Math.ceil(stats.ceilingLiters)});_docInner({id:"ceilingGallonsPaint",value:Math.ceil(stats.ceilingLiters)});}else{_docInner({id:"ceilingGallonsPrimer",value:Math.ceil(stats.ceilingGallons)});_docInner({id:"ceilingGallonsPaint",value:Math.ceil(stats.ceilingGallons)});}}else{_docStyle({id:"estimatorFinalCeiling",style:"display",value:"none"});}
if(stats.showFloors){_docStyle({id:"estimatorFinalFloor",style:"display",value:"block"});_docInner({id:"floorSQPrimer",value:stats.floorSq});_docInner({id:"floorSQPaint",value:stats.floorSq});if(myEstimator.isMetersFeet=="meters"){_docInner({id:"floorGallonsPrimer",value:Math.ceil(stats.floorLiters)});_docInner({id:"floorGallonsPaint",value:Math.ceil(stats.floorLiters)});}else{_docInner({id:"floorGallonsPrimer",value:Math.ceil(stats.floorGallons)});_docInner({id:"floorGallonsPaint",value:Math.ceil(stats.floorGallons)});}}else{_docStyle({id:"estimatorFinalFloor",style:"display",value:"none"});}
if(stats.showDoors){_docStyle({id:"showDoors",style:"display",value:"block"});_docInner({id:"doorSQPaint",value:Math.ceil(stats.doorsSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"doorGallonsPaint",value:Math.ceil(stats.doorLiters)});else
_docInner({id:"doorGallonsPaint",value:Math.ceil(stats.doorGallons)});}else{_docStyle({id:"showDoors",style:"display",value:"none"});}
if(stats.showWin){_docStyle({id:"showWin",style:"display",value:"block"});_docInner({id:"winSQPaint",value:Math.ceil(stats.winSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"winGallonsPaint",value:Math.ceil(stats.winLiters)});else
_docInner({id:"winGallonsPaint",value:Math.ceil(stats.winGallons)});}else{_docStyle({id:"showWin",style:"display",value:"none"});}
if(stats.showBase){_docStyle({id:"showBase",style:"display",value:"block"});_docInner({id:"baseSQPaint",value:Math.ceil(stats.baseSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"baseGallonsPaint",value:Math.ceil(stats.baseLiters)});else
_docInner({id:"baseGallonsPaint",value:Math.ceil(stats.baseGallons)});}else{_docStyle({id:"showBase",style:"display",value:"none"});}
if(stats.showShutters){_docStyle({id:"showShutters",style:"display",value:"block"});_docInner({id:"shuttersSQPaint",value:Math.ceil(stats.shuttersSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"shuttersGallonsPaint",value:Math.ceil(stats.shutterLiters)});else
_docInner({id:"shuttersGallonsPaint",value:Math.ceil(stats.shutterGallons)});}else{_docStyle({id:"showShutters",style:"display",value:"none"});}
if(stats.showFascia){_docStyle({id:"showFascia",style:"display",value:"block"});_docInner({id:"fasciaSQPaint",value:Math.ceil(stats.fasciaSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"fasciaGallonsPaint",value:Math.ceil(stats.fasciaLiters)});else
_docInner({id:"fasciaGallonsPaint",value:Math.ceil(stats.fasciaGallons)});}else{_docStyle({id:"showFascia",style:"display",value:"none"});}
if(stats.showDoors||stats.showWin||stats.showBase||stats.showShutters||stats.showFascia){_docStyle({id:"estimatorFinalTrims",style:"display",value:"block"});_docStyle({id:"estimate_contrasting_colors",style:"display",value:"block"});_docInner({id:"showTotalFor",value:stats.totalMsg});_docInner({id:"totalSQPaint",value:Math.ceil(stats.totalSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"totalGallonsPaint",value:Math.ceil(stats.totalLiters)});else
_docInner({id:"totalGallonsPaint",value:Math.ceil(stats.totalGallons)});}else{_docStyle({id:"estimatorFinalTrims",style:"display",value:"none"});_docStyle({id:"estimate_contrasting_colors",style:"display",value:"none"});}
_docInner({id:"painterTape",value:Math.ceil(stats.tape)});stats.dropClothSq=Math.ceil(stats.dropClothSq);stats.dropClothLF=Math.ceil(Number(stats.dropClothLF));stats.baseLF=Math.ceil(stats.dropClothLF);_docInner({id:"dropCloth",value:stats.dropClothSq});if(stats.dropClothLF!=0){_docStyle({id:"dropClothWrap",style:"display",value:"block"});_docInner({id:"dropCloth",value:stats.dropClothLF});_docInner({id:"squareCloth",value:'linear'});}else{_docStyle({id:"dropClothWrap",style:"display",value:"none"});_docInner({id:"squareCloth",value:'square'});}
if(myEstimator.isIntExt=='exterior'){_docStyle({id:"dropClothWrap",style:"display",value:"none"});_docInner({id:"squareCloth",value:'square'});}
if(vReqBean.domainCode==='valspar_bandq_uk'){if(stats.showDoors||stats.showWin||stats.showBase){_docStyle({id:"interiorTrimWindowBoardsCopy",style:"display",value:"block"});}}}
function showViewPop(){changeMetrics();var stats=getCalculation();_docStyle({id:"estimatorFinalWalls",style:"display",value:"none"});_docStyle({id:"estimatorFinalCeiling",style:"display",value:"none"});_docStyle({id:"estimatorFinalFloor",style:"display",value:"none"});_docStyle({id:"showDoors",style:"display",value:"none"});_docStyle({id:"showWin",style:"display",value:"none"});_docStyle({id:"showBase",style:"display",value:"none"});_docStyle({id:"showShutters",style:"display",value:"none"});_docStyle({id:"showFascia",style:"display",value:"none"});_docStyle({id:"estimatorFinalTrims",style:"display",value:"none"});_docStyle({id:"estimate_contrasting_colors",style:"display",value:"none"});if(stats.showWalls){_docStyle({id:"estimatorFinalWalls",style:"display",value:"block"});_docInner({id:"wallSQPrimer",value:stats.wallSq});_docInner({id:"wallSQPaint",value:stats.wallSq});if(myEstimator.isMetersFeet=="meters"){_docInner({id:"wallGallonsPrimer",value:Math.ceil(stats.wallLiters)});_docInner({id:"wallGallonsPaint",value:Math.ceil(stats.wallLiters)});}else{_docInner({id:"wallGallonsPrimer",value:Math.ceil(stats.wallGallons)});_docInner({id:"wallGallonsPaint",value:Math.ceil(stats.wallGallons)});}}else if(stats.showCeiling){_docStyle({id:"estimatorFinalCeiling",style:"display",value:"block"});_docInner({id:"ceilingSQPrimer",value:stats.ceilingSQ});_docInner({id:"ceilingSQPaint",value:stats.ceilingSQ});if(myEstimator.isMetersFeet=="meters"){_docInner({id:"ceilingGallonsPrimer",value:Math.ceil(stats.ceilingLiters)});_docInner({id:"ceilingGallonsPaint",value:Math.ceil(stats.ceilingLiters)});}else{_docInner({id:"ceilingGallonsPrimer",value:Math.ceil(stats.ceilingGallons)});_docInner({id:"ceilingGallonsPaint",value:Math.ceil(stats.ceilingGallons)});}}else if(stats.showFloors){_docStyle({id:"estimatorFinalFloor",style:"display",value:"block"});_docInner({id:"floorSQPrimer",value:stats.floorSq});_docInner({id:"floorSQPaint",value:stats.floorSq});if(myEstimator.isMetersFeet=="meters"){_docInner({id:"floorGallonsPrimer",value:Math.ceil(stats.floorLiters)});_docInner({id:"floorGallonsPaint",value:Math.ceil(stats.floorLiters)});}else{_docInner({id:"floorGallonsPrimer",value:Math.ceil(stats.floorGallons)});_docInner({id:"floorGallonsPaint",value:Math.ceil(stats.floorGallons)});}}else if(stats.showDoors){_docStyle({id:"showDoors",style:"display",value:"block"});_docInner({id:"doorSQPaint",value:Math.ceil(stats.doorsSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"doorGallonsPaint",value:Math.ceil(stats.doorLiters)});else
_docInner({id:"doorGallonsPaint",value:Math.ceil(stats.doorGallons)});}else if(stats.showWin){_docStyle({id:"showWin",style:"display",value:"block"});_docInner({id:"winSQPaint",value:Math.ceil(stats.winSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"winGallonsPaint",value:Math.ceil(stats.winLiters)});else
_docInner({id:"winGallonsPaint",value:Math.ceil(stats.winGallons)});}else if(stats.showBase){_docStyle({id:"showBase",style:"display",value:"block"});_docInner({id:"baseSQPaint",value:Math.ceil(stats.baseSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"baseGallonsPaint",value:Math.ceil(stats.baseLiters)});else
_docInner({id:"baseGallonsPaint",value:Math.ceil(stats.baseGallons)});}else if(stats.showShutters){_docStyle({id:"showShutters",style:"display",value:"block"});_docInner({id:"shuttersSQPaint",value:Math.ceil(stats.shuttersSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"shuttersGallonsPaint",value:Math.ceil(stats.shutterLiters)});else
_docInner({id:"shuttersGallonsPaint",value:Math.ceil(stats.shutterGallons)});}else if(stats.showFascia){_docStyle({id:"showFascia",style:"display",value:"block"});_docInner({id:"fasciaSQPaint",value:Math.ceil(stats.fasciaSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"fasciaGallonsPaint",value:Math.ceil(stats.fasciaLiters)});else
_docInner({id:"fasciaGallonsPaint",value:Math.ceil(stats.fasciaGallons)});}
if(stats.showDoors||stats.showWin||stats.showBase||stats.showShutters||stats.showFascia){_docStyle({id:"estimatorFinalTrims",style:"display",value:"block"});_docInner({id:"showTotalFor",value:stats.totalMsg});_docInner({id:"totalSQPaint",value:Math.ceil(stats.totalSq)});if(myEstimator.isMetersFeet=="meters")
_docInner({id:"totalGallonsPaint",value:Math.ceil(stats.totalLiters)});else
_docInner({id:"totalGallonsPaint",value:Math.ceil(stats.totalGallons)});}else{_docStyle({id:"estimatorFinalTrims",style:"display",value:"none"});}}
function radioIntExt(obj){if(obj.id=="interior"){myEstimator.dataIndex=0;myEstimator.isIntExt=obj.id;document.getElementById('estimatorMathSwapA').style.display="block";document.getElementById('estimatorMathSwapB').style.display="none";document.getElementById('estimatorPaintingWhatSwapA').style.display="block";document.getElementById('estimatorPaintingWhatSwapB').style.display="none";}else{myEstimator.dataIndex=1;myEstimator.isIntExt=obj.id;document.getElementById('estimatorMathSwapA').style.display="none";document.getElementById('estimatorMathSwapB').style.display="block";document.getElementById('estimatorPaintingWhatSwapA').style.display="none";document.getElementById('estimatorPaintingWhatSwapB').style.display="block";}}
function allInputs(){var mainTableElement=document.getElementById('estimatorMainTable');if(mainTableElement){var inputList=mainTableElement.getElementsByTagName('input');return inputList;}else{return[];}}
function painting(obj){if(obj.checked){estWorker.getRec()['painting'].push(obj.id);}else{for(var i in estWorker.getRec().painting){if(estWorker.getRec().painting[i]==obj.id){estWorker.getRec()['painting'].splice(i,1);}}}}
function ifChecked(obj){var yes=false;for(var i in estWorker.getRec().painting){if(estWorker.getRec().painting[i]==obj){yes=true;break;}}
return yes;}
function showCopy(copyId){$('#interior'+copyId+'_lowes').css('display','none');$('#interior'+copyId+'_ir').css('display','none');$('#exterior'+copyId+'_lowes').css('display','none');$('#exterior'+copyId+'_ir').css('display','none');$('#'+myEstimator.isIntExt+copyId+'_'+preferredChannelCode).css('display','block');}
function getCalculation(){changeMetrics();var perGallon=metricDefaults[myEstimator.isMetersFeet].measurement;if(myEstimator.isMetersFeet=="meters"){perGallon=metricDefaults.meters.measurement;}
var stats={wallSq:0,doorsSq:0,winSq:0,baseSq:0,floorSq:0,tape:0,dropClothSq:0,dropClothLF:0,shuttersSq:0,fasciaSq:0,fasciaLF:0,doorGallons:0,winGallons:0,baseGallons:0,shutterGallons:0,fasciaGallons:0,baseLF:0,wallGallons:0,ceilingGallons:0,ceilingSQ:0,ceilingDim:0,floorGallons:0,showWalls:ifChecked('walls'),showDoors:ifChecked('doors'),showWin:ifChecked('windows'),showBase:ifChecked('baseboards'),showCeiling:ifChecked('ceiling'),showFloors:ifChecked('floor'),showShutters:ifChecked('shutters'),showFascia:ifChecked('fascia'),totalMsg:"Total for ",totalGallons:0,totalSq:0,grandTotalMsg:"Total for ",grandTotalGallons:0,grandTotalSq:0};if(estWorker.isInterior()){if(stats.showWalls||stats.showBase)
{if(estWorker.getRec().walls.length>0){for(var i in estWorker.getRec().walls){var roomDim=estWorker.getRec().walls[i];var length=Number(roomDim.length);var height=Number(roomDim.height);stats.dropClothLF=(stats.dropClothLF<length)?length:stats.dropClothLF;stats.wallSq+=(length*height);stats.baseLF+=length;stats.fasciaLF+=length;if(stats.showWalls)
stats.tape+=length*2;}}else{var roomDim=estWorker.getRec()['roomDim'][0];if(roomDim!=undefined){var length=Number(roomDim.length);var width=Number(roomDim.width);var height=Number(roomDim.height);stats.dropClothLF=(Number(stats.dropClothLF)<length)?length:stats.dropClothLF;stats.dropClothLF=(Number(stats.dropClothLF)<width)?width:stats.dropClothLF;stats.wallSq+=((length*height)+(width*height))*2;stats.baseLF+=(length+width)*2;stats.fasciaLF+=(length+width)*2;if(stats.showWalls)
stats.tape+=(length+width)*4;stats.dropClothSq=length*width;}}}}else{for(var i in estWorker.getRec().walls){var roomDim=estWorker.getRec().walls[i];var length=Number(roomDim.length);var height=Number(roomDim.height);stats.wallSq+=(length*height);stats.baseLF+=length;stats.fasciaLF+=length;if(stats.showWalls)
stats.tape+=length*2;if(roomDim.gable){stats.wallSq+=(length*length)/4;}}}
var doorsDim=estWorker.getRec()['doorsDim'][0];if(doorsDim!=undefined){var trim=Number(doorsDim.trim)/12;var width=Number(doorsDim.width)+(trim*2);var height=Number(doorsDim.height)+trim;stats.doorsSq+=(width*height*Number(doorsDim.QTY));var tape=((width+(height*2))*Number(doorsDim.QTY));if(stats.showDoors&&stats.showWalls){stats.tape+=tape*4;}else if(stats.showDoors||stats.showWalls){stats.tape+=tape*2;}
if(((stats.showDoors)||(stats.showWalls))&&(Number(doorsDim.QTY)>0))
stats.dropClothLF+=Number(doorsDim.width);}
if((estWorker.getRec().doors.length>0)&&stats.showDoors){for(var i in estWorker.getRec().doors){var trim=Number(estWorker.getRec().doors[i].trim)/12;var width=Number(estWorker.getRec().doors[i].width)+(trim*2);var height=Number(estWorker.getRec().doors[i].height)+trim;stats.doorsSq+=(width*height);var tape=((width+(height*2))*2);if(stats.showDoors&&stats.showWalls){stats.tape+=tape*4;}else if(stats.showDoors||stats.showWalls){stats.tape+=tape*2;}
if((stats.showDoors)||(stats.showWalls))
stats.dropClothLF+=Number(estWorker.getRec().doors[i].width);}}
var windowsDim=estWorker.getRec()['windowsDim'][0];if(windowsDim!=undefined){var trim=Number(windowsDim.trim)/12;var width=Number(windowsDim.width)+(trim*2);var height=Number(windowsDim.height)+(trim*2);stats.winSq+=(((width*trim)+(height*trim))*4*Number(windowsDim.QTY));stats.tape+=(((width*2)+(height*2))*Number(windowsDim.QTY));var tape=(((width*2)+(height*2))*Number(windowsDim.QTY));if(stats.showWin&&stats.showWalls){stats.tape+=tape*6;}else if(stats.showWin){stats.tape+=tape*4;}else if(stats.showWalls){stats.tape+=tape*2;}
if((stats.showWin||stats.showWalls)&&(Number(windowsDim.QTY)>0))
stats.dropClothLF+=Number(windowsDim.width);}
if(estWorker.getRec().windows.length>0){for(var i in estWorker.getRec().windows){var trim=Number(estWorker.getRec().windows[i].trim)/12;var width=Number(estWorker.getRec().windows[i].width)+(trim*2);var height=Number(estWorker.getRec().windows[i].height)+(trim*2);stats.winSq+=(((width*trim)+(height*trim))*4);var tape=((width*2)+(height*2));if(stats.showWin&&stats.showWalls){stats.tape+=tape*6;}else if(stats.showWin){stats.tape+=tape*4;}else if(stats.showWalls){stats.tape+=tape*2;}
if((stats.showWin)||(stats.showWalls))
stats.dropClothLF+=Number(estWorker.getRec().windows[i].width);}}
if(stats.showCeiling){var width=Number(estWorker.getRec().ceilingDim[0].width);var length=Number(estWorker.getRec().ceilingDim[0].length);stats.ceilingSQ=length*width;stats.tape+=(length+width)*2;}
if(stats.showFloors){var width=Number(estWorker.getRec().floorDim[0].width);var length=Number(estWorker.getRec().floorDim[0].length);stats.floorSq=length*width;stats.tape+=(length+width)*2;}
if(stats.showShutters){stats.shuttersSq=(Number(estWorker.getRec()['shuttersDim'][0].width)*Number(estWorker.getRec()['shuttersDim'][0].height))*Number(estWorker.getRec()['shuttersDim'][0].QTY);if(estWorker.getRec().shutters.length>0){for(var i in estWorker.getRec().shutters){stats.shuttersSq+=Number(estWorker.getRec().shutters[i].height)*Number(estWorker.getRec().shutters[i].width);}}}
if(stats.showBase){var height=Number(estWorker.getRec()['baseboardDim'][0].height)/12;stats.baseSq=(stats.baseLF*height);stats.tape+=stats.baseLF*2;}
if(stats.showFascia){var height=Number(estWorker.getRec()['fasciaDim'][0].height)/12;stats.fasciaSq=(stats.fasciaLF*height);if(stats.showWalls){stats.tape+=stats.fasciaLF*2;}else{stats.tape+=stats.fasciaLF;}}
stats.wallGallons=stats.wallSq/perGallon;if(stats.showWalls){stats.grandTotalGallons+=Math.ceil(stats.wallGallons);stats.grandTotalSq+=stats.wallSq;stats.grandTotalMsg+="Walls/";}
if(myEstimator.isMetersFeet=="meters"){}
stats.ceilingGallons=(stats.ceilingSQ/perGallon);if(stats.showCeiling){stats.grandTotalGallons+=Math.ceil(stats.ceilingGallons);stats.grandTotalSq+=stats.ceilingSQ;stats.grandTotalMsg+="Ceilings/";}
if(myEstimator.isMetersFeet=="meters"){}
stats.floorGallons=(stats.floorSq/perGallon);if(stats.showFloors){stats.grandTotalGallons+=Math.ceil(stats.floorGallons);stats.grandTotalSq+=stats.floorSq;stats.grandTotalMsg+="Floors/";}
if(myEstimator.isMetersFeet=="meters"){}
if(stats.showDoors){stats.doorGallons=(stats.doorsSq/perGallon);stats.totalGallons+=stats.doorsSq;stats.totalSq+=stats.doorsSq;stats.totalMsg+="Doors/";}
if(stats.showWin){stats.winGallons=(stats.winSq/perGallon);stats.totalGallons+=stats.winSq;stats.totalSq+=stats.winSq;stats.totalMsg+="Window/";}
if(stats.showBase){stats.baseGallons=(stats.baseSq/perGallon);stats.totalGallons+=stats.baseSq;stats.totalSq+=stats.baseSq;stats.totalMsg+=(vReqBean.domainCode==="valspar_bandq_uk"?"Skirting Boards/":"Baseboards/");}
if(stats.showFascia){stats.fasciaGallons=(stats.fasciaSq/perGallon);stats.totalGallons+=stats.fasciaSq;stats.totalSq+=stats.fasciaSq;stats.totalMsg+="Fascia/Overhang/";}
if(stats.showShutters){stats.shutterGallons=(stats.shuttersSq/perGallon);stats.totalGallons+=stats.shuttersSq;stats.totalSq+=stats.shuttersSq;stats.totalMsg+="Shutters/";}
if(stats.showDoors||stats.showWin||stats.showBase||stats.showShutters||stats.showFascia){stats.totalGallons=(stats.totalGallons/perGallon);stats.totalMsg+="Trim";stats.grandTotalGallons+=Math.ceil(stats.totalGallons);stats.grandTotalSq+=stats.totalSq;stats.grandTotalMsg+=stats.totalMsg;}
if(estWorker.isInterior()&&stats.dropClothSq==0){if(stats.showCeiling){stats.dropClothSq=stats.ceilingSQ;}else if(stats.showFloors){stats.dropClothSq=stats.floorSq;}}
stats.dropClothSq*=1.34;stats.dropClothLF*=1.34;if(myEstimator.isMetersFeet=="meters"){var gallonPerLiter=3.785;stats.wallLiters=stats.wallGallons*gallonPerLiter;stats.ceilingLiters=stats.ceilingGallons*gallonPerLiter;stats.floorLiters=stats.floorGallons*gallonPerLiter;stats.doorLiters=stats.doorGallons*gallonPerLiter;stats.winLiters=stats.winGallons*gallonPerLiter;stats.baseLiters=stats.baseGallons*gallonPerLiter;stats.shutterLiters=stats.shutterGallons*gallonPerLiter;stats.fasciaLiters=stats.fasciaGallons*gallonPerLiter;stats.totalLiters=0;if(stats.showDoors||stats.showWin||stats.showBase||stats.showShutters||stats.showFascia){stats.totalLiters=Math.ceil(stats.doorLiters+stats.winLiters+stats.baseLiters+stats.shutterLiters+stats.fasciaLiters);}
stats.grandTotalLiters=Math.ceil(stats.totalLiters+(stats.wallLiters+stats.ceilingLiters+stats.floorLiters));stats.dropClothSq=(stats.dropClothSq*.3048);stats.baseLF=(stats.baseLF*.3048);stats.tape=(stats.tape*.3048);}
var decimals=2;stats.wallSq=roundTo(stats.wallSq,decimals);stats.doorsSq=roundTo(stats.doorsSq,decimals);stats.winSq=roundTo(stats.winSq,decimals);stats.baseSq=roundTo(stats.baseSq,decimals);stats.floorSq=roundTo(stats.floorSq,decimals);stats.tape=roundTo(stats.tape,decimals);stats.dropClothSq=roundTo(stats.dropClothSq,decimals);stats.dropClothLF=roundTo(stats.dropClothLF,decimals);stats.baseLF=roundTo(stats.baseLF,decimals);stats.shuttersSq=roundTo(stats.shuttersSq,decimals);stats.fasciaSq=roundTo(stats.fasciaSq,decimals);stats.fasciaLF=roundTo(stats.fasciaLF,decimals);stats.baseLF=roundTo(stats.baseLF,decimals);stats.ceilingSQ=roundTo(stats.ceilingSQ,decimals);stats.totalSq=roundTo(stats.totalSq,decimals);stats.grandTotalSq=roundTo(stats.grandTotalSq,decimals);return stats;}
function validateEmailEstimator(obj){if(obj.trackEmailToFriend)
trackEmailToFriend();if(obj.emailPopup1&&obj.emailPopup2)
emailPopup.display(checkforUndefined(obj.emailPopup1),obj.emailPopup2);}
function validatePrintEstimator(obj){if(obj.trackShoppingListPrinted)
trackShoppingListPrinted();if(obj.printPopup1)
printPopup.display(checkforUndefined(obj.printPopup1));}
function checkforUndefined(url){var checking="usrOrganizerListId=undefined";var str=url;if(url){if(url.toLowerCase().indexOf(checking.toLowerCase())>=0){var num=url.toLowerCase().indexOf(checking.toLowerCase());var str1=url.substring(0,num);var str2=url.substring(num,num+checking.length);var str3=(url.length>(str1.length+str2.length))?url.substring((str1.length+str2.length)):"";str2=str2.replace("undefined",usrOrganizerListId);str=str1+str2+str3;}}
return str;}
function roundTo(number,decimal){var num=new Number(number);if(!isNaN)return number;if(num.toString().indexOf(".")>=0){if(!decimal)
num=Math.ceil(number);else
num=num.toFixed(decimal);}else{num=Math.ceil(number);}
return num;}
