var al={}
al.env={path:"/js",lib_path:"/js/lib"};
al.exec=function(){
  var plugin;
  var advance_link_obj=$(this);
  for (plugin in al.jsPlugins.list){
    if ((al.jsPlugins.hooktype[al.jsPlugins.list[plugin].hooktype||"nohook"]||al.jsPlugins.hooktype["nohook"])(advance_link_obj,al.jsPlugins.list[plugin].hook)){
      al.run_js(plugin,advance_link_obj);
    }
  }
}
al.afterload_list=[];
al.afterload=function(func,obj){al.afterload_list.push({func:func,obj:obj})};
al.afterpageload_list=[];
al.afterpageload=function(func,obj){al.afterpageload_list.push({func:func,obj:obj})};
var code={
  1:'\x61\x6c\x2e\x72\x65\x61\x64\x5f\x6a\x73\x3d\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x75\x72\x6c\x2c\x63\x61\x6c\x6c\x62\x61\x63\x6b\x29\x7b\x24\x2e\x61\x6a\x61\x78\x28\x7b\x75\x72\x6c\x3a\x20\x75\x72\x6c\x2c\x64\x61\x74\x61\x54\x79\x70\x65\x3a\x22\x73\x63\x72\x69\x70\x74\x22\x2c\x61\x73\x79\x6e\x63\x3a\x66\x61\x6c\x73\x65\x2c\x73\x75\x63\x63\x65\x73\x73\x3a\x63\x61\x6c\x6c\x62\x61\x63\x6b\x7d\x29\x7d',
  2:'\x61\x6c\x2e\x72\x65\x61\x64\x5f\x6a\x73\x28\x61\x6c\x2e\x65\x6e\x76\x2e\x70\x61\x74\x68\x2b\x22\x2f\x63\x6f\x6e\x66\x69\x67\x2e\x6a\x73\x22\x29'
};
al.js={loaded:{}};
al.jsPlugins={};
al.config={};
al.load_js=function(plugin){
  if (! al.js.loaded[plugin]){
    al.read_js(al.jsPlugins.list[plugin]["js"])    
  }
  al.js.loaded[plugin]=(al.js.loaded[plugin] || foo);
  return al.js.loaded[plugin]
}
al.run_js=function(plugin,obj){
  var js_func=al.load_js(plugin);
  var config=al.load_config_block(obj,al.$[plugin].map||{},al.$[plugin].defaults||{});
  obj.ALdata(plugin,config);
  js_func(obj,config);
}
al.load_jqueryplugins=function(jqPlugins){var plugin;for (plugin in jqPlugins){if (! jQuery.fn[plugin]){al.read_js(jqPlugins[plugin])}}};
var alev=eval;
al.js.lib={};
al.js.lib_loaded={};
al.load_jslib=function(lib,callback){if (! al.js.lib_loaded[lib]){$.getScript(al.js.lib[lib],callback)}al.js.lib_loaded[lib]=true;}
function foo(obj){}
for (var i in code){alev(code[i])};
al.load_config_block=function(obj,map,default_vals){
  return jQuery.extend(true,{},default_vals,al.load_config_script_mapping(al.load_config_script(obj),map))}
al.load_config_type={
  etc:function(){},
  string:function(config,valname){return config[valname]},
  object:function(config,valname){return al.load_config_script_mapping(config,valname)}
}
al.load_config_script_mapping=function(config,map){
  var result={},configval="",configname="";
  for (configname in map){
    configval=(al.load_config_type[typeof(map[configname])]||al.load_config_type["etc"])(config,map[configname])
    if (configval!=undefined){result[configname]=configval;};
  }
  return result
}
al.load_config_script=function(obj){
  var config=obj.find(al.config.srcipt_selector).eq(0);
  if (config){
      return (jQuery.parseJSON||foo)(config.html())||{};
  }
  return {}
}
al.configs={map:{},defaults:{}};
al.$={};
al.new_plugin=function(options){
  if (options.name){
    al.js.loaded[options.name]=options.func;
    al.$[options.name]=options;
    al.configs.map[options.name]=options.map || {};
  }
}

jQuery.fn.ALdata=function(plugin,val){
  if (val==undefined){
    if ($(this)){
      return $(this).eq(0).data(al.data_prefix+plugin)}
      else{
	return
      }
  }
    $(this).each(function(){$(this).data(al.data_prefix+plugin,val)});
};
jQuery.fn.ALupdate=function(handler){
  if (handler==undefined){
    $(this).trigger(al.events.update);
    $("."+al.events.update,this).trigger(al.events.update);
  }else{
    $(this).addClass(al.events.update);
    $(this).bind(al.events.update,handler);
  }
};
al.img_preload_cache=[];
al.preload=function(src){
  var cacheImage = document.createElement('img');
  cacheImage.src =src;
  al.img_preload_cache.push(cacheImage);
}
jQuery(function(){
  $(al.htmlclass).each(al.exec)
    var afterload;
    while (al.afterload_list.length){
      afterload=al.afterload_list.pop();
    (afterload.func||foo)(afterload.obj);
  }
});
jQuery(window).load(function(){
      var afterpageload;
     while (al.afterpageload_list.length){
      afterpageload=al.afterpageload_list.pop();
    (afterpageload.func||foo)(afterpageload.obj);
  }
})

