<!--
//check browser
var isie=(/msie/i).test(navigator.userAgent); //ie
var isie6=(/msie 6/i).test(navigator.userAgent); //ie 6
var isie7=(/msie 7/i).test(navigator.userAgent); //ie 7
var isie8=(/msie 8/i).test(navigator.userAgent); //ie 8
var isie9=(/msie 9/i).test(navigator.userAgent); //ie 9
var isfirefox=(/firefox/i).test(navigator.userAgent); //firefox
var isapple=(/applewebkit/i).test(navigator.userAgent); //safari,chrome
var isopera=(/opera/i).test(navigator.userAgent); //opera
var isios=(/(ipod|iphone|ipad)/i).test(navigator.userAgent);//ios
var isipad=(/(ipad)/i).test(navigator.userAgent);//ipad
var isandroid=(/android/i).test(navigator.userAgent);//android
if(isie7 || isie8 || isie9) isie6=false;
if(isie9) isie=false;

//오늘 그만보기 구현을 위한 쿠키생성 및 스크립트 함수
// 쿠키를 생성하는 함수
function setCookie( name, value , expiredays ){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + '=' + escape( value ) + '; path=/; expires=' + todayDate.toGMTString() +  ';';
}

function getCookie(name) {
	var from_idx = document.cookie.indexOf(name+'=');

	if (from_idx != -1) { 
		from_idx += name.length + 1;
		to_idx = document.cookie.indexOf(';', from_idx);

		if (to_idx == -1) {
			to_idx = document.cookie.length;
		}

		return unescape(document.cookie.substring(from_idx, to_idx));
	}
}
//쿠키 get,set

//레이어 팝업 오늘 하루 보지 않기
function popTodayClose(id) {
	setCookie(id, 'done' , 1);
}

// 소스 복사
function _copy(theField) { 
	var temptxt = eval("document.all."+theField);
	var txt=document.body.createTextRange();
	txt.moveToElementText(temptxt);
	txt.select();
	txt.execCommand("copy");
	document.selection.empty();
}

//엔터키 입력시에 실행되는 폼체크함수( 이벤트, 함수명 )
var GetKeyCode = function(e, function_name){
   if(window.event) e = window.event;
	 if (e.keyCode == 13 )
		eval(function_name);
}

//날짜 체크
function valDateChk(startD, endD, startTime, endTime){
	//alert(startD + "=" + endD);
	// 시작일
	var sday1 = startD.split("-");
	// 종료일
	var eday1 = endD.split("-");
	var sDate1 = new Date(sday1[0],sday1[1],sday1[2],startTime);
	var eDate1 = new Date(eday1[0],eday1[1],eday1[2],endTime);

	if(sDate1.getTime() >= eDate1.getTime()){
		return true;
	}
	return false;
}

//이정규 추가 끝//

//-----------------------------------------------------------------------------
// 문자 앞 뒤 공백을 제거 한다.
//-----------------------------------------------------------------------------
String.prototype.trim = function() { 
	return this.replace(/(^\s*)|(\s*$)/g, ""); 
}


//-----------------------------------------------------------------------------
// 내용이 있는지 없는지 확인하다.
//
// @return : true(내용 있음) | false(내용 없음)
//-----------------------------------------------------------------------------
String.prototype.notNull = function() {
	return (this == null || this.trim() == "") ? false : true; 
}

//-----------------------------------------------------------------------------
// 메일의 유효성을 체크 한다.
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isEmail = function() {
	var em = this.trim().match(/^[_\-\.0-9a-zA-Z]{3,}@[-.0-9a-zA-z]{2,}\.[a-zA-Z]{2,4}$/);
	return (em) ? true : false;
}


//-----------------------------------------------------------------------------
// 닉네임 체크 - arguments[0] : 추가 허용할 문자들
// @return : boolean
//-----------------------------------------------------------------------------
String.prototype.isNick = function() {
	return (/^[0-9a-zA-Z가-힣]+$/).test(this.remove(arguments[0])) ? true : false;
}




//-----------------------------------------------------------------------------
// 정규식에 쓰이는 특수문자를 찾아서 이스케이프 한다.
// @return : String
//-----------------------------------------------------------------------------
String.prototype.remove = function(pattern) {
	return (pattern == null) ? this : eval("this.replace(/[" + pattern.meta() + "]/g, \"\")");
}



