var imgPath = "./../img/";
var etxFileNm = ".gif";

var prd = new Array();
	
prd[0] = 'cImg0';
	
prd[1] = 'cImg1';
	
prd[2] = 'cImg2';
	
prd[3] = 'cImg3';
	
prd[4] = 'cImg4';
	
prd[5] = 'cImg5';
	
prd[6] = 'cImg6';
	
prd[7] = 'cImg7';

prd[8] = 'cImg8';

prd[9] = 'cImg9';

var prdImgOff = new Array();
	
prdImgOff[0] = 'search/1week_off';
	
prdImgOff[1] = 'search/1month_off';
	
prdImgOff[2] = 'search/3month_off';
	
prdImgOff[3] = 'search/6month_off';
	
prdImgOff[4] = 'search/9month_off';
	
prdImgOff[5] = 'search/1year_off';

prdImgOff[6] = 'search/2year_off';

prdImgOff[7] = 'search/3year_off';

prdImgOff[8] = 'search/4year_off';

prdImgOff[9] = 'search/5year_off';


var prdImgOn = new Array();
	
prdImgOn[0] = 'search/1week_on';
	
prdImgOn[1] = 'search/1month_on';
	
prdImgOn[2] = 'search/3month_on';
	
prdImgOn[3] = 'search/6month_on';
	
prdImgOn[4] = 'search/9month_on';
	
prdImgOn[5] = 'search/1year_on';
	
prdImgOn[6] = 'search/2year_on';
	
prdImgOn[7] = 'search/3year_on';

prdImgOn[8] = 'search/4year_on';

prdImgOn[9] = 'search/5year_on';



// Image Rollover
function ChgImg(name,img){
	var imgUrl = "img/"
	name.src = imgUrl + img;
}

function chgImg(imgObj, cnt, menu){

	imgObj.src = imgPath+prdImgOn[cnt]+etxFileNm;
	
	for(var i=0; i<prd.length; i++){
		
		if(i!=cnt){
			
			document.getElementById(prd[i]).src = imgPath+prdImgOff[i]+menu+etxFileNm;		
		}
	
	}

}	


function flashWrite(url,w,h,id,bg,win){


	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='wmode' value='"+win+"' />"+ 
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	document.write(flashStr);
}

function printSWF(fn, w, h)
{
	var arg = arguments;
	var argc =  arguments.length;
	str   = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\"width=\""+w+"\" height=\""+h+"\">";
	str += "        <param name=\"SRC\" value=\""+fn+"\">";
	str += "        <param name=\"wmode\" value=\"transparent\">";
	for(i = 3; i < argc ; i++){
		str += "        <param name=\""+arg[i++]+"\" value=\""+arg[i]+"\">";
	}
	str += "        <embed wmode='transparent' src=\""+fn+"\" pluginspage=\"http://www.macromedia.com/shockwave/download/\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\">";
	str += "        </embed> ";
	str += "</object>";
	document.write(str);
}


/***************** GNB ·¹ÀÌ¾î Å©±â Á¶Àý *****************/
function large(){//·¹ÀÌ¾î Å©°Ô
	document.all['gnb'].style.height = 378;
}
function small(){//·¹ÀÌ¾î ÀÛ°Ô
	document.all['gnb'].style.height = 115;
}

/***************** GNB ·¹ÀÌ¾î Å©±â Á¶Àý ****************
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}*/

/***************** ÀÌ¹ÌÁö ·Ñ¿À¹ö *****************/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/***************** ÆË¾÷ *****************/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/**
 * 2009-09-07 Writen by LEE
 * DIV NameÀÇ DIV¸¦ Ç¥½ÃÇÑ´Ù.
 * @param str   DIV Name
 * @return ret  null
 */
function showDiv( szDivNm)
{
	document.getElementById( szDivNm).style.display = "inline";
}

/**
 * 2009-09-07 Writen by LEE
 * DIV NameÀÇ DIV¸¦ Á¦°ÅÇÑ´Ù.
 * @param str   DIV Name
 * @return ret  null
 */
