var scroll_time = 300;
var obj;

function set_top_line( mode )
{
	if( !mode )
	{
		document.all["top_line1"].height = 1
		document.all["top_line2"].height = 1
		document.all["top_line3"].height = 1
	}
}

function set_move_banner()
{
	window.setTimeout( "set_move_banner()", scroll_time );

	if( typeof( document ) != "object" || document == null )
	{
		return false;
	}

	if( typeof( document.body ) != "object" || document.body == null )
	{
		return false;
	}

        top_x = 0;
        top_y = document.body.scrollTop;

	if(typeof(document.all.r_scroll_area) == "object" || typeof(document.all.l_scroll_area) == "object")
	{
		if( typeof( document.all.r_scroll_area ) == "object"  )
		{
			document.all.r_scroll_area.style.marginTop = top_y;
		}
		if( typeof( document.all.l_scroll_area ) == "object" )
		{
			document.all.l_scroll_area.style.marginTop = top_y;
		}
	} else {
		is_banner_l = false;
		is_banner_r = false;
		//is_recent_p = false;

		if( typeof( document.all.scroll_banner_l ) == "object"  )
		{
			is_banner_l = true;
		}
		if( typeof( document.all.scroll_banner_r ) == "object" )
		{
			is_banner_r = true;
		}
		// if( typeof( document.all.scroll_recent_p ) == "object" && is_banner_l == false)
		// {
			// is_recent_p = true;
		// }

		move_banner();

		if( is_banner_l )
		{
			document.all.scroll_banner_l.style.marginTop = top_y;
		}

		if( is_banner_r )
		{
			document.all.scroll_banner_r.style.marginTop = top_y;
		}

		// if( is_recent_p )
		// {
			// document.all.scroll_recent_p.style.marginTop = top_y;
		// }
		//scroll_time -= 1;
	}
}

function move_banner()
{

        /*
        scroll_banner_top_y = document.all.scroll_banner.style.marginTop.split( "px", 1 )

        height = top_y + 1000

        for( i = 0; i < 200; i++ )
        {
                height--;
                document.all.scroll_banner.style.marginTop = height
                window.setTimeout( "", 3 );
        }

        if( document.all.scroll_banner.style.marginTop != ( top_y + "px" ) )
        {
                //alert( height )
                //alert( document.all.scroll_banner.style.marginTop + " " + top_y )
        }
        */

	/*
	height = top_y + 1000

	for( i = 0; i < 1000; i++ )
	{
		document.all.scroll_banner.style.marginTop = height - 1
                //window.setTimeout( "", 1 );
	}
	*/
}

// ÃÖ±Ùº»»óÇ° ½ºÅ©¸³Æ® ½ÃÀÛ jsyoon 05/11/21
var timerID = null;
var np_active;
var np_speed;
var dspcnt;

function ScrollUp(){
	if(parseInt(obj[np_active].style.top) == 0){
		alert('ÃÖ±Ù º» Ã¹»óÇ°ÀÔ´Ï´Ù.');
		return;
	}
	if(document.getElementById){
		if(parseInt(obj[np_active].style.top) < 0){
			obj[np_active].style.top = parseInt(obj[np_active].style.top) + np_speed + "px";
		}
		//timerID = setTimeout("ScrollUp("+np_speed+")",30);
	}
}

function ScrollDown(){
	if(document.getElementById){
		var remain_height = parseInt(obj[np_active].style.height) + (parseInt(obj[np_active].style.top));
		if(remain_height <= (dspcnt * np_speed)){
			alert('ÃÖ±Ù º» ¸¶Áö¸·»óÇ°ÀÔ´Ï´Ù.');
			return;
		}
		if(parseInt(obj[np_active].style.top) > document.getElementById('cont').offsetHeight - obj[np_active].offsetHeight){
			obj[np_active].style.top = parseInt(obj[np_active].style.top) - np_speed + "px";
		}
		//timerID = setTimeout("ScrollDown("+np_speed+")",30);
	}
}

function ScrollStop(){
	if(document.getElementById){
		clearTimeout(timerID);
	}
}

