

//팝업객체 생성
var pops=new Object();
pops.result=new Array();
pops.newwindows=function(url,classname,width,height,tpx,lpx,position,id,html,display){

	this.url=(url) ? url : "";
	this.classname=classname;
	this.width=width;
	this.height=height;
	this.tpx=tpx;
	this.lpx=lpx;
	this.position=position;
	this.id=id;
	this.html=html;
	this.display=display;
	pops.result=this;
	this.wincreate();
}

//팝업창 생성
pops.newwindows.prototype.wincreate=function(){



	dialog=document.createElement("div");
	dialog.id=this.id;
	dialog.style.position=this.position;

	//alert(parseInt(document.documentElement.scrollTop) + parseInt(this.tpx))

	dialog.style.top=parseInt(parseInt(document.documentElement.scrollTop) + parseInt(this.tpx))+"px";
	dialog.style.left=(parseInt(screen.availWidth)/2)- parseInt(this.lpx) +"px";
	dialog.className=this.classname;
	dialog.style.width=parseInt(this.width)+"px";
	dialog.style.height=parseInt(this.height)+"px";
	dialog.style.backgroundColor='#FFFFFF'

	//dialog.innerHTML=this.html;

	var bar=document.createElement("div");

	
	if (this.id=="about" ||this.id=="default" ||this.id=="transport" ||this.id=="telv" ||this.id=="image"  )
	{
		bar.style.position="relative";
		
		bar.button=document.createElement("img");
		bar.button.src=Loadings.directory+"/OUTPUT/IMAGE/multi_top_bar.gif";
		bar.button.style.height="35px";
		bar.button.style.width="9px";
		bar.style.backgroundImage="URL('"+Loadings.directory+"/OUTPUT/IMAGE/"+this.display+"')";
		bar.appendChild(bar.button);
	
	
		bar.button1=document.createElement("img");
	//	bar.button1.style.position="relative";

		bar.button1.src=Loadings.directory+"/OUTPUT/IMAGE/ucici_close.gif";
		bar.button1.style.position="absolute";
		bar.button1.style.left=(this.width - 20)+"px";
		bar.button1.style.height="13px";
		bar.button1.style.width="13px";
		bar.button1.style.top="8px";
		bar.button1.style.align="right";
		bar.button1.style.cursor="hand";
		bar.button1.className='button';
		bar.button1.onclick=this.divRemove;
		bar.appendChild(bar.button1);
		dialog.appendChild(bar);


	}else if (this.id=="ucici")
	{
		bar.style.position="relative";
		
		bar.button=document.createElement("img");
		bar.button.src=Loadings.directory+"/OUTPUT/IMAGE/ucici_top_bar.gif";
		bar.button.style.height="28px";
		bar.button.style.width="5px";
		bar.style.backgroundImage="URL('"+Loadings.directory+"/OUTPUT/IMAGE/"+this.display+"')";
		bar.appendChild(bar.button);
	
	
		bar.button1=document.createElement("img");
	//	bar.button1.style.position="relative";

		bar.button1.src=Loadings.directory+"/OUTPUT/IMAGE/ucici_close.gif";
		bar.button1.style.position="absolute";
		bar.button1.style.left=(this.width - 20)+"px";
		bar.button1.style.height="13px";
		bar.button1.style.width="13px";
		bar.button1.style.top="8px";
		bar.button1.style.align="right";
		bar.button1.style.cursor="hand";
		bar.button1.className='button';
		bar.button1.onclick=this.divRemove;
		bar.appendChild(bar.button1);
		dialog.appendChild(bar);
	}else{

		bar.style.position="relative";
		
		bar.button=document.createElement("img");
		bar.button.src='"+Loadings.directory+"/OUTPUT/IMAGE/login_top_bar.gif';
		bar.button.style.height="34px";
		bar.button.style.width="8px";
		bar.style.backgroundImage="URL('"+Loadings.directory+"/OUTPUT/IMAGE/"+this.display+"')";
		bar.appendChild(bar.button);
	

		bar.button1=document.createElement("img");
	//	bar.button1.style.position="relative";

		bar.button1.src='"+Loadings.directory+"/OUTPUT/IMAGE/close.gif';
		bar.button1.style.position="absolute";
		bar.button1.style.left=(this.width - 16)+"px";
		bar.button1.style.height="9px";
		bar.button1.style.width="9px";
		bar.button1.style.top="10px";
		bar.button1.style.align="right";
		bar.button1.style.cursor="hand";
		bar.button1.className='button';
		bar.button1.onclick=this.divRemove;
		bar.appendChild(bar.button1);
		dialog.appendChild(bar);
	
	}


	
	


	if (this.url)
	{
/*
		bar.button2=document.createElement("img");
	//	bar.button1.style.position="relative";

		bar.button2.src='"+Loadings.directory+"/OUTPUT/IMAGE/urlpop.gif';
		bar.button2.style.position="absolute";
		bar.button2.style.left=(this.width - 66)+"px";
		bar.button2.style.height="21px";
		bar.button2.style.width="33px";
		bar.button2.style.align="right";
		bar.button2.style.cursor="hand";
		bar.button2.className='button';
		bar.button2.onclick=this.urlpopup
		bar.appendChild(bar.button2);
*/


	}else{
	


	
	}

	

//url 이 있을대 iframe 생성 해서 불러옴
	if (this.url !="")
	{
		
		var imap= document.createElement("iframe");
		imap.style.width='100%';
		imap.id='mapiframe';
		imap.name=dialog.id + "ifr";
		imap.style.height='100%';
		imap.frameBorder='0'
		imap.border='0'
		imap.style.marginheight='0'
		imap.style.marginWidth='0'
		imap.scrolling='no'
		imap.src=this.url
		dialog.appendChild(imap);
	
	
	}else{
	
	
		var bodyhtml=document.createElement("div");

		bodyhtml.style.position="relative";
		bodyhtml.innerHTML=this.html;

		dialog.appendChild(bodyhtml);
	
	
	}



	//dialog.appendChild(bar);

	document.body.appendChild(dialog);
	//document.getElementById("leftscroll").checked=false;
	//setTimeout ("MoveRightBanner()", 300);
	//JSFX_FloatDiv("tree_1", 0, 0,0).floatIt();
	imgs_resize()
		//alert(incontents)
	setTimeout("imgs_resize()","50");

	return dialog;

}
function imgs_resize(){

	var img1=document.getElementById('largeimg');
	if (img1)
	{
		if (img1.width > img1.height)
		{
			if (img1.width > 150)
			{
				img1.width=150
			}
		}else{
			if (img1.height > 110){
			img1.height=110

			}
		
		}
	}

	var simg1=document.getElementById('smallimg1');
	if (simg1)
	{
		if (simg1.width > simg1.height)
		{
			if (simg1.width > 92)
			{
				simg1.width=92
			}
		}else{
			if (simg1.height > 58){
			simg1.height=58

			}
		
		}
	}

	var simg2=document.getElementById('smallimg2');
	if (simg2)
	{
		if (simg2.width > simg2.height)
		{
			if (simg2.width > 92)
			{
				simg2.width=92
			}
		}else{
			if (simg2.height > 58){
			simg2.height=58

			}
		
		}
	}

	var simg3=document.getElementById('smallimg3');
	if (simg3)
	{
		if (simg3.width > simg3.height)
		{
			if (simg3.width > 92)
			{
				simg3.width=92
			}
		}else{
			if (simg3.height > 58){
			simg3.height=58

			}
		
		}
	}
}

