function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}



/* 게시판 백그라운드 스크립트*/
function thcolor(){

	if (!document.getElementById('bgColor')){return false}
	var tbodyID = document.getElementById('bgColor');
	var nameTR = tbodyID.getElementsByTagName('tr');
	for (var i=0;i< nameTR.length;i++)
	{	
		if (i%2==0 == false)
		{		
			nameTR[i].className="bgC01";
		}	
	}
}
addLoadEvent(thcolor);

function bgchageList(){

	if (!document.getElementById('licolor')){return false}
	var ulID = document.getElementById('licolor');
	var liname = ulID.getElementsByTagName('li');
	for (var i=0;i< liname.length;i++)
	{	
		if (i%2==0 == false)
		{		
			liname[i].className="on";
		}	
	}
}
addLoadEvent(bgchageList);


function tbodycolor(tableBgList){
	if (tableBgList == null){return false}

	var tbodyNa = tableBgList;
	for (var e = 0 ;e < tbodyNa.length;e++ )
	{	
		var tbodyID = document.getElementById(tbodyNa[e]);
		var nameTR = tbodyID.getElementsByTagName('tr');
		for (var i=0;i< nameTR.length;i++)
		{	
			if (i%2==0 == false)
			{		
				nameTR[i].className="bgc02";			
				var fchid = nameTR[i].firstChild;			
				var lchid = nameTR[i].lastChild;
				fchid.className="first";
				lchid.className="last";
				
			}	
		}
		

	}
	
}


/*
function tdbgchange(tableBgList){
	
	if (!tableBgList){return false}
	for (var e = 0; e <tableBgList.length;e++ )
	{
		var body =document.getElementById(tableBgList[e]);
		var bodytr = body.getElementsByTagName('tr');
		for (var d=0;d<bodytr.length ;d++ )
		{

			if (d%2==0 == false)
			{		
				var tdfirst = bodytr[d].firstChild;
				var tdlast = bodytr[d].lastChild;
				tdfirst.className="first";
				tdlast.className="last";
			}	
			
		}
	}
	
}

*/

function popuptag(){
	if (!document.getElementById('pupupTabtop')){return false}
	var nullnum = 0;
	var listWarp = document.getElementById('pupupTabtop');
	var liID = listWarp.getElementsByTagName('li');
	
	for (var i=0 ;i<liID.length ;i++ )
	{		
		liID[i].setAttribute("id",i);
		if(liID[i].className=="on"){ nullnum = i; }
		liID[i].onclick=function(){
			
			var shownum = this.getAttribute("id");
			if(shownum!=nullnum){
				liID[nullnum].className="";
			}			
			if(this.className!="on"){
				this.className="on";
			}
				
			var frameId = document.getElementById('framecont');			
			var moon = '';
			if(params && params.moon){
				moon = params.moon;
			}
			var url = "/goodmorning/today"+shownum+"/moon:"+(moon);
			if(params && params.page){
				url += "/page:"+params.page;
			}

			if(params && params.date){
				url += "/date:"+params.date;
			}
			frameId.setAttribute("src", url);

			nullnum = this.getAttribute("id");
		}	
	}
}
addLoadEvent(popuptag);

function popuptag2(){
	if (!document.getElementById('pupupTabtop2')){return false}
	var nullnum = 0;
	var listWarp = document.getElementById('pupupTabtop2');
	var liID = listWarp.getElementsByTagName('li');
	
	for (var i=0 ;i<liID.length ;i++ )
	{
		liID[i].setAttribute("id",i);
		liID[i].onclick=function(){
			
			var shownum = this.getAttribute("id");
			var frameId = document.getElementById('framecont');

			if(shownum!=nullnum){
				liID[nullnum].className="";
			}			
			if(this.className!="on"){
				this.className="on";
			}

			nullnum = this.getAttribute("id");

			if (shownum == 0){
				frameId.setAttribute("src","/deal/thebell/");
				return;
			}else if (shownum == 1){
				frameId.setAttribute("src","/deal/dealogic/");
				return;
			}else {
				frameId.setAttribute("src","/deal/dealogic/");
				return;
			}
		}	
	}
}
addLoadEvent(popuptag2);


function popuptap(){	
	if (!document.getElementById('pupupTab')){return false}
	var nullnum = 0;	
	var listWarp = document.getElementById('pupupTab');
	var liID = listWarp.getElementsByTagName('li');
	
	for (var i=0 ;i<liID.length ;i++ )
	{

		liID[i].setAttribute("id",i);
		
		liID[i].onclick=function(){
			var shownum = this.getAttribute("id");
			if(shownum!=nullnum){
				liID[nullnum].className="";
			}			
			if(this.className!="on"){
				this.className="on";
				var showID = document.getElementById('showEl_'+shownum);
				showID.style.display="block";
				
				var hideID = document.getElementById('showEl_'+nullnum);
				hideID.style.display="none";
			}
			
			nullnum = this.getAttribute("id");
			
		}	
	}
	
}

addLoadEvent(popuptap);

/* footer area 스크립트 */
function onstart(){
	if (!document.getElementById('autoEleWarp'))
	{
		return false;
	}
	var closeele = document.getElementById('footeropen');
	var openele= document.getElementById('footerclose');
	var divid = document.getElementById('autoEleWarp');
	var eleheight = document.getElementById('autoEle');
	eleheight.style.height="168px";
	openele.onclick=function(){
		openWarp();
			closeele.style.display="none";
		}
	
	closeele.onclick=function(){
		closee();
			openele.style.display="none";
		
		}	
}