//-----------------------------------------------------------------------------
// 주민번호 체크 XXXXXX-XXXXXXX 형태로 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isJumin = function() {
	var num = this.trim().onlyNum();
	if(num.length == 13) {
		num = num.substring(0, 6) + "-" + num.substring(6, 13); 
	} else {
		return false;
	}
	
	num = num.match(/^([0-9]{6})-?([0-9]{7})$/);
	if(!num) return false;
	var num1 = RegExp.$1;
	var num2 = RegExp.$2;
	if(!num2.substring(0, 1).match(/^[1-4]{1}$/)) return false;
	num = num1 + num2;
	var sum = 0;
	var last = num.charCodeAt(12) - 0x30;
	var bases = "234567892345";
	for (i=0; i<12; i++) {
		sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
	}
	var mod = sum % 11;
	return ((11 - mod) % 10 == last) ? true : false;
}

//-----------------------------------------------------------------------------
// 14세 미만 여부 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isJumin14 = function() {
	var num = this.trim().onlyNum();
	if(num.length == 13) {
		var ssn1 = num.substring(0, 6);
		var ssn2 = num.substring(6, 13);
	} else {
		return false;
	}
	
	var today = new Date();
	var toyear = parseInt(today.getYear());
	var tomonth = parseInt(today.getMonth()) + 1;
	var todate = parseInt(today.getDate());
	var bhyear = parseInt('19' + ssn1.substring(0,2)); 
	var ntyear = ssn2.substring(0,1);
	var bhmonth = ssn1.substring(2,4); 
	var bhdate = ssn1.substring(4,6); 
	var birthyear = toyear - bhyear;

	if (ntyear == 1 || ntyear == 2)    
	{
		if (parseInt(birthyear) > 14) 
		{ 
			return false;
		} 
		else if (parseInt(birthyear) == 14) 
		{ 
			if ((parseInt(tomonth) > parseInt(bhmonth)) || (parseInt(tomonth) == parseInt(bhmonth)) && (parseInt(todate) >= parseInt(bhdate)) ) 
			{
				return false;
			} 
		} 

	}

	return true;

}

//-----------------------------------------------------------------------------
// 사업자번호 체크 XXX-XX-XXXXX 형태로 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isBiznum = function() {
	var num = this.trim().onlyNum();
	if(num.length == 10) {
		num = num.substring(0, 3) + "-" + num.substring(3, 5) + "-" + num.substring(5, 10);
	} else {
		return false;
	}
	
	num = num.match(/([0-9]{3})-?([0-9]{2})-?([0-9]{5})/);
	if(!num) return false;
	num = RegExp.$1 + RegExp.$2 + RegExp.$3;
	var cVal = 0;
	for (var i=0; i<8; i++) {
		var cKeyNum = parseInt(((_tmp = i % 3) == 0) ? 1 : ( _tmp == 1 ) ? 3 : 7);
		cVal += (parseFloat(num.substring(i,i+1)) * cKeyNum) % 10; 
	}
	var li_temp = parseFloat(num.substring(i,i+1)) * 5 + '0';
	cVal += parseFloat(li_temp.substring(0,1)) + parseFloat(li_temp.substring(1,2));
	return (parseInt(num.substring(9,10)) == 10 - (cVal % 10)%10) ? true : false;
}

//-----------------------------------------------------------------------------
// 전화번호 체크 XXX-XXXX-XXXX 형태로 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isPhone = function() {
	var num = this.trim().onlyNum();
	if(num.substring(1,2) == "2") {
		num = num.substring(0, 2) + "-" + num.substring(2, num.length - 4) + "-" + num.substring(num.length - 4, num.length);
	} else {
		num = num.substring(0, 3) + "-" + num.substring(3, num.length - 4) + "-" + num.substring(num.length - 4, num.length);
	}
	num = num.match(/^0[0-9]{1,2}-[1-9]{1}[0-9]{2,3}-[0-9]{4}$/);
	return (num) ? true : false;
}

