var _utils  =   {

    qs: null,

    fb: function(i_fb) {
        i_fb    =   i_fb.split(':');
        return  {
            check:      i_fb[0],
            comment:    i_fb[1],
            data:       i_fb
        }
    },

    go: function(i_url, i_blank) {
        
        if (parseInt(i_blank) == 1) {
            window.open(i_url);
        }
        else
        {
            window.location.href    =   i_url;
        }
        
    },

    slug:   function(i_str) {

      i_str = i_str.replace(/^\s+|\s+$/g, ''); // trim

      // remove accents, swap ñ for n, etc
      var from = "ÀÁÄÂÈÉËÊÌÍÏÎÒÓÖÔÙÚÜÛàáäâèéëêìíïîòóöôùúüûÑñÇç·/_,:;";
      var to   = "aaaaeeeeiiiioooouuuuaaaaeeeeiiiioooouuuunncc------";

      for (var i=0, l=from.length ; i<l ; i++) {
        i_str = i_str.replace(new RegExp(from[i], "g"), to[i]);
      }

      i_str = i_str.replace(/[^a-zA-Z0-9 -]/g, '') // remove invalid chars
        .replace(/\s+/g, '-') // collapse whitespace and replace by -
        .replace(/^(-*)/, '')
        .replace(/(-*)$/, '')
        .replace(/-(-+)/, '-')
        .toLowerCase();

      return i_str;
    },
    
    init:   {

        _:  function() {
            this.querystring();
            this.flash();
            this.isset();
            this.assertIsset();
        },

        querystring:    function() {

            _utils.qs   =   new Querystring();
        },

        flash:  function() {

            $(document)
                .ready(function() {

                    $('._flash')
                        .each(function() {

                            $(this)
                                .flashembed({

                                    src: $(this).html(),
                                    wmode: 'opaque'
                                })
                            ;
                        })
                    ;
                })
            ;
            
        },

        isset:  function() {

            $.fn.isset  =   function() {

                return ($(this).length > 0);
            }
        },

        assertIsset: function() {

            $.fn.assertIsset =   function() {

                if (!$(this).isset() && _settings.assert) {

                    alert('"' + $(this).selector + '" not set');
                }

                return $(this);
            };

            $.fn.assset =   $.fn.assertIsset;

        }
    }
};

_utils.init._();