addLoadEvent(onstart);

function closee(){	
	var openele= document.getElementById('footerclose');
	var closeele = document.getElementById('footeropen');
	var divid = document.getElementById('autoEleWarp');
	var auto = parseInt(divid.offsetHeight);
	
	if (auto== 0){
		divid.style.height="1px";
		openele.style.display="block";
		closeele.style.display="none";
		return false;
		
	}
	if (auto <= 168){
		var dist =Math.ceil(auto/10);
		var num = auto-dist;
	}	
	divid.style.height=num+"px";
	setTimeout(closee,20);
}
function openWarp(){	
	var openele= document.getElementById('footerclose');
	var closeele = document.getElementById('footeropen');
	var divid = document.getElementById('autoEleWarp');
	var auto = parseInt(divid.offsetHeight);	
	if (auto >= 168){
		divid.style.height="168px";
		openele.style.display="none";
		closeele.style.display="block";
		return false;		
		}
	if (auto >= 1){	
		var dist =Math.ceil(auto/10);
		var num = auto+dist;
	}	
	divid.style.height=num+"px";
	setTimeout(openWarp,20);
}




/* footer area 스크립트 끝  */

function tab(){	
	if (!document.getElementById('imgtab')){return false}
	var nullnum = 0;	
	var listWarp = document.getElementById('imgtab');	
	
	var liID = listWarp.getElementsByTagName('li');
	for (var i=0 ;i<liID.length ;i++ )
	{


		liID[i].setAttribute("id",i);
		var fchild =liID[i].firstChild;
		fchild.className="first";
		liID[i].onclick=function(){
			this.className="on";
			liID[nullnum].className="";	
			this.appendChild(imgLeft);
			this.appendChild(imgRight);
			var shownum = this.getAttribute("id");
			
			var showID = document.getElementById('showEl_'+shownum);
			showID.style.display="block";
			
			var hideID = document.getElementById('showEl_'+nullnum);
			hideID.style.display="none";
			nullnum = this.getAttribute("id");
			
		}	
	}
	
}
addLoadEvent(tab);

/* tab 전체*/

function maintab(tabId){	
	
	var nullnum = 0;	
	var listWarp = tabId;
	
	var liID = listWarp.getElementsByTagName('li');
	for (var i=0 ;i<liID.length ;i++ )
	{

		liID[i].setAttribute("id",i);
		var fchild =liID[i].firstChild;
		fchild.className="first";
		liID[i].onclick=function(){
			this.className="on";
			liID[nullnum].className="";	
			
		
			var shownum = this.getAttribute("id");
			
			var showID = document.getElementById('showEl_'+shownum);
			var imgID = document.getElementById('img_'+shownum);
			showID.style.display="block";
			imgID.src = imgID.src.replace(".gif","_on.gif");
			
			
			if (shownum==0)
			{
				this.className="onfirst";	
			}
			else{
				liID[0].className="first";	
			}
			var hideID = document.getElementById('showEl_'+nullnum);
			var imghideID = document.getElementById('img_'+nullnum);
			
			hideID.style.display="none";
			
			imghideID.src = imghideID.src.replace("_on.gif", ".gif");

			nullnum = this.getAttribute("id");
			
		}	
	}
	
}




function maintab02(tabId02){	
	
	var nullnum = 0;	
	var listWarp = tabId02;
	
	var liID = listWarp.getElementsByTagName('li');
	for (var i=0 ;i<liID.length ;i++ )
	{

		liID[i].setAttribute("id",i);
		var fchild =liID[i].firstChild;
		fchild.className="first";
		liID[i].onclick=function(){
			this.className="on";
			liID[nullnum].className="";			
			var shownum = this.getAttribute("id");			
			var showID = document.getElementById('showAl_'+shownum);
			var imgID = document.getElementById('img01_'+shownum);
			showID.style.display="block";
			imgID.src = imgID.src.replace(".gif","_on.gif");			
			if (shownum==0)
			{
				this.className="onfirst";
			}
			else{
				liID[0].className="first";				}
			var hideID = document.getElementById('showAl_'+nullnum);
			var imghideID = document.getElementById('img01_'+nullnum);			
			hideID.style.display="none";			
			imghideID.src = imghideID.src.replace("_on.gif", ".gif");
			nullnum = this.getAttribute("id");
			
		}	
	}
	
}

/* 서브메인 탭 */
function smaintab01(tabId01){	
	
	var nullnum = 0;	
	var listWarp = tabId01;	
	var liID = listWarp.getElementsByTagName('li');
	for (var i=0 ;i<liID.length ;i++ )
	{

		liID[i].setAttribute("id",i);
		var fchild =liID[i].firstChild;
		fchild.className="first";
		liID[i].onclick=function(){
			this.className="on";
			liID[nullnum].className="";			
			var shownum = this.getAttribute("id");			
			var showID = document.getElementById('showAl_'+shownum);
			var imgID = document.getElementById('img01a_'+shownum);
			showID.style.display="block";
			imgID.src = imgID.src.replace(".gif","_on.gif");			
			if (shownum==0)
			{
				this.className="onfirst";
			}
			else{
				liID[0].className="first";				}
			var hideID = document.getElementById('showAl_'+nullnum);
			var imghideID = document.getElementById('img01a_'+nullnum);			
			hideID.style.display="none";			
			imghideID.src = imghideID.src.replace("_on.gif", ".gif");
			nullnum = this.getAttribute("id");
			
		}	
	}
	
}

