/**
*@ Happyfri.com Blog Core.JS	|  BaseLib : AshAPI
 Author : 			An.sehan (www.happyfri.com / plandas@naver.com)
 Last Modified : 	2009.01.31
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function O(id) {return AshUtil.obj(id);};
function D(d) {return AshUtil.getChildByDotTree(d);};
function N(o, name) {return AshUtil.getChildByName(o, name);};
function CN(o, cname) {return AshUtil.getElementsByCName(o, cname);};
function C(o) { return AshUtil.cloneObject(o); }; /**@ Object Clone **/
function GIVS(src) { siv.show(src); };

/**@ For IE6 **/ function ie6_maxWidth(obj, value) { if(obj.offsetWidth > value) obj.style.width = value+'px'; }; function ie6_maxHeight(obj, value) { if(obj.offsetHeight > value) obj.style.height = value+'px'; };
function ie6PNG(obj, src) {
	if(obj && src) obj.style.cssText += ";display:block; background-image:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='crop');";
}

/**@ 2009.06.12 ie8 submit fix.  */
function ie8SubmitFIX(e, f) {
	if(navigator.appVersion.indexOf("MSIE 8") == -1) return;
	var t = e.target || e.srcElement;
	if(t) {
		if(e.keyCode==13 && t.tagName.toLowerCase() != 'textarea' ) return f.onsubmit();
	}
}

/**@ 2009.06.12 ie8 inline-block fix.  can solves to update any render's state.
만약 ie8에서 inline-block을 사용하면서 업데이트 렌더러가 문제가 된다면 변경내용이 적용될 스크립터에 추가적으로 이 메소드를 호출해서 버그를 잡을 수 있다.
*/
function ie8InlineBlockFIX() {
	if(navigator.appVersion.indexOf("MSIE 8") == -1) return;

	// imitate to render like that redraw the body elements.
	document.body.style.display = 'none'; 
	document.body.style.display = 'block'; // rendere as block.
}

/**@ Convert a htmlText for Eng's Chars*/
function getConvertEngHtml( htmlText, className ) {
	return htmlText.replace(/(?:^|>)([^><]+)(?:<|$)/g, function() {
		return arguments[0].replace(/([&a-zA-Z0-9][a-zA-Z0-9\s\x5c\/\!\@\#\$\%\&\*\(\)\_\-\=\+\{\}\[\]\:\;\'\"\.\,\?]*)/g, '<span class="'+className+'">$1</span>');
	});
}

function embedSWF(value) {document.write(value);}


var AshDimLayer = Ash.createClass('AshDimLayer', AshEventDispatcher);
AshDimLayer.APPLY = 'apply';
AshDimLayer.CLEAR = 'clear';
AshDimLayer.dimmer = null;
Ash.addPrototype(AshDimLayer,
{
	target:null, // the target to attach for dimLayer.
	dimmer:null, // the dimmed opacity layer.

	_createDimmer:function() 
	{
		if(!AshDimLayer.dimmer) {
			AshDimLayer.dimmer = document.createElement("DIV");
			AshDimLayer.dimmer.style.position = 'absolute';
			AshDimLayer.dimmer.style.display = 'none';
			AshDimLayer.dimmer.style.backgroundColor = '#000000';
			AshUtil.filter.opacity(AshDimLayer.dimmer, 0.7);
		}
		var dimmer = AshDimLayer.dimmer.cloneNode(true);
		try {return dimmer;} finally {//dimmer = null;
		};
	},

	initialize:function() 
	{
		this.setTarget(arguments[0]);
		this.dimmer = this._createDimmer();
		AshDepthManager.manager.register(this.dimmer, false);
		if(this.target) this.target.style.display = 'none';
		this.addEventListener(AshDimLayer.APPLY, this._onApply);
		this.addEventListener(AshDimLayer.CLEAR, this._onClear);
	},

	onApply:null, onClear:null,
	_onApply:function(e) {
		if(this.onApply != null) this.onApply(e);
	},
	_onClear:function(e) {
		if(this.onClear != null) this.onClear(e);
	},
	setTarget:function(target){
		this.target = target || null;
		if( this.target ) {
			document.body.appendChild(this.target);
			this.target.style.position = 'absolute';
		}
	},
	apply:function(dimmerOpacity, dimmerColor) 
	{
		if( !this.target) return;
		try {
			if(dimmerOpacity != null) AshUtil.filter.opacity(this.dimmer, dimmerOpacity);
			if(dimmerColor != null) this.dimmer.style.backgroundColor = dimmerColor;

			if( this.dimmer.parentNode == null ) document.body.appendChild(this.dimmer);
			AshDepthManager.manager.front(this.dimmer);
			AshDepthManager.manager.front(this.target);

			this.dimmer.style.display = this.target.style.display = 'block';
			AshUtil.rebound(this.dimmer, 0,0, '100%', document.documentElement.scrollHeight);
			this.dispatchEvent(new AshEvent(AshDimLayer.APPLY));
		}catch(error){alert(error.message);};
	},
	clear:function() 
	{
		if( !this.target) return;
		try {
			this.dimmer.style.display =  this.target.style.display = 'none';
			AshUtil.resize(this.dimmer, 2,2);
			this.dispatchEvent(new AshEvent(AshDimmer.CLEAR));
		}catch(error){};
	}
});



var Do		= document;
var wEvent	= new AshEventDispatcher(window);
var dEvent	= new AshEventDispatcher(Do);


/**@ Blog URL **/
var bu = new Ash();
bu.domain		= 'http://www.happyfri.com';
bu.home		= bu.domain+'/blog/';
bu.f				= '/home/blog';
bu.post			= bu.f + '/post.php';
bu.postRead		= bu.f + '/postRead.php';
bu.comment		= bu.f + '/comment.php';

bu.trackback		= bu.f + '/trackback.php';			/**@ trackback process real url**/
bu.trbAccess		= bu.home+"trackback";			/**@ trackback virtual access url**/
bu.trbRegister	= bu.home+"regtrb";				/**@ trackback virtual register url**/


var blogTitleSWF = '/home/blog/title.swf';
blogTitleSWF = 'http://home.megapass.net/~plandas75/title.swf'; // Megapass MyHome
blogTitleSWF = 'http://plandas.cdn2.cafe24.com/titleswf.png'; // CDN