//----------------------------------------------------------------------------------
//									°øÅëÀ¸·Î »ç¿ë
//----------------------------------------------------------------------------------
function checkEmail(Email)
{
	//email Ã¼Å©
	var strEmail = Email;
    var i;
    var strCheck1 = false;
    var strCheck2 = false;
	var iEmailLen = strEmail.length
	
	if (iEmailLen > 0) {
		// strEmail ¿¡ '.@', '@.' ÀÌ ÀÖ´Â °æ¿ì ¿¡·¯¸Þ½ÃÁö.
		// strEmailÀÇ ¸Ç¾Õ ¶Ç´Â ¸ÇµÚ¿¡  '@', '.' ÀÌ ÀÖ´Â °æ¿ì ¿¡·¯¸Þ½ÃÁö.
		if ((strEmail.indexOf(".@") != -1) || (strEmail.indexOf("@.") != -1) ||
			(strEmail.substring(0,1) == ".") || (strEmail.substring(0,1) == "@") ||
			(strEmail.substring(iEmailLen-1,iEmailLen) == ".") || (strEmail.substring(iEmailLen-1,iEmailLen) == "@"))
		{	
			return false;
		}
	    for ( i=0; i<iEmailLen; i++ ) {
	        if ( (strEmail.substring(i,i+1) == ".") || (strEmail.substring(i,i+1) == "-") || (strEmail.substring(i,i+1) == "_") ||
				((strEmail.substring(i,i+1) >= "0") && (strEmail.substring(i,i+1) <= "9")) ||
				((strEmail.substring(i,i+1) >= "@") && (strEmail.substring(i,i+1) <= "Z")) ||
				((strEmail.substring(i,i+1) >= "a") && (strEmail.substring(i,i+1) <= "z")) ) {
	                if (strEmail.substring(i,i+1) == ".")
						strCheck1 = true;
	                if (strEmail.substring(i,i+1) == "@")
						strCheck2 = true;
	        }
	        else {
				return false;
	        }
	    }
	
	    if ((strCheck1 == false) || (strCheck2 == false)) {
//			alert('¿Ã¹Ù¸£Áö ¾Ê´Â email ÀÔ´Ï´Ù.');
			return false;
	    }
	}
    return true;
}

function ChksocialidNum(socialid, socialid1) 
{
    var sum = 0;

    sum += socialid.charAt(0)*2;
    sum += socialid.charAt(1)*3;
    sum += socialid.charAt(2)*4;
    sum += socialid.charAt(3)*5;
    sum += socialid.charAt(4)*6;
    sum += socialid.charAt(5)*7;
	    
    sum += socialid1.charAt(0)*8;
    sum += socialid1.charAt(1)*9;
    sum += socialid1.charAt(2)*2;
    sum += socialid1.charAt(3)*3;
    sum += socialid1.charAt(4)*4;
    sum += socialid1.charAt(5)*5;

    check = (11 - sum % 11) % 10;

    if (socialid1.charAt(6) != check || (socialid.length != 6 && socialid1.length != 7))
    {
        return false;
    }
	    
    if(!(socialid1.charAt(0) == '1' || socialid1.charAt(0)  == '2' ||
		 socialid1.charAt(0) == '3' || socialid1.charAt(0) == '4'))
    {
    	return false;
    }

   return true;
}

function isValid_Char(sBuf)
{
	// ¹®ÀÚ¿­¿¡ num, char¸¸ ÀÖ´Ù¸é true ¸¦ return...
	var	numbers	= "1234567890";
	var	chars	= "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
	var	charnum	= numbers + chars;
	for ( var i=0; i<sBuf.length; i++ ) {
		if (charnum.indexOf(sBuf.charAt(i)) < 0) {
			return false;
		}
	}
	return true;
}