function smaintab02(tabId02){	
	
	var nullnum = 0;	
	var listWarp = tabId02;	
	var liID = listWarp.getElementsByTagName('li');
	for (var i=0 ;i<liID.length ;i++ )
	{

		liID[i].setAttribute("id",i);
		var fchild =liID[i].firstChild;
		fchild.className="first";
		liID[i].onclick=function(){
			this.className="on";
			liID[nullnum].className="";			
			var shownum = this.getAttribute("id");			
			var showID = document.getElementById('showBl_'+shownum);
			var imgID = document.getElementById('img01b_'+shownum);
			showID.style.display="block";
			imgID.src = imgID.src.replace(".gif","_on.gif");			
			if (shownum==0)
			{
				this.className="onfirst";
			}
			else{
				liID[0].className="first";				}
			var hideID = document.getElementById('showBl_'+nullnum);
			var imghideID = document.getElementById('img01b_'+nullnum);			
			hideID.style.display="none";			
			imghideID.src = imghideID.src.replace("_on.gif", ".gif");
			nullnum = this.getAttribute("id");
			
		}	
	}
	
}
function smaintab03(tabId03){	
	
	var nullnum = 0;	
	var listWarp = tabId03;	
	var liID = listWarp.getElementsByTagName('li');
	for (var i=0 ;i<liID.length ;i++ )
	{

		liID[i].setAttribute("id",i);
		var fchild =liID[i].firstChild;
		fchild.className="first";
		liID[i].onclick=function(){
			this.className="on";
			liID[nullnum].className="";			
			var shownum = this.getAttribute("id");			
			var showID = document.getElementById('showCl_'+shownum);
			var imgID = document.getElementById('img01c_'+shownum);
			showID.style.display="block";
			imgID.src = imgID.src.replace(".gif","_on.gif");			
			if (shownum==0)
			{
				this.className="onfirst";
			}
			else{
				liID[0].className="first";				}
			var hideID = document.getElementById('showCl_'+nullnum);
			var imghideID = document.getElementById('img01c_'+nullnum);			
			hideID.style.display="none";			
			imghideID.src = imghideID.src.replace("_on.gif", ".gif");
			nullnum = this.getAttribute("id");
			
		}	
	}
	
}
/* 이미지 온오버 
function imgonover() {
	var ulwrp = document.getElementById('leftMenu');
	var imgNum = ulwrp.getElementsByTagName('img');
	for (var b=0; b<imgNum.length; b++) {
		imgNum[b].onmouseover=function(){
			 this.src = this.src.replace(".gif", "_on.gif");
		}
		imgNum[b].onmouseout=function(){
			 this.src = this.src.replace("_on.gif", ".gif");	
		}
	}
}
*/
function submaintab(tabId){	
	
	var nullnum = 0;	
	var listWarp = tabId;	
	var liID = listWarp.getElementsByTagName('li');
	for (var i=0 ;i<liID.length ;i++ )
	{

		liID[i].setAttribute("id",i);
		var fchild =liID[i].firstChild;
		fchild.className="first";
		liID[i].onclick=function(){
			this.className="on";
			liID[nullnum].className="";			
			var shownum = this.getAttribute("id");			
			var showID = document.getElementById('showCl_'+shownum);
			var imgID = document.getElementById('img01c_'+shownum);
			showID.style.display="block";
			imgID.src = imgID.src.replace(".gif","_on.gif");			
			if (shownum==0)
			{
				this.className="onfirst";
			}
			else{
				liID[0].className="first";				}
			var hideID = document.getElementById('showCl_'+nullnum);
			var imghideID = document.getElementById('img01c_'+nullnum);			
			hideID.style.display="none";			
			imghideID.src = imghideID.src.replace("_on.gif", ".gif");
			nullnum = this.getAttribute("id");
			
		}	
	}
	
}
function submaintab(tabId03){	
	
	var nullnum = 0;	
	var listWarp = tabId03;	
	var liID = listWarp.getElementsByTagName('li');
	for (var i=0 ;i<liID.length ;i++ )
	{

		liID[i].setAttribute("id",i);
		var fchild =liID[i].firstChild;
		fchild.className="first";
		liID[i].onclick=function(){
			this.className="on";
			liID[nullnum].className="";			
			var shownum = this.getAttribute("id");			
			var showID = document.getElementById('showCl_'+shownum);
			var imgID = document.getElementById('img01c_'+shownum);
			//showID.style.display="block";
			if(showID) showID.style.display="block";
			imgID.src = imgID.src.replace(".gif","_on.gif");			
			if (shownum==0)
			{
				this.className="onfirst";
			}
			else{
				liID[0].className="first";				}
			var hideID = document.getElementById('showCl_'+nullnum);
			var imghideID = document.getElementById('img01c_'+nullnum);			
			hideID.style.display="none";			
			imghideID.src = imghideID.src.replace("_on.gif", ".gif");
			nullnum = this.getAttribute("id");
			
		}	
	}
	
}
/* 이미지 온오버 테스트 */

 function leftimgChange(){
	 
	if (!document.getElementById('leftMenu'))
	{
		return false;
	}
	var file_name = location.pathname;
	var file_name_array = file_name.split("/");	
	var array_length=file_name_array.length;	
	var show_name=file_name_array[array_length-3];	
	var show_plusname=file_name_array[array_length-2];

	
	var idwarp = document.getElementById('leftWarp');
	
	var menuwarp = document.getElementById('leftMenu');
	var imgchang = menuwarp.getElementsByTagName('img');
	/*
	var idarea = document.getElementById('leftArea');	
	var crnode = document.createElement('input');
	crnode.setAttribute("type","text");
	crnode.setAttribute("name","one");	  
	
	var crform = document.createElement('form');	
	crform.setAttribute("name","myform");
	crform.appendChild(crnode);
	idarea.appendChild(crform);
  */
	
	var imgname =show_name+"_"+show_plusname;
		
		
	
	
	
	/* --------- Deal ---------- */
	if ( imgname == 'deal_ma')
	{
		imgchang[0].src =imgchang[0].src.replace(".gif", "_on.gif");
		imgchang[0].setAttribute("id","on");
	}
	if ( imgname == 'deal_eipo') 
	{
		imgchang[1].src =imgchang[1].src.replace(".gif", "_on.gif");
		imgchang[1].setAttribute("id","on");
	}	
	if ( imgname == 'deal_dm') 
	{
		imgchang[2].src =imgchang[2].src.replace(".gif", "_on.gif");
		imgchang[2].setAttribute("id","on");
	}	
	if ( imgname == 'deal_pf')
	{
		imgchang[3].src =imgchang[3].src.replace(".gif", "_on.gif");
		imgchang[3].setAttribute("id","on");
	}
	/*
	if ( imgname == 'deal_pf')
	{
		imgchang[4].src =imgchang[4].src.replace(".gif", "_on.gif");
	}
	*/
	if ( imgname == 'deal_lt')
	{
		imgchang[4].src =imgchang[4].src.replace(".gif", "_on.gif");
		imgchang[4].setAttribute("id","on");
	}
	if ( imgname == 'deal_ah')
	{
		imgchang[5].src =imgchang[5].src.replace(".gif", "_on.gif");
		imgchang[5].setAttribute("id","on");
	}
	if ( imgname == 'upcoming_bond')
	{
		imgchang[6].src =imgchang[6].src.replace(".gif", "_on.gif");
		imgchang[6].setAttribute("id","on");
	}

	/* --------- Dl ---------- */
	if ( imgname == 'dl_upcoming_bond' ||  imgname == 'dl_upcoming_mna' ||  imgname == 'dl_upcoming_stock')
	{
		imgchang[0].src =imgchang[0].src.replace(".gif", "_on.gif");
		imgchang[0].setAttribute("id","on");
	}
	if ( imgname == 'dl_complete_mna' ||  imgname == 'dl_complete_dcm' ||  imgname == 'dl_complete_ecm' ||  imgname == 'dl_complete_elb') 
	{
		imgchang[1].src =imgchang[1].src.replace(".gif", "_on.gif");
		imgchang[1].setAttribute("id","on");
	}	
	if ( imgname == 'dl_bond_expiration') 
	{
		imgchang[2].src =imgchang[2].src.replace(".gif", "_on.gif");
		imgchang[2].setAttribute("id","on");
	}	


	/* --------- Market ---------- */	
	if ( imgname == 'market_ec')
	{
		imgchang[0].src =imgchang[0].src.replace(".gif", "_on.gif");
		imgchang[0].setAttribute("id","on");
	}
	
	if ( imgname == 'market_st') 
	{
		imgchang[1].src =imgchang[1].src.replace(".gif", "_on.gif");
		imgchang[1].setAttribute("id","on");
	}	
	if ( imgname == 'market_bo') 
	{
		imgchang[2].src =imgchang[2].src.replace(".gif", "_on.gif");
		imgchang[2].setAttribute("id","on");
	}	
	if ( imgname == 'market_cu')
	{
		imgchang[3].src =imgchang[3].src.replace(".gif", "_on.gif");
		imgchang[3].setAttribute("id","on");
	}		
	if ( imgname == 'market_fu')
	{
		imgchang[4].src =imgchang[4].src.replace(".gif", "_on.gif");
		imgchang[4].setAttribute("id","on");
	}
	if ( imgname == 'market_pr')
	{
		imgchang[5].src =imgchang[5].src.replace(".gif", "_on.gif");
		imgchang[5].setAttribute("id","on");
	}
	if ( imgname == 'market_ah')
	{
		imgchang[6].src =imgchang[6].src.replace(".gif", "_on.gif");
		imgchang[6].setAttribute("id","on");
	}

	/* --------- investor  ---------- */
	if ( imgname == 'investor_ba')
	{
		imgchang[0].src =imgchang[0].src.replace(".gif", "_on.gif");
		imgchang[0].setAttribute("id","on");
	}	
	if ( imgname == 'investor_ss') 
	{
		imgchang[1].src =imgchang[1].src.replace(".gif", "_on.gif");
		imgchang[1].setAttribute("id","on");
	}	
	if ( imgname == 'investor_ap') 
	{
		imgchang[2].src =imgchang[2].src.replace(".gif", "_on.gif");
		imgchang[2].setAttribute("id","on");
	}	
	if ( imgname == 'investor_pi')
	{
		imgchang[3].src =imgchang[3].src.replace(".gif", "_on.gif");
		imgchang[3].setAttribute("id","on");
	}		
	if ( imgname == 'investor_ot')
	{
		imgchang[4].src =imgchang[4].src.replace(".gif", "_on.gif");
		imgchang[4].setAttribute("id","on");
	}
	if ( imgname == 'investor_ah')
	{
		imgchang[5].src =imgchang[5].src.replace(".gif", "_on.gif");
		imgchang[5].setAttribute("id","on");
	}
	

	/* --------- firmsncredit  ---------- */
	if ( imgname == 'firmsncredit_cn')
	{
		imgchang[0].src =imgchang[0].src.replace(".gif", "_on.gif");
		imgchang[0].setAttribute("id","on");
	}	
	if ( imgname == 'firmsncredit_cr') 
	{
		imgchang[1].src =imgchang[1].src.replace(".gif", "_on.gif");
		imgchang[1].setAttribute("id","on");
	}	
	if ( imgname == 'firmsncredit_ia') 
	{
		imgchang[2].src =imgchang[2].src.replace(".gif", "_on.gif");
		imgchang[2].setAttribute("id","on");
	}	
	if ( imgname == 'firmsncredit_ah')
	{
		imgchang[3].src =imgchang[3].src.replace(".gif", "_on.gif");
		imgchang[3].setAttribute("id","on");
	}	
	
	/* --------- firmsncredit  ---------- */
	if ( imgname == 'oversea_ah')
	{
		imgchang[0].src =imgchang[0].src.replace(".gif", "_on.gif");
		imgchang[0].setAttribute("id","on");
	}	

	/* --------- peoplenbiz  ---------- */
	if ( imgname == 'peoplenbiz_hp')
	{
		imgchang[0].src =imgchang[0].src.replace(".gif", "_on.gif");
		imgchang[0].setAttribute("id","on");
	}	
	if ( imgname == 'peoplenbiz_be') 
	{
		imgchang[1].src =imgchang[1].src.replace(".gif", "_on.gif");
		imgchang[1].setAttribute("id","on");
	}	
	if ( imgname == 'peoplenbiz_ms') 
	{
		imgchang[2].src =imgchang[2].src.replace(".gif", "_on.gif");
		imgchang[2].setAttribute("id","on");
	}	
	if ( imgname == 'peoplenbiz_ah')
	{
		imgchang[3].src =imgchang[3].src.replace(".gif", "_on.gif");
		imgchang[3].setAttribute("id","on");
	}	
	/* --------- peoplenbiz  ---------- */
	
	if ( imgname == 'dataninfo_sr') 
	{
		imgchang[1].src =imgchang[1].src.replace(".gif", "_on.gif");
		imgchang[1].setAttribute("id","on");
	}	
	
	/* --------- community --------------*/

	if ( imgname == 'board_notice') 
	{
		imgchang[0].src =imgchang[0].src.replace(".gif", "_on.gif");
		imgchang[0].setAttribute("id","on");
	}
	if ( imgname == 'board_ombuds') 
	{
		imgchang[1].src =imgchang[1].src.replace(".gif", "_on.gif");
		imgchang[1].setAttribute("id","on");
	}
	if ( imgname == 'board_free') 
	{
		imgchang[2].src =imgchang[2].src.replace(".gif", "_on.gif");
		imgchang[2].setAttribute("id","on");
	}	
	if ( imgname == 'community_service') 
	{
		imgchang[3].src =imgchang[3].src.replace(".gif", "_on.gif");
		imgchang[3].setAttribute("id","on");
	}	
	
	
	for (var i=0;i<imgchang.length;i++ )
	{
		
		imgchang[i].onmouseover=function(){
		
			var onimg = this.getAttribute("id");
			
			if (!onimg)
			{				
				this.src =this.src.replace(".gif", "_on.gif");
				
			}				
		}
		imgchang[i].onmouseout=function(){			
			var onimg = this.getAttribute("id");
			
			if (!onimg)
			{
				this.src =this.src.replace("_on.gif", ".gif");
				

			}
			
		
		}
		
	}

	
}
addLoadEvent(leftimgChange);