//팝업창 삭제
pops.newwindows.prototype.divRemove=function(e){
//	alert(pops.result.state)
	if (document.getElementById(pops.result.id))
	{
		document.body.removeChild(document.getElementById(pops.result.id))
		msg.unload();
	}
}



pops.newwindows.prototype.urlpopup=function(e){
	//alert(pops.result.state)
	var dialog=(this.dialog) ? this.dialog : pops.dialog;
	document.body.removeChild(document.getElementById(dialog.id))
	window.open(dialog.url)

	msg.unload();

}








//따라다니는 매뉴
var min = 178;
var min2 = min - 50;
var max = 0;
function left_move_init() {
	alert(1)
	document.getElementById("pops_state").value=1;
	itm = document.getElementById(pops.result.id);
	itm.set_pos = function(y){
		itm.style.top=y;

	};

	itm.y = min;
	itm.set_pos(itm.y);
	max = document.documentElement.scrollHeight - itm.scrollHeight - min;
	
	tmp = document.documentElement.scrollTop + min;
	itm.y += Math.floor((tmp-itm.y)/10);
	if( itm.y>max ) itm.y = max;
	if( itm.y<min ) itm.y = min;
	itm.set_pos(itm.y);
	setTimeout('left_move_init()', 1000);

	

}
function left_move_func() {

}
//setTimeout('left_move_init()', 500);