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.0
  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 && document.getElementById) x=document.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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(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 newWindow1(imgname,name,width,height)
{
	url="gallery_zoom.html?imgname="+imgname+"&width="+width+"&height="+height;
	window.open(url,name,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=680,height=655");
}

function newWindow2(url,name)
{
	window.open(url,name,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=705,height=610");
}
	
// ´ã´çÀÚ ÀüÈ­¹øÈ£ °Ë»ö½Ã¿¡ »ç¿ëµÊ
function searchchk()
{
	/*
	if(introsearch.person.value.length<1 || introsearch.person.value=="´ã´çÀÚ ¼º¸í") 
	{
		alert('´ã´çÀÚ ¼º¸íÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		introsearch.person.focus();
		return false;
	}
	return true;
	*/

	if (srForm.sval.value.length<1)
	{
		alert('°Ë»ö ´Ü¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!');
		srForm.sval.focus();
		return false;

	}
}
// ´ã´çÀÚ ÀüÈ­¹øÈ£ °Ë»ö½Ã¿¡ »ç¿ëµÊ
function searchchk2()
{
	if (rtForm.sval.value.length<2)
	{
		alert('°Ë»ö ´Ü¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!\nµÎÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä.');
		rtForm.sval.focus();
		return false;

	}
}
function searchchk3()
{
	if (hmForm.sval.value.length<2)
	{
		alert('°Ë»ö ´Ü¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä! \nµÎÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä.');
		hmForm.sval.focus();
		return false;

	}
}

function getCookie( name ){
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
			endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		
		x = document.cookie.indexOf( " ", x ) + 1;
		
		if ( x == 0 ) break;
	}
			return "";
}

function openwin1(code,linkurl,width,height,scroll)
{		
	/*** ÆË¾÷ Ã¢ È­¸é Áß¾Ó¿¡ ¿ÀÇÂ½ÃÅ°±â**/
	
	if ( getCookie(code) != "done" )	{
	    var str;
	    
	    str = "height=" + height + ",innerHeight=" + height;
	    str += ",width=" + width + ",innerWidth=" + width;
	    if(scroll==1) str += ",scrollbars=yes";
	
	    if (window.screen) {
	        var ah = screen.availHeight - 30;
	        var aw = screen.availWidth - 10;
	        var xc = (aw - width) / 2;
	        var yc = (ah - height) / 2;
	
	        str += ",left=" + xc + ",screenX=" + xc;
	        str += ",top=" + yc + ",screenY=" + yc;

	    }
		//ÆË¾÷ÀÌ ¾øÀ»½Ã ¾Æ·¡ 2ÁÙ ¾ÕºÎºÐÀ» "//"À¸·Î °¡·ÁÁÜ
	    noticeWindow = window.open(linkurl, code , str);
	    //noticeWindow.opener = self;
	    noticeWindow.focus();
	}
}


function openwin2(code,linkurl,width,height,top,left,scroll)
{		

	if ( getCookie(code) != "done" )
	{
		 //ÆË¾÷ÀÌ ¾øÀ»½Ã ¾Æ·¡ 2ÁÙ ¾ÕºÎºÐÀ» "//"À¸·Î °¡·ÁÁÜ
		
		str = "scrollbars=yes,width=" + width +", height="+ height +", top="+ top +", left=" + left;
		
		if(scroll==1) str += ",scrollbars=yes";
		else  str += ",scrollbars=no";
		noticeWindow = window.open(linkurl, code , str);
		
		//noticeWindow.opener = self;
	}
}

function open_win(code,linkurl,width,height,scroll)
{		
	/*** ÆË¾÷ Ã¢ È­¸é Áß¾Ó¿¡ ¿ÀÇÂ½ÃÅ°±â**/
	
	if ( getCookie(code) != "done" )	{
	    var str;
	    
	    str = "height=" + height + ",innerHeight=" + height;
	    str += ",width=" + width + ",innerWidth=" + width;
	
	    if (window.screen) {
	        var ah = screen.availHeight - 30;
	        var aw = screen.availWidth - 10;
	        var xc = (aw - width) / 2;
	        var yc = (ah - height) / 2;
	
	        str += ",left=" + xc + ",screenX=" + xc;
	        str += ",top=" + yc + ",screenY=" + yc;
	        if(scroll==1) str += ",scrollbars=yes";

	    }
		//ÆË¾÷ÀÌ ¾øÀ»½Ã ¾Æ·¡ 2ÁÙ ¾ÕºÎºÐÀ» "//"À¸·Î °¡·ÁÁÜ
	    bannerWindow = window.open(linkurl, code , str);
	    //bannerWindow.opener = self;
	    bannerWindow.focus();
	}
}


function open_win_all(code,linkurl,width,height,scroll)
{		
	/*** ÆË¾÷ Ã¢ È­¸é Áß¾Ó¿¡ ¿ÀÇÂ½ÃÅ°±â**/
	    
	    str = "height=" + height + ",innerHeight=" + height;
	    str += ",width=" + width + ",innerWidth=" + width;
	
	    if (window.screen) {
	        var ah = screen.availHeight - 30;
	        var aw = screen.availWidth - 10;
	        var xc = (aw - width) / 2;
	        var yc = (ah - height) / 2;
	
	        str += ",left=" + xc + ",screenX=" + xc;
	        str += ",top=" + yc + ",screenY=" + yc;
	        if(scroll==1) str += ",scrollbars=yes";

	    }
		//ÆË¾÷ÀÌ ¾øÀ»½Ã ¾Æ·¡ 2ÁÙ ¾ÕºÎºÐÀ» "//"À¸·Î °¡·ÁÁÜ
	    bannerWindow = window.open(linkurl, code , str);
	    //bannerWindow.opener = self;
	    bannerWindow.focus();
}



function Fullscreen(theURL){
	window.open(theURL,"","Fullscreen=yes,type=FullWindow,scrollbars=no");
}

function pagemove(form,formselect)
{
	var gval="";
	gval = formselect.options[formselect.selectedIndex].value;
	if(gval=="") {
		return false;
	}
	else 
	{
		form.action= gval;
		form.submit();
	}
	
}

function viewImage1(img,W,H){ 
	str = 'height=' + H + ',innerHeight=' + H;
	str += ',width=' + W + ',innerWidth=' + W;
	
	if (window.screen) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
		var xc = (aw - W) / 2;
		var yc = (ah - H) / 2;
		
		str += ',left=' + xc + ',screenX=' + xc;
		str += ',top=' + yc + ',screenY=' + yc;
		if(scroll==1) str += ',scrollbars=yes';
	}
	img = escape(img);            
	imgWin=window.open('/gallery/zoom.html?img='+img,'img',str); 
}

function viewImage2(img){ 
        W=document.imagezoom.winwidth.value; 
        H=document.imagezoom.winheight.value; 

	str = 'height=' + H + ',innerHeight=' + H;
	str += ',width=' + W + ',innerWidth=' + W;
	
	if (window.screen) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
		var xc = (aw - W) / 2;
		var yc = (ah - H) / 2;
		
		str += ',left=' + xc + ',screenX=' + xc;
		str += ',top=' + yc + ',screenY=' + yc;
		if(scroll==1) str += ',scrollbars=yes';
	}
	img = escape(img);
	imgWin=window.open('/gallery/zoom.html?img='+img,'img',str); 
}