function elementchild(){
	if (document.getElementById('searchListId'))
	{
		var eleID = document.getElementById('searchListId');
		var lasteleID = eleID.lastChild;
		lasteleID.style.background="none";
	}
	if (document.getElementById('searchListId02'))
	{
		var eleID02 = document.getElementById('searchListId02');
		var lasteleID02 = eleID02.lastChild;
		lasteleID02.style.background="none";
	}
}
addLoadEvent(elementchild);


function m_header(){		
		var hcode ="";
		hcode = hcode +'<h1 class="logintitle"><img src="/img/member/titthebellnewsinfo.gif"alt="The bell은 회원제 뉴스& 정보 서비스입니다." /></h1>';
		document.write(hcode);
}

function m_footer(){
		var popen = document.getElementById('popen');
		var fcode ="";
		fcode = fcode +'<div class="footer">';
			fcode = fcode +'<h1><img src="/img/common/thebell_logo.gif" alt="the bell" /></h1>';
			fcode = fcode +'<div class="footerCon">';
				fcode = fcode +'<ul id="popen">';
					fcode = fcode +'<li class="first"><a href="/download/dataDownload/company/company_introduce.pdf"><img src="/img/common/company.gif" alt="회사소개" /></a></li>';
					fcode = fcode +'<li><img src="/img/common/agreement.gif" alt="서비스 이용약관" /></li>';
					fcode = fcode +'<li><img src="/img/common/privacy_info.gif" alt="개인정보취급방침" /></li>';
				fcode = fcode +'</ul>';
				fcode = fcode +'<p>Family site ';
					fcode = fcode +'<select id="" onchange="if(this.value) window.open(this.value);">';
						fcode = fcode +'<option value="" selected="selected">선택하세요</option>';
						fcode = fcode +'<option value="http://www.moneytoday.co.kr">머니투데이</option>';
						fcode = fcode +'<option value="http://coolmoney.moneytoday.co.kr">쿨머니</option>';
						fcode = fcode +'<option value="http://uclean.moneytoday.co.kr">U클린</option>';
						fcode = fcode +'<option value="http://star.moneytoday.co.kr/index.htm">스타뉴스</option>';
						fcode = fcode +'<option value="http://mtn.mt.co.kr">MTN</option>';
						fcode = fcode +'<option value="http://moneyweek.mt.co.kr">머니위크</option>';
					fcode = fcode +'</select> ';
				fcode = fcode +'</p>';
				fcode = fcode +'<div class="footerTxt"><img src="/img/common/footer_text.gif" alt="서울 종로구 서린동 149 청계 11빌딩 / 대표전화: 02)724-4100 / 팩스번호: 02)724-4109 / 사업자등록번호: 101-86-35198 개인정보 관리책임자: 오영훈 / Mail: thebell@moneytoday.co.kr (주)더벨아시아 대표 홍선근,박종면 copyright All rights reserved. Please contact the Webmaster for more information" /></div>';
			fcode = fcode +'</div>';
		fcode = fcode +'</div>';
	
		document.write(fcode);	
	}

