/**********************************************************************/
/* ÇÃ·¡½Ã ½ºÅ©¸³Æ® ****************************************************/
/**********************************************************************/

function playflash(file,width,height,bgcolor,quality,name){
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'" id="'+name+'">');  //ÇÃ·¡½¬ÇÃ·¹ÀÌ¾î ¹öÀüÀÌ ÀÌÀü¹öÀüÀÏ°æ¿ì ¹öÀü 8À» º¯°æ
        document.write('<param name="movie" value="'+file+'" />');
        document.write('<param name="quality" value="'+quality+'" />');
        document.write('<param name="wmode" value="transparent" />');  //Åõ¸íÇÃ·¡½¬°¡ ¾Æ´Ò°æ¿ì ÀÌ ¶óÀÎÀ» »èÁ¦
        document.write('<param name="bgcolor" value="'+bgcolor+'" />');
        document.write('<embed src="'+file+'" quality="'+quality+'"bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="'+name+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
        document.write('</object>')
}

/**********************************************************************/
/* Å¾¸Å´º ´­¸£¸é ºÎµå·´°Ô ÃÖ»ó´ÜÀ¸·Î ¿Ã¶ó°©´Ï´Ù. **********************/
/**********************************************************************/

function scroll(x, y){
	document.body.scrollTop=x
	document.body.scrollLeft=y
}


function back_top(){
	y = document.body.scrollLeft;
	x = document.body.scrollTop;
	step = 1;  // ¼ýÀÚ°¡ Å¬¼ö·Ï...ºü¸§
	//alert(x)
	while ((x != 0) || (y != 0)) {
		scroll (x, y);
		x -= step;
		y -= step;
		if (x < 0) x = 0;
		if (y < 0) y = 0;
	} 
	scroll (0, 0);
}

/**********************************************************************/
/* ÅÇ°Ô½ÃÆÇ ½ºÅ©¸³Æ®ÀÔ´Ï´Ù. *******************************************/
/**********************************************************************/

function BlockMenu() {
	document.all.menu_01.style.display = "none"
	document.all.menu_02.style.display = "none"
}

function toggleMenu(currMenu) {
	BlockMenu();
	thiMenu = eval("document.all." + currMenu + ".style");
	thiMenu.display = "block"
}

/**********************************************************************/
/* ·Î±×ÀÎ ÀÎÇ²¹Ú½º ½ºÅ©¸³Æ® ÀÔ´Ï´Ù.  **********************************/
/**********************************************************************/

function inputFocus(frm,img){
	if(frm.value==''){
		frm.style.backgroundColor=img
		frm.style.backgroundImage='none'
	}
}

function inputBlur(frm,img){
	if(frm.value==''){
		frm.style.backgroundImage='url('+img+')'
	}
}

/**********************************************************************/
/* Äü¸Å´º ½ºÅ©¸³Æ® ****************************************************/
/**********************************************************************/

var stmnLEFT = 944; // ½ºÅ©·Ñ¸Þ´ºÀÇ ÁÂÃø À§Ä¡ 
var stmnGAP1 = 364; // ÆäÀÌÁö Çì´õºÎºÐÀÇ ¿©¹é 
var stmnGAP2 = 150; // ½ºÅ©·Ñ½Ã ºê¶ó¿ìÀú »ó´Ü°ú ¾à°£ ¶ç¿ò. ÇÊ¿ä¾øÀ¸¸é 0À¸·Î ¼¼ÆÃ 
var stmnBASE = 270; // ½ºÅ©·Ñ¸Þ´º ÃÊ±â ½ÃÀÛÀ§Ä¡ (¾Æ¹«·¸°Ô³ª ÇØµµ »ó°üÀº ¾øÁö¸¸ stmnGAP1°ú ¾à°£ Â÷ÀÌ¸¦ ÁÖ´Â°Ô º¸±â ÁÁÀ½) 
var stmnActivateSpeed = 100; // ¿òÁ÷ÀÓÀ» °¨ÁöÇÏ´Â ¼Óµµ (¼ýÀÚ°¡ Å¬¼ö·Ï ´Ê°Ô ¾Ë¾ÆÂ÷¸²) 
var stmnScrollSpeed = 10; // ½ºÅ©·ÑµÇ´Â ¼Óµµ (Å¬¼ö·Ï ´Ê°Ô ¿òÁ÷ÀÓ) 

