var js_rolling = function(this_s){
	// ½Ã°£´ÜÀ§´Â ms·Î 1000ÀÌ 1ÃÊ
	if(this_s.nodeType==1){
		this.this_s = this_s;
	}else{
		this.this_s = document.getElementById(this_s);
	}
	this.is_rolling = false;
	this.direction = 1; //1:top, 2:right, 3:bottom, 4:left (½Ã°è¹æÇâ) // 1¹ø°ú 4¹ø¸¸ µÊ
	this.children =	null;
	this.move_gap = 1;	//¿òÁ÷ÀÌ´Â ÇÈ¼¿´ÜÀ§
	this.time_dealy = 100; //¿òÁ÷ÀÌ´Â Å¸ÀÓµô·¹ÀÌ
	this.time_dealy_pause = 1000;//ÇÏ³ªÀÇ ´ë»óÀÌ »õ·Î ½ÃÀÛÇÒ ¶§ ¸ØÃß´Â ½Ã°£, 0 ÀÌ¸é Àû¿ë ¾ÈÇÔ
	this.time_timer=null;
	this.time_timer_pause=null;
	this.mouseover=false;
	this.init();
	this.set_direction(this.direction);
}
js_rolling.prototype.init = function(){
	this.this_s.style.position='relative';
	this.this_s.style.overflow='hidden';
	var children = this.this_s.childNodes;
	for(var i=(children.length-1);0<=i;i--){
		if(children[i].nodeType==1){
			children[i].style.position='relative';
		}else{
			this.this_s.removeChild(children[i]);
		}
	}
	var this_s=this;
	this.this_s.onmouseover=function(){
		this_s.mouseover=true;
		if(!this_s.time_timer_pause){
			this_s.pause();
		}
	}
	this.this_s.onmouseout=function(){
		this_s.mouseover=false;
		if(!this_s.time_timer_pause){
			this_s.resume();
		}
	}	
}
js_rolling.prototype.set_direction = function(direction){
	this.direction=direction;
	if(this.direction==2 ||this.direction==4){
		this.this_s.style.whiteSpace='nowrap';
	}else{
		this.this_s.style.whiteSpace='normal';
	}
	var children = this.this_s.childNodes;
	for(var i=(children.length-1);0<=i;i--){
			if(this.direction==1){
				children[i].style.display='block';
			}else if(this.direction==2){
				children[i].style.textlign='right';
				children[i].style.display='inline';
			}else if(this.direction==3){
				children[i].style.display='block';
			}else if(this.direction==4){
				children[i].style.display='inline';
			}else if(this.direction==5){
				children[i].style.display='block';
			}
	}
	this.init_element_children();	
}
js_rolling.prototype.init_element_children = function(){
	var children = this.this_s.childNodes;
	this.children = children;
	for(var i=(children.length-1);0<=i;i--){
			if(this.direction==1){
				children[i].style.top='0px';
			}else if(this.direction==2){
				children[i].style.left='-'+this.this_s.firstChild.offsetWidth+'px';
			}else if(this.direction==3){
				children[i].style.top='-'+this.this_s.firstChild.offsetHeight+'px';
			}else if(this.direction==4){
				children[i].style.left='0px';
			}else if(this.direction==5){
				children[i].style.top='0px';
			}
	}
}
js_rolling.prototype.act_move_up = function(){
	for(var i = 0,m=this.children.length;i<m;i++){
		var child = this.children[i];
		child.style.top=(parseInt(child.style.top)-this.move_gap)+'px';
	}
	if((this.children[0].offsetHeight+parseInt(this.children[0].style.top))<=0){
		this.this_s.appendChild(this.children[0]);
		this.init_element_children();
		this.pause_act();		
	}
}
js_rolling.prototype.move_up = function(){
	if(this.direction!=1&&this.direction!=3){return false;}
	this.this_s.appendChild(this.children[0]);
	this.init_element_children();
	this.pause_act();	
}
js_rolling.prototype.act_move_down = function(){
	for(var i = 0,m=this.children.length;i<m;i++){
		var child = this.children[i];
		child.style.top=(parseInt(child.style.top)+this.move_gap)+'px';
	}
	if(parseInt(this.children[0].style.top)>=0){
		this.this_s.insertBefore(this.this_s.lastChild,this.this_s.firstChild);
		this.init_element_children();
		this.pause_act();	
	}
}
js_rolling.prototype.move_down = function(){
	if(this.direction!=1&&this.direction!=3){return false;}	
	this.this_s.insertBefore(this.this_s.lastChild,this.this_s.firstChild);
	this.init_element_children();
	this.pause_act();
}
js_rolling.prototype.act_move_left = function(){
	for(var i = 0,m=this.children.length;i<m;i++){
		var child = this.children[i];
		child.style.left=(parseInt(child.style.left)-this.move_gap)+'px';
	}
	if((this.children[0].offsetWidth+parseInt(this.children[0].style.left))<=0){
		this.this_s.appendChild(this.this_s.firstChild);
		this.init_element_children();
		this.pause_act();		
	}
}
js_rolling.prototype.move_left = function(){
	if(this.direction!=2&&this.direction!=4){return false;}		
	this.this_s.appendChild(this.this_s.firstChild);
	this.init_element_children();
	this.pause_act();		
}
js_rolling.prototype.act_move_right = function(){
	for(var i = 0,m=this.children.length;i<m;i++){
		var child = this.children[i];
		child.style.left=(parseInt(child.style.left)+this.move_gap)+'px';
	}
	
	if(parseInt(this.this_s.lastChild.style.left)>=0){
		this.this_s.insertBefore(this.this_s.lastChild,this.this_s.firstChild);
		this.init_element_children();
		this.pause_act();		
	}
}
js_rolling.prototype.move_right = function(){
	if(this.direction!=2&&this.direction!=4){return false;}			
	this.this_s.insertBefore(this.this_s.lastChild,this.this_s.firstChild);
	this.init_element_children();
	this.pause_act();
}
js_rolling.prototype.start = function(){ //·Ñ¸µ ½ÃÀÛ
	var this_s = this;
	this.stop();
	this.is_rolling = true;
	var act = function(){
		if(this_s.is_rolling){
			if(this_s.direction==1){this_s.act_move_up();}
			else if(this_s.direction==2){this_s.act_move_right();}
			else if(this_s.direction==3){this_s.act_move_down();}
			else if(this_s.direction==4){this_s.act_move_left();}
			else if(this_s.direction==5){this_s.act_move_up();}
		}
	}
	this.time_timer = setInterval(act,this.time_dealy);
}
js_rolling.prototype.pause_act = function(){ //ÀÏ½Ã µ¿ÀÛ
	if(this.time_dealy_pause){
		var this_s = this;
		var act = function(){this_s.resume();this_s.time_timer_pause=null;}
		if(this.time_timer_pause){clearTimeout(this.time_timer_pause);}
		this.time_timer_pause = setTimeout(act,this.time_dealy_pause);
		this.pause();
	}
}
js_rolling.prototype.pause = function(){ //ÀÏ½Ã ¸ØÃã
	this.is_rolling = false;
}
js_rolling.prototype.resume = function(){ //ÀÏ½Ã ¸ØÃã ÇØÁ¦
	if(!this.mouseover){
		this.is_rolling = true;
	}
}
js_rolling.prototype.stop = function(){ //·Ñ¸µÀ» ³¡³¿
	this.is_rolling = false;
	if(!this.time_timer){
		clearInterval(this.time_timer);
	}
	this.time_timer = null
}