function pageload(){	
	
    if (! document.getElementById('popen'))
	{
		return false;
	}

    var popen = document.getElementById('popen');	
	var popenList = popen.getElementsByTagName('li');
    popenList[0].onclick =function(){
   		if (document.getElementById('x-window-dlg01') != null){return false}    
        popup02.showopen02(560, 360);
    }
	popenList[1].onclick =function(){
    	if (document.getElementById('x-window-dlg02') != null){return false}    
        popup03.showopen03(560, 480);
    }
	popenList[2].onclick =function(){
    	if (document.getElementById('x-window-dlg03') != null){return false}    
        popup04.showopen04(560, 430);
    }
	
  
}
addLoadEvent(pageload);

function poploadingfront(){
	if (! document.getElementById('linkwarp'))
	{
		return false;
	}
	var popen = document.getElementById('linkwarp');
	var popenList = popen.getElementsByTagName('li');
	popenList[0].onclick =function(){
		if (document.getElementById('x-window-dlg01') != null){return false}    
        popup02.showopen02(560, 360);
    }
	popenList[2].onclick =function(){
		if (document.getElementById('x-window-dlg03') != null){return false}    
        popup03.showopen03(560, 480);
    }
	popenList[3].onclick =function(){
		if (document.getElementById('x-window-dlg02') != null){return false}    
        popup04.showopen04(560, 430);
    }
}
//addLoadEvent(poploadingfront);

