/*********************************************************************
*	MAIN JS BY Heris
*	last updated : 2003/11/19
*
*	Çì¸®½º
*	http://www.heris.net
*	(c)copyright 2002 by Heris. All rights reserved.
*********************************************************************/

/*********************************************************************
*	onfocus="this.blur();" È¿°ú ÁÖ±â
*********************************************************************/
function autoBlur(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 
	document.body.focus(); 
} 
document.onfocusin=autoBlur;


/*********************************************************************
*	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 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');
}


/*********************************************************************
*	ÀÌ¹ÌÁö »çÀÌÁî¿¡ ¸Â°Ô »õÃ¢ ¿­±â
*********************************************************************/
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_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_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_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; }
}


/*********************************************************************
*	TV±¤°í¿ë
*********************************************************************/
width = 11;
height = 16;

pVol_top = 380;
vminX    = 296;
vmaxX    = 336;

cPos_top = 275;
cminX    = 40;
cmaxX    = 350;

function playIt()
{	if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) 
	{	document.MediaPlayer1.Play();	
	} 
	else 
	{	document.MediaPlayer1.Play();
	}
}
function pauseIt()
{	if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) 
	{	if (document.MediaPlayer1.PlayState == 2)
		{	document.MediaPlayer1.Pause();	}
	} 
	else 
	{	if (document.MediaPlayer1.GetPlayState() == 2)
		{	document.MediaPlayer1.Pause();
		}		
	}
}

function stopIt()
{	if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) 
	{	document.MediaPlayer1.Stop();
		document.MediaPlayer1.currentPosition = 0;
	} 
	else 
	{	document.MediaPlayer1.Stop();
		document.MediaPlayer1.CurrentPosition=0;
	}
}

function volChange(UpDown)
{	if ((navigator.userAgent.indexOf("IE") > -1) && (navigator.platform == "Win32"))
	{	var curVol = document.MediaPlayer1.Volume;	} 
	else 
	{	var curVol = document.MediaPlayer1.GetVolume();		}
	
	if (UpDown == "up") 
	{	//curVol = -((Math.abs(curVol))/AUDIOSTEP);
		curVol = -(Math.abs(curVol) - 200);
		if (curVol > -1) 
		{	curVol = -1;	}		
	} 
	else if (UpDown == "down") 
	{	//curVol = -((Math.abs(curVol) + 1)*AUDIOSTEP);
		curVol = -(Math.abs(curVol) + 200);
		if (curVol < -10000) 
		{	curVol = -10000;	}
	} 
	else 
	{	if ( vol == -10000 ){  vol = curVol; curVol = -10000; }
		else {  curVol = vol; vol = -10000; }		
	}	
	
	curVol = Math.floor(curVol);
	if ((navigator.userAgent.indexOf("IE") > -1) && (navigator.platform == "Win32"))
	{	document.MediaPlayer1.Volume = curVol;
	} 
	else 
	{	document.MediaPlayer1.SetVolume(curVol);	}
}

function fullIt()
{	if (document.MediaPlayer1.DisplaySize == 0)
	{	document.MediaPlayer1.DisplaySize = 2;	}
	else
	{	document.MediaPlayer1.DisplaySize = 0;	}
}

function fullScreen()
{	document.MediaPlayer1.DisplaySize = 3;
}