//-----------------------------------------------------------------------------
// 핸드폰 체크 XXX-XXXX-XXXX 형태로 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isMobile = function() {
	var num = this.trim().onlyNum();
	num = num.substring(0, 3) + "-" + num.substring(3, num.length - 4) + "-" + num.substring(num.length - 4, num.length);
	num = num.trim().match(/^01[016789]{1}-[1-9]{1}[0-9]{2,3}-[0-9]{4}$/);
	return (num) ? true : false;
}

//-----------------------------------------------------------------------------
// 숫자만 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isNum = function() {
	return (this.trim().match(/^[0-9]+$/)) ? true : false;
}

//-----------------------------------------------------------------------------
// 숫자만 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isMoney = function() {
	return (this.trim().match(/^[0-9,]+$/)) ? true : false;
}

//-----------------------------------------------------------------------------
// 영어만 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isEng = function() {
	return (this.trim().match(/^[a-zA-Z]+$/)) ? true : false;
}

//-----------------------------------------------------------------------------
// 영어와 숫자만 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.EngNum = function() {
	return (this.trim().match(/^[0-9a-zA-Z]+$/)) ? true : false;
}

//-----------------------------------------------------------------------------
// 영어와 숫자만 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.NumEng = function() {
	return this.EngNum();
}

//-----------------------------------------------------------------------------
// 아이디 체크 영어와 숫자만 체크 첫글자는 영어로 시작
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isUserid = function() {
	return (this.trim().match(/[a-zA-z]{1}[0-9a-zA-Z]+$/)) ? true : false;
}

//-----------------------------------------------------------------------------
// 한글만 체크
//
// @return : true(맞는 형식) | false(잘못된 형식)
//-----------------------------------------------------------------------------
String.prototype.isKor = function() {
	return (this.trim().match(/^[가-힣]+$/)) ? true : false;
}

//-----------------------------------------------------------------------------
// 숫자와 . - 이외의 문자는 다 뺀다. - 통화량을 숫자로 변환
//
// @return : 숫자
//-----------------------------------------------------------------------------
String.prototype.toNum = function() {
	var num = this.trim();
	return (this.trim().replace(/[^0-9]/g,""));
}

//-----------------------------------------------------------------------------
// 숫자 이외에는 다 뺀다.
//
// @return : 숫자
//-----------------------------------------------------------------------------
String.prototype.onlyNum = function() {
	var num = this.trim();
	return (this.trim().replace(/[^0-9]/g,""));
}

//-----------------------------------------------------------------------------
// 숫자만 뺀 나머지 전부
//
// @return : 숫자 이외
//-----------------------------------------------------------------------------
String.prototype.noNum = function() {
	var num = this.trim();
	return (this.trim().replace(/[0-9]/g,""));
}

//-----------------------------------------------------------------------------
// 숫자에 3자리마다 , 를 찍어서 반환
//
// @return : 통화량
//-----------------------------------------------------------------------------
String.prototype.toMoney = function() {
	var num = this.toNum();
	var pattern = /(-?[0-9]+)([0-9]{3})/;
	while(pattern.test(num)) {
		num = num.replace(pattern,"$1,$2");
	}
	return num;
}

//-----------------------------------------------------------------------------
// String length 반환
//
// @return : int
//-----------------------------------------------------------------------------
String.prototype.getLength = function() {
	return this.length;
}

//-----------------------------------------------------------------------------
// String length 반환 한글 2글자 영어 1글자
//
// @return : int
//-----------------------------------------------------------------------------
String.prototype.getByteLength = function() {
	var tmplen = 0;
	for (var i = 0; i < this.length; i++) {
		if (this.charCodeAt(i) > 127)
			tmplen += 2;
		else
			tmplen++;
		}
	return tmplen;
}

//-----------------------------------------------------------------------------
// 파일 확장자 반환
//
// @return : String
//-----------------------------------------------------------------------------
String.prototype.getExt = function() {
	var ext = this.substring(this.lastIndexOf(".") + 1, this.length);
	return ext;
}

//-----------------------------------------------------------------------------
// String에 따라서 받침이 있으면 은|이|을 을
// 받침이 없으면 는|가|를 등을 리턴 한다.
// str.josa("을/를") : 구분자는 항상 "/"로
//
//
// @return : 은/는, 이/가 ...
//-----------------------------------------------------------------------------
String.prototype.josa = function(nm) {
	var nm1 = nm.trim().substring(0, nm.trim().indexOf("/"));
	var nm2 = nm.trim().substring(nm.trim().indexOf("/") + 1, nm.trim().length);
	var a = this.substring(this.length - 1, this.length).charCodeAt();
	a = a - 44032;
	var jongsung = a % 28;
	return (jongsung) ? nm1 : nm2;
}

