/*
function bluring()
function MM_preloadImages()
function MM_swapImgRestore()
function MM_findObj(n, d)
function MM_swapImage()
function menuclick( submenu ,cellbar)
function layer()
function view(a)
function MM_swapImage()
function zoomBox(evt,zlink,maxw,maxh,tox,toy)
function doZoom()
function DeleteAlert()
function goSortingURL(name,sorting,f)
function goSorting(f,name)
function goSortingCurr(f,name)
function goOrderURL(name,prmOrder,f)
function goOrder(f,name)
function goOrderCurr(f,name)
function goAdminLogout()
function GoExcel(t,w,f)
function NoAuth()
function OptionClear()
function OptionClearUser()
function ImgResize(Img, width, height)
*/

//¸µÅ©ÀÇ Æ÷Ä¿½º¸¦ ¾ø¾Ø´Ù
function bluring(){
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;

//·Ñ¿À¹ö ÀÌ¹ÌÁö
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_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_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];}
}



//Å×ÀÌºí ¿­°í ´Ý±â
var old_menu = '';
var old_cell = '';
function menuclick( submenu ,cellbar)
{
	if( old_menu != submenu )
	{
		if( old_menu !='' ) {
			old_menu.style.display = 'none';
		}
		submenu.style.display = 'block';
		old_menu = submenu;
		old_cell = cellbar;
	}
	else
	{
		submenu.style.display = 'none';
		old_menu = '';
		old_cell = '';
	}
}


//»ó´Ü ¸Þ´º ·¹ÀÌ¾î ¶ç¿ì±â
function layer() { //v2.0
	var i, visStr, args, theObj,br;
	args = layer.arguments;
	for (i=0; i<(args.length-1); i+=2) {
		visStr	 = args[i+1];
		if (navigator.appName == 'Netscape' && document.layers != null) {
			theObj = eval('document.layers[\''+args[i]+'\']');
			if (theObj) theObj.visibility = visStr;
		}
		else if (document.all != null) { //IE
			if (visStr == 'show') visStr = 'visible'; //convert vals
			if (visStr == 'hide') visStr = 'hidden';
			theObj = eval('document.all[\''+args[i]+'\']');
			if (theObj) theObj.style.visibility = visStr;
		}
	}
return false;
}
function view(a) {
	if (a==1) {
		layer('menu1','show','menu2','hide','menu3','hide','menu4','hide','menu5','hide',
			'sub1','show','sub2','hide','sub3','hide','sub4','hide','sub5','hide');
	}
	if (a==2) {
		layer('menu1','hide','menu2','show','menu3','hide','menu4','hide','menu5','hide',
			'sub1','hide','sub2','show','sub3','hide','sub4','hide','sub5','hide');
	}
	if (a==3) {
		layer('menu1','hide','menu2','hide','menu3','show','menu4','hide','menu5','hide',
			'sub1','hide','sub2','hide','sub3','show','sub4','hide','sub5','hide');
	}
	if (a==4) {
		layer('menu1','hide','menu2','hide','menu3','hide','menu4','show','menu5','hide',
			'sub1','hide','sub2','hide','sub3','hide','sub4','show','sub5','hide');
	}
	if (a==5) {
		layer('menu1','hide','menu2','hide','menu3','hide','menu4','hide','menu5','show',
			'sub1','hide','sub2','hide','sub3','hide','sub4','hide','sub5','show');
	}
	if (a==6) {
		layer('menu1','hide','menu2','hide','menu3','hide','menu4','hide','menu5','hide',
			'sub1','hide','sub2','hide','sub3','hide','sub4','hide','sub5','hide');
	}
}

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];}
}


var maxW,maxH,fromX,fromY,toX,toY,adjX,adjY,zBox,zStep=0,zLink,zNew;

