    /*
 * publishing.js
 * @description : ÆÛºí¸®½Ì °ü·Ã ½ºÅ©¸³Æ®
 */

/**
 * UI ¿¬µ¿ ÀÏ¹Ý Function
 */

/**
 * flash write
 */

function flashSet(s,w,h,d,bg,t,f,l){

	var code = "";
    code  = "<object type=\"application/x-shockwave-flash\" ";
    code +=         "data=\""+s+"\" ";
    code +=         "width=\""+w+"\" height=\""+h+"\" id=\""+d+"\">";
    code += "<param name=\"movie\" value=\""+s+"\" />";
    code += "<param name=\"quality\" value=\"high\" />";
    code += "<param name=\"wmode\" value=\""+t+"\" />";
    code += "<param name=\"menu\" value=\"false\" />";
    code += "<param name=\"allowScriptAccess\" value=\"always\" />";
    code += "<param name=\"swliveconnect\" value=\"true\" />";
	code += "<param name='scale' value='"+f+"' />";
	code += "<param name='salign' value='"+l+"' />";
    code += "</object>";

	return code;
}
function flashWrite(s,w,h,d,bg,t,f,l) {
	document.write (flashSet(s,w,h,d,bg,t,f,l));
}


/**
 * syncIframe
 * @Description : Iframe Å©±âÁ¶Àý(iframeÀÇ id °ªÀ» ³Ñ±è)
 * @author gggl.ko
 * @param frameId - ( frameId )
 * @return event
 */
function syncIframe(frameId,wOr) {
    var h;

    h = document.getElementById(frameId).contentWindow.document.body.scrollHeight;

    if (typeof wOr != "undefined") {
        var widthInt;
        widthInt = document.getElementById(frameId).contentWindow.document.body.scrollWidth;
    }

    if (h == 0) {
        //h = document.getElementById(frameId).offsetHeight;
        h = document.getElementById(frameId).scrollHeight;
        w = document.getElementById(frameId).clientWidth;
        //alert("%"+document.getElementById(frameId).clientHeight);
    }

    document.getElementById(frameId).height = h + "px";
    document.getElementById(frameId).width = widthInt+"px";
}


/**
 * Title : showBox
 * @Description : param À¸·Î ³Ñ¾î¿Â µÎ°³ÀÇ °³Ã¼ÀÇ display ¸¦ ±³Ã¼ÇÑ´Ù. ¼¼°³¸é ¼¼°³
 * @author gggl.ko / 2009-03-25
 * @param obj1, obj2, obj3
 * @return void
 */
function showBox (obj1, focusObj) {
    if(document.getElementById(obj1) != undefined) {

        // ´ÜÀÏÀÏ°æ¿ì´Â obj1 ÀÇ display¸¸ º¯°æÇÔ
        if(document.getElementById(obj1).style.display == "none") {
            document.getElementById(obj1).style.display = "block";
        } else {
            document.getElementById(obj1).style.display = "none";
        }

        if (document.getElementById(focusObj) != undefined) {
            document.getElementById(focusObj).focus();
        }
    }
}

/*
 * ¿©·¯ °´Ã¼ÀÇ shwo º¯°æ½Ã
 */
function showBoxs (obj1, obj2, obj3, obj4) {

	// ´ÜÀÏÀÏ°æ¿ì´Â obj1 ÀÇ display¸¸ º¯°æÇÔ
	if (document.getElementById(obj2) == undefined) {
		if(document.getElementById(obj1).style.display == "none") {
			document.getElementById(obj1).style.display = "block";
		} else {
			document.getElementById(obj1).style.display = "none";
		}
	}

	// obj1 ¸¸ display
	try { document.getElementById(obj1).style.display = "block";	 } catch (e) {}
	try { document.getElementById(obj2).style.display = "none"; } catch (e) {}
	try { document.getElementById(obj3).style.display = "none"; } catch (e) {}
	try { document.getElementById(obj4).style.display = "none"; } catch (e) {}
}

