/*********************************************************************
*	MAIN JS BY Heris
*	last updated : 2003/11/19
*
*	Çì¸®½º
*	http://www.heris.net
*	(c)copyright 2002 by Heris. All rights reserved.
*********************************************************************/

/*********************************************************************
*	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 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];}
}


/*********************************************************************
*   showHideLayers ½ºÅ©¸³Æ®
*********************************************************************/

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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; }
}



/*********************************************************************
*	¸Þ´º show : hidden
*********************************************************************/
function lf_disableMenu(ai_menu) {
	var obj = document.all.menu;
	if (obj.length+"" == "undefined") {	/* not array */
		if (obj.style.display == "") obj.style.display = "none";

	}
	else { /* is array */
		if (obj[ai_menu].style.display == "") {
			obj[ai_menu].style.display = "none";
		}
		else {
			for (var i=0 ; i<obj.length ; i++) {	/* hide all other menu item */
				(i == ai_menu) ? obj[i].style.display = "" : obj[i].style.display = "none";
//alert(i+" ... "+ai_menu);
			}
		}
	}
}

function lf_showMyID() {
	var obj = document.all.login;
	var obj1 = document.all.event;	
	
		if (obj.style.visibility == "visible") {
			obj.style.visibility = "hidden";						
			obj1.style.visibility = "visible";									
		} else {
			obj.style.visibility = "visible";			
			obj1.style.visibility = "hidden";												
		}
}


/*********************************************************************
*	¿ÀÇÂ À©µµ¿ì
*********************************************************************/
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');
}


/*********************************************************************
*	TopÀ¸·Î ½ºÅ©·Ñ µÇ¸é¼­ µ¹¾Æ°¡±â
*********************************************************************/ 
function back_top() {
	x = document.body.scrollLeft;
	y = document.body.scrollTop;
	step = 2;

	while ((x != 0) || (y != 0)) {
		scroll (x, y);
		step += (step * step / 100);
		x -= step;
		y -= step;
		if (x < 0) x = 0;
		if (y < 0) y = 0;
	} 
	scroll (0, 0);
}


/*********************************************************************
*	ÆÊ¾÷ Á¦¾îÃ¢ : ÆÊ¾÷¿¡¼­ Å¬¸¯ÇÏ¸é ºÎ¸ðÆäÀÌÁö·Î ÇØ´ç ¸µÅ©¸¦ ¿¬°áÇØÁØ´Ù. 
*********************************************************************/
function tmt_opener(url) {
	opener.location.href = url;    
}


/*********************************************************************
*	ÀÌ¹ÌÁö »çÀÌÁî¿¡ ¸Â°Ô »õÃ¢ ¿­±â
*********************************************************************/
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();
}  


// Æ¯Á¤ ºÎºÐ¸¸ ÇÁ¸°Æ® ÇÏ±â À§ÇÑ ÇÔ¼öµé 2006-06-28
//var div2print; 
function printDiv () { 
	window.open("/include/print.asp","print","height=600,width=660,scrollbars=1").focus();
} 
// Æ¯Á¤ ºÎºÐ¸¸ ÇÁ¸°Æ® ÇÏ±â À§ÇÔ ÇÔ¼ö ¿©±â±îÁö



// ÆË¾÷Ã¢ Áß¾ÓÀ¸·Î À§Ä¡ 
function popup_center(url, target, width_, height_){ 

	if (!width_) width_ = 500;
	if (!height_) height_ = 500;

	var left_ = screen.width;
    var top_ = screen.height;
    left_ = left_/2 - (width_/2);
    top_ = top_/2 - (height_/2);

	opt = "width=" + width_ + ", height=" + height_;
	opt += ", left=" + left_ + ", top=" + top_;

	window.open(url, target, opt).focus();; 
} 