var stmnTimer; 

function ReadCookie(name) { 
var label = name + "="; 
var labelLen = label.length; 
var cLen = document.cookie.length; 
var i = 0; 

while (i < cLen) { 
        var j = i + labelLen; 

        if (document.cookie.substring(i, j) == label) { 
                var cEnd = document.cookie.indexOf(";", j); 
                if (cEnd == -1) cEnd = document.cookie.length; 
                return unescape(document.cookie.substring(j, cEnd)); 
        } 
                i++; 
    } 
  return ""; 
} 

function SaveCookie(name, value, expire) { 
var eDate = new Date(); 
eDate.setDate(eDate.getDate() + expire); 
document.cookie = name + "=" + value + "; expires=" +  eDate.toGMTString()+ "; path=/"; 
} 

function RefreshStaticMenu() 
        { 
                var stmnStartPoint, stmnEndPoint, stmnRefreshTimer; 

                stmnStartPoint = parseInt(STATICMENU.style.top, 10); 

                                         
                                         stmnEndPoint = document.body.scrollTop + stmnGAP2; 

                        stmnLimit = parseInt(window.document.body.scrollHeight) - parseInt(STATICMENU.offsetHeight); 
                        if (stmnEndPoint > stmnLimit) stmnEndPoint = stmnLimit; 
                                         
                                         if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1; 

                stmnRefreshTimer = stmnActivateSpeed; 

                if ( stmnStartPoint != stmnEndPoint ) { 
                        stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 ); 
                        STATICMENU.style.top = parseInt(STATICMENU.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount ); 
                        stmnRefreshTimer = stmnScrollSpeed; 
                } 

                stmnTimer = setTimeout ("RefreshStaticMenu();", stmnRefreshTimer); 
        } 

function ToggleAnimate() { 
var Animate
        if (!ANIMATE.checked) { 
                RefreshStaticMenu(); 
                SaveCookie("ANIMATE", "true", 300); 
                } else { 
                clearTimeout(stmnTimer); 
                STATICMENU.style.top = stmnGAP1; 
                SaveCookie("ANIMATE", "false", 300); 
        } 
} 


function InitializeStaticMenu() { 
var Animate
STATICMENU.style.left = stmnLEFT; 
        if (ReadCookie("ANIMATE") == "false") { 
               // ANIMATE.checked = true; 
                STATICMENU.style.top = document.body.scrollTop + stmnGAP1; 
                } else { 
               // ANIMATE.checked = false; 
                STATICMENU.style.top = document.body.scrollTop + stmnBASE; 
                RefreshStaticMenu(); 
        } 
}  

/**********************************************************************/
/* ÆË¾÷Ã¢ ¸®»çÀÌÁî ½ºÅ©¸³Æ® *******************************************/
/**********************************************************************/

