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 win_open(names, urls, width, height) {
    window.open(urls,names,'status=no,scrollbars=no,toolbar=no,location=no,menu=no,resizable=no,top=100,left=150,width='+width+',height='+height);
}

function gologin() {
	var gourl = escape(location.href);
	var purl = "/login.php?go_url=" + gourl;
}

function gologout() {
	var gourl = escape(location.href);
	location= "/login.php?mode=logout&go_url=" + gourl;
}

function get_login_view() {
	var instr, dusercookie;
	dusercookie = getCookie("drama_uid");

	instr = "<a href='/notice.php'><img src='/img/bt_notice00.gif' width='70' height='21' hspace='10' /></a>";
	if( dusercookie == "" ) {
		instr += "<a href='/login.php'><img src='/img/bt_login.gif' width='70' height='21' /></a> ";
		instr += "<a href='/member.php'><img src='/img/bt_regis.gif' width='86' height='21' hspace='10' /></a>";        
	} else {
		instr += "<a href='/login.php?mode=logout'><img src='/img/bt_logout.gif' width='70' height='21' /></a> ";
		instr += "<a href='/member.php'><img src='/img/bt_modify.gif' width='86' height='21' hspace='10' /></a>";        
	}

	document.getElementById('loginview').innerHTML = instr;
	if( dusercookie ) {
		bgfunc(dusercookie);
	}
}

function chk_number(str) {
    for(i=0; i<str.length; i++) {
        cp = str.charAt(i)
        if(!(cp >= 0 && cp <= 9)) return false;
    }
    return true;
}

function is_chk_id(obj, txt){
	var msg = txt + "Àº(´Â) ¼ýÀÚ/¿µ¹®À¸·Î¸¸ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À.";
	var val = obj.value;

   	for(i=0; i<val.length; i++) {
    	var chr = val.substr(i,1);
       	if((chr<'0'||chr>'9')&&(chr<'a'||chr>'z')&&(chr<'A'||chr>'Z') && chr!='-' && chr!='_') {
       		alert(msg);
       		obj.focus();
       		return false;
		}
   }

   return true;
}

function is_chk_num(obj, txt) {
    var msg = txt + "Àº(´Â) ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À.";
    var val = obj.value;

    if(!chk_number(val)) {
        alert(msg);
        obj.focus();
        return false;
    }

    return true;
}

function is_chk_need(obj, txt) {
    var msg = txt + "À»(¸¦) ÀÔ·ÂÇØÁÖ½Ê½Ã¿À.";
    var val = obj.value;

    if(!val) {
        alert(msg);
        obj.focus();
        return false;
    }

    return true;
}

function set_footer() {
	var instr = "";
	instr += '<table width="280" border="0" cellpadding="0" cellspacing="0">';
	instr += '<tr>';
  	instr += '<td height="8" class="cgy" style="padding-left:15px"><span id="loginuserid"></span></td>';
	instr += '</tr>';		
  	instr += '<tr>';
    instr += '<td height="20" align="left" id="loginview"></td>';
    instr += '</tr>';
	instr += '  <tr>';
	instr += '    <td height="70" align="left" id="loginview2"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="280" height="65">';
	instr += '      <param name="movie" value="footer.swf" />';
	instr += '      <param name="quality" value="high" />';
	instr += '      <param name="flashvars" value="m=4&amp;s=0" />';
	instr += '      <param name="wmode" value="transparent" />';
	instr += '      <embed src="footer.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="594" height="100"></embed>';
	instr += '    </object></td>';
	instr += '  </tr>';
	instr += '</table>';

	document.getElementById('footer').innerHTML = instr;

}

function bgfunc(lid) { 
	var script = document.createElement('script'); 
	script.type = 'text/javascript'; 
	script.src = '/answer.php?lid='+lid; 
	document.getElementsByTagName('head')[0].appendChild(script); 
}

//<!-- LOG corp Web Analitics & Live Chat START -->
//<![CDATA[
function logCorpAScript(){
	HTTP_MSN_MEMBER_NAME="";/*member name*/
	var prtc=(document.location.protocol=="https:")?"https://":"http://";
	var hst=prtc+"asp15.http.or.kr";
	var rnd="r"+(new  Date().getTime()*Math.random()*9);
	this.ch=function(){
		if(document.getElementsByTagName("head")[0]){this.dls();}else{window.setTimeout(logCorpAnalysis.ch,30)}
	}
	this.dls=function(){
		var  h=document.getElementsByTagName("head")[0];
		var  s=document.createElement("script");s.type="text/jav"+"ascript";try{s.async=true;}catch(E){};
		if(h){s.src=hst+"/HTTP_MSN/UsrConfig/dramawed/js/ASP_Conf.js?s="+rnd;h.appendChild(s);}
	}
	this.init= function(){
		document.write('<img src="'+hst+'/[sr].gif?d='+rnd+'"  style="width:1px;height:1px;position:absolute;" alt="" onload="logCorpAnalysis.ch()" />');
	}
}
if(typeof logCorpAnalysis=="undefined"){	var logCorpAnalysis=new logCorpAScript();logCorpAnalysis.init();}
//]]>
//<!-- LOG corp Web Analitics & Live Chat END -->
