
/********************************************
	value : ¼ýÀÚ°ª
	n : ÀÚ¸®¼ö
	instring : ºóÀÚ¸®¼ö Ã¤¿ï ¹®ÀÚ
	----------------------------------
	int_format(2,3,'0') 
	-°á°ú
	002
**********************************************/
	function int_format(value, n, instring){
		buf = '';
		ni = 1;

		for(i=1; i<n; i++){
			ni = ni * 10;

			if(value < ni){
				buf = buf+instring;
			}
		}

		buf = buf + value;

		return buf;
	}
/***********************************************/


/*******************************************************************************************************
	½ºÅ©·Ñ¸µ Ã³¸® ºÎºÐ
	roll = new scroll();
	roll.height = 165;
	roll.div = 'floater';
	roll.obj = "roll";
	roll.start();
*******************************************************************************************************/
	function scroll(){
		def2 = 0;
		min2 = 0;
		max2 = 0;
		
		this.height;
		this.div;
		this.itm2;
		this.style;
		this.obj;

		this.start = function(){
			settimeout(this.obj, "init()",0);
		}

		this.init = function(){
			height_s = this.height+'';

			if(this.height || height_s == '0'){
				def2 = this.height;
				min2 = def2;
			}
			else{
				alert('³ôÀÌ¸¦ ¼³Á¤ÇØ ÁÖ¼¼¿ä!\n obj.height = xx');
				return false;
			}

			if(!this.div){
				alert('·¹ÀÌ¾î ÀÌ¸§À» Á¤ÇØÁÖ¼¼¿ä!\n obj.div = "xx"');
				return false;
			}
			else{
				this.itm2 = document.getElementById(this.div);
				this.style = this.itm2.style;
				this.style.top = def2;
				this.style.y = def2;
			}

			if(!this.obj){
				alert('°´Ã¼¸íÀ» Á¤ÇØÁÖ¼¼¿ä!\n obj_name.obj = "obj_name"');
				return false;
			}
		
			max2 = document.body.scrollHeight - this.itm2.scrollHeight - min2;

			settimeout(this.obj,"move_init2()",500)

		}

		this.out = function(str){
			document.write(str);
		}

		this.move_init2 = function(){
			tmp2 = document.body.scrollTop + min2;

			//this.style.y += parseInt( (tmp2 - this.style.y) / 10 );
			this.style.y += Math.round( (tmp2 - this.style.y) / 10 );

			if( this.style.y > max2 ){
				this.style.y = max2;
			}

			if( this.style.y < min2 ){
				this.style.y = min2;
			}

			this.style.top = this.style.y;

			setTimeout ( "settimeout('" + this.obj + "', 'move_init2()', 10 ) ", 10);
		}
	}

/***********************************************************************/


/********************************************************************
	°Ë»öÃ¢ ¹è°æ ÀÌ¹ÌÁö Ã³¸®
	<INPUT class=input_sch 
		style="BACKGROUND: url(/images/se_img.gif); #ffffff no-repeat"
		onfocus="searchform_clearbg('form','q2');" size=30 name=q2>
	
********************************************************************/
	function searchform_clearbg (form, obj) {
		obj1 = eval(form+'.'+obj);

		obj1.style.backgroundImage = '';
		obj1.style.backgroundColor = 'ffffff';

	}
/*********************************************************************/