function zoomBox(evt,zlink,maxw,maxh,tox,toy)
{
	if (arguments.length > 2)
	{
		zNew=1;
	}
	scrollH = (window.pageYOffset!=null)?window.pageYOffset:document.body.scrollTop;
	maxW = maxw?maxw:window.innerWidth?innerWidth:document.body.clientWidth;
	maxH = maxh?maxh:window.innerHeight?innerHeight:document.body.clientHeight;
	toX = tox?tox:0;
	toY = (toy?toy:0)+scrollH;
	fromX = evt.pageX?evt.pageX:evt.clientX;
	fromY = (evt.pageY?evt.pageY:evt.clientY)+(document.all?scrollH:0);
	adjX = toX+evt.screenX-fromX;
	adjY = toY+evt.screenY-fromY;

	if (document.createElement && document.body.appendChild && !zBox)
	{
		zBox=document.createElement("div");
		zBox.style.position = "absolute";
		document.body.appendChild(zBox);
	}
	else if (document.all && !zBox)
	{
		document.all[document.all.length-1].outerHTML+='<div id="zBoxDiv" style="position:absolute"></div>';
		zBox=document.all.zBoxDiv;
	}
	else if (document.layers && !zBox)
	{
		zBox = new Layer(maxW);
		zBox.style=zBox;
	}

	zLink = zlink;
	doZoom();
}

function doZoom() {
	zStep+=1;
	zPct=(10-zStep)/10
	if (document.layers)
	{
		zBox.moveTo(toX+zPct*(fromX-toX),toY+zPct*(fromY-toY));
		zBox.document.open();
		zBox.document.write("<table width='"+maxW*(1-zPct)+"' height="+maxH*(1-zPct)+" border=2 cellspacing=0><tr><td></td></tr></table>");
		zBox.document.close();
	}
	else
	{
		zBox.style.border = "2px solid #999999"; // Å×µÎ¸® ±½±âpx solid Å×µÎ¸® »ö
		zBox.style.left = toX+zPct*(fromX-toX);
		zBox.style.top = toY+zPct*(fromY-toY);
		zBox.style.width = maxW*(1-zPct);
		zBox.style.height = maxH*(1-zPct);
	}

	zBox.style.visibility = "visible";

	if (zStep < 10)
	{
		setTimeout("doZoom("+fromX+","+fromY+","+toX+","+toY+")",30);
	}
	else
	{
		zBox.style.visibility='hidden';
		zStep=0;
		if (zLink && !zNew)
		{
			location.href=zLink.href;
		}
		else if (zLink && zNew)
		{ // À©µµ ÀÌ¸§ ÁÖ½Ã¸é 1°³¹Û¿¡ »ç¿ëÇÏÁú ¸øÇÕ´Ï´Ù.
			var w=window.open(zLink.href,'','width='+maxW+',height='+maxH+',left='+adjX+',top='+adjY+',scrollbars=yes');
			zNew=null;
		}
	}
}

function DeleteAlert()
{
	msg = "»èÁ¦¸¦ ÇÏ½Ã°Ú½À´Ï±î?";
	if( confirm(msg) ) return true;
	else return false;
}

function goSortingURL(name,sorting,f)
{
	if(name=="")
	{
		location.href = "index.php?prmOrder="+f+"&sorting="+sorting
	}
	else
	{
		location.href = "index.php?"+name+"&prmOrder="+f+"&sorting="+sorting
	}
}
function goSorting(f,name)
{
	if(f !="")
	{

		if(f =="date")
		{
			sorting	= "DESC";
		}
		else if(f =="name")
		{
			sorting	= "ASC";
		}
		else
		{
			sorting	= document.sort.sorting.value;
		}


		goSortingURL(name,sorting,f);
	}
}
function goSortingCurr(f,name)
{
	if(f !="")
	{
		sorting	= document.info.sorting.value;
		goSortingURL(name,sorting,f);
	}
}

function goOrderURL(name,prmOrder,f)
{
	if(name=="")
	{
		if(prmOrder !="")	location.href = "index.php?prmOrder="+prmOrder+"&sorting="+f
	}
	else
	{
		if(prmOrder !="")	location.href = "index.php?"+name+"&prmOrder="+prmOrder+"&sorting="+f
	}
}

function goOrder(f,name)
{
	prmOrder	= document.sort.field.value;
	goOrderURL(name,prmOrder,f);
}
function goOrderCurr(f,name)
{
	prmOrder	= document.info.field.value;
	goOrderURL(name,prmOrder,f);
}

