/********************************************************************************
	@ ÇÁ·ÎÁ§Æ®¸í :	PCBang V2.0 
	@ ÆäÀÌÁö¸í    :	/Script/jsGeneralFunction.js
	@ ±â    ´É      :	»ç¿ëÀÚ Á¤ÀÇ ÀÏ¹Ý ½ºÅ©¸³Æ®
	@ ÀÌ    ·Â      :	2005.11.07 Á¤À±Á¤
	@ °Ë    ¼ö		:
	@ ¼ö    Á¤		:
*********************************************************************************/

/**
 01. fnCheckEmptyString(value)								ºó ¹®ÀÚ¿­ Ã¼Å©ÇÔ¼ö				( 2005.06.27 ³²±Ã¸¸)
 02. fnChkNumber(value)											¼ýÀÚ Ã¼Å©							( 2005.11.14 Á¤À±Á¤)
 03. fnChkEngNum(value)										¿µ¹®, ¼ýÀÚ È¥ÇÕ ¿©ºÎ Ã¼Å©		(2005.06.28 ³²±Ã¸¸, 2005.11.14 Á¤À±Á¤ ¼öÁ¤)
 04. fnGetLength(value)											¹®ÀÚ¿­ ±æÀÌ ¹ÝÈ¯					( 2005.06.27 ³²±Ã¸¸)
 05. fnCloseWindow()												À©µµ¿ì close						(2005.11.18 Á¤À±Á¤)
 06. fnWinOpen(sU,sN,sOpt)										À©µµ¿ì open						(2005.11.24 Á¤À±Á¤)
 07. fnWinPrint()														À©µµ¿ì print						(2005.11.18 Á¤À±Á¤)
 08. fnGetNumberFormat(num,cipher)						¼Ò¼ýÁ¡ ¼ýÀÚÇüÅÂ					(2005.12.7 Á¤À±Á¤)
 09. fnSetCookie(strName, strValue, intExpireDate)		ÆË¾÷Àü¿ë ÄíÅ° ¾²±â				(2005.12.29 Á¤Àç¿ì)
 10. fnGetCookie( name )											ÆË¾÷Àü¿ë ÄíÅ° ÀÐ±â				(2005.12.29 Á¤Àç¿ì) 
**/


// 01.ºó ¹®ÀÚ¿­ Ã¼Å©ÇÔ¼ö ( 2005.06.27 ³²±Ã¸¸)
	function fnCheckEmptyString(value) {

			var strTemp = value.split(" ").join("");
			strTemp = strTemp.split('\r\n').join("");
			
			if (strTemp == "") {
				return false;
			}

			return true;
	}
	

// 02.¼ýÀÚ Ã¼Å© ( 2005.11.14 Á¤À±Á¤)
function fnChkNumber(value) {
	var temp = new String(value)
		
	if(temp.search(/\D/) != -1) {
		return false;
	}
		return true;	
}


// 03.¿µ¹®, ¼ýÀÚ È¥ÇÕ ¿©ºÎ Ã¼Å© (2005.06.28 ³²±Ã¸¸, 2005.11.14 Á¤À±Á¤ ¼öÁ¤)
function fnChkEngNum(value) {
var idcount=0;
		var ls_one_char;
		for (i=0;i<value.length;i++){
			ls_one_char = value.charAt(i);

			if(ls_one_char.search(/[0-9|a-z|A-Z]/) == -1) {
				idcount++;
			}
		}
					  
		if(idcount!=0) {
			return false;
		}
		
	return true;
}

// 04.¹®ÀÚ¿­ ±æÀÌ ¹ÝÈ¯ ( 2005.06.27 ³²±Ã¸¸)
function fnGetLength(value) {
	return(value.length+(escape(value)+"%u").match(/%u/g).length-1);
}


//05. À©µµ¿ì close (2005.11.18 Á¤À±Á¤)
function fnWinClose(){
	  window.close();
}


//06. À©µµ¿ì open	(2005.11.24 Á¤À±Á¤)

function fnWinOpen(sU,sN, sOpt){
	var winPop;
	winPop	=	window.open(sU,sN, sOpt)
	winPop.focus();
}

//07. À©µµ¿ì print (2005.11.18 Á¤À±Á¤)
function fnWinPrint(){
	  window.print();
}

//08. ¼ýÀÚÇüÅÂ  (2005.12.7 Á¤À±Á¤)
function fnGetNumberFormat(num,cipher)
{
	var times;	
	var i;	
	times = 1;    
    for ( i =0; i < Math.abs(cipher); i++)	{
		times *= 10;        
	}
    
    if (cipher < 0) 
    {
		times = 1 / times;
	}
	return Math.round(num * times)/times;
}


//09. ÆË¾÷Àü¿ë ÄíÅ° ¾²±â (2005.12.29 Á¤Àç¿ì)
function fnSetCookie(strName, strValue, intExpireDate)
{
	var strToday = new Date();
	strToday.setDate(strToday.getDate() + intExpireDate);
	document.cookie = strName + "=" + escape(strValue) + "; path=/; domain=webzen.co.kr; expires=" + strToday.toGMTString() + ";"
 }
 
//10. ÆË¾÷Àü¿ë ÄíÅ° ÀÐ±â (2005.12.29 Á¤Àç¿ì) 
function fnGetCookie( 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 ""; 
 }
 
 //ÇÇ¾¾¹æ Ã£±â ÆË¾÷(2007.10.09 ±Ç¼ø¿ë)
 function fnPopFindPCBang(){
	fnOpenWindow('/Common/PCSearch/findPCBang.asp','wnPCList','width=675,height=168,scrollbars=yes');
}

//ÆË¾÷Ã¢À» »çÀÌÁî¿¡ ¸Â°Ô ¶ç¿î´Ù (2007.10.09 ±Ç¼ø¿ë)
function fnOpenWindow(strUrl, strWinName, strFeature) {
	window.open(strUrl, strWinName, strFeature);
}
