﻿function PageExtension()
{
  this._INCLUDES = Array();

  this.include = function()
  {
    for (var i=0;i!=arguments.length;i++)
    {
      file = arguments[i];
      ext = file.substring(file.lastIndexOf(".")+1);
      
      if ($$._INCLUDES[file]) continue;
      $$._INCLUDES[file] = true;
            
      if (ext == "js")
      {
        $.ajax({
          async: false,
          type: "GET",
          url: file,
          data: null,
          success: function() {
          },
          dataType: 'script'
        });
      }
      
      if (ext == "css")
      {
        $("head").append("<link>");
        $("head").children(":last").attr({
          rel: "stylesheet",
          type: "text/css",
          href: file
        });
      }
    }
  }
}

var $$ = new PageExtension();

$$.include("extension/like/main.js");