function ScrollPageInit(rowcnt, rowlimit) {
	var tbl_row =  document.getElementById("tbl_row0");
	var inner_width = 0;
	var inner_height = 0;
	var cont_obj;
	var tmp_obj;
	dspcnt = rowlimit;
	np_active = 0;
	if(tbl_row == undefined || rowcnt <= 0)
		return;
	else {
		//inner_width = parseInt(tbl_row.width);
		// Å¸ÀÌÆ²ÀÌ¹ÌÁöÀÇ Å©±â¸¦ ºÒ·¯¿Í¼­ ¸®½ºÆ® Å×ÀÌºí ³ÐÀÌ·Î¼³Á¤
		var rview_timg = new Image();
		rview_timg.src = document.getElementById("rviewpdt_img").src;
		inner_width = rview_timg.width;
		for(var i=0; i < rowcnt; i++){
			tmp_obj = document.getElementById("tbl_row" + i);
			tmp_obj.width = inner_width;
		}
		//¸®½ºÆ® Å×ÀÌºí ³ôÀÌ¼³Á¤
		inner_height = parseInt(tbl_row.height);
		if(inner_width <= 0 || inner_height <= 0)
			return;
		np_speed = inner_height;
		cont_obj = document.getElementById("cont");
		cont_obj.style.width = inner_width;
		cont_obj.style.height = (rowcnt > rowlimit ? (inner_height * rowlimit + 1) : (inner_height * rowcnt + 1)) + 'px';
	}
	if(document.getElementById){
	var	obj = document.getElementById("cont").getElementsByTagName("DIV");
		obj['inner_row'].style.visibility = "visible";
		obj['inner_line'].style.visibility = "visible";
		obj['inner_row'].style.height = (inner_height * rowcnt) + 'px';
		obj['inner_row'].style.width = inner_width + 'px';
		obj['inner_row'].style.top = 0;
	}
	if(document.addEventListener){
		for(i=0;i<document.getElementsByTagName('a').length;i++){
			document.getElementsByTagName('a')[i].style.position = "relative";
		}
	}
    return obj;
}
// ÃÖ±Ùº»»óÇ° ³¡

function check_gonggu()
{
	alert('°øµ¿±¸¸Å ±â°£ÀÌ ¾Æ´Õ´Ï´Ù');
}

function poll_form_submit( form )
{

        select_no_length = form.select_no.length
	is_checked = false;

        for( i = 0; i < select_no_length; i++ )
        {
		if( form.select_no[i].checked )
		{
			is_checked = true;
			break;
		}
        }

	if( !is_checked )
	{
		alert( '¼³¹®Ç×¸ñÀ» ¼±ÅÃÇØÁÖ¼¼¿ä.' )
		return false;
	}

	return true;
}

function sMmove( link )
{
	document.location.href = 'http://' + link
	oWin.close();
}

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 notice_popup(is_popup_check, mp_width, mp_height, mp_left_p, mp_top_p, mp_scrollbars)
{
	if (getCookie("mp_is_popup") == "") {
		mp_option = 'status:false;';
		mp_option += 'dialogWidth: ' + mp_width + 'px;';
		mp_option += 'dialogHeight: ' + mp_height + 'px;';
		mp_option += 'help:no; dialogLeft:' + mp_left_p + 'px;';
		mp_option += 'dialogTop:' + mp_top_p + ';';
		mp_option += 'status:no;scroll:' + mp_scrollbars + ';';

		url = '/admin/php/d/popup_r.php';
		url_name = 'echosting_shop_pop';

		var oWin = showModelessDialog( url, window, mp_option );
	}
}

function echosting_js_init()
{
	// ÁÂ,¿ìÃø ¿òÁ÷ÀÌ´Â ¹è³Ê
	set_move_banner();
	//window.setInterval( "set_move_banner()", scroll_time );
	//window.setTimeout( "set_move_banner()", scroll_time );
}

// ÇÑ±Û Å©±â¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö by jsyoon
function str_size_check(str){
        var strlen = str.length;
        var bsize = 0;
        for(i=0; i<strlen; i++){
                chr =   str.charAt(i);
                // ÇÑ±ÛÀÌ¸é 2¸¦ ´õÇÑ´Ù.
                if (escape(chr).length > 4)
                {
                        bsize += 2;
                }
                // ±×¹ÛÀÇ °æ¿ì´Â 1À» ´õÇÑ´Ù.
                else
                {
                        bsize++;
                }
        }
        return bsize;
}

