//--------------myplugin.js
((function(){
	if(!jQuery)return;else window.$j = jQuery;
	var Plugin = {
		Intr: {},
		Impl: {},
		extend: function(target, obj){
			for (var i in obj) {
				target[i] = obj[i];
			}
		},
		createConstructor: function(){
			return function($j,arg){
				this.$j=$j;
				if(typeof this.init=='function')this.init.apply(this,arg);
			};
		},
		createInterface: function(Impl){
			return function(){
				return new Impl(this.$j||this,arguments);
			}
		},
		createLoadMethod: function(Intr, pluginName){
			return function(){
				$j.fn[pluginName] = Intr[pluginName];
			}
		},
		chain: function(){
			var Intr = this.Intr;
			var Impl = this.Impl;
			for (var j in Intr) {
				for (var i in Impl) {
					Impl[i].prototype[j] = Intr[j];
				}
				this[j] = Intr[j];
			}
			return this;
		},
		regist:function(pluginName,member){
			var Impl = this.Impl[pluginName]=this.createConstructor();
			this.Intr[pluginName]=this.createInterface(Impl);
			Impl.prototype.load=this.createLoadMethod(this.Intr,pluginName);
			if(member){
				this.extend(Impl.prototype,member);
			}
			return this.chain();
		}
	}
	Plugin.regist('MyPlugin',{
		init:function(){
			this.load();
		},
		regist: function(pluginName,member){
			return Plugin.regist(pluginName,member);
		}
	});
	Plugin.Intr.MyPlugin();
return $j;
})()).noConflict();




//--------------myutil.js
(function(){
	$j().MyPlugin().regist('MyUtil',{
		overWrite:function(target,src){
			if(typeof target=='undefined' || typeof src=='undefined')return this;			
			for(var i in target){
				target[i]=(typeof src[i]=='undefined'?target[i]:src[i]);
			}	
		}
	});
	return this;
})();



//--------------mydesign.js
(function(){
	$j().MyPlugin().regist('MyDesign',{
		window:function(opt){
			var Build={
				A:function(node,p){
					var Win = {
						$j:$j('<div class="'+p.className+'"/>'),
						Head:{
							$j:$j('<div class="winhead"><span>'+p.title+'</span></div>')
						},
						Body: {
							$j:$j(node).addClass('winbody')
						}
					};
					Win.$j.css('width',p.width);
					Win.Body.$j.css({
						width:'auto',
						height:p.height
					});
					$j(node).before(Win.$j);
					Win.$j.prepend(Win.Head.$j);
					Win.$j.append(Win.Body.$j);
				}
			};

			var myutil=this.MyUtil();
			this.$j.each(function(idx,node){
				var param = {
					buildType:'A',
					className:'Window-TypeA-Black01',
					title:'',
					width:$j(node).css('width')||'auto',
					height:$j(node).css('height')||'auto'
				};
				myutil.overWrite(param,opt);
				Build[param.buildType](node,param);
			});
		}
	});
	return this;
})();

