//**************************//************************************************
////
//    편집자 : 크룬
//
//************************************************
function openClub(userid)
{
	if(userid){
		var win = window.open("http://www.rushmusic.net/fanClub/fanClub.html?id="+userid, "fanClub_"+userid, "menubar=no, scrollbars=no, resizable=no, width=900, height=600");
		win.focus();
	}
}

function openSongInfo(fanClub_id,song_id)
{
	var win = window.open("http://www.rushmusic.net/fanClub/album/song_info.html?fanClub_id="+fanClub_id+"&song_id="+song_id, "songInfo", "menubar=no, scrollbars=yes, resizable=no, width=680, height=650");
	win.focus();
}




function sendMemo(userid)
{
	var win = window.open("/myRush/send_memo_win.html?userid="+userid, "sendMemo_"+userid, "menubar=no, scrollbars=no, resizable=no, width=350, height=450");
	win.focus();
}

function readMemo(id)
{
	var win = window.open("/myRush/memo_win.html?id="+id, "readMemo_"+id, "menubar=no, scrollbars=no, resizable=no, width=350, height=450");
	win.focus();
}

function readMemoOutbox(id)
{
	var win = window.open("/myRush/memo_outbox_win.html?id="+id, "readMemo_"+id, "menubar=no, scrollbars=no, resizable=no, width=350, height=450");
	win.focus();
}


function addList(song_id)
{

	process.location.href="/addList.html?song_id[]="+song_id;


}


function addCart(song_id)
{

	process.location.href="/addCart.html?song_id[]="+song_id;
	


}




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

function fullScreen(){
		window.open(location.href,'fullscreen','channelmode,scrollbars,')
		document.cookie="fullScreen=ok";
			if(window.name=="fullscreen"){
				opener.document.location.href=location.href;
				self.close();
				document.cookie="fullScreen=";
			}
}

function replace(str,text,by)
{
	var value;
	value = str.toString();

	var strLength=value.length, txtLength=text.length;
	if((strLength == 0) || (txtLength == 0)) return value;

	var z= value.indexOf(text);
	if((!z)&&(text !=value.substring(0,txtLength))) return value;
	if(z == -1) return value;

	var newstr = value.substring(0,z) + by;

	if(z+txtLength < strLength)
		newstr += replace(value.substring(z+txtLength,strLength),text,by);
		return newstr;
}
 


//************************************************
// 클릭시 1px 움직이게 하는 스크립트
//************************************************


function FX1px()
{
	var el = event.srcElement;
	while(el.tagName != "TD")
		el = el.parentElement;
	el.style.paddingTop = "1px";
}


function DeFX1px()
{
	var el = event.srcElement;
	while(el.tagName != "TD")
		el = el.parentElement;
	el.style.paddingTop = "0px";
}


//************************************************
// 에디터 관련 함수 
//************************************************

function playMultimediaFile(sUri,obj)
{
	var nPlayState = obj.getAttribute("isPlaying");
	if (nPlayState==0)
	{
		el = obj.previousSibling;
		while (el.tagName!="A")
			el = el.previousSibling;

		var oMedia = document.createElement("EMBED");
		oMedia.style.display = "block";
		oMedia.src = sUri;
		oMedia.autostart = true;
		obj.parentNode.appendChild(oMedia);

		obj.setAttribute("isPlaying",1);
	}
	else
	{
		alert("이미 재생중입니다");
		return;
	}
}




