String.prototype.number_format=function(){
return this.replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1,');
}

String.prototype.trim = function() {
  return this.replace(/^\s+|\s+$/g, "");
}

String.prototype.strip_tags = function(){
	return this.replace(/<\/?[^>]+>/gi, '');
}

String.prototype.only_number = function(){
	return this.replace(/[^0-9\.]/gi, '');
}

String.prototype.only_number_dot = function(){
	return this.replace(/[^0-9\.]/gi, '');
}

String.prototype.only_eng_number = function(){
	return this.replace(/[^0-9A-Za-z]/gi, '');
}


function $(_str) {
	return document.getElementById(_str)?document.getElementById(_str):null;
}

function realOffset(_e) {
	var T = 0, L = 0;
	do {
		T += _e.offsetTop  || 0;
		L += _e.offsetLeft || 0;
		_e = _e.offsetParent;
	} while (_e);
	return [L, T];
}

function setCookie( name, value, expiredays ) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + ";Domain=.lottorich.co.kr; 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 "";
}

function closeWin(f) { 
	today = new Date() 
	if ( f.event_pop.checked )  {
    var open_time = 24 - today.getHours() ; 	
 		setCookie( "ars_event_pop", "done" , open_time);
	} else if (f.event_pop_month.checked) {
	  var open_time = 24 * 30;
	  setCookie( "ars_event_pop", "done" , open_time);
	}
	self.close(); 
}


function flashWrite( id, flashUri, vWidth, vHeight, winMode ) {
	var _obj_ = "";

 	_obj_ = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + vWidth + '" height="' + vHeight + '" id="' + id + '" align="middle">';
	_obj_ += '<param name="movie" value="' + flashUri + '" />';
	_obj_ += '<param name=allowScriptAccess value=always />';
	_obj_ += '<param name="quality" value="high" />';
	_obj_ += '<param name="wmode" value="' + winMode + '" />    ';
	_obj_ += '<param name="bgcolor" value="#ffffff" />        ';
	_obj_ += '<embed src="' + flashUri + '" quality="high" wmode="' + winMode + '" bgcolor="#ffffff" width="' + vWidth +'" height="' + vHeight + '" id="' + id + '" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>    ';
	_obj_ += '</object>';
	document.writeln( _obj_ );
}

function ACEF_Tracking (_url) {
	location.href (_url);
}

function overGnbBall (_type, _skin, _obj) {
	if (_type == 'over') {
		_obj.src = "http://image.lsinfo.co.kr/lottorich/gnb/ball_"+_skin+"_o.gif";
	} else {
		var gnb_skin = getCookie('gnb_skin');

		if (gnb_skin == _skin) {
			_obj.src = "http://image.lsinfo.co.kr/lottorich/gnb/ball_"+_skin+"_b.gif";
		} else {
			_obj.src = "http://image.lsinfo.co.kr/lottorich/gnb/ball_"+_skin+"_n.gif";
		}
	}

}

