/*
==============================================
	$Author: Kim Jong-gab <outmind@cafen.net>$
	$Date: 2006.07.12 11:13.20$
	$Source: /rainfile/images/common.js$
	$CharSet: EUC-KR$
	$Comment: °øÅë ½ºÅ©¸³ÅÍ$
==============================================
*/


document.domain = 'azoomma.com';

var msg_new = 0;var msg_total = 0;

var base_blogdomain = 'http://blog.azoomma.com/';
var base_crossdomain = '/BRIDGE/';
var base_lang = 'UTF-8';
var base_img_url = 'http://image.blog.azoomma.com/';
var blogbase_img_url = base_img_url;
var base_upload_url = 'http://file.blog.azoomma.com/uploads/';
var base_lib_url = '/zblog_lib/';
var _editor_url = 'http://image.blog.azoomma.com/service/';
var base_upload_script = 'http://file.blog.azoomma.com/upload_fileswf.html';


var NUM = "0123456789";
var SALPHA = "abcdefghijklmnopqrstuvwxyz";
var ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"+SALPHA;
var EMAIL = "!#$%&*+-./=?@^_`{|}"+NUM+ALPHA;
var NONIDABLE = "~!@#$%^&*()_+|`'\"-=:;<>?,./¡Ù¡Ø¡Ú¡Û¡Ü¡Ý¡Þ£¦¡ß";
var NONNAMEABLE = "'\"";


var PASSWORD = "!@.#,$%^*&_-" + ALPHA + NUM;
var ERRORMSG = "";
var SUBMIT_PROCESS = false;


function CheckType(s,spc) {
	var i;
	for(i=0; i<s.length; i++) {
		if (spc.indexOf( s.substring(i, i+1)) < 0) {
			return false;
		}
	}
	return true;
}

function CheckBType(s,spc) {
	var i;
	for(i=0; i<s.length; i++) {
		if (spc.indexOf( s.substring(i, i+1)) > 0) {
			return false;
		}
	}
	return true;
}

function IsChecked(junkform) {
	var i= 0 ;
	var check_uid = '';
	while (obj = eval("junkform.uid"+ i)) {
		if (obj.checked) check_uid += obj.value + '|';
		i++;
	}
	return check_uid;
}