function goURL(url) {
	location.href = url;
}

//Number Key Only
function NKO(ele)
{
	if(ele.value)
	{
		if(!ele.value.isNum())
		{
			alert("숫자키만 사용가능 합니다.");
			ele.value = ele.defaultValue;
			return false;
		}
		ele.value = ele.value.toNum();
	}
}

function setComma(str){
	return Number(String(str).replace(/\..*|[^\d]/g,"")).toLocaleString().slice(0,-3);
}

//Money key Only
function MKO(ele)
{
	if(ele.value)
	{
		if(!ele.value.isMoney())
		{
			alert("숫자키만 사용가능 합니다.");
			ele.value = ele.defaultValue;
			return false;
		}
		ele.value = ele.value.toMoney();
	}
}

//Money key Only
function MVC(ele)
{
	$("#" + ele).val ($("#" + ele).val().toMoney());
}

function hsClose()
{
	if(parent)
		parent.hs.close ();
	else
		hs.close ();
}


//FCK Null 체크

function nullChecker(id)
{
//	alert(id);
	var obj = $("#" + id);
	alert($("#" + id).type);
	return false;
	if(!obj.val())
	{
		obj.css("borderColor","red");
		alert(obj.attr("alt"));
		obj.focus();
		return false;
	}
	obj.css("borderColor","");
	return true;
}

function editorCheck(obj)
{
	var oEditor;
	oEditor = FCKeditorAPI.GetInstance(obj) ;
	var div = document.createElement("DIV");
	div.innerHTML = oEditor.GetXHTML();
	checkstr = div.innerHTML.toString();
	checkstr = checkstr.replace(/\&nbsp;/gi, "");
	checkstr = checkstr.replace(/\<br \/>/gi, "");
	checkstr = checkstr.replace(/\<BR>/gi, "");
	checkstr = checkstr.replace(/\<p>/gi, "");
	checkstr = checkstr.replace(/\<\/p>/gi, "");
	if(isNull( div.innerHTML ) || jQuery.trim(checkstr) == "")
	{
		if(obj == "Title"){
			alert("제목을 입력하여 주세요");
		}else{
			alert("내용을 입력하여 주세요");
		}
		return false;
		div.innerHTML = "";
	}
	else
		return true;
}

function isNull( s ) 
{
	if( s == null ) return true; 
	var result = s.replace(/(^\s*)|(\s*$)/g, ""); 
	if(result == "<BR>") result = "";
	if( result )
		return false; 
	else 
		return true; 
}


function idcheck(v,p)
{
	var id = $.ajax ({url : "/member/id.asp", async : false}).responseText;
	if(id == "")
	{
		alert("회원전용 공간입니다.\n\n로그인 페이지로 이동 하시겠습니까?");
		var posLeft = (screen.width - 400) / 2;
		var posTop = (screen.height - 400) / 2;
		if(posTop < 200) posTop = 200;
		var popLogin = window.open ("/member/pop_login.asp?v=" + v + "&p=" + p,"poplog","width=393, height=288, statusbar=0, scrollbars=0,left=" + posLeft + ", top = " + posTop);
		if(!popLogin)
			alert("팝업이 차단되었습니다. 팝업차단을 해제하여 주세요");
		else
			popLogin.focus();
		return false;
	}
	else
		return true;
}

function email_info(){
	NewWindow('/include/email_popup.php','email', 540, 600,'scrollbars=auto');
}

function print_info(){
	print();
}


//=================================================================================================================================
// 로그인 체크
//=================================================================================================================================
function loginCheck()
{
	if(!confirm("회원전용 공간입니다.\n\n로그인 페이지로 이동 하시겠습니까?"))
		return;
	else
		document.footerLoginForm.submit();
}

function parentloginCheck()
{
	if(!confirm("회원전용 공간입니다.\n\n로그인 페이지로 이동 하시겠습니까?"))
		return;
	else
		parent.document.footerLoginForm.submit();
}

