﻿//브라우저를 확인하는 코드
var n4 = (document.layers)?true:false; 
var e4 = (document.all)?true:false; 

function PrintEmbed() 
{
	document.write(document.getElementById("embed_print").value);
	document.getElementById("embed_print").id = "embed_print_";
}

/*embed*/
function doc_write(cont)
{
	document.write(cont);
}

function flash_movie(src, ids, width, height, wmode)
{
	var wh = "";
	if (parseInt(width) && parseInt(height)) 
		wh = " width='"+width+"' height='"+height+"' ";
	return "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "+wh+" id="+ids+"><param name=menu value=false><param name=wmode value="+wmode+"><param name=movie value="+src+"><param name=quality value=high><embed src="+src+" menu=false quality=high wmode="+wmode+" type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash' "+wh+"></embed></object>";
}

function obj_movie(src, ids, width, height, autostart)
{
	var wh = "";
	if (parseInt(width) && parseInt(height)) 
		wh = " width='"+width+"' height='"+height+"' ";
	if (!autostart) autostart = false;
	return "<embed src='"+src+"' "+wh+" autostart='"+autostart+"'></embed>";
}


/* 파일사이즈설정 */
function parseSize(val,Position)
{	
	var size = parseInt(val);
	if(size==0) return "0Bytes";
	if(size < 1024) result = size + "Bytes";
	else if (size < Math.pow(1024,2)) return Round(size /  Math.pow(1024,1),Position,'F') + "KB";
	else if (size < Math.pow(1024,3)) return Round(size /  Math.pow(1024,2),Position,'F') + "MB";
	else if (size < Math.pow(1024,4)) return Round(size /  Math.pow(1024,3),Position,'F') + "GB";
	else return Round(size /  Math.pow(1024,4),Position,'F') + "TB";	
}
function Round(Num, Position , Base)
{
	//Num = 반올림할 수
	//Position = 반올림할 자릿수(정수로만)
	//Base = I 이면 소숫점위의 자릿수에서, F 이면 소숫점아래의 자릿수에서 반올림
    
	if(Position == 0) return Math.round(Num); 
    else if(Position > 0)
	{
		var cipher = '1';
		for(var i=0; i < Position; i++ ) cipher = cipher + '0';
		var no = Number(cipher);
		if(Base=="F") return Math.round(Num * no) / no;
		else return Math.round(Num / no) * no;		
	 }
}
function Comma_(number) 
{
	number = '' + number;
	if (number.length > 3) 
	{
		var mod = number.length % 3;
		var output = (mod > 0 ? (number.substring(0,mod)) : '');
		for (i=0 ; i < Math.floor(number.length / 3); i++) 
		{
			if ((mod == 0) && (i == 0))
				output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
			else
				output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
		}
		return (output);
	}
	else return number;
}

/**********************************
// 메세지 후 url 고
***********************************/
function alertGo(msg,url,target,close) {
	if(msg) alert(msg);
	if(url) {
		if(target) window[target].location.replace(url);
		else window.self.location.replace(url);
	}
	if(close) close();
}

function confirmGo(msg,url)
{
	if(confirm(msg)) {
		location.replace(url);
	} else {
		return;
	}
}


function searchMember()
{
	var width = 400;
	var height = 420;
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.height - height) / 2 -20;
	window.open("/login/search.php","search","width="+width+",height="+height+",top="+wintop+",left="+winleft+",scrollbars=no");
}

function searchID()
{
	var width = 450;
	var height = 240;
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.height - height) / 2 -20;
	window.open("/login/search.php?pg_mode=id","search","width="+width+",height="+height+",top="+wintop+",left="+winleft+",scrollbars=no");
}

function memberInfoAdmin(userid)
{
	var width = 870;
	var height = 650;
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.height - height) / 2 -20;
	window.open("/admin/member/member.php?pg_mode=form_edit&userid="+userid,"admin_search","width="+width+",height="+height+",top="+wintop+",left="+winleft+",scrollbars=no");
}

function memberInfo(name)
{
	var width = 500;
	var height = 500;
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.height - height) / 2 -20;
	window.open("/login/index.php?pg_mode=info&name="+name,"memberInfo","width="+width+",height="+height+",top="+wintop+",left="+winleft+",scrollbars=no");
}

function memoList()
{
	var width = 700;
	var height = 500;
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.height - height) / 2 -20;
	window.open("/mypage/memo/","memoList","width="+width+",height="+height+",top="+wintop+",left="+winleft+",scrollbars=no");
}

