// JavaScript Document
function getReSize()
{
 
      var objFrame = document.getElementById("frameMain");
	  if (objFrame == null) return;
      var objBody = objFrame.document.body;

      ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);

      if (ifrmHeight > 300) {
             objFrame.style.height = ifrmHeight;
      } else {
             objFrame.style.height = 300;
      }
      objFrame.style.width = '100%'
}

function getRetry()
{
       getReSize();
       setTimeout('getRetry()',300);
}
getRetry();
function rowEvent(obj, fixed_row){
        var args = rowEvent.arguments;
        var argl = args.length;
        var TRs = new Array;
        var idx, orgColor, colorIdx=0;

        if (argl < 3) return;
        if (typeof(obj.already) == 'undefined') obj.already = false;
        if (obj.already) return;

        TRs = obj.getElementsByTagName('TR');
        for (idx=fixed_row; idx<TRs.length; idx++)
        {
                orgColor = TRs[idx].bgColor;
                if (TRs[idx].style.backgroundColor.toString().length > 0) orgColor = TRs[idx].style.backgroundColor;

                TRs[idx].onmouseover = new Function('this.style.backgroundColor="'+(args[2+colorIdx])+'";');
                TRs[idx].onmouseout = new Function('this.style.backgroundColor="'+orgColor+'";');

                if (++colorIdx > argl-3) colorIdx = 0;
        }
        obj.already = true;
}
function rowCh(obj, fixed_row){
        rowEvent(obj, fixed_row, '#FFEFE8', '#FFEFE8');
}

function delete_confirm(msg) {
	if (confirm(msg)) {
		document.dForm.submit();
	}
}

var flag = true;
function chkCtrl(frm){
	if (flag) {
		allcheck(frm);
		flag = false;
	} else {
		uncheck(frm);
		flag = true;
	}

}
function allcheck(frm){
	for( var i=0; i<frm.elements.length; i++) {
		var check = frm.elements[i];
		check.checked = true;
	} return;
}
function uncheck(frm) {
	for( var i=0; i<frm.elements.length; i++) {
		var check = frm.elements[i];
		check.checked = false;
	}
	return;
}

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 );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function popCookieWin( url , cName, scrl) {
	if (getCookie( cName ) != "done") {
		noticeWindow =  MM_openBrWindow(url, cName , 'height=200,width=200,scrollbars='+scrl );
	}
}

function popCookieNotice(url,h,w) {
	if (getCookie("popup_jast_cookie") != "done") {
		noticeWindow =  popWinScroll(url,h,w);
	}
}
function popPreview(url,id, p) {
	MM_openBrWindow(url,'p'+id,p);
}
function ColorDlg(obj){
	var oColor = obj.value;
	if (oColor == null)
		//ÄÃ·¯Ã¢ ¿­±â
	var oTColor = dlgColor.ChooseColorDlg();
	else
		var oTColor = dlgColor.ChooseColorDlg(oColor);
	oTColor = oTColor.toString(16);
	if (oTColor.length < 6) {
		var sTempString = "000000".substring(0,6-oTColor.length);
		oTColor = sTempString.concat(oTColor);
	}
	strColor = "#" + oTColor;
	obj.value = strColor;// Ã¤ÆÃ±ÛÀÚÄÃ·¯ ÀÔ·Â input
obj.style.backgroundColor = strColor; // Ã¤ÆÃ±ÛÀÚÀÔ·Â input
}

