﻿<!--
var uID = "";
var sendit;
var nameTagView = 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;
}

String.prototype.isForeigerNo = 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 sum = 0;
    var odd = 0;
    
    buf = new Array(13);
    for (i = 0; i < 13; i++) buf[i] = parseInt(num.charAt(i));

    odd = buf[7]*10 + buf[8];
    
    if (odd%2 != 0) {
      return false;
    }

    if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9)) {
      return false;
    }
     
    multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
    for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]);
    sum=11-(sum%11);
    if (sum>=10) sum-=10;

    sum += 2;

    if (sum>=10) sum-=10;

    return ( sum != buf[12]) ? false : true;
}
//-----------------------------------------------------------------------------
// 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 connecting(){
	alert("데이타를 전송중 입니다. 잠시만 기다려 주세요");
}

//show, hide 레이어
function showLayer(LayerNM) {
	document.getElementById(LayerNM).style.display='block';
}
function hideLayer(LayerNM) {
	document.getElementById(LayerNM).style.display='none';
}


//호출할때(탭이름,탭갯수,현재탭)
function tab(tab_name,max,tab_num) {
	for( i = 1; i <= max; i++){
		if (i == tab_num) { document.getElementById(tab_name+i).style.display = 'block'; }
		else { document.getElementById(tab_name+i).style.display = 'none'; }
	}
}

// 플래시 코드 정의 
// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 변수, 윈도우모드) 
function GetMPlayer(x,y,fn) {
	EmbedStr = "<OBJECT id='MPlayer' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' width='" + x + "' height='" + y + "' TYPE='application/x-oleobject' VIEWASTEXT >";
	if(fn)
		EmbedStr += "<param name='FileName' value='" + fn + "'>";
	EmbedStr += "<param name='ShowControls' value='0'>";
	EmbedStr += "<param name='autoStart' value='true'>";
	EmbedStr += "<param name='windowlessVideo' value='false'>";
	EmbedStr += "<param name='uiMode' value='none'>";
	EmbedStr += "<param name='volume' value='100'>";
	EmbedStr += "<param name='stretchToFit' value='true'>";
	EmbedStr += "<param name='autoRewind' value='false'>";
	EmbedStr += "<param name='transparentAtStart' value='true'>";
	EmbedStr += "<param name='enableContextMenu' value='false'>";
	EmbedStr += "</OBJECT>";
	document.write(EmbedStr);
	return;
}

function GetFlash(url,x,y,fn) { 
var EmbedStr;
	EmbedStr = "<object id='" + fn + "' name='" + fn + "' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + x + "' height='" + y + "'>";
	EmbedStr += "<param name='allowScriptAccess' value='always' />";
	EmbedStr += "<param name='movie' value='" + url + "' />";
	EmbedStr += "<param name='quality' value='high' />";
	EmbedStr += "<param name='bgcolor' value='#ffffff' />";
	EmbedStr += "<param name='menu' value='false' />";
	EmbedStr += "<param name='wmode' value='transparent' />";
	EmbedStr += "<param name='allowFullScreen' value='true' />";
	EmbedStr += "<param name='accessScript' value='always' />";
	EmbedStr += "<embed id='" + fn + "' name='" + fn + "' src='" + url + "' quality='high' menu='false' accessScript='always' wmode='transparent' bgcolor='#ffffff' width='" + x + "' height='" + y + "' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	EmbedStr += "</object>";
	
	document.write(EmbedStr);
	return;
}

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+"' name='"+id+"' align='middle'>"+ 
	"<param name='allowScriptAccess' value='always' />"+ 
	"<param name='allowFullScreen' value='true' />"+
	"<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+"' id='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+ 
	"</object>"; 
	document.write(flashStr); 
} 


