/*========================================
js_layer
JS로 만든 Layer 제어 클래스
(다시 만들었음)

#간단설명
레이어(div)를 제어한다.
위치,크기,투명서,배경색의 정보를 바꾸거나 가져올 수 있다.

get,set,act함수를 기본으로 구성됨
getXXX() : 해당 정보를 알아온다
setXXX() : 지정된 값으로 설정한다
actXXX() : 지정된 값으로 변화하면서 설정한다
stopXXX() : 지정된 레이어 동작을 끝낸다.(특정 메소드에만 대응되는 stopXXX()가 있다)

# 사용법
//레이어클래스 선언
var layer = js_layer(); //자체적으로 레이어를 새로 하나 생성
var layer = js_layer('xxx'); //아이디(ID)가 xxx인 대상을 레이어로 사용
var layer = js_layer(document.getElementById('xxx')); //지정된 대상을 레이어로 사용

#메소드 설명
setPosition([left],[top]) 
//레이어의 위치를 설정한다
setPosition_click([event],[left간격],[top간격])
//클릭한 곳에 레이어를 위치시킨다.
//[event] 는 IE이외의 브라우저에서 필수
actPosition([left 목적지],[top 목적지],[증가값],[딜레이]);
//레이어가 지정된 위치로 이동한다
//딜레이가 0이면 setPosition과 동작이 같다.
actPosition_click([event],[left간격],[top간격],[증가값],[딜레이]);
//클릭한 곳에 레이어를 이동시킨다

setAlign([h],[v],[gapLeft],[gapTop]) 
//현재 페이지를 기준으로 레이어위치를 변경한다
//h : 0=none,1=left,2=center,3=right	
//v : 0=none,1=top,2=middle,3=bottom
// [gapLeft],[gapTop] : left와 top의 간격
actAlign([h],[v],[gapLeft],[gapTop],[증가값],[딜레이]);
//레이어가 지정된 위치로 이동한다
//딜레이가 0이면 setAlign 동작이 같다.
actAlignFixed([h],[v],[gapLeft],[gapTop],[이동증가값],[딜레이],[이동딜레이]);
//페이지를 기준으로 지정위치에 레이어를 고정(떠있는 레이어)된다
//이돌 딜레이가 0이면 이동하지 않고 바로 위치하게 된다.
stopAlignFixed([h],[v],[gapLeft],[gapTop],[이동증가값],[딜레이]);
//페이지를 기준으로 지정위치에 레이어 고정을 해제한다.

setSize100()
//해당 레이어를 현재 페이지에 꽉 차게 설정
setSize100Fixed([dealy])
//해당 레이어를 현재 페이지에 꽉 차게 동작
stopSize100Fixed([dealy])
// setSize100Fixed([dealy]) 해제

actPositionFixed([left 목적지],[top 목적지],[left 최소],[top 최소],[증가값],[딜레이],[이동딜레이])
//목적지위치에 떠있는 레이어로 설정
//이동 딜레이가 0이면 즉각적으로 위치가 변경되고, 0이 아니면 그 딜레이가 적용되서 이동된다.
stopPositionFixed();
//떠있는 레이어 해제

actPositionFollowMouse([마우스와의거리x],[마우스와의거리y],[증가값],[딜레이]);
// 마우스를 따라다니는 레이어로 설정
stopPositionFollowMouse()
//따라다니는 레이어 해제

setSize([너비],[높이])
//레이어의 크기설정
//null로 지정하면 해당 부분은 동작하지 않는다.
actSize([너비],[높이],[증가값],[딜레이])
//레이어의 크기변화
//null로 지정하면 해당 부분은 동작하지 않는다.

setStyleOpacity([투명도])
// 0~1사이의 실수로 레이어의 투명도를 설정한다
actStyleOpacity([투명도],[증가값],[딜레이])
//변화하는 레이어의 투명도 설정

setStyleBgcolor([배경색]);
// #XXYYZZ 형식으로 색을 지정하면 레이어의 배경색이 바뀐다.
actStyleBgcolor([배경색],[증가값],[딜레이])
// #XXYYZZ 형식으로 색을 지정하면 레이어의 배경색이 서서히 바뀐다.


#사용제약
사용시 "공대여자는 예쁘다"를 나타내셔야합니다.

만든날 : 2007-06-11
수정일 : 2007-10-04
만든이 : mins01,mins,공대여자
홈페이지 : http://www.mins01.com 
NateOn&MSN : mins01(at)lycos.co.kr
========================================*/
var js_layer = function (ta){
	var layer = null; //대상 레이어
	var browser= -1;
	this.timer = new Object();
	this.timer.actStyleOpacity=null;
	this.init();
	if(ta){this.replaceLayer(ta);}
	else{this.createLayer();}
}
//============================================== 클래스 초기화
js_layer.prototype.init = function(){
	this.setBrowser();
}
//============================================== 브라우저 체크
js_layer.prototype.setBrowser = function(){
// 브라우저가 IE인지 체크 : IE=0,FF=1,OPERA=2,그외=255;
	var ua = window.navigator.userAgent;
	if(ua.indexOf('Firefox')!=-1){	this.browser=1;	}
	else if(ua.indexOf('Opera')!=-1){	this.browser=2;	}
	else  if(ua.indexOf('MSIE')!=-1){	this.browser=0;	}
	else if(document.all){	this.browser=0;}	// FF,OPERA를 구분후 기타 나머지는 IE호환 브라우저로 치부
	else{	this.browser=255;}
}
//============================================== 경고메세지(디버그용)
js_layer.prototype.alert = function(msg){
	alert(msg);
}
//============================================== 문자열을 숫자로 바꾸고 체크하고 반환
js_layer.prototype.parseInt = function(num){
	var num = parseInt(num);
	if(isNaN(num)){return 0;}
	else{return num;}
}
js_layer.prototype.parseFloat = function(num){
	var num = parseFloat(num);
	if(isNaN(num)){return 0;}
	else{return num;}
}
//================================================ 생상값 풀기
js_layer.prototype.getColorRGB = function(color_str){
	var arr_rgb = Array();
	if(color_str.indexOf('rgb')!=-1){
		color_str = color_str.replace(/[^,0-9]/g,'');
		arr_rgb = color_str.split(',');
		arr_rgb[0]=Number(arr_rgb[0]);
		arr_rgb[1]=Number(arr_rgb[1]);
		arr_rgb[2]=Number(arr_rgb[2]);
	}else{
		color_str = color_str.replace(/[^a-fA-F0-9]/g,'');
		arr_rgb.push(Number('0x'+color_str.substr(0,2)));
		arr_rgb.push(Number('0x'+color_str.substr(2,2)));
		arr_rgb.push(Number('0x'+color_str.substr(4,2)));
	}
	return arr_rgb;
}
js_layer.prototype.getColorHTML = function(r,g,b){
	if(r.length==3){b =r[2];g =r[1];r =r[0];}
	r = ((r<16)?'0':'')+r.toString(16);
	g = ((g<16)?'0':'')+g.toString(16);
	b = ((b<16)?'0':'')+b.toString(16);
	return '#'+r+g+b;
}
//============================================== 기본 레이어 생성
js_layer.prototype.createLayer = function(){
	this.removeLayer();
	var cssText="background-color:#ffccff;border:1px solid #cccccc;position:absolute;left:50px;top:50px;width:100px;height:50px;";
	var l = document.createElement('div');
	l.style.cssText=cssText
	this.layer = l;
	this.appendLayer();
}
//============================================== 레이어 삭제
js_layer.prototype.removeLayer = function(){
	if(this.layer!=null) this.layer.parentNode.removeChild(l);
}
//============================================== 레이어 바꿈(대체)
js_layer.prototype.replaceLayer = function(ta){
	this.removeLayer();
	if(ta.nodeType==1){
		this.layer = ta;
	}else{
		var l = document.getElementById(ta);
		if(l){this.layer = l;}
		else this.alert('ERROR : replaceLayer()');
	}
}
//============================================== body에 레이어 붙임(이때부터 레이어가 페이지에서 보임)
js_layer.prototype.appendLayer = function(){
	if(!this.layer){this.alert('ERROR : appendLayer');return false;}
	document.body.appendChild(this.layer);
}
//============================================== body의 스크롤 위치를 알아냄
js_layer.prototype.getBodyScrollPosition = function(){
	if(!this.layer){this.alert('ERROR : getBodyScrollPosition');return false;}
	if(document.documentElement.scrollLeft!=0)	var s_left = document.documentElement.scrollLeft;
	else 	var s_left = document.body.scrollLeft;
	if(document.documentElement.scrollTop!=0)	var s_top = document.documentElement.scrollTop;
	else 	var s_top = document.body.scrollTop;
	return Array(s_left,s_top);
}
//============================================== left,top의 위치를 알아냄
js_layer.prototype.getPosition = function(){
	if(!this.layer){this.alert('ERROR : getPosition');return false;}
	var left = this.parseInt(this.layer.style.left);
	var top = this.parseInt(this.layer.style.top);
	return Array(left,top);
}
//============================================== 페이지를 기준으로 위치를 알아온다
js_layer.prototype.getAlign  = function(h,v,gapLeft,gapTop){
	//h : 0=none,1=left,2=center,3=right	//v : 0=none,1=top,2=middle,3=bottom
	if(gapLeft==null){gapLeft = 0;}if(gapTop==null){gapTop = 0;}	
	gapLeft = parseInt(gapLeft);
	gapTop = parseInt(gapTop);	
	if(!this.layer){this.alert('ERROR : setAlign');return false;}
	var t_l = 0,t_t = 0;
	var pos = this.getPosition();	
	var s = this.getOffsetSize();	
	var bs = this.getBodySize();
	var scl = this.getBodyScrollPosition();
	if(h == 1){t_l = '0';}
	else if(h == 2){t_l = ((bs[0]-s[0])/2);}
	else if(h == 3){t_l = (bs[0]-s[0]);}
	else{t_l=pos[0];}
	if(v == 1){t_t = '0';}
	else if(v == 2){t_t = ((bs[1]-s[1])/2);}
	else if(v == 3){t_t = (bs[1]-s[1]);}	
	else{t_t=pos[1];}
	t_l = parseInt(t_l)+parseInt(scl[0])+gapLeft;
	t_t = parseInt(t_t)+parseInt(scl[1])+gapTop;
	//document.title=bs +":"+scl+":"+t_l+","+t_t;		
	return Array(t_l,t_t);
}
//============================================== 페이지를 기준으로 위치를 설정
js_layer.prototype.setAlign  = function(h,v,gapLeft,gapTop){
	//h : 0=none,1=left,2=center,3=right	//v : 0=none,1=top,2=middle,3=bottom
	if(!this.layer){this.alert('ERROR : setAlign');return false;}
	var t = this.getAlign(h,v,gapLeft,gapTop);
	this.setPosition(t[0],t[1]);
}
//============================================== 페이지를 기준으로 레이어 이동 설정
js_layer.prototype.actAlign = function(h,v,gapLeft,gapTop,inc,delay){
	//h : 0=none,1=left,2=center,3=right	//v : 0=none,1=top,2=middle,3=bottom
	if(!this.layer){this.alert('ERROR : setAlign');return false;}
	if(inc==null){inc = 1;}
	if(delay==null){delay = 100;}
	if(delay==0){		this.setAlign(h,v);		return;	}	
	var t = this.getAlign(h,v,gapLeft,gapTop);
	this.actPosition(t[0],t[1],inc,delay);
}
//============================================== 페이지를 기준으로 레이어 고정
js_layer.prototype.actAlignFixed = function(h,v,gapLeft,gapTop,inc,delay,delayPosition){
	//h : 0=none,1=left,2=center,3=right	//v : 0=none,1=top,2=middle,3=bottom
	if(!this.layer){this.alert('ERROR : setAlign');return false;}
	if(inc==null){inc = 10;}
	if(delay==null){delay = 100;}
	if(delayPosition==null){delayPosition = 10;}
	if(delay==0){		this.setAlign(h,v);		return;	}	
	var this_s = this;
	var fn=function(){
		var t = this_s.getAlign(h,v,gapLeft,gapTop);
		//alert(t);
		this_s.actPosition(t[0],t[1],inc,delayPosition);	
	}
	if(this.timer['actAlignFixed'] != null){clearInterval(this.timer['actAlignFixed']);	}
	else{this.timer['actAlignFixed'] = null; }
	this.timer['actAlignFixed'] = setInterval(fn,delay);		
}
//============================================== 페이지를 기준으로 레이어 고정 해제
js_layer.prototype.stopAlignFixed = function(){
	if(!this.layer){this.alert('ERROR : actPositionFixed');return false;}
	clearInterval(this.timer['actAlignFixed']);	
}
//============================================== left,top의 위치를 설정함
js_layer.prototype.setPosition  = function(left,top){
	if(!this.layer){this.alert('ERROR : setPosition');return false;}
	if(left!=null)	this.layer.style.left = this.parseInt(left)+'px';
	if(top!=null)	this.layer.style.top = this.parseInt(top)+'px';
}
//============================================== 클릭한 곳으로 레이어를 이동시킴(페이지의 스크롤도 처리)
js_layer.prototype.setPosition_click  = function(evt,g_left,g_top){
	if(!this.layer){this.alert('ERROR : setPosition_click');return false;}
	if(!evt){evt = window.event;}if(!g_left){g_left=0;}if(!g_top){g_top=0;}
	var arr = this.getBodyScrollPosition();
	var s_left=arr[0];
	var s_top=arr[1];
	var left = evt.clientX+g_left+s_left; 
	var top = evt.clientY+g_top+s_top; 
	this.setPosition(left,top);
}
js_layer.prototype.actPosition_click = function(evt,g_left,g_top,inc,delay){
	if(!this.layer){this.alert('ERROR : actPosition_click');return false;}
	if(!evt){evt = window.event;}if(!g_left){g_left=0;}if(!g_top){g_top=0;}
	var arr = this.getBodyScrollPosition();
	var s_left=arr[0];
	var s_top=arr[1];
	var left = evt.clientX+g_left+s_left; 
	var top = evt.clientY+g_top+s_top; 	
	this.actPosition(left,top,inc,delay);
}
//============================================== 변화하는 left,top의 위치를 설정함
js_layer.prototype.actPosition = function(ed_left,ed_top,inc,delay){
	if(!this.layer){this.alert('ERROR : actPosition');return false;}
	if(ed_left==null && ed_top==null){this.alert('ERROR : actPosition');return false;}
	var t = this.getPosition();	
	if(ed_left==null) ed_left=t[0];
	if(ed_top==null) ed_top=t[1];	
	if(inc==null){inc = 1;}
	if(delay==null){delay = 10;}
	else if(delay==0){this.setPosition(ed_left,ed_top);		return;	}	
	if(ed_left<t[0]){ var inc_l = inc*(-1); }else{var inc_l = inc;}
	if(ed_top<t[1]){ var inc_t = inc*(-1); }else{var inc_t = inc;}
	var this_s = this;
	var fn=function(){
		var pos = this_s.getPosition();
		var l = pos[0]+this_s.parseFloat(inc_l);
		var t = pos[1]+this_s.parseFloat(inc_t);
		var f = Array(true,true);
		if(inc_l>0 && ed_left>l){this_s.setPosition(l,null);}
		else if(inc_l<0 && ed_left<l){this_s.setPosition(l,null);}
		else{f[0]=false;}
		if(inc_t>0 && ed_top>t){this_s.setPosition(null,t);}
		else if(inc_t<0 && ed_top<t){this_s.setPosition(null,t);}
		else{f[1]=false;}		
		if(!f[0]&&!f[1]){
			this_s.setPosition(ed_left,ed_top);
			clearInterval(this_s.timer['actPosition']);
			return;
		}
	}
	if(this.timer['actPosition'] != null){clearInterval(this.timer['actPosition']);	}
	else{this.timer['actPosition'] = null; }
	this.timer['actPosition'] = setInterval(fn,delay);	
}
//============================================== 떠있는 레이어로 설정
js_layer.prototype.actPositionFixed = function(ed_left,ed_top,l_left,l_top,inc,delay,delayPosition){
	if(!this.layer){this.alert('ERROR : actPositionFixed');return false;}
	//if(ed_left==null && ed_top==null){this.alert('ERROR : actPositionFixed');return false;}
	var t = this.getPosition();
	if(ed_left==null){ ed_left=t[0];}if(ed_top==null){ ed_top=t[1];}
	if(l_left==null){ l_left=ed_left;}if(l_top==null){ l_top=ed_top;}
	if(inc==null){inc = 10;}
	if(delay==null){delay = 100;}	
	if(delayPosition==null){delayPosition = 0;}		
	var this_s = this;
	var fn=function(){
		var scl = this_s.getBodyScrollPosition();
		var t_l = ed_left+scl[0];
		var t_t = ed_top+scl[1];	
		if(t_l<l_left){t_l=l_left;}
		if(t_t<l_top){t_t=l_top;}
		this_s.actPosition(t_l,t_t,inc,delayPosition);
	}
	if(this.timer['actPositionFixed'] != null){clearInterval(this.timer['actPositionFixed']);	}
	else{this.timer['actPositionFixed'] = null; }
	this.timer['actPositionFixed'] = setInterval(fn,delay);		
}
js_layer.prototype.actPositionFixed2 = function(ed_left,ed_top,l_left,l_top,inc,delay,delayPosition){
	if(!this.layer){this.alert('ERROR : actPositionFixed');return false;}
	//if(ed_left==null && ed_top==null){this.alert('ERROR : actPositionFixed');return false;}
	var t = this.getPosition();
/*	if(ed_left==null){ ed_left=t[0];}*/if(ed_top==null){ ed_top=t[1];}
/*	if(l_left==null){ l_left=ed_left;}*/if(l_top==null){ l_top=ed_top;}
	if(inc==null){inc = 10;}
	if(delay==null){delay = 100;}	
	if(delayPosition==null){delayPosition = 0;}		
	var this_s = this;
	var fn=function(){
		var scl = this_s.getBodyScrollPosition();
/*		var t_l = ed_left+scl[0];*/
		var t_t = ed_top+scl[1];	
/*		if(t_l<l_left){t_l=l_left;}*/
		if(t_t<l_top){t_t=l_top;}
//		this_s.actPosition(t_l,t_t,inc,delayPosition);
		this_s.actPosition(null,t_t,inc,delayPosition);
	}
	if(this.timer['actPositionFixed'] != null){clearInterval(this.timer['actPositionFixed']);	}
	else{this.timer['actPositionFixed'] = null; }
	this.timer['actPositionFixed'] = setInterval(fn,delay);		
}
//============================================== 떠있는 레이어 해제
js_layer.prototype.stopPositionFixed = function(){
	if(!this.layer){this.alert('ERROR : actPositionFixed');return false;}
	clearInterval(this.timer['actPositionFixed']);
}
//============================================== 마우스 따라다니는 레이어
js_layer.prototype.actPositionFollowMouse = function(gap_x,gap_y,inc,delay){
	if(!this.layer){this.alert('ERROR : actPositionFixed');return false;}
	if(!gap_x){gap_x=10;}	if(!gap_y){gap_y=10;}
	if(inc==null){inc = 0;}
	if(delay==null){delay = 0;}	
	var this_s = this;
	var fn = function(evt){
		var scl = this_s.getBodyScrollPosition();
		evt = window.event?window.event:evt;
		var t_l = evt.clientX+scl[0]+gap_x;
		var t_t = evt.clientY+scl[1]+gap_y;
		this_s.actPosition(t_l,t_t,inc,delay);
	}	
		document.onmousemove = fn;
}
//============================================== 떠있는 레이어 해제
js_layer.prototype.stopPositionFollowMouse = function(){
	document.onmousemove = null
}
//============================================== width,height를 알아냄
js_layer.prototype.getSize = function(){
	if(!this.layer){this.alert('ERROR : getSize');return false;}
	var width = this.parseInt(this.layer.style.width);
	var height = this.parseInt(this.layer.style.height);
	return Array(width,height);
}
//============================================== width,height를 알아냄(border등도 포함)
js_layer.prototype.getOffsetSize = function(){
	if(!this.layer){this.alert('ERROR : getOffsetSize');return false;}
	var width = this.layer.offsetWidth;
	var height =this.layer.offsetHeight;
	return Array(width,height);
}
//============================================== 현재 페이지의 width,height를 알아냄
js_layer.prototype.getBodySize = function(){
	if(!this.layer){this.alert('ERROR : getOffsetSize');return false;}
	var t = document.documentElement;
	if(t.clientHeight<12) t = document.body;
	var width = t.clientWidth;
	var height = t.clientHeight;
	if(window.innerHeight){
		height = window.innerHeight;
	}
	document.title=(width+","+height);
	return Array(width,height);
}
//============================================== width,height를 설정함
js_layer.prototype.setSize = function(width,height){
	if(!this.layer){this.alert('ERROR : setSize');return false;}
	if(width!=null)	this.layer.style.width = this.parseInt(width)+'px';
	if(height!=null)	this.layer.style.height = this.parseInt(height)+'px';
}
//============================================== 변화하는 width,height를 설정함
js_layer.prototype.actSize = function(ed_width,ed_height,inc,delay){
	if(!this.layer){this.alert('ERROR : actSize');return false;}
	if(!ed_width && !ed_height){this.alert('ERROR : actSize');return false;}
	var t = this.getSize();	
	if(!ed_width) ed_width=t[0];
	if(!ed_height) ed_height=t[1];	
	if(inc==null){inc = 1;}
	if(delay==null){delay = 10;}	
	if(delay==0){		this.setSize(ed_width,ed_height); return;	}
	if(ed_width<t[0]){ var inc_w = inc*(-1); }else{var inc_w = inc;}
	if(ed_height<t[1]){ var inc_h = inc*(-1); }else{var inc_h = inc;}	
	var this_s = this;
	var fn=function(){
		var size = this_s.getSize();
		var w = size[0]+this_s.parseFloat(inc_w);
		var h = size[1]+this_s.parseFloat(inc_h);
		var f = Array(true,true);
		if(inc_w>0 && ed_width>w){this_s.setSize(w,null);}
		else if(inc_w<0 && ed_width<w){this_s.setSize(w,null);}
		else{f[0]=false;}
		if(inc_h>0 && ed_height>h){this_s.setSize(null,h);}
		else if(inc_h<0 && ed_height<h){this_s.setSize(null,h);}
		else{f[1]=false;}		
		if(!f[0]&&!f[1]){
			this_s.setSize(ed_width,ed_height);
			clearInterval(this_s.timer['actSize']);
			return;
		}
	}
	if(this.timer['actSize'] != null){clearInterval(this.timer['actSize']);	}
	else{this.timer['actSize'] = null; }
	this.timer['actSize'] = setInterval(fn,delay);
}
//============================================== width,height를 항상 꽉 차게
js_layer.prototype.setSize100 = function(){
	if(!this.layer){this.alert('ERROR : setSize100');return false;}
	var t = this.getBodySize();	
	this.layer.style.width = t[0]+'px';
	this.layer.style.height = t[1]+'px';
}
//============================================== width,height를 항상 꽉 차게
js_layer.prototype.setSize100Fixed = function(delay){
	var this_c = this;
	if(delay==null){delay = 10;}	
	if(!this.layer){this.alert('ERROR : setSize100Fixed');return false;}
	var fn=function(){
		this_c.setSize100();
	}
	if(this.timer['setSize100Fixed'] != null){clearInterval(this.timer['setSize100Fixed']);	}
	else{this.timer['setSize100Fixed'] = null; }
	this.timer['setSize100Fixed'] = setInterval(fn,delay);
}
//============================================== width,height를 항상 꽉 차게 해제
js_layer.prototype.stopSize100Fixed = function(){
	if(this.timer['setSize100Fixed'] != null){clearInterval(this.timer['setSize100Fixed']);	}
	else{this.timer['setSize100Fixed'] = null; }
}
//============================================== 투명도를 가져온다(0~1 사이의 실수)
js_layer.prototype.getStyleOpacity = function(){
	if(!this.layer){this.alert('ERROR : getStyleOpacity');return false;}
	if(this.browser==0){
		var temp1 = this.layer.filters;
		if(temp1.length>0 && temp1('Alpha')!=null){return parseFloat(temp1('Alpha').Opacity)/100;}
		else{return -1;}
	}else{
		var temp = this.layer.style.opacity;
		return isNaN(temp)?-1:temp;
	}	
}
//============================================== 투명도를 설정한다(0~1 사이의 실수)
js_layer.prototype.setStyleOpacity = function(opacity){
	if(!this.layer){this.alert('ERROR : getStyleOpacity');return false;}	
	opacity = parseFloat(opacity);
	if(isNaN(opacity)){this.alert('ERROR : setStyleOpacity');}
	if(opacity == -1){opacity=1;} //-1일 경우 무조건 보이도록 처리	
	if(opacity>1){opacity=opacity/100;} //0~1 사이의 값을 기준으로한다.
	try{	
		if(this.browser==0){
			opacity = Math.round((opacity*100)%101);
			this.layer.style.filter="Alpha(opacity="+opacity+")";
		}else{
			this.layer.style.opacity=opacity;
		}
	}catch(e){this.alert('ERROR : setStyleOpacity');}
}
//============================================== 변화하는 투명도를 설정한다
js_layer.prototype.actStyleOpacity = function(ed_opacity,inc,delay){
	if(!this.layer){this.alert('ERROR : actStyleOpacity');return false;}	
	if(ed_opacity==null){this.alert('ERROR : actStyleOpacity');return false;}
	if(inc==null){inc = 0.1;}
	if(delay==null){delay = 100;}	
	var st_opacity=this.getStyleOpacity();	
	if(st_opacity>ed_opacity){inc*= -1;}
	var this_s = this;
	var fn=function(){
		var opt = this_s.getStyleOpacity();
		var t = this_s.parseFloat(opt)+this_s.parseFloat(inc);
		if(inc>0 && ed_opacity<t){clearInterval(this_s.timer['actStyleOpacity']);}
		else if(inc<0 && ed_opacity>t){clearInterval(this_s.timer['actStyleOpacity']);}
		else{this_s.setStyleOpacity(t);}
	}
	if(this.timer['actStyleOpacity'] != null){clearInterval(this.timer['actStyleOpacity']);	}
	else{this.timer['actStyleOpacity'] = null; }
	this.timer['actStyleOpacity'] = setInterval(fn,delay);
}
//============================================== 배경색을 가져온다( RGB(r,g,b)형식)
js_layer.prototype.getStyleBgcolor = function(){
	if(!this.layer){this.alert('ERROR : getStyleBgcolor');return false;}
	var t = this.layer.style.backgroundColor;
	if(!t){return Array(-1,-1,-1);}
	else{return this.getColorHTML(this.getColorRGB(t));}
}
//============================================== 배경색을 설정한다
js_layer.prototype.setStyleBgcolor = function(bgcolor){
	if(!this.layer){this.alert('ERROR : setStyleBgcolor');return false;}
	var t = this.getColorHTML(this.getColorRGB(bgcolor));
	this.layer.style.backgroundColor = t;
}
//============================================== 변화하는 배경색을 설정한다
js_layer.prototype.actStyleBgcolor = function(ed_bgcolor,inc,delay){
	if(!this.layer){this.alert('ERROR : actStyleOpacity');return false;}	
	if(!ed_bgcolor){this.alert('ERROR : actStyleOpacity');return false;}
	if(inc==null){inc =1;}
	if(delay==null){delay = 10;}	
	var st_bgcolor=this.getColorRGB(this.getStyleBgcolor());	
		ed_bgcolor=this.getColorRGB(ed_bgcolor);	
	if(st_bgcolor[0]>ed_bgcolor[0]){var inc_r = inc*(-1);}else{var inc_r = inc;}
	if(st_bgcolor[1]>ed_bgcolor[1]){var inc_g = inc*(-1);}else{var inc_g = inc;}
	if(st_bgcolor[2]>ed_bgcolor[2]){var inc_b = inc*(-1);}else{var inc_b = inc;}
	var this_s = this;
	var fn=function(){
		var ed = ed_bgcolor;
		var bgcolor=this_s.getColorRGB(this_s.getStyleBgcolor());
		var r = bgcolor[0]+inc_r;
		var g = bgcolor[1]+inc_g;
		var b = bgcolor[2]+inc_b;
		if(!(inc_r<0 && r>ed_bgcolor[0])&&!(inc_r>0 && r<ed_bgcolor[0])){r=ed_bgcolor[0];}
		if(!(inc_g<0 && g>ed_bgcolor[1])&&!(inc_g>0 && g<ed_bgcolor[1])){g=ed_bgcolor[1];}
		if(!(inc_b<0 && b>ed_bgcolor[2])&&!(inc_b>0 && b<ed_bgcolor[2])){b=ed_bgcolor[2];}
		if(r==ed_bgcolor[0]&&g==ed_bgcolor[1]&&b==ed_bgcolor[2]){
			this_s.setStyleBgcolor(this_s.getColorHTML(r,g,b));
			clearInterval(this_s.timer['actStyleBgcolor']);
			return;
		}else{
			this_s.setStyleBgcolor(this_s.getColorHTML(r,g,b));			
		}
	}
	if(this.timer['actStyleBgcolor'] != null){clearInterval(this.timer['actStyleBgcolor']);	}
	else{this.timer['actStyleBgcolor'] = null; }
	this.timer['actStyleBgcolor'] = setInterval(fn,delay);
}