function getRadioValue(radioObject) 
{
	// radio objectÀÇ °ªÀ» return
	var ret = null;
	for (var i=0; i<radioObject.length; i++) 
	{
		if (radioObject[i].checked) 
		{
			ret = radioObject[i].value;
			break;
		}
	}
	return ret;
}

function setRadioValue(radioObject, t) 
{
	var ret = null;
	for (var i=0; i<radioObject.length; i++) 
	{
		if (i == (t-1) )
		{
			radioObject[i].checked = true;
		}
	}
}
         
function checkNull(oObj, sWhere)
{
	// oObjÀÇ value°¡ ºñ¾îÀÖ´ÂÁö checkÇÏ°í, 
	// ¸¸¾à ºñ¾îÀÖ´Ù¸é sWhere·Î error ¸Þ½ÃÁö¸¦ º¸¿©ÁØ´Ù.
	// oObjÀ¸·Î focus ÀÌµ¿
	if (oObj.value == "" || oObj.value == 0)
	{
		err_msg(sWhere, oObj);
		return false;
	}
	return true;
}

function checkNull2(oObj, sWhere)
{
	// oObjÀÇ value°¡ ºñ¾îÀÖ´ÂÁö checkÇÏ°í, 
	// ¸¸¾à ºñ¾îÀÖ´Ù¸é sWhere·Î error ¸Þ½ÃÁö¸¦ º¸¿©ÁØ´Ù.
	if (oObj.value == "" || oObj.value == 0)
	{
		err_msg2(sWhere, oObj);
		return false;
	}
	return true;
}

function isValid_Num(sNum)
{
	// ¹®ÀÚ¿­¿¡ num¸¸ ÀÖ´Ù¸é true¸¦ return
	var	numbers	= "1234567890";
	for ( var i=0; i<sNum.length; i++ ) {
		if (numbers.indexOf(sNum.charAt(i)) < 0) {
			return false;
		}
	}
	return true;
}

function alert_msg(msg)
{
    //Alert¸¸ ¶ç¿öÁÖ°í ³¡..
    alert(msg);
    return;
}

function err_msg(sWhere, oObj)
{
	// sWhere¿¡¼­ ¿À·ù°¡ ³ªÅ¸³µÀ½À» ¾Ë·ÁÁÖ°í, oObj·Î focus¸¦ ÀÌµ¿ÇÑ´Ù.
	alert("'" + sWhere + "'" + " Ç×¸ñ¿¡ ¿À·ù°¡ ÀÖ½À´Ï´Ù.");
	oObj.focus();
}

function err_msg2(sWhere, oObj)
{
	// sWhere¿¡¼­ ¿À·ù°¡ ³ªÅ¸³µÀ½À» ¾Ë·ÁÁØ´Ù.
	alert("'" + sWhere + "'" + " Ç×¸ñ¿¡ ¿À·ù°¡ ÀÖ½À´Ï´Ù.");
}

function err_msg3(sWhere, sMsg)
{
	// sWhere.value°¡ Null or ºóÄ­ÀÌ¸é ¾Ë·ÁÁÖ°í(sMsg), sWhere focus¸¦ ÀÌµ¿ÇÑ´Ù.
	if(sWhere.value == ""){
		alert(sMsg);
		sWhere.focus();
		return false;
	}else{
		return true;
	}
}
function confirm_msg1(msg)
{
	if (confirm(msg)==true)
    { 	return true;}
    else{
	    return false;
        }
}
function locationh(url)
{
//	location.href = "http://www.idckorea.com/"+url;

	location.href = Settingurl+url;
}
function closeNreplace(url)
{
	self.close();
	opener.location.href = Settingurl+url;
}
//
// div ´Þ·Â     
//
function show_cal(what, where)
{
	var txt = new String("<iframe src=\"/include/cal.asp?what="+what+"&where="+where+"\" width=\"142\" frameborder=\"0\" scrolling=\"No\" ></iframe>");
	document.all[what].innerHTML = txt;
}
// div ´Þ·Â  new version 09.09.25
function show_cal_new(what, where, run, changedate)
{
	var txt = new String("<iframe src=\"/include/cal.asp?what="+what+"&where="+where+"&run="+run+"&changedate="+changedate+"\" width=\"142\" frameborder=\"0\" scrolling=\"No\" ></iframe>");
	document.all[what].innerHTML = txt;
}
	
		
function hide_cal(what)
{
	document.all[what].innerHTML = "";
}