function memoSend(name,auth)
{
	if(auth == '1') {
	var width = 700;
	var height = 500;
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.height - height) / 2 -20;
	window.open("/mypage/memo/?pg_mode=form_write&recv_name="+name,"memoSend","width="+width+",height="+height+",top="+wintop+",left="+winleft+",scrollbars=no");
	} else {
		if(confirm('실명인증후 친구추가가 가능합니다.\n\n실명 인증페이지로 이동하시겠습니까?')==true) parent.location.href='/login/member.php?pg_mode=auth';
	}
}

function friend(target_name,auth)
{
	if(auth == '1') {
		if(!target_name) target_name="";
		var width = 400;
		var height = 220;
		var winleft = (screen.width - width) / 2;
		var wintop = (screen.height - height) / 2 -20;
		window.open("/mypage/friend/?pg_mode=form_add_user&name="+target_name,"friend","width="+width+",height="+height+",top="+wintop+",left="+winleft+",scrollbars=no");
	} else {
		if(confirm('실명인증후 친구추가가 가능합니다.\n\n실명 인증페이지로 이동하시겠습니까?')==true) parent.location.href='/login/member.php?pg_mode=auth';
	}

}

function Board_noLogin()
{
	alert("로그인 후 이용하세요.");
}
function Board_noSvc()
{
	alert("선택하신 기능을 사용할 권한이 없습니다.");
}
function Board_noNReply()
{
	alert("공지글에는 답글 등록이 허용되지 않습니다.");
}

function Bbs_noLogin()
{
	alert("로그인 후 이용하세요.");
}
function Bbs_noSvc()
{
	alert("선택하신 기능을 사용할 권한이 없습니다.");
}
function Bbs_noNReply()
{
	alert("공지글에는 답글 등록이 허용되지 않습니다.");
}

function check_byte(val,min,max,msg) 
{
    var tmpStr;
    var temp=0;
    var onechar;
    var tcount;
    tcount = 0;
    tmpStr = new String(val);
    temp = tmpStr.length;
    for (k=0;k<temp;k++)
    {
       onechar = tmpStr.charAt(k);
       if (escape(onechar) =='%0D') { } else if (escape(onechar).length > 4) { tcount += 2; } else { tcount++; }
    }
	if(tcount < min || tcount > max) {
		alert(msg);
		return false;
	}
	else return true;
}


function isValidName(str,msg)
{
    if(str == null || str == '')
        return false;

    for(i = 0; i < str.length; i++)
    {
        if((str.substring(i, i+1) == '\\') ||
          (str.substring(i, i+1) == '/') ||
          (str.substring(i, i+1) == ';') ||
          (str.substring(i, i+1) == '*') ||
          (str.substring(i, i+1) == '?') ||
          (str.substring(i, i+1) == '"') ||
          (str.substring(i, i+1) == '<') ||
          (str.substring(i, i+1) == '>') ||
          (str.substring(i, i+1) == '|') ||
          (str.substring(i, i+1) == '#') ||
          //(str.substring(i, i+1) == '%') ||
          (str.substring(i, i+1) == '\''))
          {
				alert(msg);
                return false;
          }
    }
    return true;
}


/***********************************
금액단위 관련 함수
***********************************/

//돈(3단위마다 컴마를 붙인다.) 
function numFormat() { 
    var ob=event.srcElement; 
    ob.value = filterNum(ob.value); 
    ob.value = commaSplitAndNumberOnly(ob); 
    return false; 
} 

//한정액(일정금액 이상이 되면 올라기지 않게 한다.) 
function numLimit(money) { 
    var ob=event.srcElement; 
    ob.value = noSplitAndNumberOnly(ob); 
    if(ob.value > money) ob.value = money; 
    return false; 
} 

//이자율(소수점 사용가능) 
function checkNumberDot(llen,rlen) { 
    if(llen == "") llen = 8; 
    if(rlen == "") rlen = 2; 
    var ob=event.srcElement; 
    ob.value = filterNum(ob.value); 

    spnumber = ob.value.split('.'); 
    if( spnumber.length >= llen && (spnumber[0].length >llen || spnumber[1].length >llen)) { 
        ob.value = spnumber[0].substring(0,llen) + "." + spnumber[1].substring(0,rlen); 
        ob.focus(); 
        return false; 
    } 
    else if( spnumber[0].length > llen ) { 
        ob.value = spnumber[0].substring(0,llen) + "."; 
        ob.focus(); 
        return false; 
    } 
    else if(ob.value && spnumber[0].length == 0) { 
        ob.value = 0 + "." + spnumber[1].substring(0,rlen); 
        ob.focus(); 
        return false; 
    } 
    ob.value = commaSplitAndAllowDot(ob); 
    return false; 
} 