function poploginCheck()
{
	if(!confirm("회원전용 공간입니다.\n\n로그인 페이지로 이동 하시겠습니까?"))
		return;
	else
		opener.document.footerLoginForm.submit();
}

function toPrice(money, cipher) {
	var len, strb, revslice;
	strb = money.toString();
	strb = strb.replace(/,/g, '');
	strb = getOnlyNumeric(strb);
	strb = parseInt(strb, 10);
	if(isNaN(strb))
		return '';
	strb = strb.toString();
	len = strb.length;
	
	if(len < 4)
		return strb;
	if(cipher == undefined)
		cipher = 3;
	
	count = len/cipher;
	slice = new Array();
	for(var i=0; i<count; ++i) {
		if(i*cipher >= len)
			break;
		slice[i] = strb.slice((i+1) * -cipher, len - (i*cipher));
	}
	revslice = slice.reverse();
	return revslice.join(',');
}

function getOnlyNumeric(str) {
	var chrTmp, strTmp;
	var len;
	
	len = str.length;
	strTmp = '';
	
	for(var i=0; i<len; ++i) {
		chrTmp = str.charCodeAt(i);
		if((chrTmp > 47 || chrTmp <= 31) && chrTmp < 58) {
			strTmp = strTmp + String.fromCharCode(chrTmp);
		}
	}
	return strTmp;
}

//정해진 숫자입력지정시 다음지정 입력칸으로 이동
function NextTab(oMe, oNext, iLen) {
  if (oMe.value.length == iLen) { 
		oNext.focus(); 
	}
}

//분리된 이메일 입력칸 앞자리 입력시 @를 입력하면 자동으로 이메일 뒷부분으로 이동
function MoveToTail(email1, email2) {
	var str = email1.value;
	if(str.indexOf("@") > 0) {
		str = str.replace(/\@/g,"");
		email1.value = str;
		email2.focus();
	}
}


function day2(d) {	// 2자리 숫자료 변경
	var str = new String();
	
	if (parseInt(d) < 10) {
		str = "0" + parseInt(d);
	} else {
		str = "" + parseInt(d);
	}
	return str;
}


function urlCopy(url)
{
	window.clipboardData.setData("Text",url);
	alert("URL이 복사 되었습니다.");
}

var getNowScroll = function(){
	var de = document.documentElement;
	var b = document.body;
	var now = {};
	now.X = document.all ? (!de.scrollLeft ? b.scrollLeft : de.scrollLeft) : (window.pageXOffset ? window.pageXOffset : window.scrollX);
	now.Y = document.all ? (!de.scrollTop ? b.scrollTop : de.scrollTop) : (window.pageYOffset ? window.pageYOffset : window.scrollY);

	return now;

}

function byte_check(obj,length_limit){
	var length = calculate_msglen(obj.value);
	if (length > length_limit) {
		alert("최대 " + length_limit + "Bytes(한글 " + (length_limit / 2) + ", 영문 "  + length_limit + "자) 이므로 초과된 글자수는 자동으로 삭제됩니다.");
		obj.value = obj.value.replace(/\r\n$/, "");
		obj.value = assert_msglen(obj.value, length_limit);
		if($("#viewcount"))
			$("#viewcount").text(calculate_msglen(obj.value));

		obj.focus();
	}
}

function calculate_msglen(message){
	var nbytes = 0;
	for (i=0; i<message.length; i++) {
		var ch = message.charAt(i);
		if(escape(ch).length > 4) {
			nbytes += 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				nbytes += 1;
			}
		} else if (ch == '<' || ch == '>') {
			nbytes += 4;
		} else {
			nbytes += 1;
		}
	}
	if($("#viewcount"))
		$("#viewcount").text(nbytes);
	return nbytes;
}

function assert_msglen(message, maximum){
	var inc = 0;
	var nbytes = 0;
	var msg = "";
	var msglen = message.length;

	for (i=0; i<msglen; i++) {
		var ch = message.charAt(i);
		if (escape(ch).length > 4) {
			inc = 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				inc = 1;
			}
		} else if (ch == '<' || ch == '>') {
			inc = 4;
		} else {
			inc = 1;
		}
		if ((nbytes + inc) > maximum) {
			break;
		}
		nbytes += inc;
		msg += ch;
	}
	return msg;
}