function goAdminLogout()
{
	proc.location.href="/common/admLogoutProcess.php";
}
function GoExcel(t,w,f)
{
	//proc.location.href = "/modules/public/m_excel.php?tablename="+t+"&excel_where="+w+"&filename="+f;
	proc.location.href = "/modules/public/m_excel.php?tablename="+t+"&excel_where="+w+"&filename="+f;
}
function NoAuth()
{
	alert("»ç¿ë±ÇÇÑÀÌ ¾ø½À´Ï´Ù.");
}

function OptionClear()
{
	if(document.info.step2)
	{
		for ( i=0 ; i < document.info.step2.options.length ; i++ )
		{
			document.info.step2.options[i].text = "";
			document.info.step2.options[i].value= "";
		}
	}
	if(document.info.step3)
	{
		for ( i=0 ; i < document.info.step3.options.length ; i++ )
		{
			document.info.step3.options[i].text = "";
			document.info.step3.options[i].value= "";
		}
	}
	if(document.info.step4)
	{
		for ( i=0 ; i < document.info.step4.options.length ; i++ )
		{
			document.info.step4.options[i].text = "";
			document.info.step4.options[i].value= "";
		}
	}
	if(document.info.step5)
	{
		for ( i=0 ; i < document.info.step5.options.length ; i++ )
		{
			document.info.step5.options[i].text = "";
			document.info.step5.options[i].value= "";
		}
	}
	if(document.info.step6)
	{
		for ( i=0 ; i < document.info.step6.options.length ; i++ )
		{
			document.info.step6.options[i].text = "";
			document.info.step6.options[i].value= "";
		}
	}
	if(document.info.step7)
	{
		for ( i=0 ; i < document.info.step7.options.length ; i++ )
		{
			document.info.step7.options[i].text = "";
			document.info.step7.options[i].value= "";
		}
	}
}

function OptionClearUser()
{
	if(document.info.step2)
	{
		for ( i=0 ; i < document.info.step2.options.length ; i++ )
		{
			document.info.step2.options[i].text = "";
			document.info.step2.options[i].value= "";
		}
	}
	if(document.info.step3)
	{
		for ( i=0 ; i < document.info.step3.options.length ; i++ )
		{
			document.info.step3.options[i].text = "";
			document.info.step3.options[i].value= "";
		}
	}
	if(document.info.step4)
	{
		for ( i=0 ; i < document.info.step4.options.length ; i++ )
		{
			document.info.step4.options[i].text = "";
			document.info.step4.options[i].value= "";
		}
	}
	if(document.info.step5)
	{
		for ( i=0 ; i < document.info.step5.options.length ; i++ )
		{
			document.info.step5.options[i].text = "";
			document.info.step5.options[i].value= "";
		}
	}
	if(document.info.step6)
	{
		for ( i=0 ; i < document.info.step6.options.length ; i++ )
		{
			document.info.step6.options[i].text = "";
			document.info.step6.options[i].value= "";
		}
	}
}

function ImgResize(Img, width, height) {
	Img.style.visibility = 'hidden';
	MidImg = new Image;
	MidImg.src = Img.src;
	y = Img.height;
	x = Img.width;

	imgcount = 1;
	while (!y) {
		MidImg = new Image;
		MidImg.src = Img.src;
		y = MidImg.height;
		x = MidImg.width;
		imgcount = imgcount + 1;
		if (imgcount == height) y = imgcount;
	}

	x = MidImg.width;
	y = MidImg.height;

	if (x > width || y > height) {
		if (x > width) {
			x_rate = width/x;
			y_s = x_rate * y;
			x_s = width;
			if (y_s > height) {
				y_s_rate = height / y_s;
				x_s = x_s * y_s_rate;
				y_s = height;
			}
		} else {
			y_rate = height/y;
			x_s = y_rate * x;
			y_s = height;
		}
	} else {
		x_s = x;
		y_s = y;
	}
	Img.height = y_s;
	Img.width = x_s;

	Img.style.visibility = 'visible';
}