function flashWrite2(url,w,h,id){ 
	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+"' name='"+id+"' align='middle'>"+ 
	"<param name='allowScriptAccess' value='always' />"+ 
	"<param name='movie' value='"+url+"' />"+ 
	"<param name='FlashVars' value='itemEa=12' />"+ 
	"<param name='wmode' value='transparent' />"+ 
	"<param name='menu' value='false' />"+
	"<param name='allowFullScreen' value='true' />"+
	"<param name='quality' value='high' />"+ 
	"<param name='bgcolor' value='#ffffff' />"+ 
	"<param name='base' value='/flash/' />"+
	"<embed allowScriptAccess='always' src='"+url+"' wmode='transparent' menu='false' quality='high' bgcolor='#ffffff' base='/flash/' width='"+w+"' height='"+h+"' name="+id+" id='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>"; 
	document.write(flashStr); 
} 


function showSelectBox(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}

// ---------------------------------------------------

function hideSelectBox(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}


function goURL(url)
{

	location.href = url;
}


//=================================================================================================================================
// 마우스 위치 조정
//=================================================================================================================================

function getMousePosition(ev, returntype)
{
	ev = ev || window.event;

	if (ev.pageX || ev.pageY){
		if (returntype == "LEFT")
			return ev.pageX;
		else if (returntype == "TOP")
			return ev.pageY;
		else{
			alert('getMousePosition-인자값 입력 오류 : returntype - ' + returntype); return;
		}
	}
	
	if (returntype == "LEFT"){

		if (window.innerWidth)
			return ev.clientX + window.pageXOffset - document.body.clientLeft + 10;
		else if (document.documentElement && document.documentElement.clientWidth)
			return ev.clientX + document.documentElement.scrollLeft - document.body.clientLeft + 10;
		else if(document.body.clientWidth)
			return ev.clientX + document.body.scrollLeft - document.body.clientLeft + 10;
			
	}else if (returntype == "TOP"){

		if (window.innerWidth)
			return ev.clientY + window.pageYOffset - document.body.clientTop;
		else if (document.documentElement && document.documentElement.clientWidth)
			return ev.clientY + document.documentElement.scrollTop - document.body.clientTop;
		else if(document.body.clientWidth)
			return ev.clientY + document.body.scrollTop - document.body.clientTop;
			

	}else{
		alert('getMousePosition-인자값 입력 오류 : returntype - ' + returntype);
	}
}

//=================================================================================================================================
// Lay Display 처리 체크
//=================================================================================================================================

function infoView(obj){
	obj.style.display = "";
}

function infoHidden(obj){
	obj.style.display = "none";
}

function infoshow(obj){
	if(obj.style.display == 'none')
		obj.style.display = "";
	else
		obj.style.display = "none";
}

//=================================================================================================================================
// 에디터 입력값 체크
//=================================================================================================================================
function editCheck(obj)
{
	alert($("#" + obj).val());
	var oEditor;
	oEditor = FCKeditorAPI.GetInstance(obj) ;
	var div = document.createElement("DIV");
	div.innerHTML = oEditor.GetXHTML();
	checkstr = div.innerHTML.toString();
	checkstr = checkstr.replace("&nbsp;", " ");
	if(isNull( div.innerHTML ) || checkstr.trim() == "")
	{
		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; 
}

//=================================================================================================================================
// 필드값으로 숫자만 입력받기
// 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 onlyNumber(obj) {
	// obj : 필드명 (ex. document.form.title)
	var checkOK = "0123456789";
	var checkStr = obj;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length){
			allValid = false;
			break;
		}
		allNum += ch;
	}
	if (!allValid){
		return false;
	} else {
		return true;
	}
}

function NumChk(obj){
	if(!onlyNumber(obj.value)){
		alert('숫자만 입력 가능합니다');
		obj.value='';
	}
}

//=================================================================================================================================
// 포터스 자동 이동
//=================================================================================================================================

function focusMove(obj,len,nxtObj)
{
	if(obj.value.length == len)
		$("#" + nxtObj).focus();
}

function emailChg(obj)
{
	if(obj.value)
	{
		$("email2").value = obj.value;
		$("email3").value = obj.value;
		$("email2").disabled = true;
	}
	else
	{
		$("email3").value = "";
		$("email2").value = "";
		$("email2").disabled = false;
		$("email2").focus();
	}
}

