// Rollover Action Menu
function Mimg_act(imgName,step,num) { 
	document [imgName].src = "../images/left/menu_"+ step +num +"_on.gif";
} 

// MouseOut Image Default Change Menu
function Mimg_inact(imgName,step,num) { 
   document [imgName].src = "../images/left/menu_"+ step + num +".gif";
}



/*############ ÇÃ·¡½Ã È£Ãâ ÇÔ¼ö ############*/
function flash_url(id,url,w,h,bg,t){

	if(navigator.appVersion.indexOf("MSIE") != -1){
		document.write("\
		<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width="+w+" height="+h+" id="+id+">\
		<param name='movie' value="+url+" />\
		<param name='wmode' value="+t+" />\
		<param name='bgcolor' value="+bg+" />\
		<param name='allowScriptAccess' value='sameDomain' />\
		<param name='quality' value='high' />\
		<param name='menu' value='false' />\
		<embed src="+url+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" allowScriptAccess='sameDomain' quality='high' type='application/x-shockwave-flash' pluginspage='http:/.macromedia.com/go/getflashplayer' />\
		</object>\
		");	
	}else{
		document.write("<embed src='"+url+"' wmode='"+t+"' width='"+w+"' height='"+h+"' name='"+id+"' bgcolor='"+bg+"'></embed>");
	}
}


/****** ¿øÇÏ´Â Å©±â·Î ÆË¾÷ ¶ì¿ì±â ****************************/

var win=null;

function open_link(mypage,myname,w,h,scroll,pos){

if(pos=="default"){

		LeftPosition=20;TopPosition=20;

	}	

if(pos=="random"){

		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;

	}

	if(pos=="center"){

		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;

	} else if((pos!="center" && pos!="random" && pos!="default") || pos==null){

		LeftPosition=0;TopPosition=20} settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';

		win=window.open(mypage,myname,settings);

		if(win.focus){win.focus();

	}

}

// ÀÌ¹ÌÁö ·Ñ¿À¹öÈ¿°ú - ´Üµ¶À¸·Î »ç¿ë
// Rollover Action Menu
function Rollover_act(imgName,imgURL,imgNum) { 
  document [imgName].src = step +num +"_on.gif";
} 

// MouseOut Image Default Change Menu
function Rollover_inact(imgName,imgURL,imgNum) { 
  document [imgName].src = step + num +".gif";
}

/****** ¿øÇÏ´Â Å©±â·Î ÆË¾÷ ¶ì¿ì±â ****************************/

var win=null;

function open_link(mypage,myname,w,h,scroll,pos){

if(pos=="default"){

		LeftPosition=20;TopPosition=20;

	}	

if(pos=="random"){

		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;

	}

	if(pos=="center"){

		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;

	} else if((pos!="center" && pos!="random" && pos!="default") || pos==null){

		LeftPosition=0;TopPosition=20} settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';

		win=window.open(mypage,myname,settings);

		if(win.focus){win.focus();

	}

}


/****** ½½¶óÀÌµù ½ºÅ©¸³Æ® ****************************/
var menu_slideSpeed = 20;	// Higher value = faster
var menu_timer = 10;	// Lower value = faster

var objectIdToSlideDown = false;
var menu_activeId = false;
var menu_slideInProgress = false;
function showHideContent(e,inputId)
{
	if(menu_slideInProgress)return;
	menu_slideInProgress = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var answerDiv = document.getElementById('slide_a' + numericId);

	objectIdToSlideDown = false;
	
	if(!answerDiv.style.display || answerDiv.style.display=='none'){
		if(menu_activeId &&  menu_activeId!=numericId){
			objectIdToSlideDown = numericId;
			slideContent(menu_activeId,(menu_slideSpeed*-1));
		}else{
			
			answerDiv.style.display='block';
			answerDiv.style.visibility = 'visible';
			
			slideContent(numericId,menu_slideSpeed);
		}
	}else{
		slideContent(numericId,(menu_slideSpeed*-1));
		menu_activeId = false;
	}	
}

function slideContent(inputId,direction)
{
	
	var obj =document.getElementById('slide_a' + inputId);
	var contentObj = document.getElementById('slide_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',menu_timer);
	}else{
		if(height<=1){
			obj.style.display='none'; 
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('slide_a' + objectIdToSlideDown).style.display='block';
				document.getElementById('slide_a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,menu_slideSpeed);
			}else{
				menu_slideInProgress = false;
			}
		}else{
			menu_activeId = inputId;
			menu_slideInProgress = false;
		}
	}
}
function initShowHideDivs()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='slide_btn'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'slide_q'+divCounter;
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'slide_a'+divCounter;	
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px';
			contentDiv.className='slide_answer_content';
			contentDiv.id = 'slide_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}		
	}	
}

// ÀÚ½ÅÀÇ ³»¿ë¿¡ ¸Â°Ô ºÎ¸ðÀÇ iframe »çÀÌÁî Å©±â Á¶Àý
function ResizeParentFrame(name)	
{
        if (parent.document.all(name)) {
            var frmSelf  = parent.document.all(name);
            var frmBody  = document.body;
            var frmBodyHeight = frmBody.scrollHeight;
            if (frmBodyHeight <= 0)
            {
                location.reload();
            }else{ 
               if(name=='ifrmComment') //´ñ±Û
               {
                 frmSelf.style.height = frmBodyHeight+40;
               }else{
                frmSelf.style.height = frmBodyHeight+10;
               }
               
            }
            
        }
        parent.document.all(name).style.display='inline';
        setTimeout(function(){ResizeParentFrame(name)}, 200);  // check 5 times for IE bug
}


//´ë¸®Á¡¾È³» Áöµµ
function map_link(no){
    document.getElementById('iframe_process').src = '/company_kr/fawoo/map'+no+'.asp';
}

function flash_map(no){
    if(no)swf = '/company_kr/images/swf/agent_map.swf?mapNum='+no;
	else swf = '/company_kr/images/swf/agent_map.swf';

    var str = ''; 
    str = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='336' height='341' id='map'>";
    str += "<param name='movie' value='"+swf+"' />";
    str += "<param name='wmode' value='transparent' />";
    str += "<param name='bgcolor' value='#ffffff' />";
    str += "<param name='allowScriptAccess' value='sameDomain' />";
    str += "<param name='quality' value='high' />";
    str += "<param name='menu' value='false' />";
    str += "<embed src='/company_kr/images/swf/agent_map.swf' width='336' height='341' name='map' bgcolor='#ffffff' allowScriptAccess='sameDomain' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
    str += "</object>";
   
    return str;    
    
}

function flash_render(id,no){
    document.getElementById(id).innerHTML = flash_map(no);
}