function resizeWin(maxX,maxY,speed,delay,win){
    this.obj = "resizeWin" + (resizeWin.count++);
    eval(this.obj + "=this");
    if (!win)     this.win = self;    else this.win = eval(win);
    if (!maxX)    this.maxX = 400;    else this.maxX = maxX;
    if (!maxY)    this.maxY = 300;    else this.maxY = maxY;
    if (!speed)   this.speed = 1/3;   else this.speed = 1/speed;
    if (!delay)   this.delay = 0;    else this.delay = delay;
    this.doResize = (document.all || document.getElementById);
    this.stayCentered = false;
    
    this.initWin =     function(){
        if (this.doResize){
            this.resizeMe();
            }
        else {
            this.win.resizeTo(this.maxX + 10, this.maxY - 20);
            }
        }

    this.resizeMe = function(){
        this.win.focus();
        this.updateMe();
        }
    
    this.resizeTo = function(x,y){
        this.maxX = x;
        this.maxY = y;
        this.resizeMe();
        }
        
    this.stayCentered = function(){
        this.stayCentered = true;
        }

    this.updateMe = function(){
        this.resizing = true;
        var x = Math.ceil((this.maxX - this.getX()) * this.speed);
        var y = Math.ceil((this.maxY - this.getY()) * this.speed);
        if (x == 0 && this.getX() != this.maxX) {
            if (this.getX() > this.maxX) x = -1;
            else  x = 1;
            }
        if (y == 0 && this.getY() != this.maxY){
            if (this.getY() > this.maxY) y = -1;
            else y = 1;
            }
        if (x == 0 && y == 0) {
            this.resizing = false;
            }
        else {
            this.win.top.resizeBy(parseInt(x),parseInt(y));
            if (this.stayCentered == true) this.win.moveTo((screen.width - this.getX()) / 2,(screen.height - this.getY()) / 2);
            setTimeout(this.obj + '.updateMe()',this.delay)
            }
        }
        
    this.write =  function(text){
        if (document.all && this.win.document.all["coords"]) this.win.document.all["coords"].innerHTML = text;
        else if (document.getElementById && this.win.document.getElementById("coords")) this.win.document.getElementById("coords").innerHTML = text;
        }
        
    this.getX =  function(){
        if (document.all) return (this.win.top.document.body.clientWidth + 10)
        else if (document.getElementById)
            return this.win.top.outerWidth;
        else return this.win.top.outerWidth - 12;
    }
    
    this.getY = function(){
        if (document.all) return (this.win.top.document.body.clientHeight + 29)
        else if (document.getElementById)
            return this.win.top.outerHeight;
        else return this.win.top.outerHeight - 31; 
    }
    
    this.onResize =  function(){
        if (this.doResize){
            if (!this.resizing) this.resizeMe();
            }
        }

    return this;
}
resizeWin.count = 0;

/* ½ºÅ©¸³Æ® ³¡ Ãß°¡ µÇ´Â°Å ÀÖÀ½ Ãß°¡ÇÏ½Ã°í¿ä..^^ */
function JS_viewObj(source,w,h,qual,flavar) { 
	document.write('<embed src="'+ source + flavar +'" quality="' + qual + '" pluginspage=http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+  w +'" height="' + h + '" wmode="transparent"></embed>');
//document.write(objhtml); 
} 

function JS_WRITE(source) { 
	document.write(source);
} 

function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {    
    output += match[1];
      x += match[1].length;
    } else {
   if (clearString[x] == ' ')
        output += '+';
      else {
  tmpEncodeV = chgEncode(clearString.substr(x))

  if(tmpEncodeV.length == 4){
   EncodeV = "%"+tmpEncodeV.substring(0,2)+"%"+tmpEncodeV.substring(2,4)
  }else{
   EncodeV = "%"+tmpEncodeV
  }
  output += EncodeV
      }
      x++;
    }
  }
  return output;
}

/**********************************************************************/
/* Select Box Design Script  ÀÌ°÷¿¡¼­ ¼¿·ºÆ®¹Ú½º Á¶ÀýÇÕ´Ï´Ù. **********/
/**********************************************************************/

var nowOpenedSelectBox = "";
var mousePosition = "";

function selectThisValue(thisId,thisIndex,thisValue,thisString) {
	var objId = thisId;
	var nowIndex = thisIndex;
	var valueString = thisString;
	var sourceObj = document.getElementById(objId);
	var nowSelectedValue = document.getElementById(objId+"SelectBoxOptionValue"+nowIndex).value;
	hideOptionLayer(objId);
	if (sourceObj) sourceObj.value = nowSelectedValue;
	settingValue(objId,valueString);
	selectBoxFocus(objId);
	if (sourceObj.onchange) sourceObj.onchange();
}

function settingValue(thisId,thisString) {
	var objId = thisId;
	var valueString = thisString;
	var selectedArea = document.getElementById(objId+"selectBoxSelectedValue");
	if (selectedArea) selectedArea.innerText = valueString;
}

function viewOptionLayer(thisId) {
	var objId = thisId;
	var optionLayer = document.getElementById(objId+"selectBoxOptionLayer");
	if (optionLayer) optionLayer.style.display = "";
	nowOpenedSelectBox = objId;
	setMousePosition("inBox");
}

function hideOptionLayer(thisId) {
	var objId = thisId;
	var optionLayer = document.getElementById(objId+"selectBoxOptionLayer");
	if (optionLayer) optionLayer.style.display = "none";
}

function setMousePosition(thisValue) {
	var positionValue = thisValue;
	mousePosition = positionValue;
}

