// JavaScript Document
var joson = function(){
	this.josonCodeError = new Array;
	this.objArray = {};
}
joson.prototype.escape = function(el,effect,params){
	this.el = el;
	this.el = this.getEl();
	this.effect = effect;
	if(this.el === false)return false;
	var funcName = this.getFuncName();
	var func;
	try{func = eval(funcName);}catch(e){
		if(this.option.CODE_DEBUG){
			this.josonCodeError.push(e);
		}
	}
	if(typeof func == 'function'){
		var params = typeof params == 'undefined'?{}:params;
		if(Object.prototype.toString.call(params)!=='[object Object]')
			params = {};
		eval('this.objArray.'+this.el.id+'=new func(this.el,params)');
		var obj = eval('this.objArray.'+this.el.id);
		if(obj.init)
			obj.init();
		return obj;
	}
	return false;
}
joson.prototype.getEl = function(){
	var el = this.el;
	if(typeof el == 'string'){
		el = document.getElementById(el);
	}
	if(typeof el == 'undefined' || el == null) return false;
	return el;
}
joson.prototype.getFuncName = function(){
	var tag = this.el.tagName;
	var effect = typeof this.effect=='undefined'?'':'_'+this.effect;
	var funcName = tag.toLowerCase()+effect;
	return funcName;
}
joson.prototype.option = {
	CODE_DEBUG	:	true	
}
joson.prototype.browse = function(){
	var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    window.ActiveXObject ? Sys.ie = ua.match(/msie ([\d.]+)/)[1] :
    document.getBoxObjectFor ? Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1] :
    window.MessageEvent && !document.getBoxObjectFor ? Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1] :
    window.opera ? Sys.opera = ua.match(/opera.([\d.]+)/)[1] :
    window.openDatabase ? Sys.safari = ua.match(/version\/([\d.]+)/)[1] : 0;
	return Sys;
}
joson.prototype.ready = function(fn){
	if(window.addEventListener){
		window.addEventListener('load',fn,false);	
	}else if(window.attachEvent){
		window.attachEvent('onload',fn);
	}else{
		window.onload = fn;	
	}
}
var x_ = new joson();