function hiddenDiv( szDivNm)
{
	document.getElementById( szDivNm).style.display = "none";
}

/**
 * 2009-09-07 Writen by LEE
 * DIV NameÀÇ DIV¸¦ ÇöÀç Ç¥½Ã»óÅÂ¿¡ µû¶ó¼­ Ç¥½Ã/Á¦°ÅÇÑ´Ù.
 * @param str   DIV Name
 * @return ret  null
 */
function showHiddenDiv( szDivNm)
{
	if ( document.getElementById( szDivNm).style.display == "inline")
	{
		document.getElementById( szDivNm).style.display = "none";
	}
	else if ( document.getElementById( szDivNm).style.display == "none")
	{
		document.getElementById( szDivNm).style.display = "inline";			
	}
}

/***************** ÅÇ ·¹ÀÌ¾î *****************/
function tLayer(id, total){
	for(i=1;i<=total;i++){
		if(i!=id){
			obj1 = eval("Smenu" + i);
			obj1.style.display = "none";
		}
	}	
	
	obj1 = eval("Smenu" + id);
	if(obj1.style.display == "none"){
		obj1.style.display = "";
	}		
}
/***************** ·¹ÀÌ¾î show/hide *****************/
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

/***************** ÅÇ ·¹ÀÌ¾î(¿­±â´Ý±âµû·Î) *****************/
function tMenu(id){
	obj1 = eval("tabLayer" + id);
	if(obj1.style.display == "none"){
		obj1.style.display = "";
	}		
}
function tMenuClose(id){
	obj1 = eval("tabLayer" + id);
	if(obj1.style.display == ""){
		obj1.style.display = "none";
	}		
}

function getToday(){
	var now =  new Date();
	var year = now.getYear();
	var month = now.getMonth()+1;
	var date = now.getDate();
	if (month<10) month = "0"+month;
	if(date<10) date = "0"+date;
	var now  = year + "" + month +""+ date;

	return now

}

function gettyImg(obj){
	var type = obj.toLowerCase();
	
	var img="";
	if(type =="pdf"){
		img =  "/fs/dis/img/ico_pdf.gif";
	}else if(type =="hwp"){
		img = "/fs/dis/img/ico_hwp.gif";
	}else if(type =="doc"){
		img = "/fs/dis/img/ico_w.gif";
	}else if(type =="htm"){
		img = "/fs/dis/img/ico_htm.gif";
	}else if(type =="zip"){
		img = "/fs/dis/img/ico_zip.gif";
	}else if(type =="ppt"){
		img = "/fs/dis/img/ico_ppt.gif";
	}else if(type =="xls"){
		img = "/fs/dis/img/ico_xls.gif";
	}
	
	return img;
}

//chart°ª Á¶Àý
function setChartDisplay(id,width, height ){
	if(id=='gridJone'){
		gridJone.style.width=width;
		gridJone.style.height=height;
		chartJone.style.width="1px";
		chartJone.style.height="1px";
	}else if(id=='chartJone'){
		gridJone.style.width="1px";
		gridJone.style.height="1px";
		chartJone.style.width=width;
		chartJone.style.height=height;	
	}
}


/*
	°³¿ù¼öÀÔ·ÂÇÏ¿© ÀÌÀü ³¯Â¥ °¡Á®¿À±â
	val °³¿ù¼ö(±¸ÇÏ°íÀÚÇÏ´Â °³¿ù¼ö+1À» ÇØ¾ßÇÔ)
*/
function calcDateTurm(val,id)
{
	var result;
	val+=1;
	var stdDate = document.getElementById(id).value;
	//alert("nextDate>>>>>>"+stdDate);
	var year = stdDate.substring(0,4) ;
	var month = stdDate.substring(4,6);
	var date = stdDate.substring(6,8);
	
	cDate = deMonth(year, month, date, val);
	//alert("cDate>>>>>>"+cDate);
	var y = cDate.getFullYear(); //°è»êµÈ ³âµµ
	var m = cDate.getMonth(); //°è»êµÈ ¿ù
	var d = cDate.getDate(); //°è»êµÈ ³¯
	if (m<10) m = "0"+m;
	if(d<10) d = "0"+d;
	result = y + "" + m +""+ d;	
	//alert(result);
	return result;
}