function clickMouse() {
	if (mousePosition == "out") hideOptionLayer(nowOpenedSelectBox);
}

function selectBoxFocus(thisId) {
	var objId = thisId;
	var obj = document.getElementById(objId + "selectBoxSelectedValue");
	obj.className = "selectBoxSelectedAreaFocus";
	obj.focus();
}

function selectBoxBlur(thisId) {
	var objId = thisId;
	var obj = document.getElementById(objId + "selectBoxSelectedValue");
	obj.className = "selectBoxSelectedArea";
}

function makeSelectBox(thisId) {
	var downArrowSrc = "/~catering/_DESIGN/_version1/img/select_arrow.gif";	//¿À¸¥ÂÊ È­»ìÇ¥ÀÌ¹ÌÁö
	var downArrowSrcWidth = 18;	//¿À¸¥ÂÊ È­»ìÇ¥ÀÌ¹ÌÁö width
	var optionHeight = 20; // option ÇÏ³ªÀÇ ³ôÀÌ
	var optionMaxNum = 10; // ÇÑ¹ø¿¡ º¸¿©Áö´Â optionÀÇ °¹¼ö
	var optionInnerLayerHeight = "";
	var objId = thisId;
	var obj = document.getElementById(objId);
	var selectBoxWidth = parseInt(obj.style.width);
	var selectBoxHeight = parseInt(obj.style.height);
	if (obj.options.length > optionMaxNum) optionInnerLayerHeight = "height:"+ (optionHeight * optionMaxNum) + "px";
	newSelect  = "<table id='" + objId + "selectBoxOptionLayer' cellpadding='0' cellspacing='0' border='0' style='position:absolute;z-index:100;display:none;' onMouseOver=\"viewOptionLayer('"+ objId + "')\" onMouseOut=\"setMousePosition('out')\">";
	newSelect += "	<tr>";
	newSelect += "		<td height='" + selectBoxHeight + "' style='cursor:hand;' onClick=\"hideOptionLayer('"+ objId + "')\"></td>";
	newSelect += "	</tr>";
	newSelect += "	<tr>";
	newSelect += "		<td height='1'></td>";
	newSelect += "	</tr>";
	newSelect += "	<tr>";
	newSelect += "		<td bgcolor='#cccccc' style='padding:1px'>";
	newSelect += "		<div class='selectBoxOptionInnerLayer' style='width:" + (selectBoxWidth-2) + "px;" + optionInnerLayerHeight + "'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%' style='table-layout:fixed;word-break:break-all;'>";
	for (var i=0 ; i < obj.options.length ; i++) {
		var nowValue = obj.options[i].value;
		var nowText = obj.options[i].text;
		newSelect += "			<tr>";
		newSelect += "				<td height='" + optionHeight + "' class='selectBoxOption' onMouseOver=\"this.className='selectBoxOptionOver'\" onMouseOut=\"this.className='selectBoxOption'\" onClick=\"selectThisValue('"+ objId + "'," + i + ",'" + nowValue + "','" + nowText + "')\" style='cursor:hand;'>" + nowText + "</td>";
		newSelect += "				<input type='hidden' id='"+ objId + "SelectBoxOptionValue" + i + "' value='" + nowValue + "'>";
		newSelect += "			</tr>";
	}
	newSelect += "		</table>";
	newSelect += "		</div>";
	newSelect += "		</td>";
	newSelect += "	</tr>";
	newSelect += "</table>";
	newSelect += "<table cellpadding='0' cellspacing='1' border='0' bgcolor='#cccccc' onClick=\"viewOptionLayer('"+ objId + "')\" style='cursor:hand;'>";
	newSelect += "	<tr>";
	newSelect += "		<td style='padding-right:1px;padding-left:1px' bgcolor='#FFFFFF'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0'>";
	newSelect += "			<tr>";
	newSelect += "				<td><div id='" + objId + "selectBoxSelectedValue' class='selectBoxSelectedArea' style='width:" + (selectBoxWidth - downArrowSrcWidth - 4) + "px;height:" + (selectBoxHeight - 5) + "px;overflow:hidden;' onBlur=\"selectBoxBlur('" + objId + "')\"></div></td>";
	newSelect += "				<td><img src='" + downArrowSrc + "' width='" + downArrowSrcWidth + "' border='0'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		</td>";
	newSelect += "	</tr>";
	newSelect += "</table>";
	document.write(newSelect);
	
	var haveSelectedValue = false;
	for (var i=0 ; i < obj.options.length ; i++) {
		if (obj.options[i].selected == true) {
			haveSelectedValue = true;
			settingValue(objId,obj.options[i].text);
		}
	}
	if (!haveSelectedValue) settingValue(objId,obj.options[0].text);
}

