Cufon.replace('h1, h2, .process-number', {fontFamily: 'Brandon'});
Cufon.replace('h3, h4', {fontFamily: 'Brandon'});
Cufon.replace('.homepage-context .header-content h4', {fontFamily: 'Brandon'});

$(function() {

  // Set backgrounds for pages with complex layout
  function set_bgr() {
    if ($('.makes-show-context').length != 0) {
      // $('<div></div>').appendTo('body').addClass('jsgen-topbgr').css({height: $('.choose-phone').offset().top + 'px', top: 0});
      // $('<div></div>').appendTo('body').addClass('jsgen-bottombgr').css({height: $('.choose-phone').outerHeight() + 'px', top: $('.choose-phone').offset().top + 'px'});
    }
    if ($('.info-page-context').length != 0) {
      $('<div></div>').appendTo('body').addClass('jsgen-topbgr').css({height: $('.c-footer').offset().top + 'px', top: 0});
    }
    if ($('.orders-context').length != 0) {
      $('<div></div>').appendTo('body').addClass('jsgen-topbgr').css({height: $('.c-footer').offset().top + 'px', top: 0});
    }
    if ($('.models-show-context').length != 0) {
      $('<div></div>').appendTo('body').addClass('jsgen-topbgr').css({height: $('.user-reviews').offset().top + 'px', top: 0});
      $('<div></div>').appendTo('body').addClass('jsgen-bottombgr').css({height: $('.footer-context .main-block').offset().top + 'px', top: $('.user-reviews').offset().top + 'px'});
    }
  }
  set_bgr(); $(window).load(function(){ set_bgr() });

	// initialize stylish selects (only those, which are not initialized yet)
	$('.stylish-select-context select').filter(function () { return !$(this).data('ssOpts'); }).sSelect({ddMaxHeight: '250px'});

	$('.js-with-placeholder').each(function() {
		var default_value = this.value;
		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = '';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
			}
		});
	});
});