//global.js µ¥ÀÌÅ¸

var tabtopMenu_on = new Array() ;
var tabtopMenu_off = new Array() ;
var tabtopMenuImgName, tabtopMenuLayName ;

for (i=1; i<=9; i++){ 
	tabtopMenu_on[i] = new Image() ;
	tabtopMenu_off[i] = new Image() ;
	if(i>9){
		tabtopMenu_on[i].src = "../img/main_menu/top_memu_on_" + i + ".gif" ;
		tabtopMenu_off[i].src = "../img/main_menu/top_memu_off_" + i + ".gif" ;
	}else{
		tabtopMenu_on[i].src = "../img/main_menu/top_memu_on_0" + i + ".gif" ;		
		tabtopMenu_off[i].src = "../img/main_menu/top_memu_off_0" + i + ".gif" ;
	}
}


function tabtopMenuAct() {
	for (i=1; i<=9; i++){
		tabtopMenuImgName = "tabtopMenu" + i ;
		document.images[tabtopMenuImgName].src = tabtopMenu_off[i].src ;
		tabtopMenuLayName = document.all["tabtopMenuLay"+i] ;
		tabtopMenuLayName.style.display = "none";
	}
	tabtopMenuImgName = "tabtopMenu" + arguments[0] ;
	document.images[tabtopMenuImgName].src = tabtopMenu_on[arguments[0]].src ;
	document.all["tabtopMenuLay"+arguments[0]].style.display = "" ;
}


