efnNORD – Product Certification and Consulting

JavaScript
/**
 * Add this script to the end of your document that use <input autofocus type="text" />
 * or <input type="text" placeholder="username" />and it'll plug support for browser
 * without these attributes
 * Minified version at the bottom
 */
(function () {

function each(list, fn) {
  var l = list.length;
  for (var i = 0; i < l; i++) {
    if (fn.call(list[i], list[i], i, list) === false) {
      break;
    }
  }
}

var addEvent = (function () {
  if (document.addEventListener) {
    return function (el, type, fn) {
      if (el && el.nodeName || el === window) {
        el.addEventListener(type, fn, false);
      } else if (el && el.length) {
        for (var i = 0; i < el.length; i++) {
          addEvent(el[i], type, fn);
        }
      }
    };
  } else {
    return function (el, type, fn) {
      if (el && el.nodeName || el === window) {
        el.attachEvent('on' + type, function () { return fn.call(el, window.event); });
      } else if (el && el.length) {
        for (var i = 0; i < el.length; i++) {
          addEvent(el[i], type, fn);
        }
      }
    };
  }
})();

var i = document.createElement('input'),
    inputs = document.getElementsByTagName('input'),
	textareas = document.getElementsByTagName('textarea');

if (!('placeholder' in i)) {
  function pl(el) {
	// note - we're using el instead of this across the board because it compresses better
    var lastValue = el.value, placeholder = el.getAttribute('placeholder');

    var focus = function () {
      if (el.value == placeholder) {
        el.value = '';
        el.style.color = '';
      }
    };

    var blur = function () {
      if (el.value == '') {
        el.value = placeholder;
        el.style.color = '#A29797';
      }
    };

    addEvent(el, 'focus', focus);
    addEvent(el, 'blur', blur);

    // remove the placeholder if the page is reload or the form is submitted
    addEvent(el.form, 'submit', function () { focus.call(el); });
    addEvent(window, 'unload', function () { focus.call(el); });

    // set the default state
    if (el.value == '') {
      blur.call(el);
    }
  }
  // placeholder fix
  each(inputs, function (el) {
    pl(el);
  });
  each(textareas, function (el) {
    pl(el);
  });
}

if (!('autofocus' in i)) {
  // auto focus
  each(inputs, function (el) {
    if (el.getAttribute('autofocus') != null) {
      el.focus();
      return false; // "there can only be one"
    }
  });
}

})();

$(document).ready(function() {
	$('#info .prod dt').click(function(){
		if(! $(this).hasClass("selected")) {
			var toShow = $(this).next();
			var toHide = $("#info .prod dd:visible");

			var staticWidth = parseInt(toShow.width());
			//var staticWidth = 606;

			toHide.animate({ width: "hide" }, {
				step: function(now) {
					var current = staticWidth - now;
					if ($.browser.msie || $.browser.opera || $.browser.safari) {
						current = Math.ceil(current);
					}
					toShow.width(current);
				},
				duration: 400
			});
			toShow.css({ width: 0, display: "block" });

			$('#info .prod dt').removeClass('selected');
			$(this).addClass('selected');
		}

		return;
	});

	$('a.modal').click(function (e) {
		e.preventDefault();
		$('#overlay').addClass('opened');
		$('#overlay .' + $(this).attr('rel')).addClass('opened');
	});
	$('#overlay .modal').click(function(e) {
		if (! $(e.target).hasClass('file') && ! $(e.target).hasClass('reset') && ! $(e.target).hasClass('submit')) {
			e.stopPropagation();
			return false;
		}
	});
	$('#overlay').live('click', function(e) {
		if (! $(e.target).hasClass('file')) {
			$(this).removeClass('opened');
			$(this).children('.modal').removeClass('opened');
		}
	});
	$('#overlay .reset').click(function () {
		$('#overlay').removeClass('opened');
		$('#overlay .modal').removeClass('opened');
	});
});