function follow_banner(div_id, origin_top, limit_top, margin_top)
{
    var d, t, s, g, target_height;
    origin_top *= 1;
    limit_top *= 1;
    margin_top *= 1;

    d = document.getElementById(div_id);
    s = document.body.scrollTop + "";

    target_height = s.toInteger() + margin_top;
    if ( target_height < limit_top )
	{
        target_height = origin_top;
    }

    t = d.style.top.toInteger();

    if ( t != target_height )
	{
        g = Math.ceil((t - target_height) / 5);
        if ( g > 50 )
		{
            g = 50;
        }
        else if ( g < -50 )
		{
            g = -50;
        }
        
		d.style.top = (t - g) + "px";
    }

    setTimeout("follow_banner('" + div_id + "', " + origin_top + ", " + limit_top + ", " + margin_top + ");", 3);
}

function cm_get_byte(str)
{
    var i, m = str.length, re_count = 0, val = 0;
    
	for ( i = 0; i < m; i++ ) 
	{ 
        val = escape(str.charAt(i)).length; 
        
		if ( val > 3 )
		{
			re_count++; 
		}
        
		re_count++; 
    
	}
	
	return re_count; 
} 


function MakeFlash(Url, Width, Height)
{                 
	document.writeln("<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=\"" + Width + "\" height=\"" + Height + "\">"); 
	document.writeln("<param name=\"movie\" value=\"" + Url + "\" />");
	document.writeln("<param name=\"allowScriptAccess\" value=\"sameDomain\" />");
	document.writeln("<param name=\"quality\" value=\"high\" />");     
	document.writeln("<param name=\"wmode\" value=\"transparent\">"); 
	document.writeln("<embed wmode=\"transparent\" src=\"" + Url + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + Width + "\"  height=\"" + Height + "\">"); 
	document.writeln("</object>");     
}

function make_chatting_room(nickname)
{
	document.writeln("<embed height='300' width='630' src='http://www.gagalive.kr/livechat1.swf?chatroom=±îºØ´ëÈ­¹æ&user=" + nickname + "'></embed>");
}