document.onmousedown = clickMouse;


function formCheck(f)
{
	var fu = new FormUtil(f);
	
	if(!fu.success())
	{
		return false;
	}

}



/* ÇÃ·¡½Ã ÀÚ¹Ù½ºÅ©Æ® */
function flash_load8(argSRC,argWIDTH,argHEIGHT,argBGCOLOR,argVar,argID,argName,argWMODE){
var strTEMP;
strTEMP ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ' ;
if(argID)
strTEMP = strTEMP + ' ID="' + argID + '" ' ;//ID
strTEMP = strTEMP + ' width="'+ argWIDTH + '" height="' + argHEIGHT + '">';//°¡·Î¼¼·Î °ª//
strTEMP = strTEMP + '<param name="allowScriptAccess" value="always" />';//Åë½Å¹æ¹ý//
strTEMP = strTEMP + '<param name="movie" value="' + argSRC + '">';//°æ·Î//
strTEMP = strTEMP + '<param name="FlashVars" value="'+argVar+'" />';//ÆäÀÌÁö ÀÎ½Ä//
strTEMP = strTEMP + '<param name="bgcolor" value="'+argBGCOLOR+'" />';//ÇÃ·¡½Ã ¹è°æ»ö°¥//
strTEMP = strTEMP + '<param name="quality" value="high" />';//ÇÃ·¡½Ã Ä÷¸®Æ¼//
strTEMP = strTEMP + '<param name="memu" value="false" />';//ÀÌ¸§°ª//
if(argWMODE)
strTEMP = strTEMP + '<param name="wmode" value="' + argWMODE + '">';
else
strTEMP = strTEMP + '<param name="wmode" value="transparent">';
strTEMP = strTEMP + '<embed src="'+ argSRC +'" FlashVars="'+ argVar +'" ';
if (argWMODE)
strTEMP = strTEMP + 'wmode="'+ argWMODE +'" ';
else
strTEMP = strTEMP + 'wmode="transparent" ';
strTEMP = strTEMP + 'menu="false" quality="high" bgcolor="'+ argBGCOLOR +'" width="'+ argWIDTH +'" height="'+ argHEIGHT +'" name="'+ argID +'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
strTEMP = strTEMP + '</object>';
document.write(strTEMP);
}
/* »ç¿ë¹ý<script>flash_load8('Index.swf','100%','100%','#ffffff','','','','transparent')</script>
°æ·Î,°¡·Î,¼¼·Î,bgÄÃ·¯,ÇÃ·¡½Ã¹Ù,"¾ÆÀÌµð",ÀÌ¸§,Åõ¸í¸ðµå¼³Á¤//wmode --> none, transparent, opaque */
/* //ÇÃ·¡½Ã ÀÚ¹Ù½ºÅ©Æ® */




function resize( $id, $prop, $pixel ){
 var obj = document.getElementById( $id );
 obj.style[$prop] = $pixel + "px";
}


function bookmark(){
window.external.AddFavorite('http://www.trueballer.com', 'Æ®·çº¼·¯')
}

function loading_st(design_home){ 
    var ct_left = (parseInt(window.screen.width)-900)/2; 
    var ct_top = (parseInt(window.screen.height))/3; 
    layer_str = "<div id='loading_layer' style='position:absolute; background-color:; font-size:12px; left:"+ct_left+"px; top:"+ct_top+"px; width:800px; height:; padding:50px; text-align:center; vertical-align:middle; z-index:1000; font-weight: bold;'><img src='"+design_home+"/img/common/loadinglogo.gif'></div>" 
	document.write(layer_str); 
} 
function loading_ed(){ 
    var ta =document.getElementById('loading_layer'); 
    ta.style.display='none'; 
} 