function viewImage3(img,W,H){ 

	str = 'height=' + H + ',innerHeight=' + H;
	str += ',width=' + W + ',innerWidth=' + W;
	
	if (window.screen) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
		var xc = (aw - W) / 2;
		var yc = (ah - H) / 2;
		
		str += ',left=' + xc + ',screenX=' + xc;
		str += ',top=' + yc + ',screenY=' + yc;
		if(scroll==1) str += ',scrollbars=yes';
	}
	img = escape(img);
	imgWin=window.open('/gallery/zoom.html?img='+img,'img',str); 
}

function ecatalogOpen(url)
{
	if(screen.width>1024) openwin1('e_catalog',url,1000,768,0);
	else {
		if(screen.width==1024) {
			window.open(url,"e_catalog","fullscreen=yes,scrollbars=no,menubar=no,toolbar=no");
			resizeTo(1024,768);
		}
		else alert('e-ºê·Î½´¾î ¼­ºñ½º´Â ÇØ»óµµ 1024¡¿768 ºÎÅÍ Áö¿øÀÌ µË´Ï´Ù.');
	}
	
}
/* e-catalog */
function ecatalogOpen(url)
{
	if(screen.width>1024) openwin1('e_catalog',url,1000,768,0);
	else {
		if(screen.width==1024) window.open(url,"e_catalog","fullscreen,scrollbars=no");
		else alert('ºê·Î½´¾î´Â ÇØ»óµµ 1024¡¿768 ºÎÅÍ Áö¿øÀÌ µË´Ï´Ù.');
	}
	
}
/* e-catalog ³¡ */