//
// ¼ýÀÚ¸¸À» ±âÀÔ¹Þ°Ô ÇÏ´Â ¹æ¹ý
// »ç¿ë¹ø ÇØ´ç ÀÔ·Â input ¿¡ : onkeypress="only_number();"
//

function only_number()  
{
   if((event.keyCode<48)||(event.keyCode>57))
      event.returnValue=false;
}

//
// alert Ã¢À¸·Î ¼ýÀÚ¸¸ ±âÀÔÇÏ°Ô ÇÏ´Â ¹æ¹ý
// »ç¿ë¹ý onblur=
function sell_sendit(dig,cmt)
    {
         var didi = "1234567890"

             for(i=0;i<dig.value.length;i++){
             if(didi.indexOf(dig.value.substring(i,i+1))<0){
                alert(cmt+"¸¦ ÀÔ·Â ÇÏ½Ç¶§¿¡´Â ¼ýÀÚ¸¸ ÀÔ·ÂÇØÁÖ¼¼¿ä ");
                dig.value='';
                dig.focus();
                return;
                 }
             }
          return;

    }


function imgResize(img){ 
  img1= new Image(); 
  img1.src=(img); 
  imgControll(img); 
} 
function imgControll(img){ 
  if((img1.width!=0)&&(img1.height!=0)){ 
    viewImage(img); 
  } 
  else{ 
    controller="imgControll('"+img+"')"; 
    intervalID=setTimeout(controller,20); 
  } 
} 
/**
 * ÀÌ¹ÌÁö Å©±â´ë·Î ÀÚµ¿ Á¶ÀýÈÄ ÀÌ¹ÌÁö ÆË¾÷
 *
 * @img 	ÀÌ¹ÌÁö ÀÌ¸§
 * @img_url	ÀÌ¹ÌÁö full °æ·Î
 **/
function viewImage(img,img_url){ 
	W=img1.width; 
	H=img1.height+40; 
	if (H > 600){
	W=W+20
	H=600+40
	Sta="scrollbars=yes"
	}else{
	Sta="scrollbars=no"}
	O='width='+W+',height='+H;
	imgWin=window.open('','',''+O+','+Sta+''); 
	imgWin.document.write("<html><head><title>»óÇ° È®´ë º¸±â</title></head>");
	imgWin.document.write("<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>");
//Ãß°¡	
	imgWin.document.write("<table><tr><td colspan=2>");
	imgWin.document.write("<img src="+img+" onclick='self.close()' style='cursor:hand'>");
	imgWin.document.write("</td></tr>");
	imgWin.document.write("<tr><td width=78>");
	imgWin.document.write("<img src="+img_url+"sub_img/happybuy.gif></td>");
	imgWin.document.write("<td align=right><img src="+img_url+"sub_img/img_close.gif onclick='window.close()' style='cursor:hand'>");
	imgWin.document.write("</td></tr>");				
	imgWin.document.write("</table>");
	imgWin.document.close();
} 
// À©µµ¿ì ÆË¾÷ ¶ç¿ì±â 
function win_pop(path, win_name, wi, he, scroll) {
	var win_inputID=window.open(path, win_name,'width='+wi+',height='+he+',resizable=no,scrollbars='+scroll+', status=no,toolbar=no');
	win_inputID.focus();
}
// ¾÷·Îµå¿ë ÆË¾÷
function win_upload(path, win_name, maxsize, title, Dcode, idx, upname, way, position, value1) {
	//path -> pop-up °æ·Î, win_name -> foldername, maxsize -> max ÀúÀåÅ©±â, title -> pop-up ÀÌ¸§, Dcode -> ?directory, upname ->idx, 
	var url = path+'?maxsize='+maxsize+'&title='+escape(title)+'&Dcode='+Dcode+'&idx='+idx+'&way='+way+'&position='+position+'&value1='+value1+'&upname='+escape(upname)
	var win_inputID=window.open(url, win_name,'width=350,height=190,resizable=no,scrollbars=no, status=no,toolbar=no');
	win_inputID.focus();
}
// °øÁöº¸±â
function PopGongji(bbs_no, news_select, news_code, wi, hi)
{
	var win_inputID=window.open('http://www.idckorea.com/Popup/notice.asp?bbs_no='+bbs_no+'&news_select='+news_select+'&news_code='+news_code+'&wi='+wi+'&hi='+hi,'popgongji','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width='+wi+',height='+hi+',left=150,top=150,resizable=yes');
	win_inputID.focus();
}