function dc_menu(val){
		if(val=='compact')
		{
			document.all('compact').style.display='';
			document.all('slr').style.display='none';
		}else{
			document.all('slr').style.display='';
			document.all('compact').style.display='none';
		}
}

function image_auto_resize(this_s,width,height){ 
 var ta_image = new Image(); 
 ta_image.src = this_s.src; 
  if(!width){this_s.removeAttribute('width'); 
  this_s.style.width='auto';} 
  else if(width < ta_image.width){ 
  this_s.width = width; 
  }else{ 
  this_s.width = ta_image.width; 
  } 
  if(!height){this_s.removeAttribute('height'); 
  this_s.style.height='auto';} 
  else if(height < ta_image.height){ 
  this_s.height = height; 
  }else{ 
  this_s.height = ta_image.height; 
  } 
}


// embeded.jsÆÄÀÏ
function GET(arrayKey, arrayValue, Value) {
        count = arrayKey.length;
        for(i=0;i<count;i++) {
            if(arrayKey[i]==Value) {
                return arrayValue[i];
                break;
            }
        }
    }

    function mEmbed() {
        var key = new Array();
        var value = new Array();
        error_check=0;
        for(i=0;i<mEmbed.arguments.length;i++) {
            data = mEmbed.arguments[i].split('=');
            key[i] = data[0];
            value[i] = data[1];
        }

        contents = '';
        srcdata = GET(key,value,'src');
        if(/\.(...)$/.test(srcdata)) {
            flashon = 1;
        }

        classid = GET(key,value,'classid');
        codebase = GET(key,value,'codebase');
        if(flashon==1) {
            classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
            codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.c-ab#version=6,0,29,0';
		   
		   // classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
           // codebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
        
        }
        if(classid && codebase) {
            contents += '<object';
            if(classid) {
                contents += ' classid="' + classid + '"';
            }
            if(codebase) {
                contents += ' codebase="' + codebase + '"';
            }
            count = key.length;
            for(i=0;i<count;i++) {
                if(value[i]!='') {
                    if(key[i]!='src') {
                        contents += ' ' + key[i] + '="' + value[i] + '"';
                    }
                }
            }
            contents += '>';
            for(i=0;i<count;i++) {
                if(value[i]!='') {
                    if(flashon==1 && key[i]=='src') {
                        contents += '<param name="movie" value="' + value[i] + '" />';
                    } else {
                        contents += '<param name="' + key[i] + '" value="' + value[i] + '" />';
                    }
                }
            }
        }
        contents += '<embed';
        for(i=0;i<count;i++) {
            if(value[i]!='') {
                contents += ' ' + key[i] + '="' + value[i] + '"';
            }
        }
        contents += '>';
        contents += '</embed>';
        if(classid && codebase) {
            contents += '</object>';
        }
        document.write(contents);
		
    }

