$(document).bind('contentReady',function(event,content){if($.browser.msie&&$.browser.version==6)
{$("#main-nav > li").hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");});}
content.find("#intro").tabs().tabs("rotate",7000);content.find("#size-tabs").tabs({select:function(event,ui){var selected=$(this).tabs('option','selected');switch(selected){case 0:$('#transport-estimator input').prop('checked',false);break;case 1:$.showLoadingMessage('Loading Information&hellip;<br />Please wait');var data={quoteId:$('.quoteId').val()};$.decibel.rpc.call('app/SpacePlace/SpaceEstimator/DeleteAllItemEstimates',deleteAllStorageItems,data,null);break;}}});content.find("#special-offers ul").jcarousel({auto:10,scroll:1,wrap:"circular"});content.find("#estimator .choices .i-know").change(function()
{if($(this).is(":checked"))
{$("#estimator-outer").hide();$("#choose-size-outer").show();}}).trigger("change");content.find("#estimator .choices .i-dont-know").change(function()
{if($(this).is(":checked"))
{$("#choose-size-outer").hide();$("#estimator-outer").show();}}).trigger("change");content.find('.storageItem').click(function(){$.showLoadingMessage('Adding new storage item&hellip;<br />Please wait');var data=createDataArray($(this));$.decibel.rpc.call('app/SpacePlace/SpaceEstimator/NewItemEstimateRpc',addStorageItem,data,null);});});function grapDeleteClick(object){$.showLoadingMessage('Deleting the storage item&hellip;<br />Please wait');var data=createDataArray($(object));$.decibel.rpc.call('app/SpacePlace/SpaceEstimator/DeleteItemEstimateRpc',deleteStorageItem,data,null);}
function addStorageItem(result){if(result.success){if($('.item-estimate-'+result.storageItem).length){$('.item-estimate-'+result.storageItem).find('span').text(result.newText);$('.quoteId').val(result.quoteId);}else{var html=$('<li id="itemEstimate-'+result.storageItem+'" class="item-estimate-'+result.storageItem+' item-estimate-row"><div  class="remove"><img alt="remove" src="'+result.imageUrl+'icon-remove.png" /></div><span>'+result.newText+'</span></li>');html.click(function(){grapDeleteClick($(this));});$(".items-estimate-list").children(':first').before(html);$('.quoteId').val(result.quoteId);}}else{alert('We can not update this information right now.');}
$.hideLoadingMessage();}
function deleteStorageItem(result){if(result.success){$('.item-estimate-'+result.storageItem).remove();}else{alert('We can not update this information right now.');}
$.hideLoadingMessage();}
function deleteAllStorageItems(result){if(result.success){$('.item-estimate-row').remove();}
$.hideLoadingMessage();}
function createDataArray(object){var storageItemId=$(object).attr('id');storageItemId=storageItemId.substring(storageItemId.indexOf('-')+1,storageItemId.length);var data={storageItem:storageItemId,quoteId:$('.quoteId').val()};return data;}
function knowSizeSubmit(){$('.lockerId').val($('#locker').val());$('#estimator-size-form').submit();}