//************************************************
// ShowHide Layer
//************************************************

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function showHideLayers() {
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

//************************************************
// showRecomment (Copy from miniwini.com)
//************************************************

function showReCommentForm(s,s2,s3,s4,s5)
{
	alldivs = document.getElementsByTagName("DIV");

	for (i=0;i<alldivs.length;i++)
	{
		if (alldivs[i].id.indexOf("_recomment") > -1 && alldivs[i].id != s.id)
			alldivs[i].style.display = "none";
	}
	
	if (s.innerHTML == "")
	{
		comment_form.outerHTML = "";
        s.style.display = "";
       	s.innerHTML = org;
		document.all.add_Comment.grp.value = s2;
		document.all.add_Comment.depth.value = s3;
		document.all.add_Comment.grp_level.value = s4;
		document.all.add_Comment.reply.value = s5;
		document.all.add_Comment.isFirst.value = "no";
		document.all.add_Comment.comment.focus();
	}
	else
	{
		comment_form_container.innerHTML = org;
		s.style.display = "none";
		s.innerHTML = "";
		document.all.add_Comment.isFirst.value = "yes";
	}
}

var select_obj;


function layerAction(name,status) { 
		var obj=document.all[name];
		var _tmpx,_tmpy, marginx, marginy;
		_tmpx = event.clientX + parseInt(obj.offsetWidth);
		_tmpy = event.clientY + parseInt(obj.offsetHeight);
		_marginx = document.body.clientWidth - _tmpx;
		_marginy = document.body.clientHeight - _tmpy ;
		if(_marginx < 0)
			_tmpx = event.clientX + document.body.scrollLeft + _marginx ;
		else
			_tmpx = event.clientX + document.body.scrollLeft ;
		if(_marginy < 0)
			_tmpy = event.clientY + document.body.scrollTop + _marginy;
		else
			_tmpy = event.clientY + document.body.scrollTop ;
		obj.style.posLeft=_tmpx+1;
		obj.style.posTop=_tmpy+1;
		if(status=='visible') {
			if(select_obj) {
				select_obj.style.visibility='hidden';
				select_obj=null;
			}
			select_obj=obj;
		}else{
			select_obj=null;
		}
		obj.style.visibility=status; 
	}




//************************************************
// IMAGE FILTER
//************************************************

var startopacity = 50;

function fadeIt(obj,direct){ 
if(window.timer) {
clearInterval(timer);
} 
tobj=obj; drct=direct; 
timer=setInterval("flowfilter(tobj,drct);",20);
}

function flowfilter(thing,dct){
if(dct==1) {
if (thing.filters.alpha.opacity<100) {
thing.filters.alpha.opacity+=5;
}
else {
clearInterval(timer);
}
}
if(dct==2) {
if (thing.filters.alpha.opacity>startopacity) {
thing.filters.alpha.opacity-=5;
}
else {
clearInterval(timer);
}
}
}

//style="filter:alpha(opacity=50)" onMouseover="fadeIt(this,1)" onMouseout="fadeIt(this,2)" 


//************************************************
// 새창을 띄웠을때 컨텐츠사이즈에 맞게 창크기 조절
//************************************************

function main_fixWindow()
{
			if(document.all) { // IE 일 때
			var x = (document.body.scrollWidth > 1000) ? 1000 : document.body.scrollWidth;
			var y = (document.body.scrollHeight > 700) ? 700 : document.body.scrollHeight;
			x -= document.body.clientWidth;
			y -= document.body.clientHeight;
			window.resizeBy(x, y);
		} else { // NN 6++
			var x = (document.body.scrollWidth > 1000) ? 1000 : document.body.scrollWidth;
			var y = (document.body.scrollHeight > 700) ? 700 : document.body.scrollHeight;
			x += self.outerWidth - self.innerWidth;
			y += self.outerHeight - self.innerHeight;
			window.resizeTo(x, y);
			window.focus()
		}
}



/******************************
*  기능 :  문자열 Valid 검사처리 *
*  수정일 : 2002-01-25              *
*  parameter : string, space  *
*******************************/

function CheckValid(String, space)
{

   var retvalue = false;

   for (var i=0; i<String.length; i++)
   {		//String이 0("" 이나 null)이면 무조건 false
      if (space == true)
      {
         if (String.charAt(i) == ' ')
         {			//String이 0이 아닐때 space가 있어야만 true(valid)
            retvalue = true;
            break;
         }
      } else {
         if (String.charAt(i) != ' ')
         {			//string이 0이 아닐때 space가 아닌 글자가 있어야만 true(valid)
            retvalue = true;
            break;
         }
      }
   }

   return retvalue;
}

/******************************
*  기능 :  Empty 및 공백 처리    *
*  수정일 : 2002-01-25              *
*  parameter : field, error_msg  *
*******************************/

function isEmpty(field, error_msg)
{
	// error_msg가 ""이면 alert와 focusing을 하지 않는다
	if(error_msg == "") {
		if(!CheckValid(field.value, false)) 	{
			return true;
		} else {
			return false;
		}
	} else {
		if(!CheckValid(field.value, false)) {
			alert(error_msg);
			field.focus() ;
			return true;
		} else {
			return false;
		}
	}
}

function isNotSet(field, error_msg)
{ 
	//for hidden field....
	if(field.value == "")
	{
		alert(error_msg);
		return true;
	} else
	{
		return false;
	}
}

function haveSpace(field, error_msg)
{
	if(CheckValid(field.value, true))
	{
		alert(error_msg);
		field.focus();
		field.select();
		return true;
	}
	return false;
}


/******************************
*  기능 :  NumberCheck           *
*  수정일 : 2002-03-29(denial)              *
*  parameter : field, error_msg  *
*******************************/
function isNotNumber(field, error_msg)
{
	var val = field.value;

	if(isNaN(val) ) {
		if(error_msg.length > 0) {
			alert(error_msg);
			field.focus();
			field.select();
		}
		return true;
	} else {
		return false;
	}
}

/******************************
*  기능 :  NumberCheck And Empty Check
*  수정일 : 2002-04-02(denial)
*  parameter : field, error_msg
*******************************/
function isNotNumberOrEmpty(field, error_msg)
{
	var val = field.value;

	if(val.length == 0 || isNaN(val) ) {
		if(error_msg.length > 0) {
			alert(error_msg);
			field.focus();
			field.select();
		}
		return true;
	} else {
		return false;
	}
}

function alertAndFocus(field, error_msg)
{
	alert(error_msg);
	field.focus();
	field.select();
}

/***************************************
*  기능 : String 알파벳과 숫자만~ Check  *
*  수정일 : 2002-01-25                           *
*  parameter : Form                              *
****************************************/
function isNotAlphaNumeric(field,error_msg)
{

   for (var i=0; i < field.value.length; i++)
   {
      if ( ( (field.value.charAt(i) < "0") || (field.value.charAt(i) > "9") ) &&
           ( ( (field.value.charAt(i) < "A") || (field.value.charAt(i) > "Z") ) &&
             ( (field.value.charAt(i) < "a") || (field.value.charAt(i) > "z") ) ) )
	  {
         alert(error_msg);
		 field.focus();
		 field.select();
		 return true;
	   }
   }

   return false;
}

// 필드(String) 길이 관련
function strLength(field)
{

   var Length = 0;

   var Nav = navigator.appName;
   var Ver = navigator.appVersion;

   var IsExplorer = false;

   var ch;

   if ( (Nav == 'Microsoft Internet Explorer') && (Ver.charAt(0) >= 4) )
   {
      IsExplorer = true;
   }

   if(IsExplorer)
   {

      for(var i = 0 ; i < field.value.length; i++)
      {

         ch = field.value.charAt(i);

         if ((ch == "\n") || ((ch >= "ㅏ") && (ch <= "히")) ||
             ((ch >="ㄱ") && (ch <="ㅎ")))
		{
	    	Length += 2;
		} else
		{
	    	Length += 1;
       	}

	  }

   }else {
      Length = field.value.length ;
   }

   return Length;
}

/****************************************
*  기능 : 문자열 길이제한                          *
*  수정일 : 2002-01-25                              *
*  parameter : field, min, max, error_msg  *
*****************************************/
function isOutOfRange(field, min, max, error_msg)
{
	if(strLength(field) < min || strLength(field) > max)
	{
		alert(error_msg);
		field.focus();
		field.select();
		return true;
	}
	return false;
}

function isNotExactLength(field, len, error_msg) {
	if(strLength(field) != len) {
		alert(error_msg);
		field.focus();
		field.select();
		return true;
	}
	return false;
}

function isOutOfNumericRange(field, min, max, error_msg) {
	if(field.value < min || field.value > max) {
		alert(error_msg);
		field.focus();
		field.select();
		return true;
	}
	return false;
}
//---------------//


//------------------------------------- SELECT, CHECK BOX 관련 함수 -------------------------------
/****************************************
*  기능 :  Select Box 선택여부 검사            *
*  수정일 : 2002-01-25                              *
*  parameter : field, error_msg                  *
*****************************************/

function isNotSelected(field, error_msg) {
	if(field.selectedIndex == 0) {
		alert(error_msg);
		field.focus() ;
		return true;
	} else {
		return false;
	}
}

/******************************
*  기능 :  Radio Button Check    *
*  수정일 : 2002-01-25              *
*  parameter : field, error_msg  *
*******************************/
function isNotCheckedRadio(field, error_msg) {
	if ( field == null ) {
		alert(error_msg);
		return true;
	}

	if ( field.length == null ) {
		if ( field.checked == true ) {
			return false;
		} else {
			alert(error_msg);
			return true;
		}
	}

	for(i = 0; i < field.length; i++) {
		if(field[i].checked == true) {
			return false;
		}
	}
	alert(error_msg);
	return true;
}
//---------------//

/**
 * Radio Button을 선택해제한다
 */
function uncheckRadio(field) {
	for(i = 0; i < field.length; i++) {
		field[i].checked = false;
	}
}

/**
 * Radio Button의 선택된 값을 가져온다
 */
function getRadioVal(field) {
	for(i = 0; i < field.length; i++) {
		if(field[i].checked == true)
			return field[i].value;
	}
	return "";
}

//------------------------------------- 특정 필드 관련 함수 ---
function checkDupID(id)
{
	if(isEmpty(id, "ID를 기입해 주세요!")) return true;
	if(isNotAlphaNumeric(id,"ID는 4~10자 사이의 숫자 및 영문 대소문자로만 기입해 주세요!")) return true;
	//if(isOutOfRange(id,4, 10, "ID는 한글 2자~5자, 영문 4~10자 이내로 기입해 주세요!")) return true;
}

function checkName(name)
{
	if(isEmpty(name, "사용자명을 기입해 주세요!")) return true;
}

/*******************************
*  기능 : 비밀번호 Check            *
*  수정일 : 2002-01-25                *
*  parameter : Form                  *
*******************************/
function isNotValidPassword(form) {

	if(isEmpty(form.userpw,"패스워드를 입력해 주세요!")) return true;
	if(isEmpty(form.userrepw,"패스워드를 재입력해 주세요!")) return true;
	if(isNotAlphaNumeric(form.userpw,"비밀번호는 4~10자 사이의 숫자 및 영문 대소문자로만 기입해 주세요!")) return true;
	if(isNotAlphaNumeric(form.userrepw,"비밀번호는 4~10자 사이의 숫자 및 영문 대소문자로만 기입해 주세요!")) return true;
	if(isOutOfRange(form.userpw, 4, 10, "비밀번호는 4~10자 사이의 숫자 및 영문 대소문자로만 기입해 주세요!")) return true;
	if(isOutOfRange(form.userrepw, 4, 10, "비밀번호는 4~10자 사이의 숫자 및 영문 대소문자로만 기입해 주세요!")) return true;
	if(form.userpw.value != form.userrepw.value) {
		alert("비밀번호가 서로 일치하지 않습니다.\n다시 입력해 주세요!");
		form.userpw.value="";
		form.userrepw.value="";
		form.userpw.focus();
		form.userpw.select();
		return true;
	}
	return false;
}

/******************************
*  기능 : 주민등록번호 Check     *
*  수정일 : 2002-01-25               *
*  parameter : Form                  *
*******************************/
function isNotValidPID(form) {

	if(isEmpty(form.jumin1,"주민등록번호를 입력해 주세요!")) return true;
	if(isEmpty(form.jumin2,"주민등록번호를 입력해 주세요!")) return true;
	if(isNotNumber(form.jumin1,"주민등록번호 앞자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotNumber(form.jumin2,"주민등록번호 뒷자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotExactLength(form.jumin1, 6, "주민등록번호 앞자리는 6자리입니다!")) return true;
	if(isNotExactLength(form.jumin2, 7, "주민등록번호 뒷자리는 7자리입니다!")) return true;
	strchr = form.jumin1.value.concat(form.jumin2.value);
	if (strchr.length == 13	) {
		nlength = strchr.length;

		num1 = strchr.charAt(0);
		num2 = strchr.charAt(1);
		num3 = strchr.charAt(2);
		num4 = strchr.charAt(3);
		num5= strchr.charAt(4);
		num6 = strchr.charAt(5);
		num7 = strchr.charAt(6);
		num8 = strchr.charAt(7);
		num9 = strchr.charAt(8);
		num10 = strchr.charAt(9);
		num11 = strchr.charAt(10);
		num12 = strchr.charAt(11);

		var total = (num1*2)+(num2*3)+(num3*4)+(num4*5)+(num5*6)+(num6*7)+(num7*8)+(num8*9)+(num9*2)+(num10*3)+(num11*4)+(num12*5);
		total = (11-(total%11)) % 10;
	//	if (total == 11) total = 1;
	//	if (total == 10) total = 0;

		if(total != strchr.charAt(12)) {
			alert("주민등록번호가 올바르지 않습니다. \n다시 입력해 주세요!");
			form.jumin1.value="";
			form.jumin2.value="";
			form.jumin1.focus();
			return true;
		}
		return false;
	}	else
		alert("주민등록번호가 올바르지 않습니다. \n다시 입력해 주세요!");
		form.jumin1.value="";
		form.jumin2.value="";
		form.jumin1.focus();
		return true;
}
/******************************
*  기능 : 사업자등록번호 Check  *
*  수정일 : 2002-01-25               *
*  parameter : Form                  *
*******************************/
function isNotValidBID(form) {

	if(isEmpty(form.bid1,"사업자등록번호를 입력해 주세요!")) return true;
	if(isEmpty(form.bid2,"사업자등록번호를 입력해 주세요!")) return true;
	if(isEmpty(form.bid3,"사업자등록번호를 입력해 주세요!")) return true;
	if(isNotNumber(form.bid1,"사업자등록번호 앞자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotNumber(form.bid2,"사업자등록번호 가운데자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotNumber(form.bid3,"사업자등록번호 뒷자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotExactLength(form.bid1, 3, "사업자등록번호 앞자리는 3자리입니다!")) return true;
	if(isNotExactLength(form.bid2, 2, "사업자등록번호 뒷자리는 2자리입니다!")) return true;
	if(isNotExactLength(form.bid3, 5, "사업자등록번호 뒷자리는 5자리입니다!")) return true;
	strchr = form.bid1.value.concat(form.bid2.value.concat(form.bid3.value));

	num1 = strchr.charAt(0);
	num2 = strchr.charAt(1);
	num3 = strchr.charAt(2);
	num4 = strchr.charAt(3);
	num5= strchr.charAt(4);
	num6 = strchr.charAt(5);
	num7 = strchr.charAt(6);
	num8 = strchr.charAt(7);
	num9 = strchr.charAt(8);
	num10 = strchr.charAt(9);

	var total = (num1*1)+(num2*3)+(num3*7)+(num4*1)+(num5*3)+(num6*7)+(num7*1)+(num8*3)+(num9*5);
	total = total + ((num9 * 5) / 10);
	var tmp = total % 10;
	if(tmp == 0) {
		var num_chk = 0;
	} else {
		var num_chk = 10 - tmp;
	}

	if(num_chk != num10) {
		alert("사업자등록번호가 올바르지 않습니다. \n다시 입력해 주세요!");
		form.bid1.value="";
		form.bid2.value="";
		form.bid3.value="";
		form.bid1.focus();
		return true;
	}
	return false;
}
/******************************
*  기능 :  E-Mail Check            *
*  수정일 : 2002-01-25              *
*  parameter : field, error_msg  *
*******************************/
function isNotValidEmail(field)
{
   var checkflag = true;
   var retvalue;

   if(field.value == "") {
	   retvalue = true;
   } else {

	   if (window.RegExp) {
		  var tempstring = "a";
		  var exam = new RegExp(tempstring);
		  if (tempstring.match(exam)) {
			 var ret1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
			 var ret2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			 retvalue = (!ret1.test(field.value) && ret2.test(field.value));
		  } else {
			 checkflag = false;
		  }
	   } else {
		  checkflag = false;
	   }

	   if (!checkflag) {
		  retvalue = ( (field.value != "") && (field.value.indexOf("@")) > 0 && (field.value.index.Of(".") > 0) );
	   }

   }
   if(retvalue) { return false;
   } else {
		alert("이메일 주소가 정확하지 않습니다. \n다시 입력해 주세요!");
		field.focus();
		field.select();
		return true;
   }
}

/******************************
*  기능 :  TelNumber Check      *
*  수정일 : 2002-01-25              *
*  parameter : field, error_msg  *
*******************************/
function isNotValidTel(field) {

   var Count;
   var PermitChar =
         "0123456789-";

   for (var i = 0; i < field.value.length; i++) {
      Count = 0;
      for (var j = 0; j < PermitChar.length; j++) {
         if(field.value.charAt(i) == PermitChar.charAt(j)) {
            Count++;
            break;
         }
      }

      if (Count == 0) {
         alert("전화번호가 정확하지 않습니다. \n다시 입력해 주세요!")
		 field.focus();
		 field.select();
		 return true;
         break;
      }
   }
   return false;
}
//---------------//


function isNotValidChar(field,error_msg) {

   var Count;
   var PermitChar = "0123456789-";  // 허용가능한 문자들을 모두 기록한다.

   for (var i = 0; i < field.value.length; i++) {
      Count = 0;
      for (var j = 0; j < PermitChar.length; j++) {
         if(field.value.charAt(i) == PermitChar.charAt(j)) {
            Count++;
            break;
         }
      }

      if (Count == 0) {
         alert(error_msg);
		 field.focus();
		 field.select();
		 return true;
         break;
      }
   }
   return false;
}

function isNotValidChar2(field,error_msg) {

   var NotPermitChar = "\"";  //허용되어서는 안되는 문자들을 모두 기록한다.
//   var NotPermitChar = "<>\"^&|'\\ ";  //허용되어서는 안되는 문자들을 모두 기록한다.

   if(field.value == "") return false;
   for (var i = 0; i < field.value.length; i++) {
      for (var j = 0; j < NotPermitChar.length; j++) {
         if(field.value.charAt(i) == NotPermitChar.charAt(j)) {
            ans = confirm(error_msg);
			if(ans == true) {
				return false;
			} else {
				field.focus();
				field.select();
				return true;
			}
         }
      }
   }
   return false;
}

function auto_fill_birth(pid1) {

	var year = pid1.value.substr(0,2);
	var month = pid1.value.substr(2,2);
	var date = pid1.value.substr(4,2);
	document.forms[0].year.value = year;
	document.forms[0].month.value = month;
	document.forms[0].date.value = date;

}

function hide_in(field) {
	if(field.value == field.defaultValue) field.value = "";
}
function show_out(field) {
	if(field.value == "") field.value = field.defaultValue;
}

function checkNumber(objname)
{
	var intErr = 1;
	var strValue = objname.value;
	var retCode = 0;

	for(i = 0; i < strValue.length; i++)
	{
		var retCode = strValue.charCodeAt(i);
		var retChar = strValue.substr(i, 1).toUpperCase();

		retCode = parseInt(retCode);

		// "3.4"도 숫자이다.
		if(!((retChar >= "0" && retChar <= "9") || retChar == "."))
		{
			intErr = 0; // break;
		}
	}

	var periodCnt = 0;

	while(strValue.indexOf(".") != -1)
	{
		periodCnt++;

		strValue = strValue.substr(strValue.indexOf(".") + 1, strValue.length - (strValue.indexOf(".") + 1));
	}

	// "3..4"는 숫자가 아니다.
	if(periodCnt > 1)
		intErr = 0;

	if (intErr!=1)
	{
		return true;
	}
	else return false;
}

/*function CheckID_onSubmit(form)
{
	if (form.id.value.length < 4 || form.id.value.length > 10 ||
	      IsAlphaNumeric(form.id.value) == false)
	{
	    alert("이용자ID는 영문과 숫자의 조합으로 4-10자리내에서 입력하십시오. \n한글, 띄어쓰기는 안됩니다! ");
	    form.id.focus();
	    return (false);
	}
	return (true);
}*/

/**
 * <PRE>
 * Scroll 이 없는 새 창을 띄운다
 * </PRE>
 * @param   theURL : 새로 띄울 파일 이름이다
 * @param   winName : 새창 이름
 * @param   winTitle : 새창 title
 * @param	width : 새창 가로 크기
 * @param	height : 새창 세로 크기
 * @param   param : 추가적인 화면 argument
 */
function openNoScrollWin(theURL, winName, winTitle, width, height, param)
{
	var win = window.open(theURL , winName, "menubar=no, scrollbars=no, resizable=no, width=" + width + ", height=" + height);
}

/**
 * <PRE>
 * Scroll 이 없는 새 창을 띄운다
 * </PRE>
 * @param   theURL : 새로 띄울 파일 이름이다
 * @param   winName : 새창 이름
 * @param   winTitle : 새창 title
 * @param	width : 새창 가로 크기
 * @param	height : 새창 세로 크기
 * @param   param : 추가적인 화면 argument
 */
function openScrollWin(theURL, winName, winTitle, width, height, param)
{
	var win = window.open(theURL , winName, "menubar=no, scrollbars=yes, resizable=no, width="+width+", height="+height) ;
}

/**
 * <PRE>
 * 제약이 없는 새 창 띄우기를 하자
 * </PRE>
 * @param   theURL : 새로 띄울 파일 이름이다
 * @param   winName : 새창 이름
 * @param   winTitle : 새창 title
 * @param	width : 새창 가로 크기
 * @param	features : 다양한 모양을 직접 준다
 * @param   param : 추가적인 화면 argument
 */
function openFlexWin(theURL,winName,winTitle, width, features, param)
{
	var win = window.open(theURL + "?popupTitle=" + winTitle + "&tableWidth=" + width + param,winName,features);
}



///////////////////// Calendar ///////////////////////////

/* 날짜만 입력해야할 때 */
function showDateCalendar(dateField)
{
	var wid = (screen.width)/2 - 560/2 ;
	var hei = (screen.height)/2 - 480/2;
	
	window.open("/common/calendar/PopCalendar.jsp?popupTitle=달력&type=date&dateField=" + dateField, "Calendar", "width=560,height=480,status=no,resizable=no,top="+hei+",left="+wid+"");
}
/* 날짜만 입력해야할 때 -- 그리드
dateField = "gridName, row, col" */
function showDateCalendarGrid(dateField)
{
	var wid = (screen.width)/2 - 560/2 ;
	var hei = (screen.height)/2 - 480/2;
	window.open("/common/calendar/PopCalendar.jsp?type=date&subType=grid&dateField=" + dateField, "Calendar", "width=560,height=480,status=no,resizable=no,top="+hei+",left="+wid+"");
}
/* 날짜와 시간 모두들 입력해야할 때 */
function showDateTimeCalendar(dateField, timeField)
{
	var wid = (screen.width)/2 - 560/2 ;
	var hei = (screen.height)/2 - 480/2;
	window.open("/common/calendar/PopCalendar.jsp?type=datetime&dateField=" + dateField + "&timeField=" + timeField, "Calendar", "width=560,height=480,status=no,resizable=no,top="+hei+",left="+wid+"");
}


/**
 * <PRE>
 * 특정 필드에 대한 수정을 막는 행위
 * </PRE>
 * @param   objectName : 수정을 중지시킬 필드객체.(주로 input type)
 */
function editStop(objectName) {
	objectName.blur();
}

/**
 * 숫자나 문자열을 통화(Money) 형식으로 만든다.( 쉼표(,) 찍는다는 소리.. )
 * @param	amount	"1234567"
 * @return	currencyString "1,234,567"
 */
function formatCurrency(amount)
{
	amount = new String(amount);
	var amountLength = amount.length;
	var modulus = amountLength % 3;
	var currencyString = amount.substr(0,modulus);
	for(i=modulus; i<amountLength; i=i+3) {
		if(currencyString != "") 
			currencyString += ",";
		currencyString += amount.substr(i, 3);
	}
	return currencyString;
}

///////////////////// LotteMRO Specific Functions ///////////////////////////
/**
 * 아이템 수량별 할인가를 반환한다(수량별 할인가 정보가 없을 경우 기본가 반환)
 *
 * @param	arrDiscount	수량별 할인가 배열
 * @param	qty	수량
 * @param	defaultSellPrice	기본 가격
 * @return	discountPrice	할인가
 */
function calcDiscountPrice(arrDiscount, qty, defaultSellPrice)
{
	var discountPrice = defaultSellPrice;
	var prevQty = 0;

	for( i=0; i<arrDiscount.length; i++ ) {
		if(qty >= prevQty && qty < arrDiscount[i][0]) {
			break;
		} else {
			discountPrice = arrDiscount[i][1];
			prevQty = arrDiscount[i][0];
		}
	}
	
	return discountPrice;
}
/**
 * 아이템 판매가를 반환한다(수량별 할인가 정보가 없을 경우 기본가 반환)
 *
 * @param	arrDiscount	수량별 할인가 배열
 * @param	qty	수량
 * @param	defaultSellPrice	기본 가격
 * @param	addedPrice	옵션으로 인해 추가된 가격(옵션가 총합)
 * @return	판매가
 */
function calcSellPrice(arrDiscount, qty, defaultSellPrice, addedPrice)
{
	return (calcDiscountPrice(arrDiscount, qty, defaultSellPrice) + addedPrice) * qty;
}
/**
 * 아이템 원가를 반환한다
 *
 * @param	defaultPrimeCost	기본 가격
 * @param	addedPrice	옵션으로 인해 추가된 가격(옵션가 총합)
 * @return	원가
 */
function calcPrimeCost(defaultPrimeCost, addedPrice)
{
	return defaultPrimeCost + addedPrice;
}

/*
 * 사업자 등록 번호를 검사한다.
 */
function isNotValidBIZ(form) {

	if(isEmpty(form.bizregno1,"사업자등록번호를 입력해 주세요!")) return true;
	if(isEmpty(form.bizregno2,"사업자등록번호를 입력해 주세요!")) return true;
	if(isEmpty(form.bizregno3,"사업자등록번호를 입력해 주세요!")) return true;
	if(isNotNumber(form.bizregno1,"사업자등록번호 앞자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotNumber(form.bizregno2,"사업자등록번호 가운데자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotNumber(form.bizregno3,"사업자등록번호 뒷자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotExactLength(form.bizregno1, 3, "사업자등록번호 앞자리는 3자리입니다!")) return true;
	if(isNotExactLength(form.bizregno2, 2, "사업자등록번호 뒷자리는 2자리입니다!")) return true;
	if(isNotExactLength(form.bizregno3, 5, "사업자등록번호 뒷자리는 5자리입니다!")) return true;
	strchr = form.bizregno1.value.concat(form.bizregno2.value.concat(form.bizregno3.value));

	num1 = strchr.charAt(0);
	num2 = strchr.charAt(1);
	num3 = strchr.charAt(2);
	num4 = strchr.charAt(3);
	num5 = strchr.charAt(4);
	num6 = strchr.charAt(5);
	num7 = strchr.charAt(6);
	num8 = strchr.charAt(7);
	num9 = strchr.charAt(8);
	num10 = strchr.charAt(9);

	var total = (num1*1)+(num2*3)+(num3*7)+(num4*1)+(num5*3)+(num6*7)+(num7*1)+(num8*3)+(num9*5);
	total = total + ((num9 * 5) / 10);
	var tmp = total % 10;
	if(tmp == 0) {
		var num_chk = 0;
	} else {
		var num_chk = 10 - tmp;
	}

	if(num_chk != num10) {
		alert("사업자등록번호가 올바르지 않습니다. \n다시 입력해 주세요!");
		form.bizregno1.value="";
		form.bizregno2.value="";
		form.bizregno3.value="";
		form.bizregno1.focus();
		return true;
	}
	return false;
}

/**
 * Confirm창을 띄우고 "예"이면 false를 "아니오"이면 true를 리턴한다
 * (JSP 사용예 : if(didNotConfirm("주문을 취소하시겠습니까?")) return;)
 */
function didNotConfirm(question) {
	return !confirm(question);
}

/**
 * 검색어가 입력되는 FORM element를 초기화 한다.
 * 
 * @param	검색어 입력 FORM
 */
function doInit(frm)
{
	for (i = 0; i < frm.elements.length; i++)
	{
		frm.elements[i].value = "";
	}
}

/******************************
*  기능 :  Positive NumberCheck           *
*  수정일 : 2002-04-10(withsun)              *
*  parameter : field, error_msg  *
*******************************/
function isNotPositiveNumber(field, error_msg)
{
   for (var i=0; i < field.value.length; i++)
   {
      if ( field.value.charAt(i) < "1" || field.value.charAt(i) > "9" )
	  {
         alert(error_msg);
		 field.focus();
		 field.select();
		 return true;
	   }
   }
}


/**
 * ENTER키 다운 되었을때 넘겨받은 Function실행
 *
 * @param	func	실행할 Function명
 */
function enterKeyDown(func)
{
	enter = event.keyCode;
	if(enter == 13)
	{
		eval(func);
	}

}

/**
 * 특정키 다운 되었을때 넘겨받은 Function실행
 *
 * @param	func	실행할 Function명
 */
function keyDown(func)
{
	enter = event.keyCode;
	if(enter == 13)
	{
		eval(func);
	}

}


/**
 * 주언진 8자리 문자열을 날짜포맷(YYYY-MM-DD or YYYY/MM/DD)로 바꾸어준다.
 *
 * @param	source		변환할 8자리 날짜문자열
 * @param	format		날짜형식
 * @return	ret			변환된 날짜 문자열
 **/
function dateFormat(source, format)
{
	ret = "";
	delimiter = "";

	if (format.indexOf("-") != -1)
		delimiter = "-";
	else if (format.indexOf("/") != -1)
		delimiter = "/";
	else
	{
		alert("입력된 날짜포맷이 잘못되었습니다.");
		return;
	}

	if (source.length == 8)
	{
		ret = source.substring(0, 4) + delimiter + source.substring(4, 6) + delimiter + source.substring(6, 8);
	} else if (source.length == 10)
	{
		ret = source.substring(0, 4) + delimiter + source.substring(5, 7) + delimiter + source.substring(8, 10);
	} else
	{
		alert("입력된 날짜형식이 잘못되었습니다.");
		return;
	}
	return ret;
}

/**
 * 날짜형식이 올바른지 검사
 *
 * @param	astrValue	날짜포맷(yyyymmdd, yyyy/mm/dd, yyyy-mm-dd)
 * @param	astrNotNull:	nn:not null, "": null 허용
 * @return	true/false
 **/
function blnOkDate(astrValue, astrNotNull)
{
	var arrDate;
	
	if (astrValue=='')
	{
		if (astrNotNull == "nn")
			return false;
		else
			return true;
	}else{	
		if (astrValue.indexOf("-") != -1) 
			arrDate = astrValue.split("-");
		else if (astrValue.indexOf("/") != -1) 
			arrDate = astrValue.split("/");
		else
		{
			if (astrValue.length != 8) return false;
			astrValue = astrValue.substring(0,4)+"/"+astrValue.substring(4,6)+"/" +astrValue.substring(6,8);
			arrDate = astrValue.split("/");
		}
	
		if (arrDate.length != 3) return false;		
		
		var chkDate = new Date(arrDate[0] + "/" + arrDate[1] + "/" + arrDate[2]);		
		if (isNaN(chkDate) == true ||
			(arrDate[1] != chkDate.getMonth() + 1 || arrDate[2] != chkDate.getDate())) 
		{
			return false;
		}
	}
	return true;
}


/**
 * 그리드 날짜 셀에서 날짜를 입력받고서 유효한지 체크(yyyymmdd or yyyy-mm-dd or yyyy/mm/dd)후 틀리면 Calendar Popup
 *
 * @param	fgName	그리드객체명
 * @param	row		행수
 * @param	col		열수
 **/
function openCalendarInGrid(fgName, row, col)
{
	var fg = document.all(fgName);
	if (!blnOkDate(fg.TextMatrix(row, col), "nn"))
	{
		fg.TextMatrix(row, col) = "";
		showDateCalendarGrid(fgName + ", " + row + ", " + col);
	}
	else
		fg.TextMatrix(row, col) = dateFormat(fg.TextMatrix(row, col), "YYYY-MM-DD");

}

/**
 * INPUT field에서 날짜를 입력받고서 유효한지 체크(yyyymmdd or yyyy-mm-dd or yyyy/mm/dd)후 틀리면 Calendar Popup
 *
 * @param	field	INPUT 객체
 **/
function openCalendar(dateField)
{
	var obj = eval("document." + dateField);
	if (!blnOkDate(obj.value, "nn"))
	{
		obj.value = "";
		showDateCalendar(dateField);
	}
	else
		obj.value = dateFormat(obj.value, "YYYY-MM-DD");

}

/**
 * 문자열내에 있는 ', "를 \', \" 로변환한다.
 *
 * @param	str	변환할 문자열
 **/
function toValidStr(str)
{
	/*
	alert(str);
	var ret = "";
	for (i = 0; i < str.length; i++)
	{
		if (str.charAt(i) == '\'')
			ret += '\\\'';
		else if (str.charAt(i) == '"')
			ret += '\\\"';
		else
			ret += str.charAt(i);
	}
	*/

	re1 = /\'/gi;
	re2 = /\"/gi;
	str = str.replace(re1, "\\\'");
	str = str.replace(re2, "\\\""); 
	return str;	
	
}

function encChar(str)
{
	var temp1 = "@@@@@";
	re1 = /\'/g;
	re2 = /\"/g;
	str = str.replace(re1, temp1);
	return str;
}	

function decChar(str)
{
	re3 = /@@@@@/g;
	str = str.replace(re3, "'");
	return str;
}


// system의 현재날짜를 return: yyyymmdd
function strGetToDay()
{
 	 var today=new Date();
 	 
 	 var strToDay = today.getYear();
 	 
 	 if (today.getMonth()+1 < 10)
 	 	strToDay += "-0"+(today.getMonth()+1);
 	 else
 	 	strToDay += "-" + today.getMonth()+1;
 	 
 	 if (today.getDate() < 10)
 	 	strToDay += "-0"+today.getDate();
 	 else
 	 	strToDay += "-" + today.getDate();
 	 	
 	 return strToDay; 	 	 
}

//주어진 값(val)을 소수점이하 num자리수에서 반올림한값을 리턴한다.
function round(val, num)
{
	val = val * Math.pow(10, num - 1);
	val = Math.round(val);
	val = val / Math.pow(10, num - 1);
	return val;
}


function isVaildMail(email)
{
     var result = false;

     if( email.indexOf("@") != -1 )
     {
          result = true;

          if( email.indexOf(".") != -1 )
          {
               result = true;
          }
          else
          {
               result = false;
          }
     }
     return result;
}



function isLoginname(obj) {
    len = obj.value.length;
    ret = true;

    if (len < 4)
		return false;
    if(!((obj.value.charAt(0) >= "a" && obj.value.charAt(0) <= "z") ||
       (obj.value.charAt(0) >= "A" && obj.value.charAt(0) <= "Z")))
		ret = false;		
    for (i = 1; i < len; i++) {
		if((obj.value.charAt(i) >= "0" && obj.value.charAt(i) <="9") ||
		   (obj.value.charAt(i) >= "a" && obj.value.charAt(i) <= "z") ||
		   (obj.value.charAt(i) >= "A" && obj.value.charAt(i) <= "Z"))
		    ;
		else 
		    ret = false;
    }
    return ret;
		   
}


//특정 필드값에 대해서 끝자리를 10단위로  전환
function roundValue(field) {

  field.value = Math.round(eval(field.value)/10) * 10

}

/*
 * 사업자 등록 번호를 검사한다.
 */
function isNotValidBIZNo(form) {
	
	if(isEmpty(form.site_serial1,"사업자등록번호를 입력해 주세요!")) return true;
	if(isEmpty(form.site_serial2,"사업자등록번호를 입력해 주세요!")) return true;
	if(isEmpty(form.site_serial3,"사업자등록번호를 입력해 주세요!")) return true;
	if(isNotNumber(form.site_serial1,"사업자등록번호 앞자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotNumber(form.site_serial2,"사업자등록번호 가운데자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotNumber(form.site_serial3,"사업자등록번호 뒷자리는 숫자로만 기입해 주세요!")) return true;
	if(isNotExactLength(form.site_serial1, 3, "사업자등록번호 앞자리는 3자리입니다!")) return true;
	if(isNotExactLength(form.site_serial2, 2, "사업자등록번호 뒷자리는 2자리입니다!")) return true;
	if(isNotExactLength(form.site_serial3, 5, "사업자등록번호 뒷자리는 5자리입니다!")) return true;
	strchr = form.site_serial1.value.concat(form.site_serial2.value.concat(form.site_serial3.value));

	num1 = strchr.charAt(0);
	num2 = strchr.charAt(1);
	num3 = strchr.charAt(2);
	num4 = strchr.charAt(3);
	num5 = strchr.charAt(4);
	num6 = strchr.charAt(5);
	num7 = strchr.charAt(6);
	num8 = strchr.charAt(7);
	num9 = strchr.charAt(8);
	num10 = strchr.charAt(9);

	var total = (num1*1)+(num2*3)+(num3*7)+(num4*1)+(num5*3)+(num6*7)+(num7*1)+(num8*3)+(num9*5);
	total = total + parseInt((num9 * 5) / 10);
	var tmp = total % 10;

	if(tmp == 0) {
		var num_chk = 0;
	} else {
		var num_chk = 10 - tmp;
	}

	if(num_chk != num10) {
		alert("사업자등록번호가 올바르지 않습니다. \n다시 입력해 주세요!");
		form.site_serial1.value="";
		form.site_serial2.value="";
		form.site_serial3.value="";
		form.site_serial1.focus();
		return true;
	}
	return false;
}
// Main 에서 날짜와 요일을 보여준다. return :ex) 2004년 8월 20일 (금요일) 
function getMainDateViewStr() {
	view_today = new Date();
	var count_day = view_today.getDay();
	var view_week;
	if      ( count_day ==0 ) view_week ="일";
	else if ( count_day ==1 ) view_week ="월";
	else if ( count_day ==2 ) view_week ="화";
	else if ( count_day ==3 ) view_week ="수";
	else if ( count_day ==4 ) view_week ="목";
	else if ( count_day ==5 ) view_week ="금";
	else if ( count_day ==6 ) view_week ="토";
	return view_today.getYear() + "년 " + (view_today.getMonth()+1) + "월 " + view_today.getDate()+"일 (" + view_week + "요일)";
} 

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


// 인풋박스 텍스트 없애기
function sc(obj){
 if(obj.value==obj.defaultValue) obj.value="";
}
// 인풋박스 defaultValue 보이기

function sb(obj){
 if(!obj.value) obj.value=obj.defaultValue;
}

 function swapImgRestore() { //v3.0 
 	 var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
}

function autotab(original, destination) 
{
	if (original.getAttribute && original.value.length == original.getAttribute("maxlength"))
	destination.focus()
}



function outputMoney(num_str){ 

	var t_align = "right"; // 텍스트 필드 정렬
	var t_num = num_str.value.substring(0,1); // 첫글자 확인 변수
	var num =  /^[/,/,0,1,2,3,4,5,6,7,8,9,/]/; // 숫자와 , 만 가능
	var cnjValue = ""; 
	var cnjValue2 = "";

	if (!num.test(num_str.value))   {
	//alert('숫자만 입력하십시오.\n\n특수문자와 한글/영문은 사용할수 없습니다.');
	num_str.value="";
	num_str.focus();
	return false;
	}

	if ((t_num < "0" || "9" < t_num)){
	alert("숫자만 입력하십시오.");
	num_str.value="";
	num_str.focus();
	return false;
	} 

	for(i=0; i<num_str.value.length; i++)  {   
	if(num_str.value.charAt(num_str.value.length - i -1) != ",") { 
	cnjValue2 = num_str.value.charAt(num_str.value.length - i -1) + cnjValue2; 
	} 
	} 

	for(i=0; i<cnjValue2.length; i++) { 

	if(i > 0 && (i%3)==0) { 
	cnjValue = cnjValue2.charAt(cnjValue2.length - i -1) + "," + cnjValue; 
	 } else { 
	cnjValue = cnjValue2.charAt(cnjValue2.length - i -1) + cnjValue; 
	} 
	} 
	num_str.value = cnjValue;
	num_str.style.textAlign = t_align;

}

function swf(src,w,h,wmode){
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';
	html += '<param name="bgcolor" value="#ffffff">';
	html += '<param name="menu" value="false">';
	html += '<param name="wmode" value="'+wmode+'">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'" height="'+h+'" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
	html += '<\/object>';
	return html;
}

function moveNext (num, from, to) {
	var len = from.value.length;
	if (len == num)
		to.focus ();
}

function onlyNum(field){
	var val = field.value;

	if(isNaN(val) ) {

		alert("숫자만 입력이 가능합니다");
		return false;
	} 
}








function setCookie(name, value, expiredays)
{
	var today = new Date();
	today.setDate(today.getDate() + expiredays);
	document.cookie = name + "=" + escape(value) + ";path=/;expires=" + today.toGMTString() + ";";
}


function getCookie(name)
{
	var x = 0;
	var nameOfCookie = name + "=";
	
	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 GetToday()
{
	var today = new Date();
	var yy = today.getYear(); 
	var mm = today.getMonth() + 1; 
	var dd = today.getDate(); 
	
	return yy + "." + mm + "." + dd;
}


/*

브라우저 종류를 무시한채 내용만으로 크기 정할수있는 함수 body onload="buildWH()" 가 들어가야한다

*/

 function setWH(){
    if (document.all){
    cW=document.body.offsetWidth
    cH=document.body.offsetHeight
    window.resizeTo(500,500)
    barsW=500-document.body.offsetWidth
    barsH=500-document.body.offsetHeight
    wW=barsW+cW
    wH=barsH+cH
    window.resizeTo(wW,wH)
    }
    else
    {
    wW=window.outerWidth
    wH=window.outerHeight
    }
    topW = wW;
    topH = wH;
    }
  
  function buildWH() {
   setWH();
   topW = topW - document.body.clientWidth;
   topH = topH - document.body.clientHeight;
  }

  function resizeWH(width,height) {
    reW = width + topW;
    reH = height + topH;
    window.resizeTo(reW,reH);
  }




function fImgSize(targetImg,wsize,hsize) //그림의 이미지 사이즈 구하기. 
{ 
	var imgw; 
	var imgh; 
	var timgw; 
	var timgh; 
	var divImg; 
	var newImg = new Image(); 

	newImg.src = targetImg; 
	imgw = newImg.width; 
	imgh = newImg.height; 

	if (imgw <= wsize && imgh <= hsize ) { // 사이즈가 공간 보다 크면 같은 비율로 줄여서 보여 준다. 
	divImg = ""; 
	}else if (imgw > wsize && imgh <= hsize) { 
	timgw = wsize; 
	timgh = (wsize / imgw) * imgh; 
	divImg = ""; 
	}else if (imgw <= wsize && imgh > hsize) { 
	timgw = (hsize / imgh) * imgw; 
	timgh = hsize; 
	divImg = ""; 
	}else if (imgw > wsize && imgh > hsize) { 
	var comp; 
	if ((wsize/imgw) >= (hsize/imgh)) { 
	comp = 'W'; 
	}else { 
	comp = 'H'; 
	} 
	if (comp == 'W') { 
	timgw = (hsize / imgh) * imgw;
	timgh = hsize 
	divImg = ""; 
	}else { 
	timgw = wsize; 
	timgh = (wsize / imgw) * imgh; 
	divImg = ""; 
	} 
	} 
	imgDiv.innerHTML = divImg; 
} 



/**********************************************************************************************************/


/***********************************************************************************************************/
// 심플 라이트박스 효과 by 알릭 (2007/03/01)   
// http://www.alik.info


var SLB_cnt = 0;
function SLB_show(url, type)   
{   
	var a = document.getElementById('SLB_film');   
	var b = document.getElementById('SLB_content');   
	var c = document.getElementById('SLB_loading');   
	if(url) {   
		a.style.top = 0;   
		a.style.left = 0;   
		a.style.display = "";   
		a.style.height = document.body.scrollHeight + 'px';   
		document.getElementById('SLB_loading').style.display = "block";   
		SLB_setCenter(c,true);   
		if(type == 'image') {   
			b.innerHTML="<img src=" + url + " class='SLB_center' onload='SLB_setCenter(this);' />";   
			if(arguments[2]) a.onclick = function () { SLB_show() };   
			if(arguments[3]) b.innerHTML += "<div class='SLB_caption'>"+ arguments[3] +"</div>";;   
		} else if (type == 'iframe') {   
			b.innerHTML="<iframe src=" + url + " width="+ arguments[2] +" height="+ arguments[3] +" class='SLB_center' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' onload='SLB_setCenter(this);' /></iframe>";      
			if(arguments[4]) {   
				b.innerHTML += "<div class='SLB_close' onclick='SLB_show();' title='닫기'>close</div>";   
			}   
			b.onclick = ''; b.firstChild.style.cursor = 'default';    
		} else if (type='html'){   
			b.innerHTML = url;   
			SLB_setCenter(b.firstChild);   
			if(arguments[2]) b.onclick = '';    
		}
		hideSelect();
	} else {   
		a.onclick = '';   
		a.style.display = "none";   
		b.innerHTML = "";   
		b.onclick = function () { SLB_show() };   
		c.style.display = "none";   
		showSelect();
		SLB_cnt = 0;
	}   
}   
   
function SLB_setCenter(obj) {   
	if (obj) {   
		var h = window.innerHeight || self.innerHeight || document.body.clientHeight;   
		var w = window.innerWidth || self.innerWidth || document.body.clientWidth;   
		var l = (document.body.scrollLeft + ((w-(obj.width||parseInt(obj.style.width)||obj.offsetWidth))/2));   
		var t = (document.body.scrollTop + ((h-(obj.height||parseInt(obj.style.height)||obj.offsetHeight))/2));   
		if((obj.width||parseInt(obj.style.width)||obj.offsetWidth) >= w) l = 0;   
		if((obj.height||parseInt(obj.style.height)||obj.offsetHeight) >= h) t = document.body.scrollTop;   
		document.getElementById('SLB_content').style.left = l + "px";
		if(SLB_cnt == 0) {		
			document.getElementById('SLB_content').style.top = t + "px"; 
			if(document.getElementById('SLB_content').offsetHeight >= h) {
				SLB_cnt ++;
			}
		}
		obj.style.visibility = 'visible';   
		if(obj.nextSibling && (obj.nextSibling.className == 'SLB_close' || obj.nextSibling.className == 'SLB_caption')) {   
			obj.nextSibling.style.display = 'block';
			if(document.getElementById('SLB_content').offsetHeight < h) {
				document.getElementById('SLB_content').style.top = parseInt(document.getElementById('SLB_content').style.top) -		(obj.nextSibling.offsetHeight/2) + "px";
			}
		}   
		if(!arguments[1]) {   
			document.getElementById('SLB_loading').style.display = "none";
		} else {
			obj.style.left = l + "px";   
			obj.style.top = t + "px";
		}   
	}   
}

function hideSelect() {
	var windows = window.frames.length;
	var selects = document.getElementsByTagName("SELECT");
	for (i=0;i < selects.length ;i++ )
	{
		selects[i].style.visibility = "hidden";
	}

	if (windows > 0) {
		for(i=0; i < windows; i++) {
			try {
				var selects = window.frames[i].document.getElementsByTagName("SELECT");
				for (j=0;j<selects.length ;j++ )
				{
					selects[j].style.visibility = "hidden";
				}
			} catch (e) {}
		}
	}
}

function showSelect() {
	var windows = window.frames.length;
	var selects = document.getElementsByTagName("SELECT");
	for (i=0;i < selects.length ;i++ )
	{
		selects[i].style.visibility = "visible";
	}

	if (windows > 0) {
		for(i=0; i < windows; i++) {
			try {
				var selects = window.frames[i].document.getElementsByTagName("SELECT");
				for (j=0;j<selects.length ;j++ )
				{
					selects[j].style.visibility = "visible";		
				}
			} catch (e) {}
		}
	}
}

var prevOnScroll = window.onscroll;   
window.onscroll = function () {   
	if(prevOnScroll != undefined) prevOnScroll();   
	document.getElementById('SLB_film').style.height = document.body.scrollHeight + 'px';   
	document.getElementById('SLB_film').style.width = document.body.scrollWidth + 'px';   
	SLB_setCenter(document.getElementById('SLB_content').firstChild);             
}   
var prevOnResize = window.onresize;      
window.onresize = function () {   
	if(prevOnResize != undefined) prevOnResize();   
	document.getElementById('SLB_film').style.height = document.body.offsetHeight + 'px';   
	document.getElementById('SLB_film').style.width = document.body.offsetWidth + 'px';   
	SLB_setCenter(document.getElementById('SLB_content').firstChild);         
}   


/********************************************************************************************/


 
function allcheck(list) 
{ 

    for( var i=0; i<list.elements.length; i++) { 
    var check = list.elements[i]; 
    check.checked = true; 
    } 
     
     
}  

function uncheck(list) 
{ 

    for( var i=0; i<list.elements.length; i++) { 
    var check = list.elements[i]; 
    check.checked = false; 
    } 
     
     
}

function addFavorite() {

  window.external.AddFavorite('http://www.rushmusic.net', '음악愛 RushTime! RushMusic!');

}