function keyCheck()
{
	if(!$F("keyword"))
	{
		alert("검색어를 입력하여 주세요");
		$("keyword").focus();
		return false;
	}
}

//=================================================================================================================================
// 텍스트의 바이트수 자동체크
//=================================================================================================================================
function byte_check(obj,length_limit, infocnt){
	var length = calculate_msglen(obj.value);
	if(!infocnt || infocnt == "") infocnt = "byte";
	if (length > length_limit) {
		alert("글자수가 초과 하였습니다.\n\n한글 기준 : " + Math.round(length_limit/2) + "자, 영문(숫자) 기준 " + length_limit + "자");
		obj.value = obj.value.replace(/\r\n$/, "");
		obj.value = assert_msglen(obj.value, length_limit);
		$("#"+infocnt).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($("#byte"))
		$("#byte").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 checkSpace( str )
{
     if(str.search(/\s/) != -1){
     	return true;
     } else {
        return 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 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 "";
}

//=================================================================================================================================
// iFrame 컨텐츠 높이 구하기, 리사이즈
//=================================================================================================================================
function IframeResize(id){
	var ifrm = $(id);
	var the_height = ifrm.contentWindow.document.body.scrollHeight;
	if(the_height < 1)
		time_id = window.setTimeout("IframeResize('"+id+"')",10);
	ifrm.height = the_height+25;
}

//=================================================================================================================================
// 이미지 Resize
// 가로 기준
//=================================================================================================================================

function imgResize(obj,maxWidth, maxHeight, speed)
{
	var x1 = getOnlyNumeric($("#" + obj).css("width"));
	var y1 = getOnlyNumeric($("#" + obj).css("height"));
	if(!speed)
		speed = 500;

	var x2 = 0;
	var y2 = 0;
	if(x1 > maxWidth) {
		x2 = maxWidth;
		y2 = maxHeight;
		
		if (x1 >= y1)
			y2 = parseInt((y1 * x2) / x1);
		else
			x2 = parseInt((x1 * y2) / y1);
	} else {
		x2 = x1;
		y2 = y1;
	} 
	$("#" + obj).animate({"width":x2, "height": y2},speed,"easeOutBounce");
}

//=================================================================================================================================
// 이미지 Resize
// 세로 기준
//=================================================================================================================================
function imgResize2(obj,maxWidth, maxHeight, speed)
{
	var x1 = getOnlyNumeric($("#" + obj).css("width"));
	var y1 = getOnlyNumeric($("#" + obj).css("height"));
	if(!speed)
		speed = 500;

	var x2 = 0;
	var y2 = 0;
	if(x1 > maxWidth || y1 > maxHeight) {

		x2 = maxWidth;
		y2 = maxHeight;
		
		if (x1 >= y1)
			y2 = parseInt((y1 * x2) / x1);
		else
			x2 = parseInt((x1 * y2) / y1);

		if(x2 > maxWidth || y2 > maxHeight) {

			x2 = maxWidth;
			y2 = maxHeight;
			
			if (x2 >= y2)
				y2 = parseInt((y2 * x2) / x2);
			else
				x2 = parseInt((x2 * y2) / y2);
		}				

	} else {
		x2 = x1;
		y2 = y1;
	} 
	$("#" + obj).animate({"width":x2, "height": y2},speed,"easeOutBounce");
}

//=================================================================================================================================
// 로그인 체크
//=================================================================================================================================

function loginCheck()
{
	if(POPWIN)
	{
		alert("로그인이 시간이 만료되었습니다.");
		return false;
	}

	if(!confirm("로그인 후 이용 가능합니다\n\n로그인 페이지로 이동 하시겠습니까?"))
		return false;
	document.footerLoginForm.submit();
}

function FormChecker(f)
{

	var fu = new FormUtil(f);
	if(!fu.success())
		return false;
	else
		return true;
}


function allcheck()
{
	if(document.all.chkbox)
	{
		if(document.all.chkbox.length)
		{
			for(i=0;i<document.all.chkbox.length;i++)
			{
				document.all.chkbox[i].checked = document.all.allchk.checked;
			}
		}
		else
		{
			document.all.chkbox.checked = document.all.allchk.checked;
		}
	}
}


function sCheck(f)
{
	if(!f.keyword.value || f.keyword.value.trim() == "")
	{
		alert("검색어를 입력하여 주세요!");
		f.keyword.value = "";
		f.keyword.focus();
		return false;
	}
	return true;
}

function ajaxLoad(ele)
{
	$(ele).startWaiting();
}


function ajaxLoadEnd(ele,n)
{
	$(ele).stopWaiting();
}


function shopCheckOK(a,b)
{
	document.frm.rgn_nm.value = a;
	document.frm.mainuse_rgnno.value = b;
	hs.close();
}

function filedel(ele)
{
	$(ele).value = "";
	$(ele + "Info").update ("");
	$(ele + "but").show();
}


//동영상 플레이 레이어
function toggleSlow() {    
    if (isSlow) {
        closeSlow();        
    } else {
        openSlow();
    }                
}    


var isSlow = false;
function openSlow() {
    isSlow = true;    
    document.getElementById("Slow_Layer").style.display = "";   
    
}  

function closeSlow() { 
    isSlow = false;
    document.getElementById("Slow_Layer").style.display = "none";    
}  

function playSlow(rate,img) {
    closeSlow();
    WMPlay.stop();
    playRate(rate);
	if(img) $("spdimg").src = img;
}    

function playRate(rate) {     
    WMPlay.rate=rate;
    WMPlay.play();    
}



function toggleLinkCopy() {
    if (isLinkCopy) {
        closeLinkCopy();        
    } else {
        openLinkCopy();
    }                
}  

//=================================================================================================================================
// 팝업 가운데 띄우기
//=================================================================================================================================
	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='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings);
	win.focus();
	} 


///////////// 영역인쇄
var initBody;

function beforePrint(){ 
	initBody = document.body.innerHTML; 
	document.body.innerHTML = prtContent.innerHTML; 
	} 
function afterPrint(){ 
	document.body.innerHTML = initBody; 
	} 
function printArea() { 
	window.onbeforeprint = beforePrint;  
	window.onafterprint = afterPrint; 
	window.print(); 
	} 

//=================================================================================================================================
// 문자열 스왑(변환) - replace대용
//=================================================================================================================================

String.prototype.swapchar = function (str, swapstr) {
	
}




//=================================================================================================================================
// 모든 링크에 링크 테두리 없애기
//=================================================================================================================================
function allblur() {
	for (i = 0; i < document.links.length; i++)
		document.links[i].onfocus = document.links[i].blur;
}

//=================================================================================================================================
// 마우스 오버 말풍선
//=================================================================================================================================
function alt( msg, _width, _height ){
    var _style = alt_div.style;
    if( msg != null ){
        alt_div.innerHTML = "<table cellpadding='0' cellspacing='0' border='0'>" +
    "<tr>" +
    "	<td><img src='/images/main/layer01.gif' border='0'></td>" +
    "	<td background='/images/main/layer02.gif'><span class='Ctype_red2'>" + msg + "</span></td>" +
    "	<td><img src='/images/main/layer03.gif' border='0'></td>" +
    "</tr>" +
    "</table>";
		
		
        _style.visibility = "visible";
        if( _width != null ){
            if( alt_div.offsetWidth > _width ){
                _style.width = _width;
            }
        }
        if( _height != null ){
            if( alt_div.offsetHeight > _height ){
                _style.height = _height;
            }
        }
    }else{
        _style.visibility = "hidden";
    }
}


//=================================================================================================================================
// 우편번호 찾기
//=================================================================================================================================
function zipcode()
{
	var wl = (screen.width - 483) / 2;
	var wh = (screen.height - 354) / 2;
	win = window.open ("/include/zip_code.asp","zipcode","width=483,height=354,left=" + wl + ",top=" + wh + ", scrollbars=no");
	win.focus();
}

//=================================================================================================================================
// 우편번호 찾기
//=================================================================================================================================
function comp_zipcode()
{
	var wl = (screen.width - 483) / 2;
	var wh = (screen.height - 354) / 2;
	win = window.open ("/include/zip_code_comp.asp","zipcode","width=483,height=354,left=" + wl + ",top=" + wh + ", scrollbars=no");
	win.focus();
}

//=================================================================================================================================
// 아이디 유효성 검사
//=================================================================================================================================
function idCheck(str)
{
	var pars = "mode=IDCHK&userid=" + encodeURIComponent(str);
//	$("IDText").update ("<span class='p_text01 Ctype_orang_n'>(아이디 체크중입니다.)</span>");
	var ajax = new Ajax.Updater (
		"IDText",
		"/include/ajaxIDChk.asp",
		{
			parameters : pars
		}
	);

	return false;
}

function enableID(obj) {
	// obj : 필드명 (ex. document.form.title)
	var checkOK = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_";
	var checkStr = obj;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length){
			allValid = false;
			break;
		}
		allNum += ch;
	}
	if (!allValid){
		return false;
	} else {
		return true;
	}
}