function popco_start(w){
	var rstr ="<table cellpadding=0 cellspacing=0 border=0 width=" +(w+4) + " align=center><tr><td colspan=2 width=2></td><td width=" +w +" class=pbox_tb></td><td colspan=2 width=2></td></tr><tr><td width=1></td><td width=1 class=pbox_tb></td><td bgcolor=ffffff></td><td width=1 class=pbox_tb></td><td width=1></td></tr><tr><td colspan=5 align=center>";
	document.write(rstr);
}
function popco_end(){
	var rstr ="</td></tr><tr height=1><td width=1></td><td width=1 bgcolor=#cdcdcd></td><td  bgcolor=ffffff></td><td width=1 bgcolor=#cdcdcd></td><td width=1></td></tr><tr height=1><td colspan=2 width=2></td><td bgcolor=#cdcdcd></td><td colspan=2 width=2></td></tr></td></tr></table>";
	document.write(rstr);
}

function popco_bold_start(w){
	var rstr ="<table cellpadding=0 cellspacing=0 border=0 width=" +(w+4) + " align=center><tr><td colspan=2 width=2></td><td width=" +w +" class=pbox_bold></td><td colspan=2 width=2></td></tr><tr><td width=1></td><td width=1 class=pbox_bold></td><td bgcolor=ffffff></td><td width=1 class=pbox_bold></td><td width=1></td></tr><tr><td colspan=5 align=center>";
	document.write(rstr);
}
function popco_bold_end(){
	var rstr ="</td></tr><tr height=1><td width=1></td><td width=1 bgcolor=#C9C9C9></td><td  bgcolor=ffffff></td><td width=1 bgcolor=#C9C9C9></td><td width=1></td></tr><tr height=1><td colspan=2 width=2></td><td bgcolor=#C9C9C9></td><td colspan=2 width=2></td></tr></td></tr></table>";
	document.write(rstr);
}


function popco_sep(){
	var rstr ="<table cellpadding=0 cellspacing=0 border=0  width=100%><tr height=10><td  bgcolor=ffffff></td></tr></table>";
	document.write(rstr);
}

function popco_cp(){ 
	alert("ÀÌº¥Æ® ÆäÀÌÁö°¡ ÀúÀåµÇ¾ú½À´Ï´Ù.\n ÇØ´ç Ä«Æä,ºí·Î±×,Ä¿¹Â´ÏÆ¼¿¡ ºÙ¿©³Ö±â ¶Ç´Â [Ctrl + V]Å°¸¦ ´©¸£½Ã¸é º¹»çµË´Ï´Ù."); 
	var event_copy = document.getElementById("copy_memo").createTextRange(); 
	event_copy.select(); 
	event_copy.execCommand('copy'); 
}

function clear_string() { 
		document.getElementById("loginvalue").value = ""; 
		
		document.getElementById("pwvalue").value = ""; 
		
		document.getElementById("pwvalue").style.display="none";
		document.getElementById("pwvalue2").style.display="";
		document.getElementById("loginvalue").focus();
	}
function dc_menu(val){
		if(val=='compact')
		{
			document.all('compact').style.display='';
			document.all('slr').style.display='none';
		}else{
			document.all('slr').style.display='';
			document.all('compact').style.display='none';
		}
}

function image_auto_resize(this_s,width,height){ 
 var ta_image = new Image(); 
 ta_image.src = this_s.src; 
  if(!width){this_s.removeAttribute('width'); 
  this_s.style.width='auto';} 
  else if(width < ta_image.width){ 
  this_s.width = width; 
  }else{ 
  this_s.width = ta_image.width; 
  } 
  if(!height){this_s.removeAttribute('height'); 
  this_s.style.height='auto';} 
  else if(height < ta_image.height){ 
  this_s.height = height; 
  }else{ 
  this_s.height = ta_image.height; 
  } 
}

function view_comment(val){
	if(val=='dica_spec_info')
	{
		document.all('dica_spec_info').style.display=''
		document.all('lens_spec_info').style.display='none'
	}else{
		document.all('lens_spec_info').style.display=''
		document.all('dica_spec_info').style.display='none'
	}
}