//참조함수 
function filterNum(str) { 
        re = /^\$|,/g; 
        return str.replace(re, ""); 
} 

//참조함수(컴마불가) 
function noDot(ob) { 
     
    var txtNumber = '' + ob.value; 
    if (isNaN(txtNumber) || txtNumber.indexOf('.') != -1 ) { 
        ob.value = ob.value.substring(0, ob.value.length-1 ); 
        ob.value = commaSplitAndNumberOnly(ob); 
        ob.focus(); 
        return ob.value; 
    } else { 
        var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])'); 
        var arrNumber = txtNumber.split('.'); 
        arrNumber[0] += '.'; 
        do { 
            arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2'); 
        } 
        while (rxSplit.test(arrNumber[0])); 
         
        if (arrNumber.length > 1) { 
            return arrNumber.join(''); 
        } else { 
            return arrNumber[0].split('.')[0]; 
        } 
   } 
} 

//숫자만가능 
function onlyNum(ob) { 
    var txtNumber = '' + ob.value; 
    if (isNaN(txtNumber) || txtNumber.indexOf('.') != -1 ) { 
        ob.value = ob.value.substring(0, ob.value.length-1 ); 
        ob.focus(); 
        return ob.value; 
    } 
    else return ob.value; 
} 

//바이트검사 
function Byte(input) { 
    var i, j=0; 
    for(i=0;i<input.length;i++) { 
        val=escape(input.charAt(i)).length; 
        if(val==  6) j++; 
        j++; 
    } 
    return j; 
} 

//팝업메뉴 
function popupMenuShow(layername,thislayer,thislayer2)
{ 
    thislayerfield.value = thislayer; 
    thislayerfield2.value = thislayer2; 
    var obj = document.all[layername]; 
    var _tmpx,_tmpy, marginx, marginy; 
    _tmpx = event.clientX + parseInt(obj.offsetWidth); 
    _tmpy = event.clientY + parseInt(obj.offsetHeight); 
    _marginx = document.body.clientWidth - _tmpx; 
    _marginy = document.body.clientHeight - _tmpy ; 
    if(_marginx < 0) _tmpx = event.clientX + document.body.scrollLeft + _marginx ; 
    else _tmpx = event.clientX + document.body.scrollLeft ; 
    if(_marginy < 0) _tmpy = event.clientY + document.body.scrollTop + _marginy + 20; 
    else _tmpy = event.clientY + document.body.scrollTop ; 
    obj.style.posLeft = _tmpx - 5; 
    obj.style.posTop  = _tmpy; 
    layerSetVisible(obj, true); 
    layerSetPos(obj, event.clientX, event.clientY); 
} 

function layerSetVisible(obj, flag) { 
  if (navigator.appName.indexOf('Netscape', 0) != -1) obj.visibility = flag ? 'show' : 'hide'; 
  else obj.style.visibility = flag ? 'visible' : 'hidden'; 
} 

function layerSetPos(obj, x, y) { 
  if (navigator.appName.indexOf('Netscape', 0) != -1) { 
    obj.left = x; 
    obj.top = y;
  } else { 
    obj.style.pixelLeft = x + document.body.scrollLeft; 
    obj.style.pixelTop  = y + document.body.scrollTop;
  } 
} 

//페이지이동 
function move(url) { 
    location.href = url; 
} 

//닫기 
function toclose() { 
    self.close(); 
} 

//위치변경 
function winsize(w,h,l,t) { 
    if(window.opener) resizeTo(w,h); 
} 