function ck_img_size(this_s,bool,limit_w,limit_h)
{
	if(bool){
		//limit_w = '120';
		//limit_h = '130';
		if(this_s.width > limit_w){
			this_s.width = limit_w;
		}else if(this_s.height > limit_h){
			this_s.height > limit_h;
		}
	}else{
		//this_s.title	= '[¿À·ù]'+this_s.title;
		this_s.src		='/images/full_noimage.jpg'; //¿À·ù°¡ ³µÀ» ¶§ º¸¿©ÁÙ ÀÌ¹ÌÁö
		this_s.width	= limit_w;
		this_s.height	= limit_h;
	}
}


function open_online(dir,swf)
{
	var filename;
	filename = swf.split(".");
	dir_name = "/upload/onlinebook/"+dir;

	if(filename[1]=="dcr")
		//var newwin = window.open(dir_name+"/m_view_dcr.php?dcr="+swf, "nouncebox1", "left=0,top=0,width=800,height=600,status=no,scrollbars=no");
		var newwin = window.open(dir_name+"/m_view_dcr.php?dcr="+swf, "nouncebox1", "left=0,top=0,width=800,height=600,status=no,scrollbars=no");

	else if(filename[1]=="swf")
		var newwin = window.open(dir_name+"/m_view_swf.php?swf="+swf, "nouncebox1", "left=0,top=0,width=800,height=600,status=no,scrollbars=no");

	else if(filename[1]=="htm")
		var newwin = window.open(dir, "html", "left=0, top=0, width=800, height=600");

	else if(filename[1]=="wmv")
		var newwin = window.open(dir_name+"/m_view_wmv.php?wmv="+swf, "nouncebox1", "left=0,top=0,width=640,height=480,scrollbar=no");

	else if(filename[1]=="exe")
		var newwin = window.open(dir_name+"/m_view_swf.php?exe="+swf, "nouncebox1", "left=0,top=0,width=640,height=480,scrollbar=no");


	else openwebBOOK(dir);
}

function openwebBOOK(url)
{

	var BrowName = navigator.appName;
	var BrowVer =  navigator.appVersion;
	if(BrowName=="Microsoft Internet Explorer"){
		if(BrowVer.substring(BrowVer.indexOf("MSIE ")+5,BrowVer.indexOf("MSIE ")+6) >= 5){
			if(screen.width >= 1024){
				window.open( url,"","fullscreen,scrollbars,width=0,height=0");
			}
			else{
				alert("webBookÀº È­¸éÇØ»óµµ 1024¡¿768 ÀÌ»ó¿¡¼­¸¸ µ¿ÀÛÇÕ´Ï´Ù.\n\nwebBookÀ» »ç¿ëÇÏ½Ã·Á¸é È­¸é ÇØ»óµµ¸¦ Á¶Á¤ÇÏ½Å ÈÄ ÀçÁ¢¼ÓÇØ ÁÖ½Ã±â¹Ù¶ø´Ï´Ù.");
			}
		}
		else{
			alert("webBookÀº ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯ 5.0ÀÌ»ó¿¡¼­¸¸ µ¿ÀÛÇÕ´Ï´Ù.\n\nwebBookÀ» »ç¿ëÇÏ½Ã·Á¸é ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯5.0ÀÌ»ó ¹öÀüÀ¸·Î ¾÷±×·¹ÀÌµå ÇÑÈÄ Á¢¼ÓÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		}
	}
	else{
		alert("webBookÀº ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯¿¡¼­¸¸ µ¿ÀÛÇÕ´Ï´Ù.\n\nwebBookÀ» »ç¿ëÇÏ½Ã·Á¸é ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯·Î Á¢¼ÓÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
	}
}

function goLogin(prmURL)
{
	location.href = "/modules/login/index.php?prmURL="+prmURL;
}

function openDetailedBugslife()
{
	var url = "/webbook/bugslife/htm/main.htm";
	var nw = window.open( url, "detailedbuglifewin", "left=0, top=0, width=1024, height=650, status=no,scrollbars=no, titlebar=no, menubar=no, resizable=no, toolbar=no, location=no");
	if ( nw != null )
	{
		nw.focus();
	}
}

