function overL(obj,num) {
	//obj.style.color = 'C3023B';
	//obj.style.textDecoration = 'underline';
	//obj.style.fontWeight = 'bold';
	//obj.style.letterSpacing = -1;

	var sectM = eval('sectM_' + num);
	sectM.style.display = 'block';
}

function outL(obj,num) {
	//obj.style.color = '595959';
	//obj.style.textDecoration = 'none';
	//obj.style.fontWeight = 'normal';
	//obj.style.letterSpacing = 0;

	var sectM = eval('sectM_' + num);
	sectM.style.display = 'none';
}

function overLM(obj) {
	obj.style.background = 'FEEAEC';
	obj.style.color = 'C3023B';
	obj.style.textDecoration = 'underline';
}

function outLM(obj) {
	obj.style.background = 'FFFFFF';
	obj.style.color = '595959';
	obj.style.textDecoration = 'none';
}

function showHide(key)
{
	var div = eval("document.all.div_" + key);
	
	if(div.style.display == ''){
		div.style.display = "none";
	}else{
	//div.style.position= "absolute";
	div.style.top =  event.clientY + document.body.scrollTop + 9; 
	div.style.left = event.x  ;	
	div.style.display = "";

	}
}

function showleft(mstr){
	var div1 = eval("document.all.left"+mstr);
	if (div1.style.display == "none"){
	div1.style.display = "inline";
	}else{
	div1.style.display = "none";
	}
	if (mstr == "1"){
	document.all.left2.style.display = "none";
	document.all.left3.style.display = "none";
	}
	if (mstr == "2"){
	document.all.left1.style.display = "none";
	document.all.left3.style.display = "none";
	}
	if (mstr == "3"){
	document.all.left1.style.display = "none";
	document.all.left2.style.display = "none";
	}
}

function check_new(y,m,d)
{
	var now = new Date();
	var nYear = now.getFullYear();
	var nMonth = now.getMonth();
	var nDay = now.getDate();
	var v2 = parseInt((now.getTime() - Date.UTC(y, m-1, d))/(3600000*24));
	if (v2 < 2)
	{
	document.write("&nbsp;<img src='/images/trendreport/icon02.gif' border='0' align='absmiddle'>");
	}
}

function new_resize(picsrc)
{
	window.open('/viewfile.asp?filename='+picsrc.src,'pic_view','width=100,height=100,toolbars=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes');
}

function new_resize2(picsrc)
{
	window.open('/viewfile.asp?filename='+picsrc,'pic_view','width=100,height=100,toolbars=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes');
}

function voted(votefor,what,where)
{
	if (votefor == 'plus')
	{
		window.open('/votefor.asp?for=plus&idx='+what+'&where='+where,'vote','width=50,height=50,toolbars=0,scrollbars=0,location=0');
	}
	else
	{
		window.open('/votefor.asp?for=minus&idx='+what+'&where='+where,'vote','width=50,height=50,toolbars=0,scrollbars=0,location=0');
	}
}

/* onLoad Handler */
function LH_create()
{
	this.LIST = new Array();
	this.add = LH_add;
	this.exec = LH_exec;
}

function LH_add(strExec)
{
	this.LIST[this.LIST.length] = strExec;
}

function LH_exec()
{
	var list_len = this.LIST.length;
	for (var i = 0; i < list_len; i++)
	{
		eval(this.LIST[i]);
	}
}

function openpage(ref){
	if (ref != "")
	{
		//location.replace(ref);
		window.location.href=ref;
	}
}

function openagreement(ref){
	window.open("/information.asp?mode="+ref,ref,"width=617,height=600,scrollbars=yes");
}

function hide_sub(){
	document.all.Sub1.style.display="none";
	document.all.Sub2.style.display="none";
	document.all.Sub3.style.display="none";
}

function showS1(param,Layer) {
	hideS1();
	Layer.style.left=param.offsetLeft+12;
	Layer.style.top=109;
	Layer.style.display="inline";
}

function show_S1(pos) {
	S1[pos].style.display="inline";
}

function showS2(param,M,j) {
	hideS2(M,j);
	document.all[M+"S2"+j].style.left=param.offsetLeft+param.offsetWidth;
	document.all[M+"S2"+j].top=param.offsetTop;
	document.all[M+"S2"+j].style.display="inline";
}

function hideS2(M,j){
for (i=0;i<2 ;i++ )
	document.all[1+"S2"+i].style.display="none";
}

function commentedit(var1){
	window.open("/editor/board/commentedit.asp?idx="+var1,"commentEdit","width=630,height=130,toolbars=0,scrollbars=0,location=0");
	//window.showModalDialog("/editor/board/commentedit.asp?idx="+var1,"commentEdit","dialogwidth:630px;dialogheight:130px;toolbars:0;scrollbars:0;location:0;");
}

