//<![CDATA[

//  ===============================================================================================
//  Site Name	    : ÄÜÅÙÃ÷°ü¸®ÀÚ ÆäÀÌÁö
//  Description		: »çÀÌÆ® Àü¹ÝÀûÀÎ ½ºÅ©¸³Æ®
//	Author			: Program By innos (±èÀÎÈ£ )
//  Date			: 2007/07
//  Company			: (ÁÖ)°¡¹ÎÁ¤º¸½Ã½ºÅÛ http://www.comin.com
//  ===============================================================================================

/*********************************************************************
*	Full Screen
*********************************************************************/
function fullwin(targeturl){
window.open(targeturl,"","fullscreen,scrollbars")
}

/*********************************************************************
*	ModalDialog Window
*********************************************************************/

bver=navigator.appVersion.split(";");
function openM_window(){
if(bver[1].match("5."))
window.showModalDialog("enterFrame.php",null,"dialogWidth:300px;dialogHeight:330px;center:1;scroll:0;help:0;status:0");
else
window.showModalDialog("enterFrame.php",null,"dialogWidth:300px;dialogHeight:350px;center:1;scroll:0;help:0;status:0");
}

/*********************************************************************
*	¿ÀÇÂÀ©µµ¿ì 
*	win_open(width,height) : ¸®»çÀÌÁî (½ÇÁ¦³»¿ë¹°ÀÇ Æø + 10, ³ôÀÌ +29 ¸¦ ÇßÀ» ¶§ ³»¿ë¹°ÀÌ Ã¢Å©±â¿¡ ¸Â°Ô ³ªÅ¸³².)
*	openWindow(theURL,theName,theWidth,theHeight,theScroll) : Åø¹Ù ¾È³ª¿À´Â »õÃ¢
*********************************************************************/

function win_open(width,height) {
	restage = new resizeWin(width,height);
	restage.stayCentered();
	restage.onResize()
} 