function checkSpace( str )
{
     if(str.search(/\s/) != -1){
     	return true;
     } else {
        return false;
     }
}


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 banWordCheck() {

}

//=================================================================================================================================
// 팀랭킹 순위
//=================================================================================================================================
function TeamRankingView(gdate,gyear,moveyear,sortflag1,sortflag2)
{
	var gdate;
	var gyear;
	var moveyear;
	var sortflag1;
	var sortflag2;

	$("#RankingList").html ("<div style='height:1000px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxTeamRankingUpdater.asp",
		data	: {
					"gdate" : gdate,
					"gyear" : gyear,
					"moveyear" : moveyear,
					"sortflag1" : sortflag1,
					"sortflag2" : sortflag2
		},
		dataType: "html",
		success	: function (res) {
			$("#RankingList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#RankingList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 팀투수 순위
//=================================================================================================================================
function TeamPitcherView(gdate,gyear,moveyear,sortflag)
{
	var gdate;
	var gyear;
	var moveyear;
	var sortflag;

	$("#PitcherList").html ("<div style='height:350px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxTeamPitcherUpdater.asp",
		data	: {
					"gdate" : gdate,
					"gyear" : gyear,
					"moveyear" : moveyear,
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#PitcherList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#PitcherList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 팀타자 순위
//=================================================================================================================================
function TeamHitterView(gdate,gyear,moveyear,sortflag)
{
	var gdate;
	var gyear;
	var moveyear;
	var sortflag;

	$("#HitterList").html ("<div style='height:350px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxTeamHitterUpdater.asp",
		data	: {
					"gdate" : gdate,
					"gyear" : gyear,
					"moveyear" : moveyear,
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#HitterList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#HitterList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 조건별 투수 성적
//=================================================================================================================================
function TeamConPitcherView(gyear,conflag,sortflag)
{
	var gyear;
	var conflag;
	var sortflag;

	$("#PitcherList").html ("<div style='height:300px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxConPitcherUpdater.asp",
		data	: {
					"gyear" : gyear,
					"conflag" : conflag,
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#PitcherList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#PitcherList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 조건별 타자 성적
//=================================================================================================================================
function TeamConHitterView(gyear,conflag,sortflag)
{
	var gyear;
	var conflag;
	var sortflag;

	$("#HitterList").html ("<div style='height:300px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxConHitterUpdater.asp",
		data	: {
					"gyear" : gyear,
					"conflag" : conflag,
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#HitterList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#HitterList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 선수별 투수 성적
//=================================================================================================================================
function PitcherListView(gyear,conflag,sortflag)
{
	var gyear;
	var conflag;
	var sortflag;

	$("#PitcherList").html ("<div style='height:300px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxPitcherUpdater.asp",
		data	: {
					"gyear" : gyear,
					"conflag" : conflag,
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#PitcherList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#PitcherList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 선수별 베스트 투수 성적
//=================================================================================================================================
function PitcherBestListView(gyear,conflag)
{
	var gyear;
	var conflag;

	$("#PitcherBestList").html ("<div style='height:300px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxPitcherBestUpdater.asp",
		data	: {
					"gyear" : gyear,
					"conflag" : conflag
		},
		dataType: "html",
		success	: function (res) {
			$("#PitcherBestList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#PitcherBestList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 선수별 타자 성적
//=================================================================================================================================
function HitterListView(gyear,conflag,sortflag)
{
	var gyear;
	var conflag;
	var sortflag;

	$("#HitterList").html ("<div style='height:300px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxHitterUpdater.asp",
		data	: {
					"gyear" : gyear,
					"conflag" : conflag,
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#HitterList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#HitterList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 선수별 베스트 타자 성적
//=================================================================================================================================
function HitterBestListView(gyear,conflag)
{
	var gyear;
	var conflag;

	$("#HitterBestList").html ("<div style='height:300px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxHitterBestUpdater.asp",
		data	: {
					"gyear" : gyear,
					"conflag" : conflag
		},
		dataType: "html",
		success	: function (res) {
			$("#HitterBestList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#HitterBestList").html (res.responseText);
		}
	});

	return false;
}


//=================================================================================================================================
// 조건별 투수 상세 성적
//=================================================================================================================================
function TeamConDetailPitcherView(gyear,conflag,conValue)
{
	var gyear;
	var conflag;
	var conValue;

	$("#PitcherList").html ("<div style='height:300px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxConDetailPitcherUpdater.asp",
		data	: {
					"gyear" : gyear,
					"conflag" : conflag,
					"conValue" : conValue
		},
		dataType: "html",
		success	: function (res) {
			$("#PitcherList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#PitcherList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 조건별 타자 상세 성적
//=================================================================================================================================
function TeamConDetailHitterView(gyear,conflag,conValue)
{
	var gyear;
	var conflag;
	var conValue;

	$("#HitterList").html ("<div style='height:300px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxConDetailHitterUpdater.asp",
		data	: {
					"gyear" : gyear,
					"conflag" : conflag,
					"conValue" : conValue
		},
		dataType: "html",
		success	: function (res) {
			$("#HitterList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#HitterList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 해외리그 순위(MLB)
//=================================================================================================================================
function MLBRankingView(gdate,gyear,moveyear)
{
	var gdate;
	var gyear;
	var moveyear;

	$("#RankingList").html ("<div style='height:1000px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxMLBRankingUpdater.asp",
		data	: {
					"gdate" : gdate,
					"gyear" : gyear,
					"moveyear" : moveyear
		},
		dataType: "html",
		success	: function (res) {
			$("#RankingList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#RankingList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 해외리그 순위(JAPAN)
//=================================================================================================================================
function JAPANRankingView(gdate,gyear,moveyear)
{
	var gdate;
	var gyear;
	var moveyear;

	$("#RankingList").html ("<div style='height:1000px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxJAPANRankingUpdater.asp",
		data	: {
					"gdate" : gdate,
					"gyear" : gyear,
					"moveyear" : moveyear
		},
		dataType: "html",
		success	: function (res) {
			$("#RankingList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#RankingList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 기록실 메인 삼성 투수 순위
//=================================================================================================================================
function SSPitcherRankingView(sortflag)
{
	var sortflag;

	$("#SSPitcherList").html ("<div style='height:160px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다.<br /><br />잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxSSPitcherUpdater.asp",
		data	: {
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#SSPitcherList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#SSPitcherList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 기록실 메인 삼성 타자 순위
//=================================================================================================================================
function SSHitterRankingView(sortflag)
{
	var sortflag;

	$("#SSHitterList").html ("<div style='height:160px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다.<br /><br />잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxSSHitterUpdater.asp",
		data	: {
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#SSHitterList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#SSHitterList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 기록실 메인 전체 투수 순위
//=================================================================================================================================
function ALLPitcherRankingView(sortflag)
{
	var sortflag;

	$("#ALLPitcherList").html ("<div style='height:199px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxALLPitcherUpdater.asp",
		data	: {
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#ALLPitcherList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#ALLPitcherList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 기록실 메인 전체 타자 순위
//=================================================================================================================================
function ALLHitterRankingView(sortflag)
{
	var sortflag;

	$("#ALLHitterList").html ("<div style='height:199px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxALLHitterUpdater.asp",
		data	: {
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#ALLHitterList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#ALLHitterList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 라스닥 기록실 (타자)
//=================================================================================================================================
function LasDaqStatHitterView(sortflag)
{
	var sortflag;

	$("#LasDaqHitterList").html ("<div style='height:1000px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxLasdaqStatHitterUpdater.asp",
		data	: {
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#LasDaqHitterList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#LasDaqHitterList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 라스닥 기록실 (투수)
//=================================================================================================================================
function LasDaqStatPitcherView(sortflag)
{
	var sortflag;

	$("#LasDaqPitcherList").html ("<div style='height:1000px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxLasdaqStatPitcherUpdater.asp",
		data	: {
					"sortflag" : sortflag
		},
		dataType: "html",
		success	: function (res) {
			$("#LasDaqPitcherList").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$("#LasDaqPitcherList").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 선수(투수) 상세 페이지 기록 정보
//=================================================================================================================================
function rosterPitcherView(flag,flag2,gyear,page,fan,pcode)
{
	$(".gameDoc").html ("<div style='height:350px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxRosterPitcherUpdater.asp",
		data	: {
					"flag" : flag,
					"flag2" : flag2,
					"gyear" : gyear,
					"page" : page,
					"fan" : fan,
					"pcode" : pcode
		},
		dataType: "html",
		success	: function (res) {
			$(".gameDoc").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$(".gameDoc").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 선수(타자) 상세 페이지 기록 정보
//=================================================================================================================================
function rosterHitterView(flag,flag2,gyear,page,fan,pcode)
{
	$(".gameDoc").html ("<div style='height:350px; text-align:center;'><br /><br /><img src='/images/common/loading.gif' border='0'><br /><br /><b>데이터를 불러오고 있는 중입니다. 잠시만 기다려 주세요.</b></div>");
	jQuery.ajax ({
		type	: "POST",
		url		: "ajaxRosterHitterUpdater.asp",
		data	: {
					"flag" : flag,
					"flag2" : flag2,
					"gyear" : gyear,
					"page" : page,
					"fan" : fan,
					"pcode" : pcode
		},
		dataType: "html",
		success	: function (res) {
			$(".gameDoc").html(res);
		},
		complete: function () {

		},
		error	: function (res) {
			$(".gameDoc").html (res.responseText);
		}
	});

	return false;
}

//=================================================================================================================================
// 선수 상세 페이지 이미지 보기
//=================================================================================================================================
function photoview(n,t)
{
	for (i=0; i<=t; i++){
		document.getElementById("bigPhoto" + i).style.display = "none";
	}
	document.getElementById("bigPhoto" + n).style.display = "";
}

//=================================================================================================================================
// 스포츠 코리아 조회수 증가
//=================================================================================================================================
function SportKoreaHitUp(mode,seq)
{
	var mode;
	var seq;
	
	jQuery.ajax ({
		type	: "POST",
		url		: "data_Proc_sportskorea.asp",
		data	: {
					"mode" : mode,
					"seq" : seq
		},
		success	: function (res) {
		},
		complete: function () {
		},
		error	: function (res) {
		}
	});

	return false;
}



function idblock(fg, id){
	UTIL.sesCheck();
	if(UID == "")
	{
		loginCheck ();
		return false;
	}

	if(UID.toLowerCase () == id.toLowerCase ()){
		alert("자기 자신은 요청하실수 없습니다.");
		return false;
	}
	hs.onDimmerClick = function() {
		return false;
	}

	$("#footer").append("<a id=\"tmpLnk\"></a>");
	$("#tmpLnk").attr("href","/fan/pop_whole.asp?pmode=E&fg=" + fg + "&id=" + id);
	var ele = document.getElementById("tmpLnk");
	hs.htmlExpand(ele,{objectType: 'iframe', width: 501, height: 437});
	$("#tmpLnk").remove();

}


function GalleryViewCount () {
	
}


function fgn_no_chksum(reg_no) {
    var sum = 0;
    var odd = 0;
    
    buf = new Array(13);
    for (i = 0; i < 13; i++) buf[i] = parseInt(reg_no.charAt(i));

    odd = buf[7]*10 + buf[8];

    if (odd%2 != 0) {
      return false;
    }

    if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9)) {
      return false;
    }
     
    multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
    for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]);


    sum=11-(sum%11);
    
    if (sum>=10) sum-=10;

    sum += 2;

    if (sum>=10) sum-=10;

    if ( sum != buf[12]) {
        return false;
    }
    else {
        return true;
    }
}


function snsTimeConvert(time,media){
	var ret = time;
	if(media == "F")
		ret = time.substr(0,4) + "년 " + time.substr(5,2) + "월 " + time.substr(8,2) + "일 " + time.substr(11,2) + ":" + time.substr(14,2);
	return ret;
}

var ipinWinp;
function ipinPopup(svrNo,url){
	var wl = (screen.width - 450) / 2;
	var wt = 200;
	var ipinWin = window.open('', 'IPINWindow', 'width=450, height=500, resizable=0, scrollbars=no, status=0, titlebar=0, toolbar=0, left=' + wl + ', top=' + wt);

	if(ipinWin == null){ 
		alert(" ※ 윈도우 XP SP2 또는 인터넷 익스플로러 7 사용자일 경우에는 \n    화면 상단에 있는 팝업 차단 알림줄을 클릭하여 팝업을 허용해 주시기 바랍니다. \n\n※ MSN,야후,구글 팝업 차단 툴바가 설치된 경우 팝업허용을 해주시기 바랍니다.");
	} else {
		ipinWin.focus();
	}
	$("#ipin_svrNo").val(svrNo);
	$("#ipin_returl").val(url);
	$("#ipinForm").attr("action","/include/ipin/current.asp");
	$("#ipinForm").attr("target","IPINWindow");
	$("#ipinForm").submit();

}

function bad_word_check(fldnm,word) {
	
	orgword = word.toLowerCase();
	awdrgy = 0;

	while (awdrgy <= BANWORD.length - 1) {

		if (orgword.indexOf(BANWORD[awdrgy]) > -1) {
			alert(fldnm + "에 금지어가 포함되어 있습니다.\n\n\"" + BANWORD[awdrgy] + "\"" + BANWORD[awdrgy].josa('은/는') + " 금지어입니다.");
			return false;
		}
		awdrgy++;
	}
	return true;
}

function RealNameCheck(id){
	hs.onDimmerClick = function() {
		return false;
	}

	$("#footer").append("<a id=\"tmpLnk\"></a>");
	$("#tmpLnk").attr("href","/member/pop_whole.asp?pmode=A&id=" + id);
	var ele = document.getElementById("tmpLnk");
	hs.htmlExpand(ele,{objectType: 'iframe', width: 501, height: 437});
	$("#tmpLnk").remove();
}

// 실시간 중계창
function popOnAir() {
	NewWindow('/onair/onair.asp', 'onair', 838, 760 ,'yes');
}

// 스크립트용 숫자함수
function FormatNumber (number, decimals, dec_point, thousands_sep) {
    number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
    var n = !isFinite(+number) ? 0 : +number,
        prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),        sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
        dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
        s = '',
        toFixedFix = function (n, prec) {
            var k = Math.pow(10, prec);            return '' + Math.round(n * k) / k;
        };
    // Fix for IE parseFloat(0.55).toFixed(0) = 0;
    s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
    if (s[0].length > 3) {        s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
    }
    if ((s[1] || '').length < prec) {
        s[1] = s[1] || '';
        s[1] += new Array(prec - s[1].length + 1).join('0');    }
    return s.join(dec);
}

