var NUM = "0123456789";	
var SALPHA = "abcdefghijklmnopqrstuvwxyz";
var ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"+SALPHA;
var EMAIL = "!#$%&*+-./=?@^_`{|}"+NUM+ALPHA;
var NONIDABLE = "~!@#$%^&*()_+|`'\"-=:;<>?,./¡Ù¡Ø¡Ú¡Û¡Ü¡Ý¡Þ£¦¡ß";


var PASSWORD = "!@.#,$%^*&_-" + ALPHA + NUM;
var ERRORMSG = "";

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 jumpForm(obj, len, nextobj) {
	if (obj.value.length == len) {
		nextobj.focus();
	}	
}

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 goURL(theURL, url_target ) {
	if (theURL !=null && theURL != '') {
		if (url_target == null) url_target = self;
		url_target.document.location.href = theURL;
	}
}

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 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, true);
	selectobj.options[optindex]= NewItem;
}


function popwin(url, scroll_bar) {
	if (scroll_bar == null || scroll_bar == '') scroll_bar = 'no';
	else scroll_bar = 'yes';
	popup = window.open(url,'popup','width=10,height=10, toolbar=0,menubar=0,resizable=yes,scrollbars='+scroll_bar+', top=50, left=50');
	popup.focus();
}

function popInfo(user_no) {
	popup = window.open('/admin/pop_meminfo.html?user_no=' + user_no ,'','width=10,height=10, toolbar=0,menubar=0,resizable=yes,scrollbars=yes, top=50, left=50');
	popup.focus();
}

function PopStarMent() {
	popup = window.open('http://eonul.com/pop/star.htm' ,'','width=10,height=10, toolbar=0,menubar=0,resizable=yes,scrollbars=no, top=50, left=50');
	popup.focus();
}



function goHompy(planer_id) {
	if (planer_id == '') {
		alert('¾ÆÁ÷ È¨ÆäÀÌÁö°¡ »ý¼º µÇÁö ¾Ê¾Ò½À´Ï´Ù');
	} else {
		document.location.href= '/rainblog/' +planer_id + '/';
	}
}


function fillForm(code, obj, sel_val) {
	obj.length = 0;
	len = code.length;
	selelced_index = 0;
	for (i = 0; i < len; i++) {
		if (sel_val != null && code[i][0] == sel_val)  selelced_index = i;
		obj.options[i] = new Option(code[i][1], code[i][0], false, true);
	}
	obj.selectedIndex = selelced_index;
}

function sendSMS(user_no) {
	popup = window.open('../admin/pop_sms.html?user_no=' + user_no ,'popup','width=10,height=10, toolbar=0,menubar=0,resizable=yes,scrollbars=auto, top=50, left=50');
	popup.focus();
}

function imgView(img_obj) 
{
	if (typeof(img_obj) == 'string') 
	{
		var win_scrollbars = 'yes';
		var width_plus = 20;
		var img_name = img_obj;
	} 
	else if (img_obj.height > 600) 
	{
		var win_scrollbars = 'yes';
		var width_plus = 20;
		var img_name = img_obj.src;
	} 
	else 
	{
		var win_scrollbars = 'yes';
		var width_plus = 0;
		var img_name = img_obj.src;
	}
	popup = window.open('about:blank','imgView','width=10,height=10, toolbar=0,menubar=0,resizable=yes,scrollbars='+win_scrollbars+', top=50, left=50');
	popup.document.writeln('<html><title>ÀÌ¹ÌÁö »ó¼¼º¸±â</title>'
		+ '<body topmargin="0" rightmargin="0" leftmargin="0" bgcolor="#FFFFFF">'
		+ '<sc'+'ript>function reSize() {if(document.all("pre_img").width > 0) resizeTo(document.all("pre_img").width + 10 + '+width_plus+',document.all("pre_img").height + 50);}</scr'+'ipt>'
		+ '<img src=' + encodeURI(img_name) + ' border=0 onclick=self.close() style="cursor:hand" name=pre_img id=pre_img onload=reSize()>'
		+ '');
}

function getCookie( name ) {
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length ){
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                                endOfCookie = document.cookie.length;
                        return unescape( document.cookie.substring( y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                        break;
        }
        return "";
}

function setCookie( name, value, expiredays ) {
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + expiredays );
        if (expiredays > 0) {
        	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";
        } else {
        	document.cookie = name + "=" + escape( value ) + "; path=/;";
        }
}


function popUrl(obj) {
	if (obj[obj.selectedIndex].value != '') {
		window.open(obj[obj.selectedIndex].value, '_blank');
	}
}

//explorer flash °íÃÄ¿ä ~
function flashLoadjs(src,w,h){
	html = '';
	html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
    html += '<param name="quality" value="high">';
	html += '<param name="wmode" value="transparent">';
	html += '<embed src="'+src+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed></object>';
	document.write(html);
}


