	//messages

	//layer
	
	function layerBlock (name) {
		div1 = document.getElementById(name);
		div1.style.display = 'block';
	}
	
	function layerNone (name) {
		div1 = document.getElementById(name);
		div1.style.display = 'none';
	}

	function layerPayTooltip (name, e) {
		var div1 = document.getElementById(name);

		if (document.all&&document.readyState=="complete"){
			//div1.style.pixelLeft=event.clientX+document.documentElement.scrollTop - 285;
			div1.style.pixelTop=event.clientY+document.documentElement.scrollTop - 275;
		} else {
			//div1.style.left = e.pageX + "px";
			div1.style.top = (e.pageY - 265) + "px";
		}
		div1.style.display = 'block';
	}


	// Image Bluring
	function allblur() {		//FF
		for (i = 0; i < document.links.length; i++){
		//`alert(document.links);
			document.links[i].onfocus = document.links[i].blur;
		}
	}
	window.onload = allblur;
	
	var bluring_loop = 1;
	function bluring(){
		if (event.srcElement){
			if(event.srcElement.tagName=="A" || event.srcElement.tagName=="IMG"){ 
				//alert(event.srcElement);
				if (bluring_loop == 1) {
					bluring_loop = 0;
					event.srcElement.blur();
				}
				//document.body.focus();
			}
		}
		bluring_loop = 1;
	}
	document.onfocusin=bluring;
	
	function blurSelf(e){
		if (e){
			e.blur();
		}
	}

	// rollover

	function overImg( obj ) {
		obj.src = obj.src.replace( 'off.gif', 'on.gif' );
	}
	function outImg( obj ) {
		obj.src = obj.src.replace( 'on.gif', 'off.gif' );
	}

	// Dreamweaver

	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.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];}
	}

	function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}

	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}

	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 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;
	}


	/*
	===============================================================================
	*  i.e patch
	===============================================================================
	*/

	function flashWrite(url,w,h,id,bg,vars,win) {
		var strSize
	
		if (w!=0 || h!=0){
			strSize = "width='"+w+"'"
		}
		if (h!=0){
			strSize = strSize + " height='"+h+"'"
		}

		var flashStr=
		 "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' " + strSize + " id='"+id+"' align='middle'>"+
		 "<param name='allowScriptAccess' value='always' />"+
		 "<param name='movie' value='"+url+"' />"+
		 "<param name='FlashVars' value='"+vars+"' />"+
		 "<param name='wmode' value='"+win+"' />"+
		 "<param name='menu' value='false' />"+
		 "<param name='quality' value='high' />"+
		 "<param name='bgcolor' value='"+bg+"' />"+
		 "<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' " + strSize + " name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
		 "</object>";

		 document.write(flashStr);

	}

	function SWFLoader(width, height, dir, num1, num2, num3, url1, url2, url3, url4, url5) {

		document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+width+"' height='"+height+"'>");
		document.write("<param name='allowScriptAccess' value='always'>");
		document.write("<param name='allowFullScreen' value='false'>");
		document.write("<param name='movie' value='"+dir+"'>");
		document.write("<param name='quality' value='high'>");
		document.write("<param name='wmode' value='transparent'>");
		document.write("<param name='base' value='.'>");
		document.write("<param name=FlashVars value='mmenu="+num1+"&smenu="+num2+"&tmenu="+num3+"&url1="+url1+"&url2="+url2+"&url3="+url3+"&url4="+url4+"&url5="+url5+"' />");
		document.write("<embed base='.' src='"+dir+"' name='wmode' value='transparent' FlashVars='mmenu="+num1+"&smenu="+num2+"&tmenu="+num3+"url1="+url1+"&url2="+url2+"&url3="+url3+"&url4="+url4+"&url5="+url5+"' quality='high' width='"+width+"' height='"+height+"' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' name='wmode' value='transparent' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'>");
		document.write("</object>");
	}


	//#########################################################################################################
	function DisplayMenu(menu,total,num) {
	     for (i=1; i<=total; i++){
		  divNum = menu+i;
		  divName = document.getElementById(divNum);
			if (num == i) {
				divName.style.display = 'block';
			}else{
				divName.style.display  = 'none'; 
			}
		}
	}
	
	function TopSearchFocus(v){
		var objKey = document.getElementById("q");
		
		if (objKey.value == v){
			objKey.value = "";
		}
		
	}
	
	function TopSearchGo(v){
		
		var objFrm = document.getElementById("frmSearchSite");
		
		if (objFrm.q.value && objFrm.q.value != v){
			objFrm.submit();
		}else{
			alert("Please enter a keyword");
			objFrm.q.focus();
			
		}

		return false;
		
	}


	function setCookie( name, value, expiredays ){
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
	}

	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 openWinN(src, name, param) { 
		var noticeCookie=getCookie(name);
		if (noticeCookie != "ok") 
			window.open(src,name,param); 
	}

	function gocloseWinN(linkurl)  {
		opener.location.href= linkurl;
		top.close();
	}

	function gocloseWinN2(linkurl)  {
		window.open(linkurl);
		top.close();
	}
	
	function closeWinN(e,name) {
		if ( e.checked )
			setCookie(name,"ok",1);
		self.close();
	}

	function setLang(strLang){
		
		if (strLang == "KOR"){
			window.location.href = "http://www.diotek.co.kr";
		}else{
			var url = "/common/dev/ChangeLang.asp";
			var pars = "Flag=L&Lang=" + strLang;
	
			var myAjax = new Ajax.Request(
				url,
				{
					method: 'post',
					parameters: pars,
					onComplete: setLangSucc
				});
		}
	}

	function setCountry(strCountry){

		/*
		if (strCountry == "KOR"){
			window.location.href = "http://www.diotek.co.kr";
		}else{
		*/
			var url = "/common/dev/ChangeLang.asp";
			var pars = "Flag=COUNTRY&Country=" + strCountry;
	
			var myAjax = new Ajax.Request(
				url,
				{
					method: 'post',
					parameters: pars,
					onComplete: setLangSucc
				});
		//}
	}

	function setCurrency(strCurrency){
		
		var url = "/common/dev/ChangeLang.asp";
		var pars = "Flag=C&Currency=" + strCurrency;
	
		var myAjax = new Ajax.Request(
			url,
			{
				method: 'post',
				parameters: pars,
				onComplete: setLangSucc
			});
	}

	function setLangSucc(originalRequest) {
		var result = originalRequest.responseText;
		var fullURL = parent.document.URL;
		var query_string = "";
		
		if (fullURL.indexOf('?') > 0) {
			query_string = fullURL.substring(fullURL.indexOf('?')+1, fullURL.length);
		}

		if (result == ""){
			window.location.reload();
		}else{
			if (query_string != ""){
				result = result + "?" + query_string;
			}
			window.location.href= result;
		}
	}
	
	// ###### 폼 체크 START

	function nullCheck_Input(obj,msg) {
		if (!obj){
			alert("Not found object.");
			return true;
		}
		
		var str = obj.value;
		str = str.replace(/^\s+|\s+$/g, "");
		
		if ( str == "" ){
			alert (msg);
			//alert ( msg + "입력하세요" );
			if (obj.style.display!="none"){
				obj.focus();
			}
			return true;
		}
		return false;
	}

	function nullCheck_select(obj,msg) {
		if (!obj){
			alert("Not found object.");
			return true;
		}
		if ( obj.value == "" ){
			//alert ( msg + "선택하세요" );
			alert (msg);
			obj.focus();
			return true;
		}
		return false;
	}

	function nullCheck_chkbox(obj,msg) {
		var tmpFlag, tmpI ;
		tmpFlag = false;

		if (!obj){
			alert("Not found object.");
			return true;
		}
		if (obj.length){
			for (tmpI = 0 ; tmpI < obj.length; tmpI ++){
				if 	(obj[tmpI].checked)		tmpFlag = true;
			}
		}else{
			if (obj.checked)		tmpFlag = true;
		}

		if (! tmpFlag ){
			alert (msg);
			//alert ( msg + "선택하세요" );
			return true;
		}
		return false;
	}

	function CheckAll(obj){			// 체크 박스를 사용하지 않은 전체 체크
		var obj = eval(obj);
		var i, chk;

		if (obj.length) {
			chk = obj[0].checked;
			for (i=0;i<obj.length;i++){
				if (chk){
					obj[i].checked = false;
				}else{
					obj[i].checked = true;
				}
			}
		}else{
			if (obj.checked){
				obj.checked = false;
			}else{
				obj.checked = true;
			}
		}
		return;
	}

	function CheckAllCk(obj,opt){		// 체크 박스를 사용한 전체 체크
		var obj = eval(obj);
		var i, chk;

		if (!obj){
			alert("Not found object.");
			//alert("선택할 목록이 존재하지 않습니다.");
			return false;
		}

		if (obj.length) {
			for (i=0;i<obj.length;i++){
				obj[i].checked = opt;
			}
		}else{
			obj.checked = opt;
		}

		return;
	}

	// ###### 폼 체크 END

	// ###### 체크 박스 관련 START

	// 선택된 체크박스의 값들을 구하는 함수
	// objEle : 체크박스 객체
	function RtnCheckValues(objEle) {
		var i, nID, nSize
	
		nID = -1
		
		if(objEle==null) {
		   return nID
		}
	
		nSize = objEle.length;
	
		if(nSize==null) {
		   nSize = 0;
		}
		if(nSize!=0) {   
		   j = 0
		   for(i = 0; i < nSize; i++) {
			   if(objEle[i].checked == true) {
				  if(j==0) {
					 nID = objEle[i].value
				  } else {
					 nID = nID + "," + objEle[i].value
				  }
				  j = j + 1
			   }      
		   }
		} else {
		   if(objEle.checked == true) {
			  nID = objEle.value
		   }
		} 
		return nID
	}
	
	// 선택된 체크박스의 갯수를 구하는 함수
	// objEle : 체크박스 객체
	function RtnChecksCnt(objEle) {
		var i, nID, nSize
	
		nID = -1;
		
		if(objEle==null) {
		   return nID
		}
	
		nSize = objEle.length;
	
		if(nSize==null) {
		   nSize = 0;
		}
		if(nSize!=0) {
			nID = 0;
		   for(i = 0; i < nSize; i++) {
			   if(objEle[i].checked == true) {
					nID = nID + 1;
			   }      
		   }
		} else {
		   if(objEle.checked == true) {
			  nID = 1;
		   }
		} 
		return nID
	}

	// ###### 체크 박스 관련 END


	/*
	function email_check(email) {

		if (!is_null(email)) {

			  var filter=/^.+@.+\..{2,3}$/ ;

			  if (filter.test(email)) {
				  return true ;			// 올바른이메일
			  } else{
	   			   return false ;		// 옳지않은이메일
			  }

		} else {
			return false;
		}

	}
	*/


	function email_check (emailStr) { 
		// Email check 함수 
		var emailPat=/^(.+)@(.+)$/ 
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]" 
		var validChars="\[^\\s" + specialChars + "\]" 
		var firstChars=validChars 
		var quotedUser="(\"[^\"]*\")" 
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/ 
		var atom="(" + firstChars + validChars + "*" + ")" 
		var word="(" + atom + "|" + quotedUser + ")" 
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$") 
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$") 
		
		
		var matchArray=emailStr.match(emailPat) 
		if (matchArray==null) { 
			//alert("@,.") 
			return false 
		} 
		var user=matchArray[1] 
		var domain=matchArray[2] 
		
		if (user.match(userPat)==null) { 
			//alert("id") 
			return false 
		} 
		
		var IPArray=domain.match(ipDomainPat) 
		if (IPArray!=null) { 
			for (var i=1;i<=4;i++) { 
				if (IPArray[i]>255) { 
					//alert("IP") 
					return false 
				} 
			} 
			return true 
		} 
		
		var domainArray=domain.match(domainPat) 
		
		if (domainArray==null) { 
			//alert("domain") 
			return false 
		} 
		var atomPat=new RegExp(atom,"g") 
		var domArr=domain.match(atomPat) 
		var len=domArr.length 
		
		if (domArr[domArr.length-1].length<2 || 
			domArr[domArr.length-1].length>3) { 
			//alert("country") 
			return false 
		} 
		
		if (domArr[domArr.length-1].length==2 && len<2) { 
			var errStr="This address ends in two characters, which is a country" 
			errStr+=" code. Country codes must be preceded by " 
			errStr+="a hostname and category (like com, co, pub, pu, etc.)" 
			//alert(errStr) 
			return false 
		} 
		
		if (domArr[domArr.length-1].length==3 && len<2) { 
			//var errStr="hostname" 
			alert(errStr) 
			return false 
		} 
		return true; 
	} 

	function id_check(str) {

		var result_str = "" ; 			// 널값을 없앤 새로운 값을 만들기 위해서 변수선언 및 초기화
		var i ;

		for(i = 0 ; i < str.length ; i++) { 	// 넘어온 인자을 하나씩 검사해서 널값(space)이면 값을 없애고

			if(str.charAt(i) == " ") {
			}else {			// 널값(space)이 아니면 그값을 새로운 변수에 저장한다.
				result_str = result_str + str.charAt(i) ;
			}
		}

		if(result_str == "" || result_str.length < 4 || result_str.length > 15) {		// 최종적인 값이 널 혹은 length가 4이하, 12이상 이면 true 값 리턴
			return true ;
		}

		return false ;		// 최종적인 값이 널값이 아니면 false 값 리턴
	}

	function pwd_check(str) {

		var result_str = "" ; 			// 널값을 없앤 새로운 값을 만들기 위해서 변수선언 및 초기화
		var i ;

		for(i = 0 ; i < str.length ; i++) { 		// 넘어온 인자을 하나씩 검사해서 널값(space)이면 값을 없애고
																							  
			if(str.charAt(i) == " ") {
			} else { 		// 널값(space)이 아니면 그값을 새로운 변수에 저장한다.
				result_str = result_str + str.charAt(i) ;
			}
		}

		if(result_str == "" || result_str.length < 4 || result_str.length > 15) {		// 최종적인 값이 널 혹은 length가 4이하, 15이상 이면 true 값 리턴
			return true ;
		}

		return false ;		// 최종적인 값이 널값이 아니면 false 값 리턴
	}



	//090520 main추가
	function change(max,val){
		for (i=1;i<=max ;i++ ){
			document.getElementById("mainProduct"+i).style.display = "none";
		}
		document.getElementById("mainProduct"+val).style.display="";
		chk_val = document.ttform.chk.value;
		chk_val = val + 1;
		if(chk_val > max){chk_val=1;}
		timer2 = setTimeout("change("+max+","+chk_val+")",6000);
	}

	//090522 pop-up
	function winOpen (doc, wname, top, left, width, height) {
	  window.open(doc, wname, 'scrollbars=yes,resizable=yes,top='+top+',left='+left+',width='+width+',height='+height);
	}

	function winOpen2 (doc, wname, top, left, width, height) { 
	  window.open(doc, wname, 'scrollbars=yes,resizable=yes,location=yes,top='+top+',left='+left+',width='+width+',height='+height);
	} // location 표시


	function winOpenGuide (doc) {
	  window.open(doc,'PopGuide','scrollbars=yes,resizable=yes,top=0,left=0,width=647,height=800');
	}

	function winOpenInstall (doc, bsn) {
	  window.open(doc + "&bsn=" + bsn,'PopInstall','scrollbars=yes,resizable=yes,top=0,left=0,width=730,height=500');
	}

	function closeWin()
	{ 
		self.close(); 
	}

	//090527 download 
	function setFileDownload(filename)	{
		location.href = "/common/dev/DownFiles.asp?filename=" + filename;
	}

	//100413 download & login check
	function setFileDownloadChk(filename,flag)	{
		if (flag){
			location.href = "/common/dev/DownFiles.asp?filename=" + filename;
		}else{
			alert(MSG_LOGIN);
		}
	}

	function setFileDownloadLoc(dir,filename)	{
		location.href = "/common/dev/DownFilesLocal.asp?dir=" + dir+ "&filename=" + filename;
	}

	function RtnMsg(msg){
		alert(msg);
	}
	
	// 문자열 자르기
	function CutStrByte( sTargetStr , nMaxLen ) { 
	    var sTmpStr, sTmpChar, sDestStr; 
	    var nOriginLen = 0; 
	    var nStrLength = 0; 
	    var sDestStr = ""; 
	    sTmpStr = new String(sTargetStr); 
	    nOriginLen = sTmpStr.length; 

	    for ( var i=0 ; i < nOriginLen ; i++ ) { 
	        sTmpChar = sTmpStr.charAt(i); 

	        if (escape(sTmpChar).length > 4) { 
	            nStrLength = nStrLength + 2; 

	        } else if ((sTmpChar != '\r')&&(sTmpChar != '\n')) { 
	        
	            nStrLength ++; 
	        } 

	        if (nStrLength <= nMaxLen) { 
	            sDestStr = sDestStr + sTmpChar; 
	        } else { 
	            break; 
	        } 

	    } 

	    return sDestStr; 

	} 

	// 문자열 길이 가져오기
	function LenByte(str) {
		var cnt = 0;

		for (var i = 0; i < str.length; i++) {
			if (str.charCodeAt(i) > 127)
				cnt += 2;
			else
				cnt++;
		}

		return cnt;
	}
	
	function stripHTMLtag(string) { 
		var objStrip = new RegExp(); 
		objStrip = /[<][^>]*[>]/gi; 
		return string.replace(objStrip, ""); 
	} 

	// 이미지 크기 변경
	function resizeImage(objImg, limitW) {
		var objParent = objImg.parentNode;
		var imgWidth = parseInt(objImg.width, 10);
	
		if (imgWidth > limitW) {
			objImg.width = limitW;
		}
	}
	
	function resizeImageAll(limitId) {
		var objLimit = document.getElementById(limitId);
		if (objLimit) {
			var fixWidth = objLimit.clientWidth;
			var arrImgs = objLimit.getElementsByTagName("IMG");
			for (var i=0, len=arrImgs.length; i<len; i++) {
				if (parseInt(arrImgs[i].width, 10) > fixWidth) {
					arrImgs[i].width = fixWidth;
				}
			}
		}
	}