function check_byte(frm, maxsize, msg){
        var txtval  = frm.value;
        var bsize = 0;
        bsize = str_size_check(txtval);
        if(bsize > maxsize){
                alert(msg);
                return false;
        } else {
		return true;
	}
}

// ÀÔ·ÂÆûÀÇ ¹®ÀÚ°¡ ¼ýÀÚÀÎÁö¸¦ Ã¼Å© by jsyoon
function checkDigit(inputval)
{
        inputstr = inputval.toString();
        for ( var i=0; i < inputstr.length; i++)
        {
                var onechar = inputstr.charAt(i);
                if ((onechar < "0" || onechar > "9"))
                {
                        return false
                }
        }
        return true
}
// ÀÚ¹Ù½ºÅ©¸³Æ® number_format jsyoon
function number_format(str)
{
	str+='';

	var objRegExp = new RegExp('(-?[0-9]+)([0-9]{3})');

	while(objRegExp.test(str))
	{
		str = str.replace(objRegExp, '$1,$2');
	}

	return str;
}

var oldActionUrl = '';
// add ÀåÁ¤ÀÎ
// date 2005.10.19
// login.simplexi.comÀ»(ssl) ÅëÇÏ¿© ·Î±×ÀÎ ÇÏ±â
function set_ssl_login( frm )
{
    if (frm.is_ssl.checked) {
        oldActionUrl = frm.action;
	frm.action = 'https://login2.simplexi.com/echosting/shop19.php?predomain=' + login_host + '&sessionid=' + login_sessionid + '&mall_id=' + login_mallid;
    } else {
        frm.action = '/front/php/login/login_a.php';
    }
} // end of set_ssl_login()

echosting_js_init()


// sujin
// object°ü·Ã script ÆÄÀÏ

function set_Embed()
{
  var obj = new String;
  var parameter = new String;
  var embed = new String;
  var html = new String;
  var allParameter = new String;
  var clsid = new String;
  var codebase = new String;
  var pluginspace = new String;
  var embedType = new String;
  var src = new String;

  var width = new String;
  var height = new String;

  var ServerIp = new String;
  var UserId = new String;
  var PassiveMode = new String;
  var Port = new String;
  var Status = new String;
  var Banner = new String;
  var ECHosting = new String;
  var FilelinkService = new String;
  var FilelinkServer = new String;

  this.init = function( s ,w , h, getType ) {
      getType = (getType != undefined)? getType :'flash';
      if ( getType == "flash")
      {
        clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";
        codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
        pluginspage = "http://www.macromedia.com/go/getflashplayer";
        embedType = "application/x-shockwave-flash";

        parameter += "<param name='movie' value='"+ s + "'>\n";
        parameter += "<param name='quality' value='high'>\n";
        parameter += "<Param name='bgcolor' value=#FFFFFF>\n";

      }
      else if ( getType == 'webftp')
      {
        clsid = "EF256D78-3982-4F12-900B-AD8B254A43BD";
        codebase = "http://echosting.cafe24.com/ftpclient/Cafe24FtpCtl21.cab#version=1,0,2,7";
      }
      else if ( getType == 'filelinkftp')
      {
        clsid = "EF256D78-3982-4F12-900B-AD8B254A43BD";
        codebase = "http://echosting.cafe24.com/ftpclient/Cafe24FtpCtl14.cab#version=1,0,2,4";
      }



      src = s;
      width = w;
      height = h;
  }

  this.parameter = function( parm , value ) {
      parameter += "<param name='"+parm +"' value='"+ value + "'>\n";
      allParameter += " "+parm + "='"+ value+"'";
  }

  this.show = function(getType) {
      if ( clsid)
      {
        obj = "<object classid=\"clsid:"+ clsid +"\" codebase=\""+ codebase +"\"";

        if (width) {
            obj += " width ='" + width + "' ";
        }

        if (height) {
            obj += " height ='" + height + "' ";
        }

        obj += ">\n";
      }

      if ( getType == "flash" || typeof(getType) == "undefined") {
      	embed = "<embed src='" + src + "' pluginspage='"+ pluginspage + "' type='"+ embedType + "'";

        if (width) {
            embed += " width ='" + width + "' ";
        }

        if (height) {
            embed += " height ='" + height + "' ";
        }

        embed += allParameter + " ></embed>\n";
      }

      if (getType == 'streaming') {
      	embed = "<embed src='" + src + "' type='"+ embedType + "'";

        if (width) {
            embed += " width ='" + width + "' ";
        }

        if (height) {
            embed += " height ='" + height + "' ";
        }

        embed += allParameter + " ></embed>\n";
      }

      if ( obj )
      {
        end_embed = "</object>\n";
      }

      if(getType == 'streaming')
	      html = embed;
      else
	      html = obj + parameter + embed + end_embed;

      document.write( html );
  }


}