// 날짜,시간 format 함수 = php의 date() 
function date(arg_format, arg_date) { 
       if(!arg_date) arg_date = new Date(); 

       var M = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); 
       var F = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); 
       var K = new Array("일","월","화","수","목","금","토"); 
       var k = new Array("日","月","火","水","木","金","土"); 
       var D = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); 
       var l = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); 
       var o = new Array("전","후"); 
       var O = new Array("오전","오후"); 
       var a = new Array("am","pm"); 
       var A = new Array("AM","PM"); 

       var org_year = arg_date.getFullYear(); 
       var org_month = arg_date.getMonth(); 
       var org_date = arg_date.getDate(); 
       var org_wday = arg_date.getDay(); 
       var org_hour = arg_date.getHours(); 
       var org_minute = arg_date.getMinutes(); 
       var org_second = arg_date.getSeconds(); 
       var hour = org_hour % 12; hour = (hour) ? hour : 12; 
       var ampm = Math.floor(org_hour / 12); 

       var value = new Array(); 
       value["Y"] = org_year; 
       value["y"] = String(org_year).substr(2,2); 
       value["m"] = String(org_month+1).replace(/^([0-9])$/,"0$1"); 
       value["n"] = org_month+1; 
       value["d"] = String(org_date).replace(/^([0-9])$/,"0$1"); 
       value["j"] = org_date; 
       value["w"] = org_wday; 
       value["H"] = String(org_hour).replace(/^([0-9])$/,"0$1"); 
       value["G"] = org_hour; 
       value["h"] = String(hour).replace(/^([0-9])$/,"0$1"); 
       value["g"] = hour; 
       value["i"] = String(org_minute).replace(/^([0-9])$/,"0$1"); 
       value["s"] = String(org_second).replace(/^([0-9])$/,"0$1"); 
       value["t"] = (new Date(org_year, org_month+1, 1) - new Date(org_year, org_month, 1)) / 86400000; 
       value["z"] = (new Date(org_year, org_month, org_date) - new Date(org_year, 0, 1)) / 86400000; 
       value["L"] = ((new Date(org_year, 2, 1) - new Date(org_year, 1, 1)) / 86400000) - 28; 
       value["M"] = M[org_month]; 
       value["F"] = F[org_month]; 
       value["K"] = K[org_wday]; 
       value["k"] = k[org_wday]; 
       value["D"] = D[org_wday]; 
       value["l"] = l[org_wday]; 
       value["o"] = o[ampm]; 
       value["O"] = O[ampm]; 
       value["a"] = a[ampm]; 
       value["A"] = A[ampm]; 
       
       var str = ""; 
       var tag = 0; 
       for(i=0;i<arg_format.length;i++) { 
              var chr = arg_format.charAt(i); 
              switch(chr) { 
                     case "<" : tag++; break; 
                     case ">" : tag--; break; 
              } 
              if(tag || value[chr]==null) str += chr; else str += value[chr]; 
       } 

       return str; 
} 

// 해상도에 맞는 크기 사용 
function screenSize() { 
    self.moveTo(0,0); 
    self.resizeTo(screen.availWidth,screen.availHeight); 
} 

//콤마 넣기(정수만 해당) 
function comma(val) { 
    val = get_number(val); 
    if(val.length <= 3) return val; 

    var loop = Math.ceil(val.length / 3); 
    var offset = val.length % 3; 

    if(offset==0) offset = 3; 
    var ret = val.substring(0, offset); 

    for(i=1;i<loop;i++) { 
        ret += "," + val.substring(offset, offset+3); 
        offset += 3; 
    } 
    return ret; 
} 

//문자열에서 숫자만 가져가기 
function getNum(str) { 
    var val = str; 
    var temp = ""; 
    var num = ""; 

    for(i=0; i<val.length; i++) { 
        temp = val.charAt(i); 
        if(temp >= "0" && temp <= "9") num += temp; 
    } 
    return num; 
} 

//새창띄우기 
function openWin(url, target, w, h, s) { 
	var winleft = (screen.width - w) / 2;
	var wintop = (screen.height - h) / 2 -20;
    if(s) s = 'yes'; 
    else s = 'no'; 
    var its = window.open(url,target,'width='+w+',height='+h+',top='+wintop+',left='+winleft+',scrollbars='+s); 
    its.focus();
} 

//배열에 값이 있는지 검사
function array_in(Val,Arr)
{
	for(var i=0;i<Arr.length;i++) {
		if(Val == Arr[i]) {
			return true;
			break;
		}
	}
}

function over_effect(e,state){
	if(document.all) source4=event.srcElement
	else if(document.getElementById) source4=e.target
	if(source4.className=="menulines") source4.style.borderStyle=state
	else {
		while(source4.tagName!="TABLE") {
			source4=document.getElementById? source4.parentNode : source4.parentElement
			if(source4.className=="menulines") source4.style.borderStyle=state
		}
	}
}

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_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; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}
function toggle_menu(contents) {
 if(contents.style.display == "none") {
  contents.style.display = "";
  } 
  else {
    contents.style.display = "none";
    } 
}