/********************************************************************
	·Î±×ÀÎÆû °ª Ã¼Å©
********************************************************************/
	function checkbox(){
		if(loginform.userID.value == ''){
			alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä!");
			loginform.userID.select();
			loginform.userID.focus();
			return;
		}

		if(loginform.password.value == ''){
			alert("¾ÏÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
			loginform.password.select();
			loginform.password.focus();
			return;
		}
		loginform.action = "<?=$this->base_dir?>/member/memberProcess.php";
		loginform.submit();
	}
/**************************************************************************/

/************************************************************************************
	setTimeout ¼³Á¤

	setTimeout("func()", delay)
	func() : ½ÇÇàÇÔ¼ö¸í
	delay : ½Ã°£°£°Ý

	Å¬·¡½º ³»ºÎ ÇüÅÂÀÇ Å¸ÀÌ¸Ó ¼³Á¤ÀÌ ÇÊ¿äÇÑ °æ¿ì
	Çü½ÄÀÌ 
	setTimeout("this.func()", delay)
	ÀÏ°æ¿ì °á°ú°¡ ³ª¿ÀÁö ¾ÊÀ½
	±×·¡¼­

	setTimeout(var_name + "." + func_name , delay)
	var_name : ¼±¾ðÇÑ Å¬·¡½º °´Ã¼ÀÇ ÀÌ¸§
	func_name : Å¬·¡½º ³»ºÎ ÇÔ¼ö¸í
	delay : ½Ã°£°£°Ý
************************************************************************************/
	function count(var_name,func_name, delay_time){
		window.setTimeout(var_name+"."+func_name,delay_time);
	}
	function settimeout(var_name,func_name, delay_time){
		window.setTimeout(var_name+"."+func_name,delay_time);
	}
/*********************************************************************************/


/*********************************************************************************
	remain = new datecounter();
	remain.div = 'remain_time';
	remain.obj_name = 'remain';
	remain.settime(2006,4,10,0);
	remain.show();

	settime()À» ÅëÇØ ¼³Á¤µÈ ½Ã°£°ú ÇöÀç½Ã°¢°úÀÇ Â÷ÀÌ¸¦ 
	div(È­¸é¿¡ º¸¿©Áú label, div ÀÇ id¸í)¿¡ º¸¿©ÁÜ
	´Ü, ÇöÀçº¸´Ù ÀÌÀü ½Ã°£ÀÇ °æ¿ì´Â 0°ª Ã³¸®µÊ
	º¸¿©ÁÖ´Â Çü½ÄÀº
	³²Àº±â°£ 04ÀÏ 06½Ã 27ºÐ 37ÃÊ
*********************************************************************************/
	function datecounter() { 
		this.div;
		this.time = new Array;
		this.year;
		this.mon;
		this.day;
		this.hour;
		this.min=0;
		this.sec=0;
		this.finish_time;
		this.obj_name;
		var div;


		this.ab = function(s){
			alert(s);
		}

		this.settime = function(a,b,c,d,e,f){
			this.time[0] = a;
			this.time[1] = b;
			this.time[2] = c;
			this.time[3] = d;
			this.time[4] = e;
			this.time[5] = f;

			this.year = this.time[0];
			this.mon = this.time[1];
			this.day = this.time[2];
			this.hour = this.time[3];
			this.min = this.time[4]?this.time[4]:0;
			this.sec = this.time[5]?this.time[5]:0;

		}

		this.show = function(){
			if(!this.check()) return false;

			this.count();
		}

		this.check = function(){
			if(!this.div){
				this.ab('·¹ÀÌ¾î ÀÌ¸§À» ÁöÁ¤ÇØ ÁÖ¼¼¿ä!\n>>obj.div = "layer"');
				return false;
			}
			else{
				div = document.getElementById(this.div);
			}

			if(!this.obj_name){
				this.ab('¿ÀºêÁ§Æ® ÀÌ¸§À» ÁöÁ¤ÇØ ÁÖ¼¼¿ä!\n>>obj.var_name = "xxx"');
				return false;
			}

			if(!this.year){
				this.ab('³âµµ ¼³Á¤ ÇÊ¿ä\n>>obj.year = xx');
				return false;
			}
			else if(!this.mon){
				this.ab('¿ù ¼³Á¤ ÇÊ¿ä\n>>obj.mon = xx');
				return false;
			}
			else if(!this.day){
				this.ab('ÀÏ ¼³Á¤ ÇÊ¿ä\n>>obj.day = xx');
				return false;
			}
			else if(!this.hour && this.hour+'' != '0'){
				this.ab('½Ã°¢ ¼³Á¤ ÇÊ¿ä\n>>obj.hour = xx\nºÐ/ÃÊ ´Â ¼³Á¤¾øÀ¸¸é 0°ªÃ³¸®µÊ\nºÐ : obj.min = xx\nÃÊ : obj.sec = xx');
				return false;
			}

			this.finish_time = new Date(this.year,this.mon,this.day,this.hour,this.min,this.sec);

			return true;
		}

		this.count = function(){
			finish_time = this.finish_time;

			now_time = new Date();
			now_time.setMonth(now_time.getMonth() + 1);

			r_stamp = finish_time.getTime() - now_time.getTime();

			r_mtime = new Date(r_stamp);

			r_day = parseInt(r_mtime / 1000 / 60 / 60 / 24) ;
			r_hour = parseInt((r_mtime / 1000 / 60 / 60) - (r_day * 24));
			r_min = parseInt((r_mtime / 1000 / 60) - ((r_day * 24 * 60) + (r_hour * 60)));
			r_sec = parseInt((r_mtime / 1000) - ((r_day * 24 * 60 * 60) + (r_hour * 60 * 60) + (r_min * 60)));

			if(r_day < 0)
				r_day = 0;
			if(r_hour < 0)
				r_hour = 0;
			if(r_min < 0)
				r_min = 0;
			if(r_sec < 0)
				r_sec = 0;

			remain_time_str = 
				'³²Àº±â°£  &nbsp;'
				+ '<font size = "+1" color = "FFFC00"><strong>' + int_format(r_day,2,'0') + '</strong></font>ÀÏ'
				+  '<font size = "+1" color = "FFFC00"><strong>' + int_format(r_hour,2,'0') + '</strong></font>½Ã'
				+ '<font size = "+1" color = "FFFC00"><strong>' +  int_format(r_min,2,'0')  + '</strong></font>ºÐ' 
				+ '<font size = "+1" color = "FFFC00"><strong>' +  int_format(r_sec,2,'0')  + '</strong></font>ÃÊ' 
			;

			div.innerHTML = remain_time_str;

			//count(this.obj_name,"count()",1000);
			settimeout(this.obj_name,"count()",1000);
		}
	}
/*************************************************************************************/


/**********************************************************************************************
	·Ñ¸µ ÇÔ¼ö
	¼±¾ðµÈ º¯¼ö¸íÀ» ´Ù½Ã ÀÔ·Â ÇÊ¿ä
	- xxx.obj = 'xxx';f
	- 'xxx' °ªÀ» ¾ò´Â ¸Þ¼Òµå¸¦ Ã£Áö ¸øÇØ¼­ ÀÓ½ÃÇüÀ¸·Î º¯¼ö Ã³¸®
	·Ñ¸µµÉ ³»¿ë ÀÔ·Â
	- xxx.content[i] = 'abcd...'
	- i=1,2,3,.....
	ÇÑ ¶óÀÎÀÇ ±æÀÌ ¼³Á¤
	- xxx.height = 20;
	content[i] ·¹ÀÌ¾îÀÇ ÀüÃ¼ ±æÀÌ ¼³Á¤ ( i °ªÀÌ º¯ÇØµµ ±æÀÌ´Â °íÁ¤ )
	- ÀÌ ±æÀÌÈÄ ´ÙÀ½ ·¹ÀÌ¾î°¡ ºÙÀ¸¹Ç·Î µ¿ÀÏÇÏ°Ô ¼³Á¤
	- xxx.area_height = 40;
	È­¸é¿¡ º¸¿©ÁÖ°í ½ÍÀº ·Ñ¸µ È­¸éÀÇ Å©±â ¼³Á¤
	- xxx.div_height = 40;
	- area_height ¿Í ´Ù¸¥ ÀÇ¹ÌÀÓ

	ex >> 
	roller = new rolling();
	roller.obj = 'roller';
	roller.content[0] = scroll_content[0];
	roller.height = 20;
	roller.area_height = 40;
	roller.div_height = 40;
	roller.rolling();
**********************************************************************************************/

	function rolling(){

		this.content = new Array; // ·¹ÀÌ¾î ³»¿ë
		this.obj; // ¼±¾ðµÈ º¯¼ö(Å¬·¹½º) ¸í

		this.height = 30; // ¶óÀÎ ±æÀÌ
		this.area_height = 200; // ·¹ÀÌ¾î ±æÀÌ
		this.div_height = 500; // º¸¿©ÁÖ´Â ·¹ÀÌ¾îÀÇ ±æÀÌ
		this.div_width = 300; // º¸¿©ÁÖ´Â ·¹ÀÌ¾îÀÇ ³ÐÀÌ

		this.area_left = 0; // ·¹ÀÌ¾î left
		this.area_width = 300; // ·¹ÀÌ¾î ³ÐÀÌ

		this.speed = 1; // ÀÏ¹Ý ÁøÇà½Ã ·Ñ¸µ ¼Óµµ (ms)
		this.waittime = 3000; // ¸ØÃã ½Ã°£

		this.top_buf =0; // ·¹ÀÌ¾î ÁÂÇ¥ °è»ê½Ã ÇÊ¿äÇÑ ÀÓ½Ã °ª
		this.wait_f = true; // ·¹ÀÌ¾î ½Ã°£ º¯°æ½Ã ÇÊ¿äÇÑ °ª

		var bMouseOver = 1; // ¸¶¿ì½º over/out È®ÀÎ
		this.m_over_f = 0;
		this.len; // ·¹ÀÌ¾î ¼ýÀÚ

		this.div_border_type = 0; // ·¹ÀÌ¾î Å×µÎ¸® Ç¥Çö
		this.div_border = ''; // Å×µÎ¸® °ª

		// div(·¹ÀÌ¾î Å×µÎ¸® º¸¿©ÁÙ¶§ »ç¿ë ) : border:1 window-inset #ffffff ;

		this.help = function(){
			str = ''
				+'\nthis.content = new Array; // ·¹ÀÌ¾î ³»¿ë'
				+'\nthis.obj; // ¼±¾ðµÈ º¯¼ö(Å¬·¹½º) ¸í'
				+'\nobj.rolling(); // ·Ñ¸µ ½ÇÇà'

				+'\nthis.height = 50; // ¶óÀÎ ±æÀÌ'
				+'\nthis.area_height = 200; // ·¹ÀÌ¾î ±æÀÌ'
				+'\nthis.div_height = 500; // º¸¿©ÁÖ´Â ·¹ÀÌ¾îÀÇ ±æÀÌ'
				+'\nthis.div_width = 300; // º¸¿©ÁÖ´Â ·¹ÀÌ¾îÀÇ ³ÐÀÌ'

				+'\nthis.area_left = 0; // ·¹ÀÌ¾î left'
				+'\nthis.area_width = 300; // ·¹ÀÌ¾î ³ÐÀÌ'

				+'\nthis.speed = 1; // ÀÏ¹Ý ÁøÇà½Ã ·Ñ¸µ ¼Óµµ (ms)'
				+'\nthis.waittime = 3000; // ¸ØÃã ½Ã°£'

				+'\nthis.wait_f = true; // ·¹ÀÌ¾î ½Ã°£ º¯°æ½Ã ÇÊ¿äÇÑ °ª'
				+'\nthis.top_buf = 0; // ·¹ÀÌ¾î ÁÂÇ¥ °è»ê½Ã ÇÊ¿äÇÑ ÀÓ½Ã °ª'
				
				+'\nthis.len; // ·¹ÀÌ¾î ¼ýÀÚ'
				+'\nvar bMouseOver = 1; // ¸¶¿ì½º over/out È®ÀÎ'

				+'\nthis.div_border_type = 0; // ·¹ÀÌ¾î Å×µÎ¸® Ç¥Çö'
				+'\nthis.div_border = ""; // Å×µÎ¸® °ª'
			;

			alert(str);
			return false;
		}

		this.mouse = function(v){

			bMouseOver = v;
		}

		this.content = function(){
			len =0;

			if(!this.obj){
				alert('º¯¼ö¸íÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä!');
				return false;
			}

			for(i in this.content)
				len++;

			if(len + '' == '0'){
				alert('³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä!\n obj.content[0] = "Ãâ·Â³»¿ë"');
				return false;
			}
			else if(len == 1){
				this.content[1] = this.content[0];
				len++;
			}

			this.len = len;

			if(this.div_border_type)
				this.div_border = ' border:1 window-inset #ffffff;';
			else
				this.div_border = '';
			
			return true;
		}

		this.insert = function (i, n){
			area = '<div style = "position=absolute; overflow=hidden; '
				+ 'width=' + this.div_width + '; height=' + this.div_height + ';' + this.div_border +'" '
				+ 'onMouseover="'+this.obj+'.mouse('+this.m_over_f+')" onMouseout="'+this.obj+'.mouse(1)">\n'
				+ '<div style = "' + this.div_border + ' left: ' + this.area_left +'px; ' 
				+ 'width: ' + this.area_width + 'px; position: absolute; '
				+ 'top: ' + (this.area_height * ( i ) ) + 'px" id = "' + this.obj + '_area' + i + '">\n'
				+ this.content[i] + '\n'
				+ '</div>\n'
				+ '</div>\n';

			document.write(area);
		}

		this.insert_area = function(){
			for(i=0; i<this.len; i++){
				this.insert(i,i+1);
			}
		}

		this.roll_start = function(){

			if (bMouseOver){
				for (i=0; i<this.len; i++) {
					objstyle = document.getElementById( this.obj + '_area' + i ).style;
					objstyle.top = parseInt(objstyle.top) - this.speed;

					if(parseInt(objstyle.top) <= -this.area_height){
						objstyle.top = this.area_height * (this.len - 1);
					}

					this.top_buf += 1*this.speed;

					if(this.top_buf > this.height*this.len -1){
						this.top_buf = 0;

						this.wait_f = false;
					}
				}
			}

			if(this.wait_f){
				delay = this.speed;
				settimeout(this.obj,'roll_start()',delay)
			}
			else{
				delay = this.waittime;
				this.wait_f = true;
				settimeout(this.obj,'roll_start();',delay)
			}
		}

		this.rolling = function(){

			if(!this.content())
				return false;

			this.insert_area();

			settimeout(this.obj,'roll_start();',this.waittime);
		}
	}
/**********************************************************************************************/