function popopen_W(){
	if (! document.getElementById('popen'))
	{
		return false;
	}
	var popen = document.getElementById('popen');
	var popenList = popen.getElementsByTagName('li');
	popenList[0].onclick=function(){		
		//popup02.showopen02(560,360); //회사소개 => pdf파일 다운로드
	}
	popenList[1].onclick=function(){
		
		popup03.showopen03(560,480); //서비스이용약관
	}
	popenList[2].onclick=function(){
		
		popup04.showopen04(560,430); //개인정보취그방침
	}
}
addLoadEvent(popopen_W);



function poplinkwarp01(){
	popup02.showopen02(560,360);	// 회사소개
}
function poplinkwarp02(){	
	popup04.showopen04(560,430);	// 개인정보취급방침
}
function poplinkwarp03(){
	popup03.showopen03(560,480);	// 서비스이용약관
}

// 서비스가이드
function servespayment(){
	if (!document.getElementById('spayment')){return false;}

	var payment = document.getElementById('spayment');

	payment.onmouseover =function()
	{
		if (document.getElementById('x-window-dlg04') != null){return false}    
			introduction();
	}
	payment.onclick = function(){popup05.showopen05(730,650);}
}
addLoadEvent(servespayment);


function r1egform(){
	window.open('/regform.doc');
}
function plugin_check(){
	document.location.href="/payment/plugin_check.html";
}
function goodMorningPop(){
	if (document.getElementById('x-window-dlg-good') == null)
	{
		var vload ="";
		vload = vload +'<div class="layoutWarp">';
			vload = vload +'<div id="x-window-dlg-good" class="x-hidden" >';
				vload = vload +'<h1 class="x-window-header"><img src="/img/popup/sttigoodmorning.gif"  alt="good morning" /></h1>';
				vload = vload +'<div class="x-window-body">';
					vload = vload +'<div class="popup_cont" style="width:1050px;">  ';
						vload = vload +'<iframe id="iframeID" src="/goodmorning/morning/" frameborder="0" width="1050px" height="700px" marginwidth="0" marginheight="0" scrolling="no" style="width:1050px;"></iframe>';
					vload = vload +'</div>';
				vload = vload +'</div>';
			vload = vload +'</div>';
		vload = vload +'</div>';
		var loadele = document.getElementById('loadelement');
		loadele.innerHTML=vload;
	}
	popup_good.showopen_good(1050,700);
}