function chkTalk(){
var strName = document.Talk.Name.value;
var strPWD = document.Talk.PWD.value;
var strSubject = document.Talk.Subject.value;
var strContents = document.Talk.Contents.value;

if (!strName)
	alert("ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
else if(!strPWD)
	alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
else if(!strSubject)
	alert("Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
else if(!strContents)
	alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
else
	document.Talk.submit();
}

function CheckSearch(KeyWord){
var GoUrl
if (!KeyWord)
{	
	alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.")
}
else
	document.Tsearch.submit();
}

///////////¹æ¸í·Ï//////////////////////////
function TextSend() {

 var str;
 
  str = document.TempText.Subject.value;
   if (str == "" ){
  alert( "Á¦¸ñÀ» ÀÔ·ÂÇÏ½Ê½Ã¿À." );
  document.TempText.Subject.focus();
  return false;
 } 
 
  str = document.TempText.Content.value;
   if (str == "" ){
  alert( "³»¿ëÀ» ÀÔ·ÂÇÏ½Ê½Ã¿À." );
  document.TempText.Content.focus();
  return false;
 } 

else{
		if (document.all.ref.value == "" || document.all.writeaction.value != "edit")
		{
			if (confirm('ÇÑ¹ø ¿Ã¸®½Å ±ÛÀº ¼öÁ¤¸¸ °¡´ÉÇÕ´Ï´Ù.  ÀúÀå ÇÏ½Ã°Ú½À´Ï±î?'))
			{
			document.TempText.submit();
			}
		}
		else 
		{
			if (confirm('¼öÁ¤ ÇÏ½Ã°Ú½À´Ï±î?'))
			{
			document.TempText.submit();
			}
		}
	}

}

function TextSends() {

 var str;
 
    str = document.TempText.Name.value;
    if (str == "" ){
  alert( "ÀÌ¸§À» ÀÔ·ÂÇÏ½Ê½Ã¿À." );
  document.TempText.Name.focus();
  return false;
 } 
  str = document.TempText.Pwd.value;
   if (str == "" ){
  alert( "ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À." );
  document.TempText.Pwd.focus();
  return false;
 } 
 
  str = document.TempText.Content.value;
   if (str == "" ){
  alert( "³»¿ëÀ» ÀÔ·ÂÇÏ½Ê½Ã¿À." );
  document.TempText.Content.focus();
  return false;
 } 

return true;
}

function commentlayer(no){

var Cfrm = eval("document.all.commentfrm" + no);
if (Cfrm.style.display == "none"){
	Cfrm.style.display = "inline"
}
else{
	Cfrm.style.display = "none"
}

}

function commentview(no){
var Cview = eval("document.all.commentview" + no);
if (Cview.style.display == "none"){
	Cview.style.display = "inline"
}
else{
	Cview.style.display = "none"
}

}

function commentslayer(no){

var Cfrm = eval("document.all.commentfrm" + no);
if (Cfrm.style.display == "none"){
	Cfrm.style.display = "inline"
}
else{
	Cfrm.style.display = "none"
}

}

function commentsview(no){
var Cview = eval("document.all.commentsview" + no);
if (Cview.style.display == "none"){
	Cview.style.display = "inline";
	window.open("/Editor/commentview.asp?where=Board&abidx="+no,"","");
}
else{
	Cview.style.display = "none"
}

}

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 sendlogin()
{
	if (document.trylogin.id.value=="")
	{
		alert("¾ÆÀÌµð(E-mail)¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		document.trylogin.id.focus();
		return false;
	}
	if (document.trylogin.pwd.value=="")
	{
		alert("¾ÏÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		document.trylogin.pwd.focus();
		return false;
	}
	if (document.trylogin.idsave.checked)
	{
		setLoginCookie("memberIDSAVE","1",365);
		setLoginCookie("memberID",document.trylogin.id.value,365);
	}
	else
	{
		setLoginCookie("memberIDSAVE","",365);
		setLoginCookie("memberID","",365);
	}
	document.trylogin.submit();
}

function sendlogin2()
{
	if (document.trylogin2.id.value=="")
	{
		alert("¾ÆÀÌµð(E-mail)¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		document.trylogin2.id.focus();
		return false;
	}
	if (document.trylogin2.pwd.value=="")
	{
		alert("¾ÏÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		document.trylogin2.pwd.focus();
		return false;
	}
	if (document.trylogin.idsave.checked)
	{
		setLoginCookie("memberIDSAVE","1",365);
		setLoginCookie("memberID",document.trylogin2.id.value,365);
	}
	else
	{
		setLoginCookie("memberIDSAVE","",365);
		setLoginCookie("memberID","",365);
	}
	document.trylogin2.submit();
}

function getLoginCookie( name, subname )
{
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 login_box()
{
var idchk,memids;

idchk = getLoginCookie('memberIDSAVE');

if (idchk == "1")
{
memids=getLoginCookie('memberID');
document.trylogin.idsave.checked=true;
document.trylogin.id.value=memids;
document.trylogin.pwd.focus();

}
else
{	
document.trylogin.idsave.checked=false;
document.trylogin.id.focus();
}

}

function login_box2()
{
var idchk,memids;

idchk = getLoginCookie('memberIDSAVE');

if (idchk == "1")
{
memids=getLoginCookie('memberID');
//document.trylogin2.idsave.checked=true;
document.trylogin.id.value=memids;
document.trylogin2.id.value=memids;
document.trylogin2.pwd.focus();

}
else
{	
//document.trylogin2.idsave.checked=false;
document.trylogin2.id.focus();
}

}

function setLoginCookie( name, value, expiredays ) 
{ 
    var todayDate = new Date(); 
        todayDate.setDate( todayDate.getDate() + expiredays ); 
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
}


//*************************************************************************************************************//
// ¿Ï·á½Ã°£±îÁö ³²Àº ½Ã°£ Ç¥½Ã ÇÔ¼ö                                                                            //
//*************************************************************************************************************//

function getRemainedTime(endDateTime, currentDateTime, idx)
{
	var endYyyy = Number(endDateTime.substring(0,4));
	var endMm   = Number(endDateTime.substring(4,6)) - 1;
	var endDd   = Number(endDateTime.substring(6,8));
	var endHh   = Number(endDateTime.substring(8,10));
	var endMi   = Number(endDateTime.substring(10,12));
	var endSs   = Number(endDateTime.substring(12,14));
	
	var nowDateTime = String(currentDateTime);
	var nowYyyy = Number(nowDateTime.substring(0,4));
	var nowMm   = Number(nowDateTime.substring(4,6)) - 1;
	var nowDd   = Number(nowDateTime.substring(6,8));
	var nowHh   = Number(nowDateTime.substring(8,10));
	var nowMi   = Number(nowDateTime.substring(10,12));
	var nowSs   = Number(nowDateTime.substring(12,14));
	
	var idx = String(idx);
	
	
	now   = new Date(nowYyyy, nowMm, nowDd, nowHh, nowMi, nowSs); //ÇöÀç½Ã°£ ÁöÁ¤
	later = new Date(endYyyy, endMm, endDd, endHh, endMi, endSs); //¿Ï·á½Ã°£ ÁöÁ¤
	
	if( later <= now )
	{
		s2[idx].innerHTML = "0";
		return;
	}
	
	
	days      = (later - now) / 1000 / 60 / 60 / 24;
	daysRound = Math.floor(days);
	
	hours      = (later - now) / 1000 / 60 / 60 - (24 * daysRound);
	hoursRound = Math.floor(hours);
	
	minutes      = (later - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
	minutesRound = Math.floor(minutes);
	
	seconds      = (later - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
	secondsRound = Math.round(seconds);
	
	if (secondsRound <= 9)
	{
		s1[idx].innerHTML = "0";
		s2[idx].innerHTML = secondsRound;
	}
	else
	{
		s1[idx].innerHTML = Math.floor(secondsRound/10);
		s2[idx].innerHTML = secondsRound%10;
	}
	
	if (minutesRound <= 9)
	{
		m1[idx].innerHTML = "0";
		m2[idx].innerHTML = minutesRound;
	}
	else
	{
		m1[idx].innerHTML = Math.floor(minutesRound/10);
		m2[idx].innerHTML = minutesRound%10;
	}
	
	if (hoursRound <= 9)
	{
		h1[idx].innerHTML = "0";
		h2[idx].innerHTML = hoursRound;
	}
	else
	{
		h1[idx].innerHTML = Math.floor(hoursRound/10);
		h2[idx].innerHTML = hoursRound%10;
	}
	
	if (daysRound <= 9)
	{
		//ÇÑÀÚ¸®ÀÏ¶§
		d1[idx].innerHTML = "";
		d2[idx].innerHTML = "";
		d3[idx].innerHTML = daysRound;
	}
	else if (daysRound <= 99)
	{
		//µÎÀÚ¸®ÀÏ¶§
		d1[idx].innerHTML = "";
		d2[idx].innerHTML = Math.floor((daysRound/10)%10);
		d3[idx].innerHTML = Math.floor(daysRound%10);
	}
	else if (daysRound <= 999)
	{
		//¼¼ÀÚ¸®ÀÏ¶§
		d1[idx].innerHTML = Math.floor(daysRound/100);
		d2[idx].innerHTML = Math.floor((daysRound/10)%10);
		d3[idx].innerHTML = Math.floor(daysRound%10);
	}
	
	
	currentDateTime = parseInt(currentDateTime) + 1;
	
	newtime = window.setTimeout("getRemainedTime('" + endDateTime + "', '" + currentDateTime + "', '" + idx + "');", 1000);
}