// show hide
function showLy(id){
    var bx = document.getElementById(id);
    if (bx.style.display == 'block')
        {
            bx.style.display='none';
        }
    else
        {
            bx.style.display='block';
        }
}



/**
 * @Title : selectbox Á÷Á¢ÀÔ·ÂµîÀÇ ÆíÀÇ¸¦ À§ÇÑ ÇÔ¼ö
 * @Description :
 * @Create : 2010-05-25 / gggl.ko
 * @param : trueFalse ´Â °´Ã¼¸¦ ³Ñ±æ¼öµµ ÀÖ´Ù. °´Ã¼·Î ³Ñ¾î¿Ã¶§´Â ºó°ªÀÇ °ËÁõÀÓ
 *
 */
function showBoxEx(obj1, trueFalse, val) {

    var objFalg = false;

    if (typeof trueFalse == "object") {
        var obj = trueFalse;
        trueFalse = obj.value == "";
        objFalg = true;
    }

    if (trueFalse == true) {
        obj1.style.display="";
        obj1.value = "";
        obj1.focus();
    } else {
        obj1.style.display="none";

        if (objFalg == true && val != undefined) {

            if(val == "{t}") {
                obj1.value = obj[obj.selectedIndex].text;
            } else if(val == "{v}") {
                obj1.value = obj[obj.selectedIndex].value;
            } else {
                obj1.value = val;
            }
        }
    }
}