function tableButton(value,go_url,width) {
	var btn;
	var td_width;

	td_width = width - 3;

	btn = '<table width="'+width+'" border="0" cellspacing="0" cellpadding="0">'
		+ '<tr>'
		+'<td width="1" height="1"></td>'
		+'<td width="'+td_width+'" height="1" bgcolor="#211B00"></td>'
		+'<td width="1" height="1" bgcolor="#211B00"></td>'
		+'<td width="1" height="1"></td>'
		+'</tr>'
		+'<tr>'
		+'<td width="1" height="2" bgcolor="#211B00"></td>'
		+'<td width="'+td_width+'" height="2" bgcolor="#5F6505"></td>'
		+'<td width="1" height="2" bgcolor="#5A4F1A"></td>'
		+'<td width="1" height="2" bgcolor="#211B00"></td>'
		+'</tr>'
		+'<tr>'
		+'<td width="1" height="10" bgcolor="#211B00"></td>'
		+'<td width="'+td_width+'" height="10" bgcolor="#5F6505" align="center" valign="bottom" style="padding-top:1;padding-left:1;"><a href="'+go_url+'"><font color="#FFFFFF">'+value+'</font></a></td>'
		+'<td width="1"  height="10" bgcolor="#5A4F1A"></td>'
		+'<td width="1" height="10" bgcolor="#211B00"></td>'
		+'</tr>'
		+'<tr>'
		+'<td width="1" height="1"></td>'
		+'<td width="'+td_width+'" height="1" bgcolor="#211B00"></td>'
		+'<td width="1" height="1" bgcolor="#211B00"></td>'
		+'<td width="1" height="1"></td>'
		+'</tr>'
		+'</table>';
	document.write(btn);
}

function showSelects(bVisible)
{ 
	var selects = []; 
	if(document.all) 
		selects = document.all.tags("SELECT"); 
	var leng = selects.length; 
	for (var i = 0; i < leng; i++) 
		selects[i].runtimeStyle.visibility = bVisible ? "" : "hidden"; 
}

