//Common java script
function NewOpenHelp(hel,wx,wy){
	window.open(hel,'hlp','resizable=no,screenx=0,screeny=0,width='+wx+',height='+wy);
}
function NewOpen(php,wx,wy){
	window.open(php,'win','resizable=no,screenx=0,screeny=0,left='+((screen.width-1000)/2)+',top='+((screen.height-770)/2)+',width='+wx+',height='+wy);
}
function PrintCatalog(cat,wx,wy){
	window.open(cat,'win','resizable=no,scrollbars=yes,screenx=0,screeny=0,left=0,top=0,width='+wx+',height='+wy);
}
function NewWindowOpen(php,wx,wy){
	window.open(php,'newwin','resizable=no,screenx=0,screeny=0,width='+wx+',height='+wy);
}
function ProductOpen(img,wx,wy){
   window.open(img,'imga','resizable=no,scrollbars=no,screenx=0,screeny=0,width='+wx+',height='+wy);
}
function IconOpen(i_con,wx,wy){
   window.open(i_con,'icon','resizable=no,scrollbars=yes,screenx=0,screeny=0,width='+wx+',height='+wy);
 }
function login(php,wx,wy){
   window.open(php,'nwwin','resizable=no,scrollbars=no,screenx=0,screeny=0,width='+wx+',height='+wy);
 }
function CatalogMake(cata,wx,wy){
   window.open(cata,'imgag','resizable=no,scrollbars=no,screenx=0,screeny=0,width='+wx+',height='+wy);
}
function MapOpen(map,wx,wy){
	window.open(map,'ope','resizable=no,screenx=0,screeny=0,width='+wx+',height='+wy);
}
function ManOpen(man,wx,wy) {
	window.open(man,'mane','resizable=no,screenx=0,screeny=0,width='+wx+',height='+wy);
}
function AskData(man,wx,wy) {
	window.open(man,'ask','resizable=no,scrollbars=no,screenx=0,screeny=0,width='+wx+',height='+wy);
}
function Check() {
	if (document.sfor.input.value == "") 
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		document.sfor.input.focus();
		return false;
	}
}

function namosw_goto_byselect(sel, targetstr)
{
  var index = sel.selectedIndex;
  if (sel.options[index].value != '') {
     if (targetstr == 'blank') {
       window.open(sel.options[index].value, 'win1');
     } else {
       var frameobj;
       if ((frameobj = eval(targetstr)) != null)
         frameobj.location = sel.options[index].value;
     }
  }
}

function Chk() {

    var wher = document.aform.wher.value;	
    var val  = document.aform.val.value;
    var dt   = document.aform.dt.value;
    var dd   = document.aform.dd.value;
    
    if (document.aform.dt.checked == true ) {
    	var dc  = document.aform.dt.value;
    	var se1 = 1;
    	var se2 = 3;
    }else{
    	var dc  = "";
    	var se1 = 0;
    	var se2 = 2;
    }
    if (document.aform.dd.checked == true ) {
    	var opt  = document.aform.dd.value;
    }else{
    	var opt  = "";
    }
    
    if (document.aform.val.value == "") {
	alert("°Ë»ö¾î ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
	document.aform.val.focus();
	return false;
    }else {
    if (wher == 1) {
        if ((dt == true) && (dd == true)) {
        	URL = "com_gubun_search.htm?techw="+val+"&de="+1+"&dt="+dt+"&dd="+dd+"&c_area="+0
        	aform.action = URL;
        }else if ((dt == true) && (dd == false)) {
	        URL = "com_gubun_search.htm?techw="+val+"&de="+1+"&dt="+dt+"&c_area="+0
	        aform.action = URL;
        }else if ((dt == false) && (dd == true)) {
	        URL = "com_gubun_search.htm?techw="+val+"&de="+1+"&dd="+dd+"&c_area="+0
	        aform.action = URL;
        }else{	        
	        URL = "com_gubun_search.htm?techw="+val+"&de="+1+"&c_area="+0
	        aform.action = URL;
        }
    }else if (wher == 2) {
		URL = "tech_note_search.htm?techw="+val+"&dt="+dt+"&dc="+dc
		aform.action = URL;
    }else if (wher == 3) {
		URL = "tec_qna_search.htm?techw="+val+"&dt="+dt+"&dc="+dc
		aform.action = URL;
    }else if (wher == 4) {
		URL = "tech_site_search.htm?sword="+val+"&sel="+se1+"&opt="+opt
		aform.action = URL;
    }else if (wher == 5) {
		URL = "tech_bank.htm?sbox="+val+"&selv="+se2+"&opt="+opt
		aform.action = URL;
    }else if ((wher == 6) || (wher == 7)){
		URL = "cat_search.htm?techw="+val+"&dt="+dt+"&dc="+dc
		aform.action = URL;
    }else {
        aform.action = "msite_find.htm";
   }
  }
}



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) { //v3.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); 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_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 AdPositionSetting() {
	var heightgap, timeDelay;
	timeoutNextCheck = 300;
	if (parseInt (Layer1.style.top, 10) != document.body.scrollTop) {
		heightgap = Math.ceil(Math.abs(document.body.scrollTop - parseInt (Layer1.style.top, 10)) / 20);
		if (document.body.scrollTop < parseInt (Layer1.style.top, 10)){
			heightgap = -heightgap;
			}
			Layer1.style.top = parseInt (Layer1.style.top, 10) + heightgap;
			timeDelay = 1;
	}
	setTimeout ('AdPositionSetting()', timeDelay);
}
/*
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 '';
}

if ( getCookie( 'event' ) != 'checked' )
{
  window.open('pop_dic.htm','event','x=100, y=200,width=490,height=220,resizable=no,scrollbars=no,toolbar=no,location=no,directory=no');
}
*/
function checkImgFormat(imgPath) {
	var len = imgPath.length;
	var sFormat = imgPath.substring(len-4);

	if ( sFormat == ".PNG" ||
		sFormat == ".JPG" ||
		sFormat == ".GIF" ||
		sFormat == ".BMP" ||
		sFormat == ".png" ||
		sFormat == ".bmp" ||
		sFormat == ".gif" ||
		sFormat == ".jpg" ) {

		document.uform.src = imgPath;
	} else {
		if ( imgPath != "" ) {
			alert("Áö¿øÇÏÁö ¾Ê´Â ÆÄÀÏÇü½ÄÀÔ´Ï´Ù. ¾àµµ´Â jpg,gifÆ÷¸ËÀ» Áö¿øÇÕ´Ï´Ù.\n\nÃ£¾Æº¸±â¸¦ ´­·¯ ÆÄÀÏÀ» ´Ù½Ã ¼±ÅÃÇØÁÖ¼¼¿ä.");
			return
		}
	}
}
function marq_stop()
{
	marq.stop();
	return true;
}
function marq_start()
{ 	
	marq.start();
	return true;
}
document.onkeydown=KeyEventHandle;
document.onkeyup=KeyEventHandle;
function KeyEventHandle() {
        if((event.ctrlKey == true && event.keyCode == 67)) {
                event.keyCode = 0;
                event.cancelBubble = true;
                event.returnValue = false;
        }
}