function id_check(id){
	if (id == "") {
		alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
	} else {
		frame_id_check.location.replace('/common/member_id_check.asp?member_id='+id);
	}
}
function URLencode(sStr) {
    return escape(sStr).replace(/\+/g, '%2C').replace(/"/g,'%22');replace(/\'/g, '%27');
}
function login(url){
	url = URLencode(url);
	parent.location.replace('/sub.asp?page=112211&goURL='+url);
}
function open_zipcode(frm, zip, addr){
	MM_openBrWindow('/common/zipcode.asp?frm='+frm+'&zipcode='+zip+'&address='+addr,'zipcode','height=340,width=478');
}
function open_zipcode1(frm, zip, addr, what){
	MM_openBrWindow('/common/zipcode.asp?frm='+frm+'&zipcode='+zip+'&address='+addr+'&what='+what,'zipcode','height=340,width=478');
}
function open_upload(frm,fld,folder){
	MM_openBrWindow('/common/upload.asp?frm='+frm+'&fld='+fld+'&folder='+folder,'upload','height=240,width=478');
}
function open_banner(mc){
	MM_openBrWindow('/common/banner_list.asp?menu_code='+mc,'upload','height=680,width=210');
}
function insert_schedule(sg){
	MM_openBrWindow('/calendar/schedule_insert.asp?schedule_group='+sg,'sg','height=400,width=400');
}
function update_schedule(sc){
	MM_openBrWindow('/calendar/schedule_update.asp?schedule_code='+sc,'sg','height=400,width=400');
}
function delete_schedule(sc){
	MM_openBrWindow('/calendar/schedule_delete.asp?schedule_code='+sc,'sg','height=100,width=100');
}
function openWin2(URL) {
	aWindow = MM_openBrWindow(URL,"hot","width=1000,height=530,toolbar=0,directories=0,menubar=0,status=no,resizable=0,location=0,scrollbars=no,copyhistory=0");
}
function openChild() {
	aWindow = MM_openBrWindow("/sraa/child/index.htm","hot","width=1000,height=530,toolbar=0,directories=0,menubar=0,status=no,resizable=0,location=0,scrollbars=no,copyhistory=0");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/* ÇÁ·¹ÀÓ ¸®»çÀÌÁö °ü·Ã ½ºÅ©¸³Æ® */
var ifrContentsTimer;
function resizeRetry() { //ÀÌ¹ÌÁö°°ÀÌ ·Îµù½Ã°£ÀÌ °É¸®´Â °ÍµéÀÌ ·ÎµùµÈÈÄ ´Ù½Ã ÇÑ¹ø ¸®»çÀÌÁî
	if(document.body.readyState == "complete") {
		clearInterval(ifrContentsTimer);
	}
	else {
		resizeFrame();
	}
}

function resizeFrame() { //ÆäÀÌÁö°¡ ·ÎµùµÇ¸é ¹Ù·Î ¸®»çÀÌÁî.
	var iframeObj = self.parent.document.getElementById("frameMain");
	if(!iframeObj) {
		return;
	}
	iframeObj.style.overflowY = "hidden";
	
	iframeObj.style.height = parseInt(self.document.body.scrollHeight, 10) + "px";
}
/* ÇÁ·¹ÀÓ ¸®»çÀÌÁö °ü·Ã ½ºÅ©¸³Æ® */

/* »õÃ¢À¸·Î ÀÌ¹ÌÁö ¶Ù¿ì±â (2010-07-28)*/
function SFAC_LoadImageViewer(pImageUrl, pImageAlt, pWidth, pHeight) {
	var imageViewerURL = "";
	var imageViewerProperty = "";
	if(!pImageUrl) return;
	if(!pImageAlt) pImageAlt = "ÀÌ¹ÌÁö º¸±â(" + pImageUrl + ")";
	if(!pWidth || pWidth == 0) pWidth = 700;
	if(!pHeight || pHeight == 0) pHeight = 650;

	imageViewerProperty = "";
	imageViewerProperty = "menubar=no";
	if(pWidth) {
		imageViewerProperty += ",width=" + pWidth;
	}
	if(pHeight) {
		imageViewerProperty += ",height=" + pHeight;
	}

	imageViewerProperty += ",scrollbars=yes,resizable=yes";
	
	var wndImageViewer = window.open(imageViewerURL,'WNDHImageViewer',imageViewerProperty);
	wndImageViewer.document.open();
	wndImageViewer.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
	wndImageViewer.document.write('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko"><head>');
	wndImageViewer.document.write('<meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />');
	wndImageViewer.document.write('<meta http-equiv="imagetoolbar" content="no"/>');
	wndImageViewer.document.write('<title>'+ pImageAlt +'</title>');
	wndImageViewer.document.write('</head><body>');
	wndImageViewer.document.write('<img src="'+ pImageUrl +'" alt="'+ pImageAlt +'"/>');
	wndImageViewer.document.write('</body></html>');
	wndImageViewer.document.close();
}