function noDragAndContext(){
	/*
	if("/goodmorning/".indexOf(location.pathname)<0){
		return;
	}
	*/
	if(location.href.indexOf("localhost")>=0){
		return;
	}
	document.body.oncontextmenu = function(){ return false; }
	document.body.ondragstart=function(){ return false; }
	document.body.onselectstart = function(){ return false; }
}
addLoadEvent(noDragAndContext);


// 롤링
function RollSet(str)
{
	var gSetChk        = true;
	var gSetObj        = null;
	var gRollSetObj    = null;
	var gRollChk       = false;

	var gArrDat        = new Array();
	if(str)
		var gArrCnt        = str;
	else
		var gArrCnt        = -1;
	var gArrCntBool    = false;
	var gArrTotCnt     = 0;
	var gMoveSpeed     = 1000;
	var gPauseTime     = 1000;
	var gPauseChk      = false;
	var gCurPos        = 15;
	var gEndPos        = 0;
	var gChkCnt        = 0;
	var gWordheight    = 15;
	var gOwordHeight   = 15;
	var gRwordHeight   = -1;
	var gWordSet       = false;
	var gRollType      = new Array('up','shine');
	var gRollSelect    = 'shine';

	var gTid1          = 0;
	var gTid2          = 0;

	this.Init = function ( setObj, data, moveSpeed, pauseTime, wrdHeight, RollObj, type, rWrdheight )
	{
		gSetObj     = setObj;
		gRollSetObj = RollObj;
		gArrDat     = data;
		gArrTotCnt  = gArrDat.length;

		if( gSetObj == null || gSetObj == '' || gSetObj == 'undefined' )                { gSetChk = false; return; }
		if( gRollSetObj == null || gRollSetObj == '' || gRollSetObj == 'undefined' )    { gSetChk = false; return; }
		if( gArrDat[0] == null || gArrDat[0] == '' || gArrDat[0] == 'undefined' )       { gSetChk = false; return; }

		if( moveSpeed != null && moveSpeed > 0 ) {
			gMoveSpeed = moveSpeed;
		}

		if( pauseTime != null && pauseTime > 0 ) {
			gPauseTime = pauseTime;
		}

		if( wrdHeight != null && wrdHeight > 0 ) {
			gWordheight  = wrdHeight;
			gOwordHeight = wrdHeight;
			gCurPos = wrdHeight;
		}

		if( rWrdheight != '' )
		{
			var gBw = rWrdheight.split(',');

			if( gBw[0] && gBw[1] )
			{
				if( navigator.appVersion.indexOf("MSIE") != -1 )
					gRwordHeight = gBw[0];
				else
					gRwordHeight = gBw[1];
			}
			else
			{
				gSetChk = false;
			}
		} else {
			gSetChk = false;
		}

		if( type != null && type != '' )
		{
			for(var i=0;i<gRollType.length;i++)
			{
				if( type == gRollType[i] )
				{
					gRollSelect = type;
					gSetChk = true;
					break;
				}
				else
				{
					gSetChk = false;
					continue;
				}
			}
		}

		return;
	}

	this.Play = function ()
	{
		if( gSetChk == false) return;

		gRollChk = true;

		RollStart();
		return;
	}

	this.OnMouse = function ()
	{
		if( gSetChk == false) return;

		gPauseChk = true;
		clearInterval( gTid1 );
		clearTimeout( gTid2 );
		return;
	}

	this.OutMouse = function ()
	{
		if( gSetChk == false) return;

		gPauseChk = false;
		this.Play();
		return;
	}

	this.PrevDat = function ()
	{
		if( gSetChk == false) return;
		if( gRollChk==false && gArrCnt==-1 ) gArrCnt = 0;

		clearInterval( gTid1 );
		clearTimeout( gTid2 );

		gCurPos = gEndPos;

		gArrCnt--;
		if( gArrCnt < 0 ) 
			gArrCnt = gArrTotCnt-2;

		if( gArrCnt == 0 )
		{
			gWordheight = gOwordHeight;
		}
		else
		{
			gWordheight = gRwordHeight;
		}

		gCurPos           = 0;
		gChkCnt           = 0;
		gSetObj.style.top = gCurPos + 'px';
		gSetObj.innerHTML = gArrDat[gArrCnt];
		gWordSet          = false;

		if( gRollChk == true )
			gTid2 = setTimeout( gRollSetObj.Play, gPauseTime );
		return;
	}

	this.NextDat = function ()
	{
		if( gSetChk == false) return;
		if( gRollChk==false && gArrCnt==-1 ) gArrCnt = 0;

		clearInterval( gTid1 );
		clearTimeout( gTid2 );

		gArrCnt++;
		if( gArrCnt == (gArrTotCnt-1) )
		{
			gWordheight = gOwordHeight;
			gArrCnt = 0;
		}
		else
		{
			gWordheight = gRwordHeight;
		}

		gCurPos           = 0;
		gChkCnt           = 0;
		gSetObj.style.top = gCurPos + 'px';
		gSetObj.innerHTML = gArrDat[gArrCnt];
		gWordSet          = false;

		if( gRollChk == true )
			gTid2 = setTimeout( gRollSetObj.Play, gPauseTime );

		return;
	}

	function RollStart()
	{
		if( gRollSelect == 'up' )           gTid1 = setInterval( RollUp , gMoveSpeed );
		else if( gRollSelect == 'shine' )   gTid1 = setInterval( RollShine , gPauseTime );
		else                                gSetObj.innerHTML = '지원하지 않는 기능입니다.';

		return;
	}

	function RollUp()
	{
		if( gWordSet == false )
		{
			var gTxt = '';
			var gPrevCnt;

			gPrevCnt = gArrCnt;

			gArrCnt++;
			if( gArrCnt == (gArrTotCnt-1) )
			{
				gArrCnt = 0;
			}

			if( gPrevCnt != -1 )
			{
				gTxt = gArrDat[gPrevCnt];
				gCurPos = 0;
			}

			gTxt += gArrDat[gArrCnt];

			gSetObj.innerHTML = gTxt;
			gWordSet = true;

		}

		gCurPos--;
		gSetObj.style.top = gCurPos + 'px';

		gChkCnt++;
		if( gChkCnt == gWordheight )
		{
			clearInterval( gTid1 );

			gWordSet = false;
			gChkCnt  = 0;

			if( gArrCnt >= gArrTotCnt-1 )
			{
				gWordheight       = gOwordHeight;
				gCurPos           = gOwordHeight;
				gArrCnt           = -1;
				gSetObj.style.top = gCurPos + 'px';
				gSetObj.innerHTML = '';
			}
			else
			{
				gWordheight = gRwordHeight;
			}

			parent.document.title ='더벨 - 딜이 있는 곳에 벨이 울립니다.';
			gTid2 = setTimeout( gRollSetObj.Play, gPauseTime );
			return;
		}
		parent.document.title ='더벨 - 딜이 있는 곳에 벨이 울립니다.';

	}

	function RollShine()
	{
		if( (gArrCnt == -1) || (gArrCnt == gArrTotCnt))
			gArrCnt = 0;

		gSetObj.style.top = gEndPos;
		gSetObj.innerHTML = gArrDat[gArrCnt++];
		parent.document.title ='더벨 - 딜이 있는 곳에 벨이 울립니다.';
		return;
	}
}