function chGnbSkin (_type) {
	var color = new Array;
	var skin = getCookie('gnb_skin')?getCookie('gnb_skin'):'green';
	gnb_skin = _type;

	color['green'] = '#2b8616';
	color['blue'] = '#2f6dc6';
	color['orange'] = '#ec5f12';
	color['yellow'] = '#e8a305';
	color['gray'] = '#656565';

	document.getElementById("skin_icon_" + skin).src = 'http://image.lsinfo.co.kr/lottorich/gnb/ball_' +  skin + '_n.gif';
	document.getElementById("skin_icon_" + _type).src = 'http://image.lsinfo.co.kr/lottorich/gnb/ball_' +  _type + '_b.gif';


	document.getElementById("gnb_wrap").style.backgroundImage = "url('http://image.lsinfo.co.kr/lottorich/gnb/" +  _type + "/background_topbg.gif')";
	for (var i = 0; i < document.getElementById('gnb').getElementsByTagName("IMG").length; i++) {
		document.getElementById('gnb').getElementsByTagName("IMG")[i].src = document.getElementById('gnb').getElementsByTagName("IMG")[i].src.replace('/' + skin + '/', '/' + _type + '/');
	}
	
	for (var i = 0; i < document.getElementById('gnb').getElementsByTagName("DIV").length; i++) {
		document.getElementById('gnb').getElementsByTagName("DIV")[i].style.backgroundImage = document.getElementById('gnb').getElementsByTagName("DIV")[i].style.backgroundImage.replace('/' + skin + '/', '/' + _type + '/');
	}

	if (document.getElementById('gnb_gold_ad')) {
		document.getElementById('gnb_gold_ad').src = document.getElementById('gnb_gold_ad').src.replace('/' + skin + '/', '/' + _type + '/');
	}

	if (document.getElementById('gnb_quick')) {
		for (var i = 0; i < document.getElementById('gnb_quick').getElementsByTagName("IMG").length; i++) {
			document.getElementById('gnb_quick').getElementsByTagName("IMG")[i].src = document.getElementById('gnb_quick').getElementsByTagName("IMG")[i].src.replace('/' + skin + '/', '/' + _type + '/');
		}
	}


	if (document.getElementById('loginbox')) {
		document.getElementById("loginbox").style.backgroundImage = document.getElementById("loginbox").style.backgroundImage.replace('/' + skin + '/', '/' + _type + '/');
	}

	if (document.getElementById('join_txt')) {
		document.getElementById('join_txt').style.color = color[_type];
	}

	if (document.getElementById('ipoint_txt')) {
		document.getElementById('ipoint_txt').style.color = color[_type];
	}

	if (document.getElementById('cash_txt')) {
		document.getElementById('cash_txt').style.color = color[_type];
	}

	if (document.getElementById('left_menu')) {
		for (var i = 0; i < document.getElementById('left_menu').getElementsByTagName("IMG").length; i++) {
			document.getElementById('left_menu').getElementsByTagName("IMG")[i].src = document.getElementById('left_menu').getElementsByTagName("IMG")[i].src.replace('/' + skin + '/', '/' + _type + '/');
		}

		for (var i = 0; i < document.getElementById('left_menu').getElementsByTagName("DIV").length; i++) {
			document.getElementById('left_menu').getElementsByTagName("DIV")[i].style.backgroundImage = document.getElementById('left_menu').getElementsByTagName("DIV")[i].style.backgroundImage.replace('/' + skin + '/', '/' + _type + '/');
		}
	}

	if (document.getElementById('foot')) {
		document.getElementById('foot').style.borderColor = color[_type];
	}

	document.getElementById('gnb_sub').className = _type;

	setCookie( 'gnb_skin', _type, 180);
}


function flylayerforie(){
	return document.documentElement.scrollTop + 100 + 'px';
}

function _flylayerforie(){
	return document.documentElement.scrollTop + 175 + 'px';
}



function f_login_submit(f) {
	f.userid.value = f.userid.value.trim();
	if (f.userid.value == '') {
		alert ('¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');
		f.userid.focus();
		return false;
	} else if (f.passwd.value == '') {
		alert ('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');
		f.passwd.focus();
		return false;
	} else {
		return true;
	}
}

function fill_cash(_aim) {

	var Param = window.location.search;
	Param	=	encodeURIComponent (Param.substr(1));
	if (_aim) {
	  window.open("/cash/fill_popup.html?aim=" + _aim + "&tsn="+Param, "cash_popup", 'width=450, height=350, fullscreen=no scrollbars=no, status=yes');
	} else {
	  window.open("/cash/fill_popup.html?aim=char&tsn="+Param, "cash_popup", 'width=450, height=350, fullscreen=no scrollbars=no, status=yes');
	}
}

function fill_cash2(_param) {
  if (_param == '') {
    return;
  } else {
    window.open("/cash/fill_popup2.html?" + _param, "cash_popup", 'width=400, height=380, fullscreen=no scrollbars=no, status=yes');
  }
}

function fill_cash2_ex(_param) {
  if (_param == '') {
    return;
  } else {
    window.open("/cash/fill_popup2_ex.html?" + _param, "cash_popup", 'width=400, height=380, fullscreen=no scrollbars=no, status=yes');
  }
}

function ch_ipont() {
  window.open("/cash/ch_ipoint.html", "cash_popup", 'width=442, height=350, fullscreen=no scrollbars=no, status=yes');
}

function login_pop() {
	//alert("·Î±×ÀÎ ÈÄ ÀÌ¿ëÇØ ÁÖ½Ã±â ¹Ù¸³´Ï´Ù.");
	window.open("/member/login_popup.html", "login_popup", 'width=390, height=340, fullscreen=no scrollbars=no, status=yes');
}