/*! A fix for the iOS orientationchange zoom bug.
 Script by @scottjehl, rebound by @wilto.
 MIT License.
(function(w){
    var doc = w.document;

    if( !doc.querySelector ){ return; }

    var meta = doc.querySelector( "meta[name=viewport]" ),
        initialContent = meta && meta.getAttribute( "content" ),
        disabledZoom = initialContent + ",maximum-scale=1",
        enabledZoom = initialContent + ",maximum-scale=10",
        enabled = true,
		x, y, z, aig;

    if( !meta ){ return; }

    function restoreZoom(){
        meta.setAttribute( "content", enabledZoom );
        enabled = true;
    }

    function disableZoom(){
        meta.setAttribute( "content", disabledZoom );
        enabled = false;
    }

    function checkTilt( e ){
		aig = e.accelerationIncludingGravity;
		x = Math.abs( aig.x );
		y = Math.abs( aig.y );
		z = Math.abs( aig.z );

		// If portrait orientation and in one of the danger zones
        if( !w.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ){
			if( enabled ){
				disableZoom();
			}        	
        }
		else if( !enabled ){
			restoreZoom();
        }
    }

    w.addEventListener( "orientationchange", restoreZoom, false );
	w.addEventListener( "devicemotion", checkTilt, false );

})( this );
*/

/*! TinyNav.js v1.01. (c)2011-2012 Viljami Salminen. MIT License. http://tinynav.viljamis.com */
(function ($, window, i) {
  $.fn.tinyNav = function (options) {
    var settings = {
      'active' : 'selected'
    };
    return this.each(function () {
      i++;
      var $nav = $(this),
        namespace = 'tinynav',
        namespace_i = namespace + i,
        l_namespace_i = '.l_' + namespace_i,
        $select = $('<select/>').addClass(namespace, namespace_i);
      if (options) {
        $.extend(settings, options);
      }
      if ($nav.is('ul,ol')) {
        $nav
          .addClass('l_' + namespace_i)
          .find('a').each(function () {
          	var prepend = '';
          	prepend     = liCheck($(this));
          	          	
            $select.append(
              $('<option/>')
               .text(prepend + $(this).text())
               .val($(this).attr('href'))
            );
          });
        $select
          .find(':eq(' + $(l_namespace_i + ' li')
          .index($(l_namespace_i + ' li.' + settings.active)) + ')')
          .attr('selected', true);
        $select.change(function () {
          window.location.href = $(this).val();
        });
        $(l_namespace_i).after($select);
      }
    });
  };
})(jQuery, this, 0);

// This function is meant to be recursively called to determine
// how deep the nested LIs are. This function returns a prepend
// string to the caller - customized by jg at informe
var prependString;
function liCheck(liObj, r) {
	if (prependString == undefined || r == null) {
		prependString = '';
	}
	
	if (liObj.parent().parent().parent().get(0).tagName == 'LI') {
		prependString += "\u00A0\u00A0\u00A0\u00A0";
		liCheck(liObj.parent().parent(), 1);
	} 
	return prependString;
}
  $(function () {
    $(".sf-menu").tinyNav();
  });