function callUtilLog() {
    thisMovie('topnaviFla').checkUtilLog('y');
    thisMovie('todayFla').checkLog();
}


function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

/*
 * 상점결제 인증요청후 PAYKEY를 받아서 최종결제 요청.
 */
function doPay_ActiveX(){
//    ret = xpay_check(document.getElementById('LGD_PAYINFO'), 'test');
    ret = xpay_check(document.getElementById('LGD_PAYINFO'), 'service');

    if (ret=="00"){     //ActiveX 로딩 성공
        var LGD_RESPCODE        = dpop.getData('LGD_RESPCODE');       //결과코드
        var LGD_RESPMSG         = dpop.getData('LGD_RESPMSG');        //결과메세지

        if( "0000" == LGD_RESPCODE ) { //인증성공
            var LGD_PAYKEY      = dpop.getData('LGD_PAYKEY');         //LG텔레콤 인증KEY
            var msg = "인증결과 : " + LGD_RESPMSG + "\n";
            msg += "LGD_PAYKEY : " + LGD_PAYKEY +"\n\n";
            document.getElementById('LGD_PAYKEY').value = LGD_PAYKEY;
            alert(msg);
            document.getElementById('LGD_PAYINFO').submit();
        } else { //인증실패
            alert("인증이 실패하였습니다. " + LGD_RESPMSG);
            /*
             * 인증실패 화면 처리
             */
        }
    } else {
        alert("LG U+ 전자결제를 위한 ActiveX Control이  설치되지 않았습니다.");
        /*
         * 인증실패 화면 처리
         */
    }
}

function isActiveXOK(){
	if(lgdacom_atx_flag == true){
    	document.getElementById('LGD_BUTTON1').style.display='none';
        document.getElementById('LGD_BUTTON2').style.display='';
	}else{
		document.getElementById('LGD_BUTTON1').style.display='';
        document.getElementById('LGD_BUTTON2').style.display='none';	
	}
}

//=================================================================================================================================
// 팝업 가운데 띄우기
//=================================================================================================================================
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

	settings = 'height='+h+',width='+w+',top='+parseInt(TopPosition)+',left='+parseInt(LeftPosition)+',scrollbars='+scroll+',resizable';
	//alert(mypage + "=" + myname + "=" + w + "=" + h + "=" + settings);
	win = window.open(mypage,myname,settings);
	win.focus();
} 

//=================================================================================================================================
// 메인화면 팝업 띄우기
//=================================================================================================================================
function MainNewWindow(mypage,myname,w,h,wp,scroll){
//	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	LeftPosition = wp;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

	settings = 'height='+h+',width='+w+',top='+parseInt(TopPosition)+',left='+parseInt(LeftPosition)+',scrollbars='+scroll+',resizable';
	//alert(mypage + "=" + myname + "=" + w + "=" + h + "=" + settings);
	win = window.open(mypage,myname,settings);
	//win.focus();
} 


// 플래시 코드 정의 
// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 변수, 윈도우모드) 


function flashWrite(url,w,h,id,bg,vars,win){ 

var flashStr= 
"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+ 
"<param name='allowScriptAccess' value='always' />"+ 
"<param name='movie' value='"+url+"' />"+ 
"<param name='FlashVars' value='"+vars+"' />"+ 
"<param name='wmode' value='"+win+"' />"+ 
"<param name='menu' value='false' />"+

"<param name='scaleMode' value='noScale' />"+
"<param name='showMenu' value='false' />"+
"<param name='align' value='CT' />"+ 
"<param name='quality' value='high' />"+ 
"<param name='bgcolor' value='"+bg+"' />"+ 
"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+ 
"</object>"; 

// 플래시 코드 출력 
document.write(flashStr); 
} 