//ÀüÀÚº¸Áõº¸Çè Áõ±Ç ³»¿ë ¿¬°á ÆË¾÷½ºÅ©¸³Æ®
function usafe_print(asMallId, asOrderId)
{
	var iXpos;
	var iYpos;

	iXPos = (screen.width  - 700) / 2;
	iYpos = (screen.height - 600) / 2;

        url = "https://gateway.usafe.co.kr/esafe/InsuranceView.asp?mall_id="+asMallId+"&order_id="+asOrderId;
        winname = "uclick_win" ;
        //option = "toolbar=no location=no scrollbars=yes width=650 height=537 left="+iXpos+",top="+iYpos ;
        option = "toolbar=no location=no scrollbars=yes width=650 height=537" ;
        opener = window.open( url, winname, option ) ;
}
// ¸¶¿ì½º ¿À¸¥ÂÊÅ¬¸¯ »ç¿ë±ÝÁö
function disableMouseRightButton()
{
	if ((event.button==2) ||  (event.button==3))
	{
		alert("¹«´Üµµ¿ë¹æÁö¸¦ À§ÇÏ¿© ¸¶¿ì½º ¿À¸¥ÂÊ\n\n ¹öÆ°Àº »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
		return false;
	}
}
//ÄÁÆ®·ÑÅ° ¹× Æã¼ÇÅ° ±ÝÁö
function disableKeys()
{
	if((event.ctrlKey == true && (event.keyCode == 78 || event.keyCode == 82)) ||
		(event.keyCode >= 112 && event.keyCode <= 123))
	{
		event.keyCode = 0;
		event.cancelBubble = true;
		event.returnValue = false;
	}	
}

/**
	* »ç¿ëÀÚ Á¤ÀÇ ÇÔ¼ö
	*
	* @author ÀÌ°æ¶õ<krlee2@simplexi.com>
	* @date 2008-05-28
	* sample
	* getLog('/front/php/b/board_list.php','myshop','c_1','')
**/
function getLog(sURL,path1,path2,path3)
{

	if (path1 == null) {
	    path1 = '';
	}
	if (path2 == null) {
	    path2 = '';
	}
	if (path3 == null) {
	    path3 = '';
	}

	if (sURL == '' && path1 == '' && path2 == '' && path3 == '' ){
		alert('sURL¶Ç´Â path1¶Ç´Â path2¶Ç´Â path3¸¦ ÀÔ·ÂÇÏ¼Å¾ßÇÕ´Ï´Ù');
	}else if (sURL == ''){
		alert('sURLÀ» ÀÔ·ÂÇÏ¼Å¾ßÇÕ´Ï´Ù');
	}else	if (path1 == ''&& path2 == '' && path3 == ''){
		alert('path1¶Ç´Â path2¸¦ ÀÔ·ÂÇÏ¼Å¾ßÇÕ´Ï´Ù');
	}else if (sURL != '' && ( path1 != '' || path2 != '' || path3 != '' ) ){
        var path1_size = str_size_check(path1);
        var path2_size = str_size_check(path2);
        var path3_size = str_size_check(path3);
        var sURL_size = str_size_check(sURL);
        if(path1_size > 255) {
            alert("Ã¹¹øÂ° ÀÎÀÚ°¡ ³Ê¹« ±é´Ï´Ù.");
            return;
        }
        if(path2_size > 255) {
            alert("µÎ¹øÂ° ÀÎÀÚ°¡ ³Ê¹« ±é´Ï´Ù.");
            return;
        }
        if(path3_size > 255) {
            alert("¼¼¹øÂ° ÀÎÀÚ°¡ ³Ê¹« ±é´Ï´Ù.");
            return;
        }
        if(sURL_size > 255) {
            alert("Àü´Þ URLÀÇ ±æÀÌ°¡ ³Ê¹« ±é´Ï´Ù.");
            return;
        }
		location.href = "/front/php/get_log.php?sCliMode=Evnt&sURL="+sURL+"&path1="+path1+"&path2="+path2+"&path3="+path3;
	}

}

// 2009-07-13 °Ô½ÃÆÇ »ó¼¼ ±Û º¸±â ¼³Á¤ Ãß°¡ - ±ÇÇõÃµ (»óÇ°ÈÄ±â °Ô½ÃÆÇ¸¸ ¼³Á¤ °¡´É:¿ÀÁ¤Èñ)
var preViewTarget = null;
var preViewCloseImg = '';
function viewTarget(bbs_number,is_secret,address,prev_open_img,prev_close_img) {
    if (is_secret=='F') {
        if (preViewTarget==bbs_number) {
            viewTargetDivControl(prev_open_img,'','none');
            preViewTarget = null
        } else {
            try
            {
                if (preViewTarget != null) {
                    viewTargetDivControl(prev_open_img,'','none');
                }

                preViewTarget = bbs_number;
                preViewCloseImg = prev_close_img;
                parma_str = '&mode=read_preview&'+address.substring(address.indexOf('?')+1);
                sendRequest(viewTargetContents, parma_str,'POST', address.substring(0,address.indexOf('?')), true, true);
            } catch (e) {}
       }
        return;
    } else if (is_secret=='M') {
        alert('È¸¿ø¿¡°Ô¸¸ ÀÐ±â ±ÇÇÑÀÌ ÀÖ½À´Ï´Ù');
    } else {
        alert('ºñ¹Ð±ÛÀº ¹Ì¸®º¸±â°¡ ºÒ°¡ ÇÕ´Ï´Ù.');
    }
}

// 2009-07-13 °Ô½ÃÆÇ »ó¼¼ ±Û º¸±â ¼³Á¤ Ãß°¡ - ±ÇÇõÃµ (»óÇ°ÈÄ±â °Ô½ÃÆÇ¸¸ ¼³Á¤ °¡´É:¿ÀÁ¤Èñ)
function viewTargetDivControl(img,contents,type) {
    try {
        document.getElementById('prevImg'+preViewTarget).src = img;
        document.getElementById('view'+preViewTarget).innerHTML = contents;
        document.getElementById('view'+preViewTarget).style.display = type;
    }
    catch (e) {}

}
// 2009-07-13 °Ô½ÃÆÇ »ó¼¼ ±Û º¸±â ¼³Á¤ Ãß°¡ - ±ÇÇõÃµ (»óÇ°ÈÄ±â °Ô½ÃÆÇ¸¸ ¼³Á¤ °¡´É:¿ÀÁ¤Èñ)
function viewTargetContents(oj) {
    viewTargetDivControl(preViewCloseImg,oj.responseText,'block');
}

// 2009-07-18 ÆË¾÷Ã¢ »ý¼º ÇÔ¼ö - ±ÇÇõÃµ
function OpenWindow(StrPage, StrName, w, h,scrolls)
{
	var win = null;
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/3;
	settings = 'height='+h+',';
	settings += 'width='+w+',';
	settings += 'top='+wint+',';
	settings += 'left='+winl+',';
	settings += 'scrollbars='+scrolls+',';
	settings += 'resizable=no,';
	settings += 'status=no';
	win = window.open(StrPage, StrName, settings);
	if (parseInt(navigator.appVersion)>=4) {
		win.window.focus();
	}
}