function openWindow(theURL,theName,theWidth,theHeight,theScroll) { 
	window.open(theURL, theName,'width='+theWidth+',height='+theHeight+',marginwidth=0,marginheight=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+theScroll+',resizable=no');
}

// popup
function openPopup(theURL,theName,theTop,theLeft,theWidth,theHeight,theScroll) { 
	window.open(theURL, theName,'top='+theTop+',left='+theLeft+',width='+theWidth+',height='+theHeight+',marginwidth=0,marginheight=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+theScroll+',resizable=no');
}

/*********************************************************************
*	ÄíÅ°°ü·Ã 
*********************************************************************/
// SETCOOKIE
function setCookie(name,value,expiredays) {
	var todayDate = new Date();
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

// GETCOOKIE
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 AutoResize(img) { 
	foto1= new Image(); 
	foto1.src=(img); 
	Controlla(img); 
} 

function Controlla(img) { 
	if((foto1.width!=0)&&(foto1.height!=0)){ 
		viewFoto(img); 
	} else{ 
		funzione="Controlla('"+img+"')"; 
		intervallo=setTimeout(funzione,20); 
	} 
} 

function viewFoto(img) { 
	largh=foto1.width; 
	altez=foto1.height; 
	stringa="width="+largh+",height="+altez; 
	WinOpen(img, stringa);
	// finestra=window.open(img,"",stringa); 
} 

function WinOpen(img, stringa) {
	var WinOpen1;
	WinOpen1 = window.open("","",stringa);
	WinOpen1.document.open();
	WinOpen1.document.write("<HTML><HEAD><TITLE>:: ÀÌ¹ÌÁöºä ::</TITLE></HEAD>");
	WinOpen1.document.write("<BODY topmargin=0 leftmargin=0>");
	WinOpen1.document.write("<a href='javascript:window.close()'><IMG SRC='"+escape(img)+"' border=0 alt='Ã¢´Ý±â' onfocus='this.blur()' GALLERYIMG='no' /></a>");
	WinOpen1.document.write("</BODY></HTML>");
	WinOpen1.document.close();
}  


/*********************************************************************
*	¸Þ´º·Ñ¿À¹ö ±â´É(µå¸²À§¹öÁ¦°ø)
*********************************************************************/ 
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

/*********************************************************************
*	onfocus="this.blur();" È¿°ú ÁÖ±â
*********************************************************************/  
function autoBlur(){ 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 
		document.body.focus(); 
	} 
document.onfocusin=autoBlur; 

// ¸Þ´º
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Á¡ÇÁ¸Þ´º
function goto_byselect(sel, targetstr) {
	var index = sel.selectedIndex;
	if (sel.options[index].value != '') {
	if (targetstr == 'blank') {
		window.open(sel.options[index].value, 'win1');
	} else {
		var frameobj;
		if (targetstr == '') targetstr = 'self';
		if ((frameobj = eval(targetstr)) != null)
			frameobj.location = sel.options[index].value;
		}
	}
}

/***********************************************************************************************
*	¼­ºêÆäÀÌÁö ÁÂÃø ½½¶óÀÌµù ¸Þ´º
***********************************************************************************************/
function slide(Id, interval, to) {
	var level = Id.length;
    var obj = document.getElementById(Id);
    var H, step = 30; // ÆîÄ§¸Þ´º ¼Óµµ Á¦¾î

    if (obj == null) return;
    if (to == undefined) { // user clicking
        if (obj._slideStart == true) return;
        if (obj._expand == true) {
            to = 0;
            obj.style.overflow = "hidden";
        } else {
            slide.addId(Id);
			for(var i=0; i < slide.objects.length; i++) {
				if (slide.objects[i].id != Id && slide.objects[i]._expand == true) {
					slide(slide.objects[i].id);
				}
			}
            obj.style.height = "";
            obj.style.overflow = "";
            obj.style.display = "block";
            to = obj.offsetHeight; 
            obj.style.overflow = "hidden";
            obj.style.height = "1px";
        }
        obj._slideStart = true;
    }
    
    step             = ((to > 0) ? 1:-1) * step;
    interval         = ((interval==undefined)?1:interval);

    obj.style.height = (H=((H=(isNaN(H=parseInt(obj.style.height))?0:H))+step<0)?0:H+step)+"px";
    
    
    if (H <= 0) {
		obj.style.display = "none";
		obj.style.overflow = "hidden";
		obj._expand = false;
		obj._slideStart = false;
    } else if (to > 0 && H >= to) {
		obj.style.display = "block";
		obj.style.overflow = "visible";
		obj.style.height = H + "px";
		obj._expand = true;
		obj._slideStart = false;
    } else {
        setTimeout("slide('"+Id+"' , "+interval+", "+to+");", interval);
    }
}
slide.objects = new Array();
slide.addId = function(Id)
{
    for (var i=0; i < slide.objects.length; i++) {
       if (slide.objects[i].id == Id) return true;
    }
    slide.objects[slide.objects.length] = document.getElementById(Id);
}

/***********************************************************************************************
*	»ó´Ü¸Þ´ºÀÇ ¾ËÆÄ¿À¹ö
***********************************************************************************************/
function trans(id,after) { 
eval(id+'.filters.blendTrans.stop();'); 
eval(id+'.filters.blendTrans.Apply();'); 
eval(id+'.src="'+after+'";'); 
eval(id+'.filters.blendTrans.Play();'); 
} 

function Find_Obj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=Find_Obj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

/*********************************************************************
*	¸Þ´º È¿°ú
*********************************************************************/

function FX1px() {
	var el = event.srcElement;
	while(el.tagName != "TD")
		el = el.parentElement;
	el.style.paddingTop = "1px";
}


function DeFX1px() {
	var el = event.srcElement;
	while(el.tagName != "TD")
		el = el.parentElement;
	el.style.paddingTop = "0px";
}

/*********************************************************************
*	³»¿ë¿¡ µû¶ó ´Ã¾î³ª´Â ¾ÆÀÌÇÁ·¹ÀÓ
*********************************************************************/

var ifr= parent.document.all? parent.document.all.iframe_main : parent.document.getElementById("iframe_main") ;

function do_resize() {
	resizeFrame(1);
}

//°¡·Î±æÀÌ´Â À¯µ¿ÀûÀÎ °æ¿ì°¡ µå¹°±â ¶§¹®¿¡ ÁÖ¼®Ã³¸®!
function resizeFrame(re) {
	if (ifr) { 
		var innerHeight = document.body.scrollHeight + (document.body.offsetHeight - document.body.clientHeight);
		//var innerWidth = document.body.scrollWidth + (document.body.offsetWidth - document.body.clientWidth);

		if (ifr.style.height != innerHeight) //ÁÖ¼®Á¦°Å½Ã ´ÙÀ½ ±¸¹®À¸·Î ±³Ã¼ -> if (ifr.style.height != innerHeight || ifr.style.width != innerWidth)
		{
			ifr.style.height = innerHeight;
			//ifr.style.width = innerWidth;
		}
		if(!re) {
			try{
				document.body.attachEvent('onclick',do_resize);
				//document.body.attachEvent('onkeyup',do_resize);
				//±ÛÀÛ¼º »óÈ²¿¡¼­ Å¬¸¯¾øÀÌ Å¸ÀÌÇÎÇÏ¸é¼­ Ã¢ÀÌ ´Ã¾î³ª´Â »óÈ²ÀÌ¸é À­ÁÙ ÁÖ¼®Á¦°Å
			} catch(e) {
				document.body.addEventListener("click", do_resize, false);
				//document.body.addEventListener("keyup", do_resize, false);
				//±ÛÀÛ¼º »óÈ²¿¡¼­ Å¬¸¯¾øÀÌ Å¸ÀÌÇÎÇÏ¸é¼­ Ã¢ÀÌ ´Ã¾î³ª´Â »óÈ²ÀÌ¸é À­ÁÙ ÁÖ¼®Á¦°Å
			}
		}
	}
}

/*********************************************************************
*	°Ô½ÃÆÇ ºä ÇÁ¸°Æ® ½ºÅ©¸³Æ®
*********************************************************************/ 

function print_out(){

	PrintWindow  =  window.open('', '', 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=750, height=500'); 

	printBoxHTML   = "<html><head><title>Print Page</title>\n";
	printBoxHTML  += "<link href=\"/cnc/inc/Default.css\" rel=\"stylesheet\" type=\"text/css\">\n</head>\n<body>\n";
//	printBoxHTML  += "<"+"script type=\"text/javascript\">\n";
//	printBoxHTML  += "//<![CDATA[\n";
//	printBoxHTML  += "document.getElementById(\"myid\").style.display=\"none\";\n ";
//	printBoxHTML  += "//]]>\n";
//	printBoxHTML  += "</script>\n";
	printBoxHTML  += '<object id=factory viewastext style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="/cnc/inc/smsx.cab#Version=6,3,435,20"><param name="template" value="MeadCo://IE7" /></object>';
	printBoxHTML  += document.all.print_out.innerHTML;
	printBoxHTML  += "<"+"script type=\"text/javascript\">\n";
	printBoxHTML  += "//<![CDATA[\n";
	printBoxHTML  += "document.getElementById(\"myid\").style.display=\"none\";\n ";
	printBoxHTML  += "factory.printing.header = \"\";\n";
	printBoxHTML  += "factory.printing.footer = \"\";\n";
	printBoxHTML  += "factory.printing.portrait = true;\n";
	printBoxHTML  += "factory.printing.leftMargin = 1.0;\n";
	printBoxHTML  += "factory.printing.topMargin = 1.0;\n";
	printBoxHTML  += "factory.printing.rightMargin = 1.0;\n";
	printBoxHTML  += "factory.printing.bottomMargin = 1.0;\n";
	printBoxHTML  += "factory.printing.Print(false, window);\n";
	printBoxHTML  += "//]]>\n";
	printBoxHTML  += "</script>\n";
	printBoxHTML  += "\n</body>\n</html>";
	PrintWindow.document.write(printBoxHTML);		
}

/*********************************************************************
*	more/less Åä±Û
*********************************************************************/ 

function toggleMoreLess(obj, num, txtMore, txtLess)
{
	oMore = document.getElementById('more' + num);
	oContent = document.getElementById('content' + num);

	if (txtMore.Length == 0) txtMore = 'more...';
	if (txtLess.Length == 0) txtLess = 'less...';

	if (oContent.style.display == 'none') {
		oContent.style.display = 'block';
		oMore.className = "moreless_top";
		obj.innerHTML = txtLess;

		oLess = document.createElement("P");
		oLess.id = "less" + num;
		oLess.className = "moreless_bottom";
		var txtMore2 = txtMore.replace(/&/g,'&amp;');
		var txtLess2 = txtLess.replace(/&/g,'&amp;');

		oLess.innerHTML = '<span style="cursor: pointer;" onclick="toggleMoreLess(this, \'' + num + '\', \'' + txtMore2 + '\', \'' + txtLess2 + '\'); return false;">' + txtLess + '<\/span>';

		after = oContent.nextSibling;
		oContent.parentNode.insertBefore(oLess, after);
	} else {
		oContent.style.display = 'none';
		oMore.className = "moreless_fold";
		oMore.childNodes[0].innerHTML = txtMore;

		oLess = document.getElementById('less' + num);
		oContent.parentNode.removeChild(oLess);
	}
}

//]]>