//상단 왼쪽 배너 랜덤
function imgwrite(no){
 document.write("<a href='"+imgurl[no][1]+"' target='_BLANK'>");
 document.write("<img width=100 height=100 src='"+imgurl[no][0]+"' border=0>");
 document.write("</a>");
}
imgurl = new Array();
imgurl[0] = Array("/img/banner/mainTop/main_top_kb.gif","http://money.kbstar.com/quics?asfilecode=5023&_nextPage=page=gnw");
imgurl[1] = Array("/img/banner/mainTop/main_top_samsung.gif","http://www.samsunglife.com/");
imgurl[2] = Array("/img/banner/mainTop/mani_top_kyobo.gif","http://www.kyobo.co.kr/");

for(i=0;i<100;i++){
 tmp1 = parseInt(Math.random()*imgurl.length);
 tmp2 = parseInt(Math.random()*imgurl.length);
 tmp3 = imgurl[tmp1];
 imgurl[tmp1] = imgurl[tmp2];
 imgurl[tmp2] = tmp3;
}

//article 배너 랜덤
function bannerwrite(no){
 document.write("<div style='float:right;width:180px;height:150px;margin-left:5px;'><a href='"+bannerurl[no][1]+"' target='_BLANK'>");
 document.write("<IMG id='adImg' src='"+bannerurl[no][0]+"' border=0>");
 document.write("</a></div>");
}

bannerurl = new Array();
bannerurl[0] = Array("/img/banner/article/shinhan_2.gif","http://www.goodi.com/ir/index.htm");
bannerurl[1] = Array("/img/banner/article/kbstar_2.gif","http://kbstar.com");
bannerurl[2] = Array("/img/banner/article/kyobo_2.gif","http://www.kyobo.co.kr");
bannerurl[3] = Array("/img/banner/article/samsung_2.gif","http://www.samsunglife.com/index.html");

for(i=0;i<100;i++){
 temp1 = parseInt(Math.random()*bannerurl.length);
 temp2 = parseInt(Math.random()*bannerurl.length);
 temp3 = bannerurl[temp1];
 bannerurl[temp1] = bannerurl[temp2];
 bannerurl[temp2] = temp3;
}

//메인 왼쪽 배너 랜덤
function leftimgwrite(no){
 document.write("<a href='"+leftimgurl[no][1]+"' target='_BLANK'>");
 document.write("<img width='161' height='53' src='"+leftimgurl[no][0]+"' border='0'>");
 document.write("</a>");
}

leftimgurl = new Array();
leftimgurl[0] = Array("/img/banner/hyundai_iron.gif","http://www.hyundai-steel.com/");
leftimgurl[1] = Array("/img/banner/mainLeft/main_left_hana.gif","http://www.hanaw.com/global/notice/1247752_1114.html");

for(i=0;i<100;i++){
 tmp10 = parseInt(Math.random()*leftimgurl.length);
 tmp20 = parseInt(Math.random()*leftimgurl.length);
 tmp30 = leftimgurl[tmp10];
 leftimgurl[tmp10] = leftimgurl[tmp20];
 leftimgurl[tmp20] = tmp30;
}