// 카테고리 펼치기 
function toggleLayer(whichLayer) {
	var elem, vis;
	if(document.getElementById) // this is the way the standards work
		elem = document.getElementById(whichLayer);
	else if(document.all) // this is the way old msie versions work
		elem = document.all[whichLayer];
	else if(document.layers) // this is the way nn4 works
		elem = document.layers[whichLayer];
		vis = elem.style;
	//if the style.display value is blank we try to figure it out here
	if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
	vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
	vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

//png출력
function setPng24(obj) { 
	var request_os = window.navigator.userAgent; 
	var os_array = request_os.split(";"); 

	if(os_array[1] != " MSIE 7.0") { 
		obj.width=obj.height=1; 
		obj.className=obj.className.replace(/png24/i,''); 
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"; 
		obj.src=''; 
	}

	return ''; 
}

function inFocus1(i) {
	(i).style.border='1px solid #DDDDDD';
}
function outFocus1(i) {
	(i).style.border='1px solid #efefef';
}

//메인 탭메뉴
function DisplayMenu(index) {
	for (i=1; i<=2; i++)
	if (index == i) {
		thisMenu = eval("menu" + index + ".style");
		thisMenu.display = "";
	} else {
		otherMenu = eval("menu" + i + ".style"); 
		otherMenu.display = "none"; 
	}
}

//메인 탭메뉴2
function show_leemocon(size){ //show_leemocon를 선언
	var d1 = document.getElementById("size1"); // 탭1
	var d2 = document.getElementById("size2"); // 탭2
	d1.style.display = "none";
	d2.style.display = "none";

	switch(size){
	case 1:
		d1.style.display = "";
	break;
	case 2:
		d2.style.display = "";
	break;
	}
}

function Init_contents_body(val) 
{  	
	if(val == 0) document.getElementById('contents_body').style.height = 0;	
	document.getElementById('contents_body').style.height = document.frames['contents_body'].document.body.scrollHeight;	
	if(val == 0) window.scrollTo(0,0);
}

//메인 레이어를 이용한 공지창 띄우기
function setCookie( name, value, expiredays ) { 
	var todayDate = new Date(); 
		todayDate.setDate( todayDate.getDate() + expiredays ); 
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
	} 

function closeWin(mode) { 
	if ( mode == 1 ){ 
		setCookie( "maindiv", "done" , 1 ); 
	} 
	document.all['mainMini'].style.visibility = "hidden";
}

function getCookie(strName)
{
	var strArg = new String(strName + "="); 
	var nArgLen, nCookieLen, nEnd;
	var i = 0, j;
	
	nArgLen    = strArg.length;
	nCookieLen = document.cookie.length;
	
	if(nCookieLen > 0) {
		while(i < nCookieLen) {
			j = i + nArgLen;
			if(document.cookie.substring(i, j) == strArg) {
				nEnd = document.cookie.indexOf (";", j);
				if(nEnd == -1) nEnd = document.cookie.length;
				return unescape(document.cookie.substring(j, nEnd));
			}
			i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
		}
	}
	return "";
}

// 영화보기 새창
function viewMovie(type, stream, no, coupon) {

	if(coupon != 'U') coupon = 'N';
	if(stream == "D"){
		var move_url = "/movie/movie.php?pg_mode=movie_play&type=" + type + "&stream=" + stream + "&coupon=" + coupon + "&no=" + no;
		var str_width = 822;
		var str_height = 588;
	}else{
		var move_url = "/movie/movie.php?pg_mode=movie_play&type=" + type + "&stream=" + stream + "&coupon=" + coupon + "&no=" + no;
		var str_width = 960;
		var str_height = 560;
		if(stream == "N"){
			str_width = 541;
			str_height = 338;
		}
	}
	window.open(move_url,"Bux_player" ,"left=0, top=0,width=" + str_width + ",height=" + str_height + ",scrollbars=0,toolbar=0,status=1,resizable=1,menubar=0");
	
}

function chargeInfo()
{
	f=document.myform;
	document.all['chargeInfo'].style.display = "block";
}

function chargeInfoClose()
{
	f=document.myform;
	document.all['chargeInfo'].style.display = "none";
}

function listOver (Obj,BGColor) {
	Obj.style.backgroundColor = '#f8f8f8';
}

function listOut (Obj,BGColor) {
	Obj.style.backgroundColor = BGColor;
}

function noSpam()
{
	var width = 500;
	var height = 240;
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.height - height) / 2 -20;
	window.open("/site/?pg_mode=nospam","nospam","width="+width+",height="+height+",top="+wintop+",left="+winleft+",scrollbars=no");
}

// 시작페이지 설정
function setSurl() {
	obj = document.body;
	obj.style.behavior='url(#default#homepage)';
	obj.setHomePage('http://www.buxmovie.com');
} 

// 찜바구니 스크롤 기능
function get_objectTop(obj){
	if (obj.offsetParent == document.body) return obj.offsetTop;
	else return obj.offsetTop + get_objectTop(obj.offsetParent);
}


function initSlide()
{
	var scroll = document.getElementById('scroll');
	var scrollTop = get_objectTop(document.getElementById('pos_scroll'));
	scroll.style.top = document.body.scrollTop + scrollTop;
	bodyHeight = document.body.scrollHeight;
	scrollobjHeight = scroll.clientHeight;
	movingSlide();
}

function movingSlide()
{
	var xMenuFrom, xMenuTo, xOffset, timeoutNextCheck;
	var scroll = document.getElementById('scroll');
	var scrollTop = get_objectTop(document.getElementById('pos_scroll'));

	yMenuFrom  = parseInt (scroll.style.top, 10);
	yMenuTo    = document.body.scrollTop + 10;
	if(yMenuTo<scrollTop) yMenuTo = scrollTop;
	timeoutNextCheck = 500;
	if (yMenuFrom != yMenuTo) {
		yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 10);
		if (yMenuTo < yMenuFrom) yOffset = -yOffset;
		scroll.style.top = parseInt (scroll.style.top, 10) + yOffset;
		timeoutNextCheck = 10;
	}
	if (scroll.style.pixelTop > bodyHeight - scrollobjHeight) scroll.style.top = bodyHeight - scrollobjHeight;

	setTimeout ("movingSlide()", timeoutNextCheck);
}

function gdscroll(gap)
{
	var gdscroll = document.getElementById('gdscroll');
	gdscroll.scrollLeft += gap;
}

// ie6에서 png 출력하기
function setPng24(obj) { 
	obj.width=obj.height=1; 
	obj.className=obj.className.replace(/\bpng24\b/i,''); 
	obj.style.filter = 
	"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='';  
	return ''; 
}