var GB_frame;
var GB_div;
window.openEx = function(arg0,arg1,arg2,arg3) {

    var url, wname, wid, hei, ifrmpadding, hs;
    url = arguments[0];
    wname = arguments[1];
    wid = arguments[2];
    hei = arguments[3];

    if (arguments.length == 4) {
        wname = arg1;
        wid = arg2;
        hei = arg3;
    } else if (arguments.length == 3) {
        wname = "shadowIfram";
        wid = arg1;
        hei = arg2;
    }

    if (arguments.length < 3) {
        wname = arg1;
        wid = Math.ceil(document.documentElement.clientWidth*0.8);
        hei = Math.ceil(document.documentElement.clientHeight*0.8);;
    }
    
    // Ã¢ ³ÐÀÌ ³ôÀÌ¿¡ µû¶ó Ãâ·ÂÆäÀÌÁöµµ Á¶Á¤
    if (document.documentElement.clientHeight < hei) {
        hei = document.documentElement.clientHeight;
    }

    if (document.documentElement.clientWidth < wid) {
        wid = document.documentElement.clientWidth;
    }

    var pt = document.documentElement.scrollTop;

    // //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    document.getElementsByTagName('HTML')[0].style.overflow = "hidden";

    GB_div = document.createElement("div");
    GB_div.setAttribute("name","shadowLayer");
    GB_div.setAttribute("id","shadowLayer");
    GB_div.onclick = function () {
        window.closeEx();
    }
    with (GB_div.style) {
        //backgroundColor = "red";
        zIndex        = "995";
        top           = "0px";        // º¸¿©Áö´Â È­¸é¿¡¼­ ¶³¾îÁö´Â ³ôÀÌ
        borderWidth   = "0px";
        position      = "absolute";
        textAlign     = "center";
        display       = "none";
        top           = "0";
        left	      = "0";

        width       = "100%";
        height      = document.documentElement.clientHeight + pt + "px";
        //height      = "100%";
        //width	    = document.body.scrollWidth + "px";
        //height	    = document.documentElement.scrollHeight + "px";

        background  = "#000000";
        filter	    = "alpha(opacity=70";
        opacity	    = 0.2;
        display	    = "block";
    }

    document.body.appendChild(GB_div);

    // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    if (hei < document.documentElement.clientHeight) {
        var c = document.documentElement.clientHeight-hei;
        c = Math.ceil(c/2);
        pt = c+pt; // È­¸é ³ôÀÌ¿¡¼­ Ãâ·ÂÃ¢ ³ôÀÌ¸¦ »« ±× ¹ÝÀ» ¶³¾îÁö´Â ³ôÀÌ·ÎÇÔ
    }

    //document.documentElement.clientWidth;   // ½Ç display width
    //document.documentElement.clientHeight;  // ½Ç display height
    //document.documentElement.scrollTop;     // ½ºÅ©·Ñ·Î ³»¸° ³ôÀÌ
    //document.body.clientWidth +'//'+document.body.clientHeight +'//'+ // not IE
    //document.body.scrollTop +'//');
    var pl = document.documentElement.scrollLeft;
    if (wid < document.documentElement.clientWidth) {
        var c = document.documentElement.clientWidth-wid;
        c = Math.ceil(c/2);
        pl = c+pl; // È­¸é ³ôÀÌ¿¡¼­ Ãâ·ÂÃ¢ ³ôÀÌ¸¦ »« ±× ¹ÝÀ» ¶³¾îÁö´Â ³ôÀÌ·ÎÇÔ
    }

                                                                        /*
                                                                         * ¸¸¾à »ó´ÜÀÇ ´Ý±â ¹öÆ°ÀÌ ÀÖ´Ù¸é, ¾Æ·¡ÀÇ div ¸¦ ¿î¿ëÇÏ¿©,
                                                                         * ¾ÆÀÌÇÁ·¹ÀÓÀ» inDiv.appendChild(GB_frame); ½ÄÀ¸·Î ¼­ºê·Î µÎÀÚ.
                                                                         */
                                                                        //var st = document.documentElement.scrollTop;
                                                                        //var ch = document.documentElement.clientHeight;

                                                                        //var inDiv = document.createElement("div");
                                                                        //inDiv.setAttribute("id","innerLayer");
                                                                        //inDiv.setAttribute("name","innerLayer");
                                                                        //inDiv.setAttribute("scrolling","no");
                                                                        //with (inDiv.style) {
                                                                            //textAlign   = "center";
                                                                            //position    = "absolute";
                                                                            //width	    = "100%";
                                                                            //height	    = "100%";
                                                                            //top = "0";
                                                                            //width = "0";
                                                                            //zIndex      = "996";
                                                                            //backgroundColor       = "red";
                                                                        //}
                                                                        //document.body.appendChild(inDiv);

    //// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    GB_frame = document.createElement("iframe");
    GB_frame.setAttribute("src",url);
    GB_frame.setAttribute("scrolling","auto");
    GB_frame.setAttribute("id",wname);
    GB_frame.setAttribute("name",wname);
    GB_frame.setAttribute("frameborder","0");
    GB_frame.setAttribute("marginwidth","0");
    GB_frame.setAttribute("marginheight","0");
    GB_frame.setAttribute("align","middle");
    GB_frame.setAttribute("vspace",0);
    GB_frame.setAttribute("hspace",0);
    GB_frame.setAttribute("height",hei+"px");
    GB_frame.setAttribute("width",wid+"px");
    //GB_frame.setAttribute("allowtransparency","true");

    with (GB_frame.style) {
        zIndex = "996";
        border = "0px solid #fff";
        padding = "0px;"
        position  = "absolute";
        top = pt+"px";
        left = pl+"px";
    }

    //GB_frame.onload = function () { syncIframe(this.id,true); }
    //GB_div.appendChild(GB_frame);
    document.body.appendChild(GB_frame);
    return false;
}

window.closeEx = function() {

    GB_div.style.display="none";
    GB_frame.style.display="none";
    GB_frame.src="about:blank";
    
    // °´Ã¼ ¼Ò¸êÇØ¹ö·Á!!! ÄíÄô!
    GB_div.parentNode.removeChild(GB_div);
    GB_frame.parentNode.removeChild(GB_frame);

    document.getElementsByTagName('HTML')[0].style.overflow = "auto";
    //document.getElementsByTagName('HTML')[0].style.overflow = "auto";
}
