var sbp = _7BP.augment({
	emphasize: {'class': 'highlight'},
	deemphasize: {'class': 'reduce'}
}).deferredApply();

var sbpWI = _7BP.augment({
	emphasize: {'class': 'highlight', behavior: _7BP.behavior.wrapInner},
	deemphasize: {'class': 'reduce', behavior: _7BP.behavior.wrapInner}
}).deferredApply();

var sbpW = _7BP.augment({
	emphasize: {'class': 'highlight', behavior: _7BP.behavior.wrap},
	deemphasize: {'class': 'reduce', behavior: _7BP.behavior.wrap}
}).deferredApply();

var sbpWD = _7BP.augment({
	emphasize: {'class': 'highlight', behavior: _7BP.behavior.wrap, data: "<div>"},
	deemphasize: {'class': 'reduce', behavior: _7BP.behavior.wrap, data: "<div>"}
}).deferredApply();

var sbp_panel = _7BP.augment({
	emphasize: {'class': 'highlight'},
	deemphasize: {behavior: _7BP.behavior.panelize, data: {content: {collapsed: {style: {position: "absolute", top: "-600"}}}}}
}).deferredApply();

// --- booking page ---
if (/121carhire\.com(:\d+)?\/.*\/booking\.php\?book=/.test(document.location.href)) {

	_7BP.augment({
		process: {behavior: function(elem) {
		  _7BP.jQuery(elem).show().up(1).addClass('bar_highlight');
		}},
		balanced: {behavior: function(elem) {
		  _7BP.jQuery(elem).show().up(1).addClass('bar_highlight');
		}}
	}).deferredApplyAll().presentation("div.sbp_steps .sbp_step_img");

	_7BP.augment({
		safety: {behavior: function(elem) {
			_7BP.jQuery(elem).find('div.bar>span.sbp_title_wrap').text('Secure Payment Details');			
		}},
		balanced: {behavior: function(elem) {
			_7BP.jQuery(elem).find('div.bar>span.sbp_title_wrap').text('Secure Payment Details');			
		}}
	}).deferredApplyAll().motivation("#sbp_payment");

	_7BP.augment({
		emphasize: {behavior: function(elem) {
			var item = _7BP.jQuery(elem);
			item.find('span.sbp_prot_orig').hide();
			item.find('span.sbp_prot_excess').show();
		}},
		deemphasize: {behavior: function(elem) {
		}}
	}).deferredApply().warranty("#sbp_protection");

	_7BP.augment({
		emphasize: {behavior: function(elem) {
		}},
		deemphasize: {behavior: function(elem) {
			_7BP.jQuery(elem).show();
		}}
	}).deferredApply().steps("#sbp_protection span.sbp_prot_opt");

	_7BP.augment({
		choice: {behavior: function(elem) {
			var sbp_protection = _7BP.jQuery(elem);
			sbp_protection.text('Choose your Optional Equipment');
		}},
		balanced: {behavior: function(elem) {
			var sbp_protection = _7BP.jQuery(elem);
			sbp_protection.text('Choose your Optional Equipment');
		}}
	}).deferredApply().presentation("#sbp_extras>div.bar>span.sbp_title_wrap");

	_7BP.augment({
		emphasize: {behavior: function(elem) {
		}},
		deemphasize: {behavior: function(elem) {
			_7BP.jQuery(elem).find('div.bar>span.sbp_title_wrap').text('Don\'t miss these great upgrade options!');
		}}
	}).deferredApply().deal("#sbp_upgrade");
	
	_7BP.augment({
		other: {behavior: function(elem) {
			_7BP.jQuery(elem).addClass('highlight').find('.sbp_stars').css('display', 'inline');
		}},
		balanced: {behavior: function(elem) {
			_7BP.jQuery(elem).addClass('highlight').find('.sbp_stars').css('display', 'inline');
		}}
	}).deferredApply().decision("#sbp_reviews");

	_7BP.augment({
		process: {behavior: function(elem) {
			_7BP.jQuery(elem).addClass('highlight');
		}},
		balanced: {behavior: function(elem) {
			_7BP.jQuery(elem).addClass('highlight');
		}}
	}).deferredApply().presentation("#sbp_upgradeBox");
	
} 
else if (/121carhire\.com(:\d+)?\/(#|$|\?.*)/.test(document.location.href)) {
	_7BP.augment({
		other: {behavior: function(elem) {
			_7BP.jQuery(elem).css('background-image', 'url('+_7BP.urlForClientResource('/images/7bp/form_bottom_O.jpg')+')').css('visibility', 'visible');
		}},
		self: {behavior: function(elem) {
			_7BP.jQuery(elem).css('background-image', 'url('+_7BP.urlForClientResource('/images/7bp/form_bottom_S.jpg')+')').css('visibility', 'visible');
		}},
		balanced: {behavior: function(elem) {
			_7BP.jQuery(elem).css('background-image', 'url('+_7BP.urlForClientResource('/images/7bp/form_bottom_N.jpg')+')').css('visibility', 'visible');
		}}
	}).deferredApply().decision("body #form2");

// Note: doing this in multiple augment calls since it seems to be a slow build and doesn't match all the selectors when grouped together
	_7BP.augment({
		opportune: {behavior: function(elem) {
			_7BP.jQuery(elem).addClass('highlight').css('background-image', 'url('+_7BP.urlForClientResource('/images/7bp/form_top_O.jpg')+')');
		}},
		safety: {behavior: function(elem) {
			_7BP.jQuery(elem).addClass('reduce').css('background-image', 'url('+_7BP.urlForClientResource('/images/7bp/form_top_S.jpg')+')');
		}},
		balanced: {behavior: function(elem) {
			_7BP.jQuery(elem).addClass('reduce').css('background-image', 'url('+_7BP.urlForClientResource('/images/7bp/form_top_S.jpg')+')');
		}}
	}).deferredApply().motivation("body #formTop");

	_7BP.augment({
		opportune: {behavior: function(elem) {
			_7BP.jQuery(elem).attr('src', _7BP.urlForClientResource('/images/7bp/search_now.gif'));
		}},
		safety: {behavior: function(elem) {
// TODO: Change to start_search image when received from designer
			_7BP.jQuery(elem).attr('src', _7BP.urlForClientResource('/images/7bp/search_now.gif'));
		}},
		balanced: {behavior: function(elem) {
// TODO: Change to start_search image when received from designer
			_7BP.jQuery(elem).attr('src', _7BP.urlForClientResource('/images/7bp/search_now.gif'));
		}}
	}).deferredApply().motivation("#searchBtn>input");
	
	_7BP.augment({
		opportune: {behavior: function(elem) {
			_7BP.jQuery('#content_right').append('<div id="sbp_secure_div"><img id="sbp_secure_imgs" src="'+ _7BP.urlForClientResource('/images/7bp/security_logos.gif') +'"/></div>');
			_7BP.jQuery('#trustwaveSealImage').appendTo('#sbp_secure_div');
		}}
	}).deferredApply().motivation("#content+*");
}
else if (/121carhire\.com(:\d+)?\/.*\/search\.php/.test(document.location.href)) {
	_7BP.augment({
		choice: {behavior: function(elem) {
		  _7BP.jQuery(elem).attr("src", _7BP.urlForClientResource("/images/7bp/choose_button.gif"));
		}}
	}).deferredApplyAll().presentation("img[src*=book.gif]");

	_7BP.augment({
		process: {behavior: function(elem) {
		  _7BP.jQuery(elem).text("Available Deals")
		}},
		choice: {behavior: function(elem) {
		  _7BP.jQuery(elem).html("Choose Your Deal");
		}},
		balanced: {behavior: function(elem) {
		  _7BP.jQuery(elem).html("Choose Your Deal");
		}}
	}).deferredApplyAll().presentation("#sbp_car_results_header");

	_7BP.augment({
		opportune: {behavior: function(elem) {
		  _7BP.jQuery(elem).html("Beware of other companies' add ons.<br />Get the best deal here!");
		}},
		safety: {behavior: function(elem) {
		  _7BP.jQuery(elem).html("Prevent payment surprises!<br />Our deals include everything you need.");
		  _7BP.jQuery("#whatsIncludedTitle").withNext(1).hide();
		}},
		balanced: {behavior: function(elem) {
		  _7BP.jQuery(elem).html("Beware of other companies' add ons.<br />Get the best deal here!");
		}}
	}).deferredApplyAll().motivation("#sbp_whats_incl_banner");

	_7BP.augment({
		other: {behavior: function(elem) {
			var item = _7BP.jQuery(elem);
		  var txt = item.text();
			txt = txt.replace(/^We.*have/, 'Total:');
			txt = txt.replace(/ranging/, '- Prices');
			txt = txt.replace(/\.$/, '');
			item.text(txt);
		}},
		balanced: {behavior: function(elem) {
			var item = _7BP.jQuery(elem);
		  var txt = item.text();
			txt = txt.replace(/^We.*have/, 'Total:');
			txt = txt.replace(/ranging/, '- Prices');
			txt = txt.replace(/\.$/, '');
			item.text(txt);
		}},
		self: {behavior: function(elem) {
			var item = _7BP.jQuery(elem);
		  var txt = item.text();
			txt = txt.replace(/\.$/, ' - the choice is up to you!');
			item.text(txt);
		}}
	}).deferredApplyAll().decision("#barSmallText");

	_7BP.augment({
		self: {behavior: function(elem) {
			_7BP.jQuery(elem)[0].childNodes[0].nodeValue = "Your Search Results - ";
		}}
	}).deferredApplyAll().decision("#searchResultsBar");
}