function CheckEmail (sEmail) {
	if (!CheckType(sEmail, EMAIL)) {
		alert("¸ÞÀÏÁÖ¼Ò¿¡ Àß¸øµÈ ¹®ÀÚ°¡ ÀÖ½À´Ï´Ù.");
		return false;
	}
	var a = sEmail.indexOf('@');
	if ( a <=0 || a == sEmail.length -1 ) {
		alert("¸ÞÀÏÁÖ¼Ò´Â aaa@bbb.ccc.ddd µîÀÇ ÇüÅÂ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	} else {
		return true;
	}
}

function HanMailCheck(email) {
	if (!CheckEmail(email)) {
		return false;
	} else if ((email.indexOf("@hanmail.net") > 0 || email.indexOf("@daum.net") > 0 )&& !confirm('ÇÑ¸ÞÀÏ ÁÖ¼Ò¸¦ »ç¿ë½Ã ÀÏºÎ ±â´ÉÀ» »ç¿ë ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.\n\n±×·¡µµ »ç¿ëÇÏ½Ã°Ú½À´Ï±î?')) {
		return false;
	} else {
		return true;
	}
}

function checkLen(s, int_min, int_max) {
	if (int_min != null && s.length <int_min) {
		return false;
	} else if (int_max != null && s.length > int_max) {
		return false;
	} else {
		return true;
	}
}

function RadioCheck(radioinput) {
	len = radioinput.length;
	if (len > 0 ) {
		for (i = 0; i < len; i++) {
			if (radioinput[i].checked) return radioinput[i].value;
		}
		return false;
	} else {
		if (radioinput.checked) return radioinput.value;
		return false;
	}
}

function chkSelect(obj) {
	var txt = obj[obj.selectedIndex].value;
	return txt;
}

function CheckAll(bl, checkinput) {
	if (checkinput == null) return ;
	var len = checkinput.length;
	if (len > 0 ) {
		for (i = 0; i < len; i++) {
			checkinput[i].checked = bl;
		}
	} else {
		checkinput.checked = bl;
	}
}


function CheckedVal(checkinput) {
	if (checkinput == null) return '';
	len = checkinput.length;
	var rev_val = '';
	if (len > 0 ) {
		for (i = 0; i < len; i++) {
			if (checkinput[i].checked) rev_val += ':' + checkinput[i].value;
		}
	} else {
		if (checkinput.checked) rev_val += checkinput.value;
	}
	return rev_val;
}

function isNULL(val) {
	if (val.split(' ').join('') == '') return false;
	else return true;
}

function goURL(theURL, url_target ) {
	if (theURL !=null && theURL != '') {
		if (url_target == null) document.location.href = theURL;//url_target = parent;
		if (url_target != null) {
			url_target.document.location.href = theURL;
			url_target.focus();
		}
	}
}

function goHURL(theURL, mode, so, uid ) {
	form = document.hiddenform;
	form.action = theURL;
	form.mode.value = mode;
	form.so.value = so;
	form.uid.value = uid;
	form.submit();
}


function CheckHLen(s) {
	len = s.length;
	count = 0;
	for(k=0;k<len;k++){
		temp = s.charAt(k);
		if(escape(temp).length > 4) count += 2;
		else count++;
	}
	return count;
}

function chkHanInput(obj, len) {
	if (CheckHLen(obj.value) > len) {
		alert('ÇÑ±Û '+ Math.floor(len/2) +' ÀÚ, ¿µ¹® '+len+' ÀÚ¸¦ ÃÊ°úÇÒ ¼ö ¾ø½À´Ï´Ù');
		obj.value =HanCut(obj.value,len);
	}
}

function HanCut(s, cut_len) {
	slen = s.length;
	count = 0;
	for(k=0;k<slen;k++){
		temp = s.charAt(k);
		if(escape(temp).length > 4) count += 2;
		else count++;
		if (cut_len < count) break;
	}
	if (slen == k) 	return s;
	else return s.substring(0, k-1)+'..';
}

function ClearVal(obj, val) {
	if (obj.value == val) obj.value = '';
}

function AddItem(selectobj,val,txt,optindex) {
	NewItem = new Option(txt, val, false, false);
	selectobj.options[optindex]= NewItem;
}


function imgView(img_obj) {
	if (parent != top && parent != undefined && parent.rain != undefined && parent.imgView != undefined) {
		parent.imgView(img_obj);
	} else {
		if (typeof(img_obj) == 'string') {
			var win_scrollbars = 'yes';
			var tmp_file = img_obj.split('|');
			if (tmp_file.length > 0)
				img_obj = tmp_file[0];
			var img_name = base_upload_url + img_obj;
		} else if (img_obj.height > 400) {
			var win_scrollbars = 'yes';
			var img_name = img_obj.src;
		} else if (img_obj.width > 400) {
			var win_scrollbars = 'yes';
			var img_name = img_obj.src;
		} else {
			var win_scrollbars = 'no';
			var img_name = img_obj.src;
		}
		rainPopup.check();
		var obj = rain.nodeUtil.getDiv({}, rain.extend(rainPopup.popup_class.style_class.getStyle('scroll'),{
			width:((win_scrollbars=='yes')?'100px':'auto'),
			height:((win_scrollbars=='yes')?'100px':'auto'),
			overflowY:'auto' ,overflowX:'auto',
			padding: '3px'
		}));
		var imgclass = {
			obj:obj,
			imgobj: null,
			resize : function() {
				Element.setStyle(this.obj, {width:(((this.imgobj.width > 680)?680:this.imgobj.width)+30) + 'px',height:(((this.imgobj.height > 500)?500:this.imgobj.height)+30) + 'px'});
				if (this.popup_class != null) {
					this.popup_class.is_resized = false;
					this.popup_class.reSize();
				}
			}
		};
		var imgobj = obj.appendChild(
			rain.nodeUtil.getImage(
				{
					src:img_name,
					onload: imgclass.resize.bind(imgclass),
					onerror: function() {RainImgError(this)},
					onclick:rainPopup.popup_class.closeChild.bind(rainPopup.popup_class)
				}, {cursor:'pointer'}
			)
		);
		imgclass.imgobj = imgobj;
		var popup_obj = rainPopup.popup_class.add(imgclass);
		if (imgobj.width != null && imgobj.width > 0) {
			imgclass.resize();
		}
		popup_obj.reSize();
	}
}


function pop_Open(theurl) {
	popup = window.open(theurl,'tmppop','width=10,height=10, toolbar=0,menubar=0,resizable=yes,scrollbars=no, top=50, left=50');
	popup.focus();
}

var init_maxwidth = 550;

function checkRainImg(max_width) {
	if (max_width != undefined)
		init_maxwidth = max_width;
	var imgobjs = getElementsById('rainimg_resize');
	var len = imgobjs.length;
	for(var i = 0 ; i < len; i++) loadRainImg(imgobjs[i]);
}

function loadRainImg(imgobj) {
	try {
		if (imgobj.width > init_maxwidth) {
			imgobj.height = Number(imgobj.height * init_maxwidth / imgobj.width);
			imgobj.width = 	init_maxwidth;
			imgobj.style.width=init_maxwidth;
			imgobj.style.height=Number(imgobj.height * init_maxwidth / imgobj.width);
			imgobj.style.cursor= 'pointer';
			imgobj.onclick= function () {imgView(this)};
		} else if (imgobj.width > (init_maxwidth - 30)) {
			imgobj.style.cursor= 'pointer';
			imgobj.onclick= function () {imgView(this)};
		} else {
			imgobj.style.cursor= '';
			imgobj.onclick= null;
		}
	} catch(ex) {}
}


function RainImgError(imgobj) {
	try {
		imgobj.src = base_img_url +'nopic_article.gif';
		imgobj.width =55;
		imgobj.height= 70;
		imgobj.style.width ='55';
		imgobj.style.height ='70';
	} catch (ex) 	{}
}


function goBlog(obj) {
	if (obj[obj.selectedIndex].value !='') {
		document.location.href = base_blogdomain + obj[obj.selectedIndex].value + '/';
	}
}

function openMsg(blog_id) {
	if (blog_id == '') {
		rainPopup.alert('¸ÕÀú ºí·Î±×¸¦ ¸¸µé¾î ÁÖ½Ê½Ã¿À');
	} else {
		popup = window.open (base_blogdomain + blog_id +'/pop_msgopen.html' , 'popup' ,'width=10,height=10,resizable=no,scrollbars=no,top=10,left=10');
		popup.focus();
	}
}

function chkUploadImg(obj) {
	if (obj.value != '' && !obj.value.match(/gif|jpg|png|jpeg|bmp/i)) {
		rainPopup.alert('ÀÌ¹ÌÁö ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù. jpg,gif,png ');
		obj.focus();
	}
}

document.writeln("<div id=submit_layer style='position:absolute;display:none;top:0;left:0'></div>");

function submitCheck() {
	if (!SUBMIT_PROCESS) return true;
	else {
		rainPopup.alert('Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À. ÀÚ·á Àü¼ÛÁßÀÔ´Ï´Ù.');
		return false;
	}
}

function submitLock() {
	if (! SUBMIT_PROCESS) {
		rainPopup.alert('ÀÚ·á¸¦ Àü¼ÛÇÏ°í ÀÖ½À´Ï´Ù');
		SUBMIT_PROCESS = true;
	} else {
		rainPopup.alert('Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À. ÀÚ·á Àü¼ÛÁßÀÔ´Ï´Ù.');
	}
}
function submitUnLock() {
	rainPopup.close();
	SUBMIT_PROCESS = false;
}

function RainaddEvent(el, evname, func) {
	if (document.all) {
		try {
			el.attachEvent("on" + evname, func);
		} catch (ex) {}
	} else {
		el.addEventListener(evname, func, true);
	}
}


function displayObj(str) {
	document.write('<OBJECT ' + str + 'OBJECT>');
}



function startSubmiter(theURL, param) {
	function onComplete(channel, msg) {
		if (channel != null) {
			var result_msg = channel.getNode('msg');
			var result_link = channel.getNode('link');
			if (result_msg != undefined && result_msg != '')
				rainPopup.alert(result_msg);
			if (result_link != '')
				goURL(result_link, self);
		} else
			rainPopup.alert(msg);
	}
	new rain.Ajax(param, onComplete, theURL, 'post');
}


function setCookie(name, value, expires, path, domain, secure) {
	document.cookie= name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
}

function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + "=" +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

function getElementsById(id){
	var els = new Array();
	try {
		tags = document.getElementsByTagName(document.getElementById(id).tagName);
		for(i=0;i<tags.length;i++){
			if(tags[i].id==id) els[els.length]=tags[i];
		}
	} catch(ex) {}
	return els;
}

// window.onerror = HandleError

function HandleError(message, url, line) {
//	alert('Msg :' + message + '\r\n'
//		+ 'Url :' + url + '\r\n'
//		+ 'Line :' + line + '\r\n');
  return true;
}



var rainPopup = {
	check : function() {
		if (this.popup_class == null) {
			this.style_class = new rain.Popup.style();
			this.popup_class = new rain.Popup(this.style_class);
		}
	},
	showUser : function(user_id, obj, user_nm) {
		this.check();
		if (this.last_userid == user_id) {
			this.popup_class.closeChild();
			this.last_userid = '';
		} else {
			this.last_userid = user_id;
			var blogUser = new rain.blogUser(user_id, user_nm, this.style_class);
			this.add(blogUser, {is_scrollable:false, toolbar:false, sticker:{obj:obj,pos:'TR'}});
		}
	},
	alert : function(msg) {
		this.add(new rain.Popup.alert(msg,this.style_class), {is_scrollable:true});
	},
	confirm : function(msg, call_back) {
		this.add(new rain.Popup.confirm(msg, call_back, this.style_class), {is_scrollable:true});
	},
	prompt : function(msg, call_back, options) {
		this.add(new rain.Popup.prompt(msg, call_back,options, this.style_class), {is_scrollable:true});
	},
	close : function() {
		if (this.popup_class != null)
			this.popup_class.closeChild();
	},
	submitConfirm : function(msg, tgForm) {
		function formSubmit(bl) {
			if (bl && typeof tgForm != 'undefined') {
				submitLock();
				tgForm.submit();
			}
		}
		this.confirm(msg,formSubmit);
		return false;
	},
	add : function(obj, options) {
		this.check();
		this.popup_class.add(obj, options);
	},
	getColor : function (init_color, call_back,use_trasparent) {
		this.check();
		var popup_class = this.popup_class;
		function getColor(color) {
			popup_class.closeChild();
			call_back(color);
		}
		this.add(new rain.Popup.ColorPicker(getColor, this.style_class, init_color,use_trasparent), {stick2parent:true});
	},
	getCalendar : function(obj) {
		if (obj == this.lastcalendarobj) {
			this.close();
			this.lastcalendarobj = null;
		} else {
			if (this.class_calendar == null) {
				this.check();
				this.class_calendar = new rain.Calendar(this.style_class);
			}
			this.lastcalendarobj = obj;
			this.class_calendar.setObj($(obj));
			this.add(this.class_calendar, {is_transparent : true,toolbar : false,shadow : false,sticker :{obj : $(obj), pos : 'BL', margin : [0,2]}});
		}
	},
	submitXML : function(theURL, param) {
		this.check();
		function onComplete(channel, msg) {
			if (channel != null) {
				var result_msg = channel.getNode('msg');
				var result_link = channel.getNode('link');
				var result_link_type = channel.getNode('linktype');
				if (result_link_type != undefined && result_link_type != '' && result_msg != undefined && result_msg != '' && result_link != undefined &&  result_link != '') {
					function jumpLinkURL(bl) {
						if (bl)
							goURL(result_link, self);
					}
					rainPopup.confirm(result_msg + '<br><br>' + result_link,jumpLinkURL);
				} else {
					if (result_msg != undefined && result_msg != '')
						rainPopup.alert(result_msg);
					if (result_link != undefined &&  result_link != '')
						goURL(result_link, self);
				}
			} else
				rainPopup.alert(msg);
		}
		new rain.Ajax(param, onComplete, theURL, 'post');
		this.alert('ÀÚ·á¸¦ Àü¼ÛÁßÀÔ´Ï´Ù<br>Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À');
	}
}

if (rain == undefined)
	var rain = Class.create();

rain.blogUser = Class.create();
rain.blogUser.prototype = {
	initialize : function(user_id, user_nm, style_class) {
		this.user_id = user_id;
		this.user_nm = user_nm;
		this.style_class = (style_class != null)?style_class:new rain.Popup.style();
		this.obj = rain.nodeUtil.getDiv({},{width:'107px', height:'auto', padding:'5px 5px 0px 5px'});
		this.menu_info = [];
		this.menu_info.push(this.obj.appendChild(rain.nodeUtil.getDiv({innerHTML:'ÈçÀûº¸±â', onclick: this.userCmd.bind(this,'log'), onmouseover:this.over.bind(this,0)},this.getMenuStyle())));
		this.menu_info.push(this.obj.appendChild(rain.nodeUtil.getDiv({innerHTML:'ºí·Î±×°¡±â', onclick: this.userCmd.bind(this,'goblog'), onmouseover:this.over.bind(this,1)},this.getMenuStyle())));
		//this.menu_info.push(this.obj.appendChild(rain.nodeUtil.getDiv({innerHTML:'ÂÊÁö º¸³»±â', onclick: this.userCmd.bind(this,'msg'), onmouseover:this.over.bind(this,2)},this.getMenuStyle())));
		this.menu_info.push(this.obj.appendChild(rain.nodeUtil.getDiv({innerHTML:'ÂÊÁö º¸³»±â', onclick: this.userCmd.bind(this,'note'), onmouseover:this.over.bind(this,2)},this.getMenuStyle())));
		this.menu_info.push(this.obj.appendChild(rain.nodeUtil.getDiv({innerHTML:'Áñ°ÜÃ£±â Ãß°¡', onclick: this.userCmd.bind(this,'favor'), onmouseover:this.over.bind(this,3)},this.getMenuStyle())));
		this.menu_info.push(this.obj.appendChild(rain.nodeUtil.getDiv({innerHTML:'ÀÌ¿ôºí·Î±× ½ÅÃ»', onclick: this.userCmd.bind(this,'navi'), onmouseover:this.over.bind(this,4)},this.getMenuStyle())));
	},
	over : function(seqn) {
		var style_class = this.style_class;
		this.menu_info.each(function(obj, idx) {
			if (idx == seqn)
				Element.setStyle(obj, {borderBottom : '1px dotted '+style_class.options.line});
			else
				Element.setStyle(obj, {borderBottom : '1px dotted '+style_class.options.bg});
		});
	},
	getMenuStyle : function() {
		return {
			color : this.style_class.options.font,
			width : '100px',
			height : '15px',
			borderBottom : '1px dotted '+this.style_class.options.bg,
			textAlign : 'left',
			margin :'3px 0px 0px 0px',
			cursor : 'pointer'
		}
	},
	getBlogID : function(last_cmd) {
		if (this.blog_id == null) {
			this.last_cmd = last_cmd;
			new rain.Ajax({user_id:this.user_id,mode:'INFO'}, this.setBlogID.bind(this), base_crossdomain + 'xml_usercontrol.html');
			this.popup_class.add(new rain.Popup.alert('Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À.<br>ºí·Î±× Á¤º¸¸¦ È®ÀÎÇÏ°í ÀÖ½À´Ï´Ù.', this.style_class),{stick2parent:true});
			return false;
		} else
			return true;
	},
	setBlogID : function(channel, msg) {
		if (channel == null) {
			alert(msg);
		} else {
			this.blog_id = channel.getNode('blogid');
			if (this.blog_id == undefined || this.blog_id == '')
				this.popup_class.add(new rain.Popup.alert('ÇØ´ç È¸¿øÀº ºí·Î±×°¡ °³¼³ µÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù.', this.style_class),{stick2parent:true});
			else {
				this.popup_class.closeChild();
				this.userCmd(this.last_cmd);
			}
		}
	},
	checkData : function(channel, msg) {
		if (channel != null)
			msg = channel.getNode('msg');
		this.popup_class.add(new rain.Popup.alert(msg,this.style_class),{stick2parent:true});
	},
	sendMsg : function(msg) {
		new rain.Ajax({user_id:this.user_id,mode:'MSG', contents:msg}, this.checkData.bind(this), base_crossdomain + 'xml_usercontrol.html');
		this.popup_class.add(new rain.Popup.alert('ÂÊÁö¸¦ Àü¼ÛÇÏ°í ÀÖ½À´Ï´Ù Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À', this.style_class),{stick2parent:true,stick2parent:true});
	},
	setFavor : function(bl) {
		if (bl) {
			new rain.Ajax({user_id:this.user_id,blog_id:this.blog_id,mode:'FAVOR'}, this.checkData.bind(this), base_crossdomain + 'xml_usercontrol.html');
			this.popup_class.add(new rain.Popup.alert('Áñ°ÜÃ£±â Ãß°¡ÇÏ°í ÀÖ½À´Ï´Ù Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À', this.style_class),{stick2parent:true});
		} else
			this.popup_class.closeChild();
	},
	setNavi : function(bl) {
		if (bl)
			goURL(base_blogdomain + this.blog_id + '/member_be.html');
		else
			this.popup_class.closeChild();
	},
	userCmd : function(cmd) {
		var log_no = this.log_no;
		var popup_class = this.popup_class;
		switch(cmd) {
			case 'goblog' :
				if (this.getBlogID(cmd))
					goURL(base_blogdomain + this.blog_id + '/');
				break;
			case 'log' :
				if (this.getBlogID(cmd))
					goURL(base_blogdomain + this.blog_id + '/mylogs.html');
 				break;
			case 'msg' :
				if (!rainCheck.checkBlog())
					return ;
				if (this.getBlogID(cmd))
					this.popup_class.add(new rain.Popup.prompt('Àü´ÞÇÏ½Ç ÂÊÁö³»¿ëÀ» ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À', this.sendMsg.bind(this),{height : 50},this.style_class), {stick2parent:true});
				break;
			case 'favor' :
				if (!rainCheck.checkBlog())
					return ;
				if (this.getBlogID(cmd))
					this.popup_class.add(new rain.Popup.confirm('Áñ°ÜÃ£±â Ãß°¡ ÇÏ½Ã°Ú½À´Ï±î?', this.setFavor.bind(this) ,this.style_class), {stick2parent:true} );
				break;
			case 'navi' :
				if (!rainCheck.checkBlog())
					return ;
				if (this.getBlogID(cmd))
					this.popup_class.add(new rain.Popup.confirm('ÇØ´ç È¸¿øÀÇ ºí·Î±×·Î ÀÌµ¿ÇÕ´Ï´Ù. <br> ÇØ´ç ºí·Î±×¿¡¼­ ÀÌ¿ô ½ÅÃ» ÇÏ½Ã°Ú½À´Ï±î?', this.setNavi.bind(this) ,this.style_class), {stick2parent:true});
				break;
			case 'print' :
				var popup = window.open (base_lib_url+ 'pop_print.html?BLOG_ID='+this_blogid+'&log_no=' + this.log_no , 'delpopup' ,'width=10,height=10,resizable=no,scrollbars=yes,top=10,left=10');
				popup.focus();
				break;
			case 'note' :
				if (!rainCheck.checkBlog()){
					return ;
				}else{
					if (this.getBlogID(cmd)){}
					window.open ('http://www.azoomma.com/note/?BLOG_ID='+this.blog_id , 'note_popup' ,'width=1000,height=700,resizable=yes,scrollbars=yes,top=0,left=0');						
				}
			break;
		}
	}
}


var blogUserinfo  = {
	show : function (user_id, obj, user_nm) {
		rainPopup.showUser(user_id, obj, user_nm);
	}
}

var rainCheck = {
	user_id : null,
	user_nm : null,
	user_realnm : null,
	blog_id : null,
	getUserID : function() {
		if (rainCheck.user_id == null) {
			if (document.cookie.indexOf("chat_name") == -1) {
				rainCheck.user_id = '';
				rainCheck.user_realnm = '';
			} else {
				var user_id = rainCheck.getCookie('chat_name');
				var user_realnm = rainCheck.getCookie('chat_irum');
				if (user_id != '' && user_realnm != '') {
					rainCheck.user_id = user_id;
					rainCheck.user_realnm = user_realnm;
				} else {
					rainCheck.user_id = '';
					rainCheck.user_realnm = '';
				}
			}
		}
		return rainCheck.user_id;
	},
	getUserNM : function() {
		if (	rainCheck.blog_id == null) {
			if (document.cookie.indexOf("CLTBLOGINFO") == -1) {
				rainCheck.blog_id = '';
				rainCheck.user_nm = '';
			}else {
				var user_info = rainCheck.parseCookie('CLTBLOGINFO');
				if (user_info.length > 2) {
					rainCheck.user_nm = user_info[1];
					rainCheck.blog_id = user_info[2];
				} else {
					rainCheck.blog_id = '';
					rainCheck.user_nm = '';
				}
			}
		}
		return rainCheck.user_nm;
	},
	getBlogID : function() {
		if (	rainCheck.blog_id == null) {
			rainCheck.getUserNM();
		}
		return rainCheck.blog_id;
	},
	getCookie : function (name){
	    var dc = document.cookie;
	    var prefix = name + "=";
	    var begin = dc.indexOf("; " + prefix);
	    if (begin == -1) {
	        begin = dc.indexOf(prefix);
	        if (begin != 0) return null;
	    } else {
	        begin += 2;
	    }
	    var end = document.cookie.indexOf(";", begin);
	    if (end == -1) end = dc.length;
	    return unescape(dc.substring(begin + prefix.length, end));
	},
	parseCookie : function(name) {
		var txt = rainCheck.getCookie(name);
		return txt.split(':');
	},
	chkLength : function(obj,cut_len,show_id) {
		var s = obj.value;
		slen = s.length;
		count = 0;
		for(k=0;k<slen;k++){
			temp = s.charAt(k);
			if(escape(temp).length > 4) count += 2;
			else count++;
			if (cut_len < count) break;
		}
		if (slen != k) {
			alert('±ÛÀÚ¼ö('+count+'/'+cut_len+'¹ÙÀÌÆ®)¸¦ ÃÊ°ú ÇÏ¿´½À´Ï´Ù.');
			obj.value = s.substring(0, k) + '...';
		}
		var show_obj = $(show_id);
		if (show_obj != undefined ) show_obj.innerHTML = count;
	},
	chkLogin : function() {
		if (document.cookie.indexOf("CLTCOOKINFO") == -1)
			return false;
		else
			return true;
	},
	getHashUrl : function() {
		return $H({re_url:document.location.href}).toQueryString();
	},
	jumpLogin : function(msg) {
		if (msg == undefined) msg = 'ÇØ´ç ÆäÀÌÁö´Â È¸¿ø¸¸À» À§ÇÑ °ø°£ÀÔ´Ï´Ù. <br>Áö±Ý ·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?';
		function jump_Login(bl) {
			if (bl)
				top.document.location.href = base_crossdomain + 'jump_url.html?mode=LOGIN&' + rainCheck.getHashUrl();
		}
		rainPopup.confirm(msg, jump_Login);
	},
	jumpBlog : function(msg) {
		if (msg == undefined) msg = 'ÇØ´ç ÆäÀÌÁö´Â ºí·Î±× »ç¿ëÀÚ¸¦  À§ÇÑ °ø°£ÀÔ´Ï´Ù. <br>Áö±Ý ºí·Î±×¸¦ °³¼³ÇÏ½Ã°Ú½À´Ï±î?';
		function jump_Blog(bl) {
			if (bl)
				top.document.location.href = base_crossdomain + 'jump_url.html?mode=BLOGMAKE&' + rainCheck.getHashUrl();
		}
		rainPopup.confirm(msg, jump_Blog);
	},
	chkLoginTxt : function(obj_id,logintxt, blog_txt) {
		if (logintxt != undefined && logintxt != '' && rainCheck.getUserID() == '') {
			var obj = $(obj_id);
			obj.value = logintxt;
			obj.style.padding ='7px';
			obj.onfocus = function () { rainCheck.needLogin(this) };
		} else if (blog_txt != undefined && blog_txt != '' && rainCheck.getBlogID() == '') {
			var obj = $(obj_id);
			obj.value = blog_txt;
			obj.style.padding ='7px';
			obj.onfocus = function () { rainCheck.needBlog(this) };
		}
	},
	checkBlog : function() {
		if (this.getUserID() == '') {
			this.jumpLogin();
			return false;
		} else if (this.getBlogID() == '') {
			this.jumpBlog();
			return false;
		} else
			return true;
	},
	needLogin : function(obj,msg) {
		if (rainCheck.getUserID() =='') {
			this.jumpLogin(msg);
			obj.blur() ;
		}
	},
	needBlog : function(obj,msg) {
		if (rainCheck.getBlogID() == '') {
			this.jumpBlog(msg);
			obj.blur() ;
		}
	},
	formLogin : function(msg) {
		if (this.getUserID() =='') {
			return false;
		} else return true;
	},
	formBlog : function(msg) {
		if (this.getBlogID() =='') {
			return false;
		} else return true;
	},
	setUploadForm : function(obj_id,file_type) {
		var upload_obj = $(obj_id);
		upload_obj.style.filter = 'alpha(opacity: 0)';
		upload_obj.style.opacity = '0';
		var obj_width = parseInt(upload_obj.style.width);
		var obj_height = parseInt(upload_obj.style.height);
		var obj_class = upload_obj.className;
		upload_obj.size = Math.round(obj_width/8);
	  	upload_obj.style.position ='absolute';
	  	upload_obj.style.zIndex ='1';
	  	upload_obj.relatedElement = obj_id+'_filename';
	  	upload_obj.allow_type = (file_type == undefined)?'':file_type;
	  	upload_obj.onchange =  function () {
	  		var img_txt = this.value.substring(this.value.lastIndexOf('\\') + 1)+ '';
	  		if (this.allow_type == 'image') {
		  		if (!this.value.match(/gif|jpg|png|jpeg|bmp/i)) {
		  			rainPopup.alert('ÀÌ¹ÌÁö¸¸ Ã·ºÎ ÇÏ½Ç¼ö ÀÖ½À´Ï´Ù.');
		  			$(this.relatedElement).value = '';
		  			return ;
		  		}
		  	}
		  	$(this.relatedElement).value = img_txt ;
	  	}

		var obj = document.createElement('span');
		obj.innerHTML = '<input id='+obj_id+'_filename size=1 class='+obj_class+' style="width:'+(obj_width -76)+'px;height:'+obj_height+'px" readonly />&nbsp;&nbsp;<img id='+obj_id+'_junk src=http://ftimg.hani.co.kr/07/COMMON/btn_file.gif width=76px height=20px style="cursor:pointer;position: relative;" border=0 align=absmiddle>';
		obj.style.zIndex ='2';

		upload_obj.parentNode.appendChild(obj);
		var new_obj = $(obj_id+'_junk');
	},
	checkLevel : function(check_level) {
		if (check_level == undefined || check_level == '')
			return true;
		else {
			if (!rainCheck.formLogin()) {
				rainCheck.jumpLogin();
				return false;
			} else if (check_level == 'B' ) {
				if (!rainCheck.formBlog()) {
					rainCheck.jumpBlog();
					return false;
				} else
					return true;
			} else
				return true;
		}
	},
	openPop : function(theURL, opt_scrollbars, check_level) {
		if (!rainCheck.checkLevel(check_level)) {
			return ;
		} else if (opt_scrollbars == 'blank') {
			popup = window.open(theURL ,'NEWBRO');
		} else {
			var popup_name = '';
			if (opt_scrollbars == 'yesrand') {
				popup_name = Math.round(Math.random()*10000);
				opt_scrollbars = 'yes';
			} else if (opt_scrollbars == 'norand') {
				popup_name = Math.round(Math.random()*10000);
				opt_scrollbars = 'no';
			}

			if (opt_scrollbars == 'yes')
				popup = window.open(theURL ,'PopUpScroll'+popup_name,'width=10,height=10, toolbar=0,menubar=0,resizable=no,scrollbars=yes, top=50, left=50');
			else
				popup = window.open(theURL ,'PopUpNone' + popup_name,'width=10,height=10, toolbar=0,menubar=0,resizable=no,scrollbars=no, top=50, left=50');
		}
		popup.focus();
	},
	openTop : function(theURL, check_level) {
		if (!rainCheck.checkLevel(check_level)) {
			return ;
		} else {
			top.document.location.href = theURL;
		}
	},
	autoSelect : function(obj, val) {
		var len = obj.length;
		var sel_index = -1;
		for(i = 0; i < len; i++) {
			if (obj[i].value == val) {
				sel_index = i;
				break;
			}
		}
		if (	sel_index > -1) obj.selectedIndex = sel_index;
	},
	chkURL : function(addr) {
		if (!addr.match(/^(http:\/\/.+\..+\/)/i))
			return false;
		else
			return true;
	},
	chkEmail : function(email) {
		if (!email.match(/^(.+@.+\..+)/i))
			return false;
		else
			return true;
	},
	chkInt : function(obj) {
		if (obj.value == '' || parseInt(obj.value))
			return true;
		else {
			rainPopup.alert('¼ýÀÚ¸¸ ÀÔ·ÂÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù');
			obj.focus();
			return false;
		}
	},
	chkID : function(userid) {
		if (userid.length > 15 || userid.length < 3)
			return false;
		else if (!userid.match(/^([a-z0-9]+)$/i))
			return false;
		else
			return true;
	},
	copyRSS : function(obj){
		var doc = document.body.createTextRange();
		doc.moveToElementText($(obj));
		doc.select();
		doc.execCommand('copy');
		rainPopup.alert("ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù.\nºÙ¿©³Ö±â ÇÏ½Ã¸é ¿Ï·áµË´Ï´Ù.");
	},
	nullfun : null
}


function rainReSize(obj) {
	var objname = (typeof obj == 'string')?obj:obj.name;
	var myIframe = document.getElementById(objname);
	if (myIframe) {
		if (myIframe.contentDocument && myIframe.contentDocument.body.offsetHeight) {
			myIframe.height = myIframe.contentDocument.body.offsetHeight +10;
			if (parent != self) {
				try {parent.rainReSize(self.name); } catch(ex) {}
			}
		} else if (myIframe.Document && myIframe.Document.body.scrollHeight) {
			myIframe.height = myIframe.Document.body.scrollHeight;
			if (parent != self) {
				try {parent.rainReSize(self.name); } catch(ex) {}
			}
		} else {
			window.setTimeout("rainReSize('"+objname+"')",1000);
		}
	}
}

function getChecked(checkinput) {
	len = checkinput.length;
	var check_uid = '';
	if (len > 0 ) {
		for (i = 0; i < len; i++) {
			if (checkinput[i].checked) check_uid += checkinput[i].value + '|';
		}
	} else {
		if (checkinput != null && checkinput.checked) check_uid += checkinput.value + '|';
	}
	return check_uid;
}

var myTag  = {
	input_box : null,
	view_area : null,
	my_tags : null,
	set: function(view_area, input_box, tag_info) {
		if (this.view_area != null) {
			Element.hide(this.view_area);
			this.view_area = null;
		} else {
			this.setInput(input_box);
			this.setView(view_area);
			this.showTag();
		}
	},
	setInput : function(obj) { this.input_box = $(obj); },
	setView : function(obj) {
		this.view_area = $(obj);
	},
	showTag : function() {
		Element.show(this.view_area);
		var html = '';
		if (myTag.my_tags == null) {
			html = '<div align=center>Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À ¼­¹ö¿¡¼­ ÅÂ±×Á¤º¸¸¦ ¼ö½ÅÁßÀÔ´Ï´Ù.</div>';
			function setContents(response) {
				var xml = new rain.xmlParser(response);
				var mytags = [];
				var channel = null, item = null;
				while(channel = xml.getNext()) {
					while(item = channel.getNext()) {
						var title = item.getNode('title');
						if (title != null && title != '')
							mytags.push({title:title});
					}
				}
				myTag.my_tags = mytags;
				myTag.showTag();
			}
			var myAjax = new Ajax.Request(
				'/BRIDGE/xml_usercontrol.html?mode=TAG',
				{
					method: 'post',
					onComplete: setContents
				});
		} else {
			if (myTag.my_tags.length == 0) {
				html = '<table width=100% cellpadding=2 cellspacing=1 border=0 style="margin-bottom:10px">';
				html += '<tr><td height=34>±âÁ¸¿¡ ÀÔ·ÂµÈ ÅÂ±×°¡ ¾ø½À´Ï´Ù.</td></tr>';
				html += '</table>';
			} else {
				html = '<table width=100% cellpadding=2 cellspacing=1 border=0 style="margin-bottom:10px">';
				html += '<tr><td height=34>±âÁ¸¿¡ µî·ÏÇÑ ³ªÀÇ ÅÂ±×ÀÔ´Ï´Ù. ¾Æ·¡¿¡¼­ µî·ÏÇÒ ÅÂ±×¸¦ ¼±ÅÃÇÏ½Ã¸é ÀÚµ¿À¸·Î ÀÔ·ÂµË´Ï´Ù.</td></tr>';
				html += '<tr><td style="border-top:1px solid #acacac;border-left:1px solid #acacac;border-right:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;line-height:150%;padding:10px">';
				myTag.my_tags.each(function(val,idx) {
					html += '<a href="javascript:myTag.setTag(\''+val.title+'\')">'+val.title+'</a> &nbsp; ';
				});
				html += '</td></tr></table>';
			}
		}
		this.view_area.innerHTML = html;
	},
	setTag : function (mytag) {
		var old_tag = this.input_box.value.split(',');
		var tmp_mytag = Array();
		old_tag.each(function (val) {
			if (val == mytag) mytag = '';
			if (val  != '') tmp_mytag.push(val);
		});
		if (mytag != '') tmp_mytag.push(mytag);
		this.input_box.value = tmp_mytag.join(',');
	},
	nullfunc : null
};


var last_showtopmenu = null;
function showTopMenu(menuid, basimg) {
	if (last_showtopmenu != null) {
		Element.hide($(last_showtopmenu.id));
		//$(last_showtopmenu.id + 'img').src = base_img_url + 'topmenu/' + last_showtopmenu.img + '.gif';
	}
	if (menuid != null) {
		Element.show($(menuid));
		//$(menuid + 'img').src = base_img_url + 'topmenu/' + basimg + '_over.gif';
		last_showtopmenu = {id : menuid, img :basimg}
	}
}


var rainGlobalConf = {
	editorURL : _editor_url,
	imageURL : base_img_url + 'service/images/',
	uploadSCRIPT : base_upload_script,
	uploadURL : base_upload_url,
	uploadDOMAIN : 'http://' + document.domain,
	callbackURL : base_img_url +'service/editor_callback.html',
	editorClassName : 'blogtext',
	editorStyleSheet : base_img_url +'service/images/editor/blank.css',
	maxUploadSize : 1024*1024*5,
	useMediaPlayer : true,
	useImageEditor : true,
	mediaPlayer : {
		logo : base_img_url + 'service/images/logo_media.png',
		backColor : '0x000000',
		frontColor : '0xccCCCC'
	},
	skinSet : {},
	toolbarSet : {},
	middlebarSet : {}
}