// 플래시 코드 정의 
// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 변수, 윈도우모드) 
function GetMPlayer(x,y,fn) {
	var htmlTxt = "";

//	htmlTxt = htmlTxt + "<object classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='"+escape(fn)+"' width='" + x + "' height='" + y + "' id='MediaPlayer' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>";
//	htmlTxt = htmlTxt + "	<param name='Filename' value='"+escape(fn)+"'>";
//	htmlTxt = htmlTxt + "	<param name='AutoSize' value='1'>";
//	htmlTxt = htmlTxt + "	<param name='AutoStart' value='1'>";
//	htmlTxt = htmlTxt + "	<param NAME='ShowControls' VALUE='1'>";
//	htmlTxt = htmlTxt + "	<param NAME='DisplaySize' VALUE='2'>";
////	htmlTxt = htmlTxt + "	<param NAME='AutoSize' VALUE='false'>";
//	htmlTxt = htmlTxt + "	<param name='ShowPositionControls' value='true'>";
//	htmlTxt = htmlTxt + "	<param name='EnableContextMenu' value='true'>";
//	htmlTxt = htmlTxt + "</object>";

	htmlTxt = htmlTxt + "<object id=\"video01\" type=\"video/x-ms-wmv\" data=\""+escape(fn)+"\" width=\"" + x + "\" height=\"" + y + "\" allowScriptAccess=\"always\">";
	htmlTxt = htmlTxt + "	<param name=\"src\" value=\""+escape(fn)+"\" />";
	htmlTxt = htmlTxt + "	<param name=\"allowScriptAccess\" value=\"always\" />";
	htmlTxt = htmlTxt + "	<param name=\"autostart\" value=\"true\" />";
	htmlTxt = htmlTxt + "	<param name=\"controller\" value=\"true\" />";
	htmlTxt = htmlTxt + "</object>";

	document.write(htmlTxt);
	return;
}

// 이미지 미리보기
function $m(theVar){
	return document.getElementById(theVar)
}
function remove(theVar){
	var theParent = theVar.parentNode;
	theParent.removeChild(theVar);
}
function addEvent(obj, evType, fn){
	if(obj.addEventListener)
	    obj.addEventListener(evType, fn, true)
	if(obj.attachEvent)
	    obj.attachEvent("on"+evType, fn)
}
function removeEvent(obj, type, fn){
	if(obj.detachEvent){
		obj.detachEvent('on'+type, fn);
	}else{
		obj.removeEventListener(type, fn, false);
	}
}
function isWebKit(){
	return RegExp(" AppleWebKit/").test(navigator.userAgent);
}
function ajaxUpload(form,url_action,id_element,html_show_loading,html_error_http){
	var detectWebKit = isWebKit();
	form = typeof(form)=="string"?$m(form):form;
	var erro="";
	if(form==null || typeof(form)=="undefined"){
		erro += "The form of 1st parameter does not exists.\n";
	}else if(form.nodeName.toLowerCase()!="form"){
		erro += "The form of 1st parameter its not a form.\n";
	}
	if($m(id_element)==null){
		erro += "The element of 3rd parameter does not exists.\n";
	}
	if(erro.length>0){
		alert("Error in call ajaxUpload:\n" + erro);
		return;
	}
	var iframe = document.createElement("iframe");
	iframe.setAttribute("id","ajax-temp");
	iframe.setAttribute("name","ajax-temp");
	iframe.setAttribute("width","0");
	iframe.setAttribute("height","0");
	iframe.setAttribute("border","0");
	iframe.setAttribute("style","width: 0; height: 0; border: none;");
	form.parentNode.appendChild(iframe);
	window.frames['ajax-temp'].name="ajax-temp";
	var doUpload = function(){
		removeEvent($m('ajax-temp'),"load", doUpload);
		var cross = "javascript: ";
		cross += "window.parent.$m('"+id_element+"').innerHTML = document.body.innerHTML; void(0);";
		$m(id_element).innerHTML = html_error_http;
		$m('ajax-temp').src = cross;
		if(detectWebKit){
        	remove($m('ajax-temp'));
        }else{
        	setTimeout(function(){ remove($m('ajax-temp'))}, 250);
        }
    }
	addEvent($m('ajax-temp'),"load", doUpload);
	form.setAttribute("target","ajax-temp");
	form.setAttribute("action",url_action);
	form.setAttribute("method","post");
	form.setAttribute("enctype","multipart/form-data");
	form.setAttribute("encoding","multipart/form-data");
	if(html_show_loading.length > 0){
		$m(id_element).innerHTML = html_show_loading;
	}
	form.submit();
}
//-->