/*---------------------------------------------------------------------------------
	title :   AJAX·Î JSP³»¿ë °¡Á®¿À±â
	content:	setOutFormno(standardDt,reportCd) ±âÁØÀÏ/º¸°í¼­ÄÚµå
				getOutFormno(xmlHttp)
------------------------------------------------------------------------------------*/
var pageRequest = null;
var ctlId;

function getPageContent(url,id){
//ºê¶ó¿ìÀú¿¡ µû¸¥ XMLHttpRequest °´Ã¼¸¦ ¾ò¾î¿ÂÈÄ httpRequest Àü¿ªº¯¼ö¿¡ ´ã´Â´Ù.
 pageRequest = createHttpRequest();
 ctlId = id;
 //ÁöÁ¤ÇÑ URL¿¡ GET¹æ½ÄÀ¸·Î µ¥ÀÌÅÍ¸¦ ¿äÃ»ÇÑ´Ù.
 //httpRequest°´Ã¼ÀÇ »óÅÂ º¯È­°¡ ÀÖÀ»¶§ È£ÃâÇÒ ÇÔ¼ö¸¦ ÁöÁ¤ÇÑ´Ù.
 pageRequest.onreadystatechange = setPageCont;
 pageRequest.open("GET", url, true); // urlÀÇ ÁÖ¼Ò¸¦ GET¹æ½ÄÀ¸·Î ¿­ ÁØºñ¸¦ ÇÑ´Ù.
 pageRequest.send(null); //¼­¹ö¿¡ Àü¼ÛÇÑ´Ù. 
}
function setPageCont(){
 if(pageRequest.readyState == 4){ //µ¥ÀÌÅÍÀÇ ÀüºÎ¸¦ ¹ÞÀº »óÅÂ
  if(pageRequest.status == 200){//¿äÃ» ¼º°ø  
   //alert(pageRequest.responseText);
   document.getElementById(ctlId).innerHTML = pageRequest.responseText;
  
	pageMethod(ctlId);
   
  }else{
   alert("½ÇÆÐ: " + pageRequest.status);
  }
 }
}

function srchCompList(){
	var frm = document.sendForm;
	  window.open("/fs/dis2/com/DISComCompSrch.jsp","compPop","scrollbars=no,toolbar=no,resizable=no,width=600,height=640,left=50,top=50");
	  frm.target = "compPop";
	  frm.action ="/fs/dis2/com/DISComCompSrch.jsp";
	  frm.method = "post";
	  frm.submit();
	//window.open("/fs/dis2/com/DISComCompSrch.jsp","popup","scrollbars=no,toolbar=no,resizable=no,width=600,height=650,left=50,top=50");
}

function fundSrch(){ 
	window.open("/fs/dis2/fundann/DISFundChc.jsp","popup","scrollbars=no,toolbar=no,resizable=no,width=600,height=626,left=50,top=50");
} 

function srchAccountList( szStandardDt){
	window.open("/fs/dis2/cmpann/DISAccLsnSrchPop.jsp?standardDt=" + szStandardDt ,"popup","scrollbars=no,toolbar=no,resizable=no,width=600,height=650,left=50,top=50");
}

// °³ÀÎÁ¤º¸Ãë±Þ¹æÄ§
function goIdvInfo()
{
	window.open("http://www.kofia.or.kr/kofia/index.cfm?event=index.guide.page01","popup","");
}

// ÀÌ¸ÞÀÏÁÖ¼Ò¹«´Ü¼öÁý°ÅºÎ
function goEmailRejection()
{
	window.open("/fs/secure/com/COMEmailRejection.jsp","popup","scrollbars=no,toolbar=no,resizable=no,width=600,height=570,left=50,top=50");
}

//E-mail
function sendEmail()
{
	window.location.href="mailto:webmaster@kofia.or.kr"
}