// °øÁö¸®½ºÆ®
function Gongji_list()
{
	var vFile = 'http://www.idckorea.com/Popup/notice_list.asp?news_select=0&news_code=1';
	var popName = 'popgongji';
	var vStat = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=600,height=500,left=150,top=150,resizable=yes';
	window.open(vFile, popName, vStat);
}

// Æ¯¼ö¹®ÀÚ Ã¼Å©
function chkStr(chkString)
{
	esc = new Array("~","`","!","#","$","%","^","&","*","(",")","/","\,","\\","?","<",">","+","=","|",":",";","'","}","{","[","]","\"",".","-","_","@");

	if(chkString != null)
	{
		for (i = 0; i < chkString.length ; i++)
		{
			for ( j = 0 ; j < esc.length; j++)
			{
				if( esc[j] == chkString.charAt(i))
				{
					alert("Æ¯¼ö¹®ÀÚ´Â ÀÔ·ÂÀÌ ºÒ°¡´É ÇÕ´Ï´Ù.");
					return false;
				}
			}
		}
	}
//	return true;
}

//°Ë»ö½Ã Ã¼Å©
function search_prod(form)
{
  if(form.String.value == "") 
  {
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form.String.focus();
		return false;
	}
  for (var i = 0 ; i < form.String.value.length ; i ++ ) 
		{
		if ( form.String.value.substring( i,  i + 1 ) == "%" ) 
			{
			alert("°Ë»ö¾î¿¡´Â % ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
			form.String.focus();
			return false;
			}
	  }
	form.action=''+Settingurl+'/search/Search_goods.asp'
	form.submit();
//	return true;  
}  
//¿ìÆí¹øÈ£ Ã£±â 
function zip(Mcode){  
var zip_search = window.open(''+Settingurl+'/MyIDC/add_check.asp?Mcode='+Mcode,"join_zipcode","width=400, height=430, toolbar=no, resizable=yes, scrolling=yes, scollbars=yes, top=100, left=100");
zip_search.focus(); 
}  

 function ReplaceNull(obj)
 {
 	str = obj.value;
 	newstr = str.replace(/,/gi, "[*]");
 	obj.value = newstr;
 }	
 
  function Replaceempty(obj)
 {
 	str = obj.value;
 	newstr = str.replace(/ /gi, "");
 	obj.value = newstr;
 }	
 
 function getdoc(docno,field)
{
	location.href = ''+Settingurl+'/product/Getdoc.asp?idx='+docno+'&field='+field;
}

 function getlist(field)
{
	location.href = ''+Settingurl+'/product/Doclist.asp?field='+field;
}

 function getres(docno,field)
{
	location.href = ''+Settingurl+'/product/Getres.asp?idx='+docno+'&field='+field;
}
 function getreslist(field)
{
	location.href = ''+Settingurl+'/product/Reslist.asp?field='+field;
}

 function getanalinfo(field,code)
{
	location.href = ''+Settingurl+'/about/Analyst_view.asp?Analystcode='+code+'&field='+field;
}

function SearchALL(form)
{
  if(form.word.value == "") 
  {
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		form.word.focus();
		return false;
	}
  for (var i = 0 ; i < form.word.value.length ; i ++ ) 
		{
		if ( form.word.value.substring( i,  i + 1 ) == "%" ) 
			{
			alert("°Ë»ö¾î¿¡´Â % ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
			form.word.focus();
			return false;
			}
	  }
	if(chkStr(form.word.value)==false) {return false;}
	form.action = ''+Settingurl+'/Product/SearchALL.asp';
//	form.submit();
//	return true;  
}  

//±â»ç print
function aprint (value, field) {
	window.open ("Aprint.asp?aidx=" + value + "&field=" + field , "aprint", "width=668,height=700, scrollbars=yes")
}

//±â»ç print
function bprint (value, field) {
	window.open ("bprint.asp?aidx=" + value + "&field=" + field , "aprint", "width=668,height=700, scrollbars=yes")
}

//FontSize Á¶Àý
function getFontCookie(){ 
	var cookie = getCookie("hf_NewsFontSize"); 
	if ( cookie == null ) return 16; 
	if ( cookie.length ) return cookie; 
	else return 16; 
}

function NewsFontSize(val) {
	var content, lineHeight; 
	content = document.getElementById("NewsContent"); 
	if (val > 0) 
	{ 
		if (fontSize < 20) 
		{ 
			fontSize = fontSize + val; 
			lineHeight = fontSize+Math.round(1.1*fontSize); 
			content.style.fontSize = fontSize + "px"; 
		} 
	} 
	else 
	{ 
		if (fontSize > 12) 
		{ 
			fontSize = fontSize + val; 
			lineHeight = fontSize+Math.round(1.1*fontSize); 
			content.style.fontSize = fontSize + "px"; 
		} 
	} 
	var mydate = new Date; 
	mydate.setDate(mydate.getDate()+1000); 
	setCookie("hf_NewsFontSize", fontSize, mydate); 
}

function popup_resize_a(){
	var xgap = document.body.scrollWidth - document.body.clientWidth;
	var ygap = document.body.scrollHeight - document.body.clientHeight;
	window.resizeBy( xgap, ygap );
	}

function newPopupResize() {
   var dWidth = parseInt(document.body.scrollWidth);
   var dHeight = parseInt(document.body.scrollHeight);
  
   var divEl = document.createElement('div');
   divEl.style.left = '0px';
   divEl.style.top = '0px';
   divEl.style.width = '100%';
   divEl.style.height = '100%';
  
   document.body.appendChild(divEl);
  
   window.resizeBy(dWidth - divEl.offsetWidth, dHeight - divEl.offsetHeight);
   document.body.removeChild(divEl);  
}	

function helpdesk(product_name, product_type, service_code, idx) {
url="/manage/helpdesk/mail_to_helpdesk.asp?idx="+idx+"&product_name="+product_name+"&product_type="+product_type+"&service_code="+service_code;
var helpdesk = window.open(url,"helpdesk","resizable=yes,scrollbar=yes,height=518,width=448,top=20,left=150");
helpdesk.focus();
} 


function CopyContent()
    {
        if (window.event)
        {
            window.event.returnValue = true;
            window.setTimeout('PlusSiteTitle()', 25);
        }
    }
function PlusSiteTitle()
    {
        if (window.clipboardData) // IE
        {            
            var clipData = window.clipboardData.getData('Text');            
			clipData = clipData + '\r\n[ÃâÃ³] ÇÑ±¹IDC ('+Settingurl+')\r\n' ;          
            var copyResult = window.clipboardData.setData('Text', clipData);            
            //document.getElementById('div_s').innerText = '<br>' + copyResult + '<br>' + window.clipboardData.getData('Text');
        }
    }