//ÀÎ¼â ÆäÀÌÁö (ÇàÁ¤È¨ÆäÀÌÁö)
function printContent() 
{
	window.open("/include/print_contents.php","print","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=655,height=700");
}

//¸ÞÀÏ º¸³»±â (ÇàÁ¤È¨ÆäÀÌÁö)
function printMail()
{
	//window.open("/include/mail_send.html","mail","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=655,height=540");
		window.open("/common/send_mail.html","print","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=655,height=700");

}

//ÀÎ¼â ÆäÀÌÁö (³­°èÃàÁ¦)
function e_printContent(value1,value2) 
{
	window.open('/nangye/include/print_contents.php?value1='+value1+'&value2='+value2,"print","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=655,height=700");
}
//ÀÎ¼â ÆäÀÌÁö (Æ÷µµÃàÁ¦)
function g_printContent(value1) 
{
	window.open('/grape/_include/print_contents.php?value1='+value1,"print","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=655,height=700");
}
//ÀÎ¼â ÆäÀÌÁö (°ù°¨ÃàÁ¦)
function p_printContent(value1) 
{
	window.open('/persimmon/_include/print_contents.php?value1='+value1,"print","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=655,height=700");
}

//TOP Ã¥±òÇÇ
function back_top()
{
        x = document.body.scrollLeft;
        y = document.body.scrollTop;
        step = 2;

        while ((x != 0) || (y != 0)) {
                scroll (x, y);
                step += (step * step / 100); //¼ýÀÚ°ªÀÌ Å¬¼ö·Ï ½ºÅ©·Ñ¼Óµµ°¡ ´À·ÁÁü
                x -= step;
                y -= step;
                if (x < 0) x = 0;
                if (y < 0) y = 0;
        } 
        scroll (0, 0);
}

function reSizeG()
{
		var ParentFrame	    =	main_content.document.body;
		var ContentFrame	=	document.all["main_content"];
		ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);
		//ContentFrame.style.width = ParentFrame.scrollWidth + (ParentFrame.offsetWidth - ParentFrame.clientWidth);		
}

//·Î±×ÀÎÆû Ã¼Å©
function Login_chk()
{
	if(loginform.userid.value=='') {
		alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		loginform.userid.focus();
		return false;
	}
	if(loginform.passwd.value=='') {
		alert('ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		loginform.passwd.focus();
		return false;
	}
}

function flash_echo(width , height , movie , quality , wmode) {
	var flash_tag = "";
 	flash_tag = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
 	flash_tag +='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
	flash_tag +='WIDTH="'+width+'" HEIGHT="'+height+'" >';
	flash_tag +='<param name="movie" value="'+movie+'">';
	flash_tag +='<param name="quality" value="'+quality+'">';
	flash_tag +='<param name="wmode" value="'+wmode+'">';
	flash_tag +='<embed src="'+movie+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+width+'" HEIGHT="'+height+'"></embed></object>'

 	document.write(flash_tag);
}