<!--//
/**
* ·¹ÀÌ¾î ÀÌµ¿ ¸ÖÆ¼ ½ºÅ©¸³Æ®
* Á¦ÀÛÀÚ : iezn(iezn@iezn.com, MSN: iezn@iezn.com)
* È¨ÆäÀÌÁö : http://iezn.com
* ¸ñÀû 
* ´ÙÁß ½½¶óÀÌµù¸Þ´º + À§·Î°¡±â ¹öÆ°»ý¼º
*
*/

function IEZN_quick_menu(input_obj){
	this.hide = new Array(0,0);
	try{
		this.input_obj = input_obj;
		this.input_obj.style.display = 'none';
	}catch(e){
		this.hide[1] = 1;
	}
	var IEZN_quick_menu_counter;
	IEZN_quick_menu_counter = (typeof(IEZN_quick_menu_counter)=='undefined')? 0:IEZN_quick_menu_counter++;
	this.counter = IEZN_quick_menu_counter;





	try{
		this.init();
	}catch(e){}
}

IEZN_quick_menu.prototype = {	
	init : function() {	
		this.move_ok = new Array();//ÀÌµ¿Çã¶ô
		this.move_img_src = new Array();//À§,¾Æ·¡ ¾ÆÀÌÄÜ ÀÌ¹ÌÁö °æ·Î
		this.check_img_src = new Array();//½½¶óÀÌµù Ã¼Å©ÀÌ¹ÌÁö
		this.div_obj_top = new Array();//°íÁ¤ ÆäÀÌÁö »ó´Ü¿©¹é(ÀÌÀÌ»ó ¾È¿Ã¶ó°¨)
		this.div_obj_max_move_top = new Array();//ÀÌµ¿ ÆäÀÌÁö »ó´Ü¿©¹é(ÀÌÀÌ»ó ¾È¿Ã¶ó°¨)
		this.div_obj_left = new Array();//¸Þ´ºÀ§Ä¡ ½º¸ô½½¶óÀÌµù,¸ÞÀÎ½½¶óÀÌµù
		this.div_obj_use = new Array();
		this.timeId	 = new Array();
		this.div_obj = new Array();//sub,main layer object
	},

	
	move : function(){

		var obj = this;
		document.write("<div id='izqm0"+this.counter+"'></div>");
		document.write("<div id='izqm1"+this.counter+"'></div>");

		this.div_obj[0] = document.getElementById("izqm0"+this.counter);
		this.div_obj[1] = document.getElementById("izqm1"+this.counter);
		
		if(this.div_obj_use[0]==0) this.hide[0]=1;
		if(this.div_obj_use[1]==0) this.hide[1]=1;
	
		//¼±ÅÃ obj ¿¡ ´ëÇÑ °ªÀ» ±âÁØÀ¸·Î ÇÑ´Ù
		
		if(this.hide[1]==0){
			if(this.input_obj.style.top){
				this.div_obj_top[1] = parseInt(this.input_obj.style.top);
				this.div_obj_top[0] = this.div_obj_top[1]+50;
			}
			if(this.input_obj.style.left){
				this.div_obj_left[1] = parseInt(this.input_obj.style.left);
				this.div_obj_left[0] = this.div_obj_left[1]-12;
			}
		}

		if(this.div_obj_top[0]=="")	this.div_obj_top = Array(75,10);//°íÁ¤ ÆäÀÌÁö »ó´Ü¿©¹é(ÀÌÀÌ»ó ¾È¿Ã¶ó°¨)
		if(this.div_obj_left[0]=="") this.div_obj_left = Array(948,960);//¸Þ´ºÀ§Ä¡ ½º¸ô½½¶óÀÌµù,¸ÞÀÎ½½¶óÀÌµù
		if(this.div_obj_max_move_top[0]=="") this.div_obj_max_move_top = Array(85,0);//ÀÌµ¿ ÆäÀÌÁö »ó´Ü¿©¹é(ÀÌÀÌ»ó ¾È¿Ã¶ó°¨)

		//¼­ºê DIV	
		if(this.hide[0]==0){
			//this.div_obj[0] = document.createElement("div");
			//this.div_obj[0].id='izqm0'+this.counter;
			this.div_obj[0].style.position = 'absolute';
			this.div_obj[0].style.width='10px';
			this.div_obj[0].style.top = this.div_obj_top[0]+'px';
			this.div_obj[0].style.textAlign='center';
			this.div_obj[0].style.left=this.div_obj_left[0]+'px';
			this.div_obj[0].style.backgroundColor='transparent';
			try{
			document.body.appendChild(this.div_obj[0]);				
			}catch(e){}
		}

		//¸ÞÀÎ DIV
		if(this.hide[1]==0){
			//this.div_obj[1] = document.createElement("div");
			//this.div_obj[1].id='izqm1'+this.counter;
			this.div_obj[1].style.position = 'absolute';
			this.div_obj[1].style.top=this.div_obj_top[1]+'px';
			this.div_obj[1].style.padding='0px';
			this.div_obj[1].style.left=this.div_obj_left[1]+'px';
			this.div_obj[1].style.backgroundColor='transparent';
			this.div_obj[1].style.overflow='hidden';
			this.div_obj[1].style.textOverflow='ellipsis';
			this.div_obj[1].style.width=this.input_obj.style.width;
			this.div_obj[1].style.border=this.input_obj.style.border;
			this.div_obj[1].style.padding=this.input_obj.style.padding;

			try{
				document.body.appendChild(this.div_obj[1]);			
				this.div_obj[1].innerHTML = this.input_obj.innerHTML;
			}catch(e){}
		}

		//À§·ÎÀÌµ¿ ÀÌ¹ÌÁö 
		if(this.move_img_src[0]!="" && this.hide[0]==0){
			this.move_up_img = document.createElement("img");
			this.move_up_img.src = this.move_img_src[0];
			this.move_up_img.style.marginBottom = '2px';
			this.move_up_img.style.cursor = 'pointer';
			this.move_up_img.style.marginTop = this.div_obj_top[0]+'px';
			addEvent(this.move_up_img,'click',function(){window.scrollTo(0,0)});//move top
			try{
			this.div_obj[0].appendChild(this.move_up_img);
			}catch(e){}
		}
		if(this.hide[0]==0 && this.move_fix==0){
			this.hidden_check_img = new Object();
			this.hidden_check_img[0] = document.createElement("img");
			this.hidden_check_img[0].src = this.check_img_src[this.get_ck(0)];
			this.hidden_check_img[0].style.marginBottom = '2px';
			this.hidden_check_img[0].style.cursor = 'pointer';
			addEvent(this.hidden_check_img[0],'click',function(){obj.move_check(0)});
			try{
			this.div_obj[0].appendChild(this.hidden_check_img[0]);
			}catch(e){}
		}
		if(this.hide[1]==0 && this.move_fix==0){
			this.hidden_check_img[1] = document.createElement("img");
			this.hidden_check_img[1].src = this.check_img_src[this.get_ck(1)];
			this.hidden_check_img[1].style.marginBottom = '2px';
			this.hidden_check_img[1].style.cursor = 'pointer';
			addEvent(this.hidden_check_img[1],'click',function(){obj.move_check(1)});
			try{
			this.div_obj[0].appendChild(this.hidden_check_img[1]);
			}catch(e){}
		}
		//¾Æ·¡·ÎÀÌµ¿ ÀÌ¹ÌÁö 
		if(this.move_img_src[1]!="" && this.hide[0]==0){
			this.move_down_img = new Image();
			this.move_down_img.src = this.move_img_src[1];
			this.move_down_img.style.cursor = 'pointer';
			addEvent(this.move_down_img,'click',function(){window.scrollTo(0,parseInt(document.body.scrollHeight))});//move bottom
			try{
			this.div_obj[0].appendChild(this.move_down_img);
			}catch(e){}
		}
		for(var no=0;no<2;no++){
			if(typeof(this.div_obj[no])!='defined'){
				if(this.get_ck(no)==1){
					this.move_menu(no,1);
				}
			}
		}
		return true;
	},
	get_ck : function(no){
		v = (this.move_fix==1)? this.move_ok[no]:getCookie("mov["+this.div_obj[no].id+"]");
		if(v==null){
			return 0;
		}else{
			return v;
		}
	},
	set_ck : function(no,ck){
		if(this.move_fix==1){
			setCookie("mov["+this.div_obj[no].id+"]",this.move_ok[no],0);//°íÁ¤
		}else{
			setCookie("mov["+this.div_obj[no].id+"]",ck,0);
		}
	},	
	move_check : function(no){
		if(this.get_ck(no)==1){//½½¶óÀÌµå ²ô±â
			window.clearTimeout(this.timeId[this.div_obj[no].id]);//Å¸ÀÓ»èÁ¦
			this.div_obj[no].style.top = parseInt(this.div_obj_top[no])+'px';//¿øÀ§Ä¡·Î ÀÌµ¿
			this.hidden_check_img[no].src = this.check_img_src[0];
			this.set_ck(no,0);
		}else{
			this.hidden_check_img[no].src=this.check_img_src[1];
			this.set_ck(no,1);
			this.move_menu(no,1);
		}
	},
	move_menu : function (n,ck){
		var obj = this;
		if(ck==1){
			this.div_obj_start = parseInt(this.div_obj[n].style.top,10);
			this.div_obj_end = parseInt(scrollTop()) + parseInt(this.div_obj_max_move_top[n],10);//scroll top xhtml 1.0 check
			if (this.div_obj_end < parseInt(this.div_obj_top[n],10)) this.div_obj_end = parseInt(this.div_obj_top[n],10);
			if (this.div_obj_start != this.div_obj_end ) {
				this.div_obj_offset = Math.ceil(Math.abs( this.div_obj_end - this.div_obj_start ) / 15 );
				t = parseInt(this.div_obj[n].style.top, 10) + ((this.div_obj_end<this.div_obj_start)? this.div_obj_offset*-1:this.div_obj_offset);
				this.div_obj[n].style.top = t+'px';
				this.slide_time = 10;
			}
			this.timeId[this.div_obj[n].id] = window.setTimeout(function(){obj.move_menu(n,ck)},this.slide_time);
		}else{
			window.clearTimeout(this.timeId[this.div_obj[no].id]);
		}
	}
}
//-->