// ÁÖ¹Î¹øÈ£ Ã¼Å©
function check_juminno(juminno) {
        if(juminno=="" || juminno==null || juminno.length!=13) {
                alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ Àû¾îÁÖ¼¼¿ä.");
                return false;
        }
        var jumin1 = juminno.substr(0,6);
        var jumin2 = juminno.substr(6,7);
        var yy         = jumin1.substr(0,2);        // ³âµµ
        var mm = jumin1.substr(2,2);        // ¿ù
        var dd = jumin1.substr(4,2);        // ÀÏ
        var genda = jumin2.substr(0,1);        // ¼ºº°
        var msg, ss, cc;

        // ¼ýÀÚ°¡ ¾Æ´Ñ °ÍÀ» ÀÔ·ÂÇÑ °æ¿ì
        if (!isNumeric(jumin1)) {
                alert("ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä.");
                return false;
        }
        // ±æÀÌ°¡ 6ÀÌ ¾Æ´Ñ °æ¿ì
        if (jumin1.length != 6) {
                alert("ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
                return false;
        }
        // Ã¹¹øÂ° ÀÚ·á¿¡¼­ ¿¬¿ùÀÏ(YYMMDD) Çü½Ä Áß ±âº» ±¸¼º °Ë»ç
        if (yy < "00" || yy > "99" ||
                mm < "01" || mm > "12" ||
                dd < "01" || dd > "31") {
                alert("ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
                return false;
        }
        // ¼ýÀÚ°¡ ¾Æ´Ñ °ÍÀ» ÀÔ·ÂÇÑ °æ¿ì
        if (!isNumeric(jumin2)) {
                alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä.");
                return false;
        }
        // ±æÀÌ°¡ 7ÀÌ ¾Æ´Ñ °æ¿ì
        if (jumin2.length != 7) {
                alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
                return false;
        }
        // ¼ºº°ºÎºÐÀÌ 1 ~ 4 °¡ ¾Æ´Ñ °æ¿ì
        if (genda < "1" || genda > "4") {
                alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
                return false;
        }
        // ¿¬µµ °è»ê - 1 ¶Ç´Â 2: 1900³â´ë, 3 ¶Ç´Â 4: 2000³â´ë
        cc = (genda == "1" || genda == "2") ? "19" : "20";
        // Ã¹¹øÂ° ÀÚ·á¿¡¼­ ¿¬¿ùÀÏ(YYMMDD) Çü½Ä Áß ³¯Â¥ Çü½Ä °Ë»ç
        if (isYYYYMMDD(parseInt(cc+yy), parseInt(mm), parseInt(dd)) == false) {
                alert("ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
                return false;
        }
        // Check Digit °Ë»ç
        if (!isSSN(jumin1, jumin2)) {
                alert("ÀÔ·ÂÇÑ ÁÖ¹Îµî·Ï¹øÈ£¸¦ °ËÅäÇÑ ÈÄ, ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
                return false;
        }
        return true;
}

// »ç¾÷ÀÚµî·Ï¹øÈ£ Ã¼Å©
function check_busino(vencod) {
        var sum = 0;
        var getlist =new Array(10);
        var chkvalue =new Array("1","3","7","1","3","7","1","3","5");
        for(var i=0; i<10; i++) { getlist[i] = vencod.substring(i, i+1); }
        for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
        sum = sum + parseInt((getlist[8]*5)/10);
        sidliy = sum % 10;
        sidchk = 0;
        if(sidliy != 0) { sidchk = 10 - sidliy; }
        else { sidchk = 0; }
        if(sidchk != getlist[9]) { return false; }
        return true;
}


function isYYYYMMDD(y, m, d) {
        switch (m) {
        case 2:        // 2¿ùÀÇ °æ¿ì
                if (d > 29) return false;
                if (d == 29) {
                        // 2¿ù 29ÀÇ °æ¿ì ´çÇØ°¡ À±³âÀÎÁö¸¦ È®ÀÎ
                        if ((y % 4 != 0) || (y % 100 == 0) && (y % 400 != 0))
                                return false;
                }
                break;
        case 4:        // ÀÛÀº ´ÞÀÇ °æ¿ì
        case 6:
        case 9:
        case 11:
                if (d == 31) return false;
        }
        // Å« ´ÞÀÇ °æ¿ì
        return true;
}
function isNumeric(s) {
        for (i=0; i<s.length; i++) {
                c = s.substr(i, 1);
                if (c < "0" || c > "9") return false;
        }
        return true;
}
function isLeapYear(y) {
        if (y < 100)
        y = y + 1900;
        if ( (y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0) ) {
                return true;
        } else {
                return false;
        }
}
function getNumberOfDate(yy, mm) {
        month = new Array(29,31,28,31,30,31,30,31,31,30,31,30,31);
        if (mm == 2 && isLeapYear(yy)) mm = 0;
        return month[mm];
}
function isSSN(s1, s2) {
        n = 2;
        sum = 0;
        for (i=0; i<s1.length; i++)
                sum += parseInt(s1.substr(i, 1)) * n++;
        for (i=0; i<s2.length-1; i++) {
                sum += parseInt(s2.substr(i, 1)) * n++;
                if (n == 10) n = 2;
        }
        c = 11 - sum % 11;
        if (c == 11) c = 1;
        if (c == 10) c = 0;
        if (c != parseInt(s2.substr(6, 1))) return false;
        else return true;
}

function is_hanguel(str)
{
	if ( !trim(str) )
	{
		return false;
	}

	return !/[^(°¡-ÆR)]/.test(str);
}

function is_hanguel_2(str)
{
	if ( !trim(str) )
	{
		return false;
	}

	if ( /^\s/.test(str) )
	{
		return false;
	}

	return !/[^(°¡-ÆR\s)]/.test(str);
}

function is_alnum(str)
{
	if ( !trim(str) )
	{
		return false;
	}

	return !/[^(a-zA-Z0-9)]/.test(str);
}

function is_num(num)
{
	if ( !trim(num) )
	{
		return false;
	}

	return !/[^(0-9)]/.test(num);
}

function is_al(str)
{
	if ( !trim(str) )
	{
		return false;
	}

	return !/[^(a-zA-Z)]/.test(str);
}

function is_hanalnum(str)
{
	if ( !trim(str) )
	{
		return false;
	}

	return !/[^(°¡-ÆRa-zA-Z0-9\s)]/.test(str);
}

function nextFocus(sFormName, sNow, sNext)
{
	var sForm = 'document.'+ sFormName +'.';
	var oNow = eval(sForm + sNow);
	
	if ( typeof oNow == 'object' )
	{
		if ( oNow.value.length == oNow.maxLength)
		{
			var oNext = eval(sForm + sNext);
	
			if ( (typeof oNext) == 'object' )
			{
				oNext.focus();
			}
		}
	}
}

// ±è¼±¿ë 2006.3 - ÀüÈ­¹øÈ£(ÈÞ´ëÆù) Çü½Ä °Ë»ç : 123-123(4)-5678
function check_phone_no(phone_no)
{
	if ( !trim(phone_no) )
	{
		return false;
	}

	var pattern = /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/;
	
	if ( !pattern.test(phone_no) )
	{
		return false;
	}

	return true;
}

// ÀÌ¸ÞÀÏÁÖ¼Ò Çü½Ä °Ë»ç
function check_email(email_address)
{
	if ( !trim(email_address) )
	{
		return false;
	}

    var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
    
	if ( !pattern.test(email_address) )
    {
		return false;
	}

	return true;
}

// ¾çÂÊ °ø¹é ¾ø¾Ö±â
function trim(str)
{
	var pattern = /(^\s*)|(\s*$)/g;
    str = str.replace(pattern, "");

	return str;
}

function is_right_char(str)
{
	return true;
}

function openImageWinCenter(imageRef){ 
       var x,y,w,h,loadingMsg; 
       //ÆË¾÷µÉ Ã¢ÀÇ ÃÊ±â Å©±â 
       w=300;h=100; 
       //È­¸é ÇÑ°¡¿îµ¥·Î ÆË¾÷Ã¢ ¶ç¿ì±â À§ÇÑ ÁÂÇ¥ °è»ê 
       x=Math.floor( (screen.availWidth-(w+12))/2 );y=Math.floor( (screen.availHeight-(h+30))/2 ); 

       //ÀÌÁö¹Ì°¡ ·ÎµùÁß¿¡ ³»º¸³¾ ¸Þ½ÃÁö 
       loadingMsg="<table width=100% height=100%><tr><td valign=center align=center><font size='2' color='#ff6600' face='termanal'>NOW LODDING...</font></td></tr></table>"; 

       with( window.open("","",'height='+h+',width='+w+',top='+y+',left='+x+',scrollbars=no,resizable=no') ) 
       { 
              document.write( 
              "<body topmargin=0 rightmargin=0 bottommargin=0 leftmargin=0>", 
              loadingMsg, 
              "<img src=\""+imageRef+"\" hspace=0 vspace=0 border=0 onmousedown=\"window.close();\" onload=\"document.title=this.src;document.body.removeChild(document.body.children[0]);window.resizeTo(this.width+12,this.height+30);window.moveTo(Math.floor( (screen.availWidth-(this.width+12))/2),Math.floor( (screen.availHeight-(this.height+30))/2 ));\">", 
              "</body>"); 
              focus(); 
       } 
}

function viewsealinfo(seal)
{
	window.open('http://info.anycert.com?seal='+seal,'viewipinfo2','width=650, height=583,scrollbars=no,top=10,left=10');
}

// ¿ªÇÒ : ÀÔ·Â¹ÞÀº ÆÄÀÏÀÌ¸§ÀÌ È®ÀåÀÚ¸¦ °Ë»çÇÑ´Ù.
// ÀÔ·Â : ÆÄÀÏÀÌ¸§
// Ãâ·Â : È®ÀåÀÚ°¡ jpg, jpeg, png, gif¸é true¸¦ ±×·¸Áö ¾ÊÀ¸¸é false¸¦ ¹ÝÈ¯ÇÑ´Ù.
function img_format_check(file_name)
{
	var image_format = file_name.split('.');
	image_format[1] = image_format[1].toLowerCase();

	switch ( image_format[1] )
	{
	case 'jpg':
	case 'jpeg':
	case 'png':
	case 'gif':
		break;
	default:
		return false;
	}

	return true;
}

// ¿ªÇÒ : ÆÄÀÏÀÇ Å©±â¸¦ ±¸ÇÑ´Ù.
// ÀÔ·Â : ÆÄÀÏÀÇ °æ·Î
// Ãâ·Â : ÆÄÀÏÀÇ »çÀÌÁî
function getFileSize(path)
{
	var img = new Image();
	img.dynsrc = path;

	return img.fileSize;
}
//-->