var w3c=(document.getElementById)? true: false; 
var ie5=(w3c && document.all)? true : false; 
var ns6=(w3c && (navigator.appName=="Netscape"))? true: false; 



function GEID(id){
	try{
		return document.getElementById(id);
	}catch(e){errAlert("Common.GEID"); }
}

document.onmousemove = getMousePosition;
_x =0;
_y =0;

function getMousePosition(e){
	try{
		var mInfo = getMouseInfo(e);
		_x = mInfo.pageX;
		_y = mInfo.pageY;
	}catch(e){
		//alert(e);
	}
}


function moveToXY(obj, x, y){
	if(x != null) obj.style.left = x + "px";
	if(y != null) obj.style.top = y + "px";
}

function pageFocusTop(targetDoc){
	if(targetDoc == null) targetDoc = document;
	if(targetDoc.documentElement.scrollTop) targetDoc.documentElement.scrollTop = "0px";
	else targetDoc.body.scrollTop = "0px";
}

function errAlert(err, str) {
		try{
			var msg = (err.message) ? err.message : "";
			var description = (err.description) ? err.description : "";
			var fileName = (err.fileName) ? err.fileName : "";
			var lineNumber = (err.lineNumber) ? err.lineNumber : "";
			var name = (err.name) ? err.name : "";
			var number = (err.number) ? err.number : "";

			var tab = ">>>>>>>> ";

			alert( str
				+ " Function Error !!!!!! " + "\n"
				+ tab + "message : " + msg  + "\n"
				+ tab + "description : " + description + "\n"
				+ tab + "fileName : " + fileName + "\n"
				+ tab + "lineNumber : " + lineNumber + "\n"
				+ tab + "name : " + name + "\n"
				+ tab + "number : " + number + "\n" );

		}catch(e){
			alert("errAlert() Error!");
		}

}


		function loadScroll(iScroll)
		{
			window.scrollTo(0, iScroll);
			//lblCheckNum1.focus();
		}
		
		var targetObj = null;
		//var FadingTimerID = new Array();
		//var FadingCode = 0;
		
		function ObjFadeOut(obj, FadingTimerID, endMethod, startValue, endValue){
			try{
			/*if(ie5)shadow.style.filter="alpha(opacity=50)"; <BR>else 
				shadow.style.MozOpacity=.5;
				testObj.style.opacity = value/10;
				testObj.style.filter = 'alpha(opacity=' + value*10 + ')';	
				
				opacity is for Mozilla and Safari, filter for Explorer. value ranges from 0 to 10.

			*/
			//	var value = 1/10
				//alert("페이드아웃실행" + obj);
				var value = 100;
				targetObj = obj;
				for(var i = 0 ; i < FadingTimerID.length ; i++) window.clearTimeout(FadingTimerID[i]);
				FadingTimerID = [];
				
				var increaseNum = 50;
				var v=0;
				while( value >= 0) {
					FadingTimerID.push( setTimeout(new Function('setOpacity('+value+')'),increaseNum*v) );
					//setTimeout('setOpacity('+value+')',100*(10-value));
					value--;
					v++;
				}
				if(endMethod!=null)  FadingTimerID[FadingTimerID.length] = setTimeout(endMethod,increaseNum*v);
				return FadingTimerID;
			}catch(e){errAlert(e, "common.ObjFadeOut");}
		}

		function ObjFadeIn(obj, FadingTimerID, endMethod, startValue, endValue){
			try{
				var value = 0;
				targetObj = obj;
				for(var i = 0 ; i < FadingTimerID.length ; i++) window.clearTimeout(FadingTimerID[i]);
				FadingTimerID = [];

				var increaseNum = 50;
				while( value <= 100 ) {
					FadingTimerID[FadingTimerID.length] = setTimeout(new Function('setOpacity(' + value + ')'),increaseNum*value);
					value++;
				}
				if(endMethod!=null)  FadingTimerID[FadingTimerID.length] = setTimeout(endMethod,increaseNum*value);//StsMgr.customSet(GEID('statusImage'), GEID('statusMessage'), "", "");
				
				return FadingTimerID;
			}catch(e){errAlert(e, "common.ObjFadeIn");}
		}
		
		function setOpacity(value)
		{
			//alert("!");
			setOpacityObj(targetObj, value);
//			targetObj.style.opacity = value/10;
//			targetObj.style.filter = 'alpha(opacity=' + value*10 + ')';
		}

		function setOpacityObj(obj, value){
			obj.style.opacity = value/10;
			obj.style.filter = 'alpha(opacity=' + value*10 + ')';
		}
		
		
		function shadow(mode){
			if(z.style.display=="none"){
			    z.style.width  = document.body.scrollWidth;
				z.style.height = document.body.scrollHeight;
				z.style.top = 0;
				z.style.left = 0;
				z.style.filter = "alpha(opacity=60)";
				z.style.display = "";
				//alert(document.);
			}
		}








// 문자열 갯수 체크
function lengthCheck(data) {

		var count = 0;
		for ( var i=0; i < data.length; i++ ) {
			if( data.charCodeAt(i) < 127 )
				count++;
			else
				count = count + 2;
		}
		
		return count;
}

//문자열 자르기 한글버젼
function subStrKor(str, len, tail){
		if(tail == null) tail = "";
		var count = 0;
		var strC = 0;
		for ( var i=0; i < str.length; i++ ) {
			if( str.charCodeAt(i) < 127 )
				count++;
			else
				count = count + 2;

			strC++;
			if(count > len) {
				strC--;
				return str.substr(0, strC) + tail;
			}
		}
		
		return str;
}


	// 특수문자 체크
function check_nonChar(id_text)
{
		//var nonchar = '~`!@#$%^&*()-_=+\|<>?,./;:"';
		var nonchar = '`@#$%&\|<>;"';

		var i ; 
		for ( i=0; i < id_text.length; i++ )  {
			if( nonchar.indexOf(id_text.substring(i,i+1)) != -1) {
				//alert(id_text.substring(i,i+1));
				break ; 
			}
		}
		if ( i != id_text.length ) {
			return false ; 
		}
		else{
			return true ;
		} 

		return false;
}



function trim(str){ 
	str = str.replace(/^\s*/,'').replace(/\s*$/, ''); 
	return str; //변환한 스트링을 리턴.
} 





//쿼리생성
function createQuery(queryArray){
	var queryData="";
	for(var i =0 ; i < queryArray.length ; i++){
		queryData += queryArray[i].name + "=" + escape(queryArray[i].value);
		if(i != (queryArray.length-1) ) queryData+= "&";
	}
	//alert("Has been making Query : " + queryData);
	return queryData;
}


//배열->테이블 변환
function convertArray2Table(arrData, obj, col, width, align){
	try{
		
		var str = new Array();
		var wid = "100%";
		if(width != null && width != "undefined") wid = width;
		if(align != null || align != "undefined") {
			align = {
				tdH : "left",
				tdV : "top"
			};
		}
		str[str.length] = "<table border=0 width="+wid+">";
		var count=1;
		for(var i = 0 ; i < arrData.length ; i++){
			if(count==0) str[str.length] = "<tr>";
			str[str.length] = "<td align="+align.tdH+" valign="+align.tdV+">" + arrData[i] + "</td>";
			if(count==col) {
				str[str.length] = "</tr>";
				count = 1;
			}else{
				count++;
			}
		
		}
		if(count != 1) {
			for(var i = count-1; i < col ; i++){
				str[str.length] = "<td>&nbsp;</td>";
			}
			str[str.length] = "</tr>";
			
		}
		
		str[str.length] = "</table>";
		
		var result;
		if(arrData.length != 0) {
			result = str.join("");
		}
		else {
			result = "&nbsp;&nbsp;--";
		}
		
		if(typeof obj != "undefined" && obj != null) obj.innerHTML = result;
		return result;
		
	
	}catch(e){ errAlert(e, "common -> convertArray2Table");}
		
}



//Client ScreenSet Info

var props = new Array(
	'clientHeight',
	'clientWidth',
	'scrollHeight',
	'scrollWidth',
	'scrollLeft',
	'scrollTop',
	'offsetHeight',
	'offsetWidth'
);

function resetScrollTop(){
	if (document.documentElement && document.documentElement.scrollTop)
		document.documentElement.scrollTop = 0+"px";
	else
		document.body.scrollTop = 0 + "px";
}

function getHtmlInfo()
{
	var obj = {
		clientHeight : 0, 
		clientWidth : 0,  
		scrollHeight : 0, 
		scrollWidth : 0,  
		scrollLeft : 0,   
		scrollTop : 0,    
		offsetHeight : 0, 
		offsetWidth : 0 ,
		screenX:0,
		screenY:0
	};

		obj.clientHeight	= document.documentElement.clientHeight;
		obj.clientWidth	= document.documentElement.clientWidth;

	if (document.documentElement && document.documentElement.scrollTop){
		obj.scrollHeight	= document.documentElement.scrollHeight;
		obj.scrollWidth		= document.documentElement.scrollWidth;
		obj.scrollLeft		= document.documentElement.scrollLeft;	
		obj.scrollTop		= document.documentElement.scrollTop;
		obj.offsetHeight	= document.documentElement.offsetHeight;
		obj.offsetWidth		= document.documentElement.offsetWidth;
		obj.screenX			= screen.width;
		obj.screenY			= screen.height;

	} else if (document.body){
//		obj.clientHeight	= document.body.clientHeight;
	//	obj.clientWidth		= document.body.clientWidth;
		obj.scrollHeight	= document.body.scrollHeight;
		obj.scrollWidth		= document.body.scrollWidth;
		obj.scrollLeft		= document.body.scrollLeft;	
		obj.scrollTop		= document.body.scrollTop;
		obj.offsetHeight	= document.body.offsetHeight;
		obj.offsetWidth		= document.body.offsetWidth;		
		obj.screenX			= screen.width;
		obj.screenY			= screen.height;

	}else{
		//[Netscape stuff]
	}

	return obj;
}

function getHtmlInfoList(addStr){
	if(addStr==null) addStr = "\n";
	var hInfo = getHtmlInfo();
	var strB = [];
	for( var idx in hInfo){
		strB[strB.length] = idx + " : " +hInfo[idx];
	}
	return strB.join(addStr);
}


function getMouseInfo(e){
	var obj = {
		screenX :0,
		screenY :0,
		pageX : 0,
		pageY : 0
	}
	var evt = e ? e : window.event;
	var x = document.all ? event.clientX : document.layers ? evt.x : evt.clientX;
	var y = document.all ? event.clientY : document.layers ? evt.y : evt.clientY;

	var hInfo = getHtmlInfo(); //common

	obj.screenX = x;
	obj.screenY = y;
	obj.pageX = x + hInfo.scrollLeft;
	obj.pageY = y + hInfo.scrollTop;

	return obj;

}

function ENTER_KEY(e){
	var evt = e ? e : window.event;
	  	 if(evt.keyCode) keynum = evt.keyCode;// IE
	else if(e.which)     keynum = evt.which;// Netscape/Firefox/Opera

//	alert(String.fromCharCode(keynum));
		//keychar = String.fromCharCode(keynum)
		//numcheck = /\d/
	//return !numcheck.test(keychar)

	//alert(keynum);
	if(keynum == 13) return true;
	else return false;
}

function chkNull(str){
	if(str == "" || str == null) return false;
	else return true;
}

function chkN(str){
	if(str == "" || str == null) return true;
	else return false;
}


function objCopy(obj) {
    var tempObj = new Object();

    for (var arg in obj) {
      tempObj[arg] = obj[arg];
    }
    return tempObj;
 }


function arrayCopy(a){
	var n=[];
	for(var i=a.length-1; i>=0; i--)
		n[i]=a[i];
	return n;
}


function errorStr(msg){
	alert(msg);
	return false;
}



function addEvent(object, type, handler, phase)
{
	if(phase==null) phase=false;
	if (object.addEventListener) {
		object.addEventListener(type, handler, phase);
	} else if (object.attachEvent) {
		object.attachEvent(['on',type].join(''),handler);
	} else {
		object[['on',type].join('')] = handler;
	}
}


function URLdecode(str, type){
//	alert(str);
	if(type!= null && type=="URI")	return decodeURIComponent(str.replace(/\+/g, " "));
	else return unescape(str.replace("+", " "));
}


function getSystemInfo(){
	try{
		var agt=navigator.userAgent.toLowerCase();
		


		// *** BROWSER VERSION ***
		// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
		var is_major = parseInt(navigator.appVersion);
		var is_minor = parseFloat(navigator.appVersion);

		// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
		// If you want to allow spoofing, take out the tests for opera and webtv.



		var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
					&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
					&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
		var is_nav2 = (is_nav && (is_major == 2));
		var is_nav3 = (is_nav && (is_major == 3));
		var is_nav4 = (is_nav && (is_major == 4));
		var is_nav4up = (is_nav && (is_major >= 4));
		var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
							  (agt.indexOf("; nav") != -1)) );
		var is_nav6 = (is_nav && (is_major == 5));
		var is_nav6up = (is_nav && (is_major >= 5));
		var is_gecko = (agt.indexOf('gecko') != -1);


		var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
		var is_ie3    = (is_ie && (is_major < 4));
		var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
		var is_ie4up  = (is_ie && (is_major >= 4));
		var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
		var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
		var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
		var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
		var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
		var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

		// KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
		// or if this is the first browser window opened.  Thus the
		// variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
		var is_aol   = (agt.indexOf("aol") != -1);
		var is_aol3  = (is_aol && is_ie3);
		var is_aol4  = (is_aol && is_ie4);
		var is_aol5  = (agt.indexOf("aol 5") != -1);
		var is_aol6  = (agt.indexOf("aol 6") != -1);

		var is_opera = (agt.indexOf("opera") != -1);
		var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
		var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
		var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
		var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
		var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);

		var is_webtv = (agt.indexOf("webtv") != -1); 

		var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
		var is_AOLTV = is_TVNavigator;

		var is_hotjava = (agt.indexOf("hotjava") != -1);
		var is_hotjava3 = (is_hotjava && (is_major == 3));
		var is_hotjava3up = (is_hotjava && (is_major >= 3));

		// *** JAVASCRIPT VERSION CHECK ***
		var is_js;
		if (is_nav2 || is_ie3) is_js = 1.0;
		else if (is_nav3) is_js = 1.1;
		else if (is_opera5up) is_js = 1.3;
		else if (is_opera) is_js = 1.1;
		else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
		else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
		else if (is_hotjava3up) is_js = 1.4;
		else if (is_nav6 || is_gecko) is_js = 1.5;
		// NOTE: In the future, update this code when newer versions of JS
		// are released. For now, we try to provide some upward compatibility
		// so that future versions of Nav and IE will show they are at
		// *least* JS 1.x capable. Always check for JS version compatibility
		// with > or >=.
		else if (is_nav6up) is_js = 1.5;
		// NOTE: ie5up on mac is 1.4
		else if (is_ie5up) is_js = 1.3

		// HACK: no idea for other browsers; always check for JS version with > or >=
		else is_js = 0.0;

		// *** PLATFORM ***
		var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
		// NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
		//        Win32, so you can't distinguish between Win95 and WinNT.
		var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

		// is this a 16 bit compiled version?
		var is_win16 = ((agt.indexOf("win16")!=-1) || 
				   (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
				   (agt.indexOf("windows 16-bit")!=-1) );  

		var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
						(agt.indexOf("windows 16-bit")!=-1));

		var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
		var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));

		// NOTE: Reliable detection of Win98 may not be possible. It appears that:
		//       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
		//       - On Mercury client, the 32-bit version will return "Win98", but
		//         the 16-bit version running on Win98 will still return "Win95".
		var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
		var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
		var is_win32 = (is_win95 || is_winnt || is_win98 || 
						((is_major >= 4) && (navigator.platform == "Win32")) ||
						(agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

		var is_os2   = ((agt.indexOf("os/2")!=-1) || 
						(navigator.appVersion.indexOf("OS/2")!=-1) ||   
						(agt.indexOf("ibm-webexplorer")!=-1));

		var is_mac    = (agt.indexOf("mac")!=-1);
		// hack ie5 js version for mac
		if (is_mac && is_ie5up) is_js = 1.4;
		var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
								   (agt.indexOf("68000")!=-1)));
		var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
									(agt.indexOf("powerpc")!=-1)));

		var is_sun   = (agt.indexOf("sunos")!=-1);
		var is_sun4  = (agt.indexOf("sunos 4")!=-1);
		var is_sun5  = (agt.indexOf("sunos 5")!=-1);
		var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
		var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
		var is_irix5 = (agt.indexOf("irix 5") !=-1);
		var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
		var is_hpux  = (agt.indexOf("hp-ux")!=-1);
		var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
		var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
		var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
		var is_aix1  = (agt.indexOf("aix 1") !=-1);    
		var is_aix2  = (agt.indexOf("aix 2") !=-1);    
		var is_aix3  = (agt.indexOf("aix 3") !=-1);    
		var is_aix4  = (agt.indexOf("aix 4") !=-1);    
		var is_linux = (agt.indexOf("inux")!=-1);
		var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
		var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
		var is_mpras    = (agt.indexOf("ncr")!=-1); 
		var is_reliant  = (agt.indexOf("reliantunix")!=-1);
		var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
			   (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
			   (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
		var is_sinix = (agt.indexOf("sinix")!=-1);
		var is_freebsd = (agt.indexOf("freebsd")!=-1);
		var is_bsd = (agt.indexOf("bsd")!=-1);
		var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
					 is_sco ||is_unixware || is_mpras || is_reliant || 
					 is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);

		var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));

		return {
			isNav : is_nav,
			isIE : is_ie,
			isGecko : is_gecko,




			

			nav : {
				version : is_major,
				isNav2 : is_nav2,
				isNav3 : is_nav3,
				isNav4 : is_nav4,
				isNav4up : is_nav4up,
				isNavOnly: is_navonly,
				isNav6 : is_nav6,
				isNav6up: is_nav6up
					},
			ie : {
				isIE3 : is_ie3,
				isIE3 : is_ie3,
				isIE3 : is_ie3,
					isIE3 : is_ie3,
					isIE4 : is_ie4,
					isIE4up : is_ie4up,
					isIE5 : is_ie5,
					isIE5_5 : is_ie5_5,
					isIE6 : is_ie6,
					isIE6up : is_ie6up

				}
		};

	}catch(e){
		errAlert(e, "getSystemInfo()");
	}
}


function convertFunc(func){
	//alert(func);
	var nFunc = new Function("return " + func);
	return nFunc();
}

function disOff(obj){
	obj.style.display="none";
}
function disOn(obj){
	obj.style.display="";
}

var disOffStid = new Object();

function disOn_T(obj_id){
	if(disOffStid[obj_id] != null) {
		window.clearTimeout(disOffStid[obj_id]);
		disOffStid[obj_id] = null;
	}

	disOn(GEID(obj_id));
}

function disOff_T(obj_id, time){
	if(time==null) time=200;
	if(disOffStid[obj_id] != null) {
		window.clearTimeout(disOffStid[obj_id]);
		disOffStid[obj_id] = null;
	}
//	obj = GEID(obj_id);
	disOffStid[obj_id] = setTimeout(new Function("disOff(GEID('"+obj_id+"'));"), time);
//	{'disOffStid'+obj_id} = setTimeout(new Function(), time);
//	obj.style.display="none";
}


function ajaxError(no){
	switch(no){
		case 1 : alert("서버와의 통신이 정상적으로 실행되지 않았습니다. 잠시 뒤에 다시 시도해 주십시오");
		break;
	}
	return false;
}





function pageNavi(cPage, aCount, maxLen, viewPageNum, methodName){
		try{
			var ext = aCount % maxLen;
			var maxPage;
			if(ext != 0)  maxPage= parseInt(aCount / maxLen, 10) + 1;
			else maxPage = aCount / maxLen;

			if(cPage == null ) cPage = 1;

			//alert("maxPage : " + maxPage);

			var str = [];
			//var viewPageNum = 10;

			var startPage = cPage / viewPageNum;
			if(( cPage % viewPageNum ) != 0 ) startPage = parseInt(startPage, 10) + 1;
//			alert("cPage : " + cPage + ", viewPageNum : " + viewPageNum + ", startPage " + startPage + ", aCount : " + aCount);

			//var count = 1;
			if (aCount > 0 ) {
				for(var i = startPage; i <= startPage+(viewPageNum-1) ; i++){
					if(i != cPage) str[str.length] = " <span onClick='javascript:"+ methodName+"("+i+");' style='cursor:pointer;'>"+  i + "</span> ";
					else str[str.length] = " <b>" + i + "</b> ";
					
					if(i == maxPage) break;
					else str[str.length] = " | ";
				}
			}else {
				str[str.length] = " <b>1</b> ";
			}

			return "<center>"+str.join("")+"</center>";
										
		}catch(e){
			errAlert(e,  "common -> pageNavi");
		}
}

//html 태그 비적용
function del_html_js(str){
	str = str.replace("<", "&lt;");
	str = str.replace(">", "&gt;");
	return str;
}


function goScrollTop(px){
	if(document.documentElement.scrollTop) document.documentElement.scrollTop = px + "px";
	else document.body.scrollTop = px + "px";
}

function makesRandom(end, start){
	if(end == null) end = 100;
	if(start==null) start=0;

	var max = end - start;
	var ran_unrounded=Math.random()*max;
	var ran_number=Math.floor(ran_unrounded);

	return ran_number + start;
	

}



function insertFlash(swf, width, height, bgcolor, id, flashvars)
{
	var strFlashTag = new String();

	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		strFlashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		strFlashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" ';
		strFlashTag += 'id="' + id + '" width="' + width + '" height="' + height + '">';
		strFlashTag += '<param name="movie" value="' + swf + '"/>';

		if(flashvars != null) {strFlashTag += '<param name="flashvars" value="' + flashvars + '"/>'};
		strFlashTag += '<param name="quality" value="best"/>';
		strFlashTag += '<param name="bgcolor" value="' + bgcolor + '"/>';
		strFlashTag += '<param name="menu" value="false"/>';
		strFlashTag += '<param name="salign" value="LT"/>';
		strFlashTag += '<param name="scale" value="noscale"/>';
		strFlashTag += '<param name="wmode" value="transparent"/>';
		strFlashTag += '<param name="allowScriptAccess" value="always"/>';
		strFlashTag += '</object>';
	}
	else
	{
		strFlashTag += '<embed src="' + swf + '" ';
		strFlashTag += 'quality="best" ';
		strFlashTag += 'bgcolor="' + bgcolor + '" ';
		strFlashTag += 'width="' + width + '" ';
		strFlashTag += 'height="' + height + '" ';
		strFlashTag += 'menu="false" ';
		strFlashTag += 'scale="noscale" ';
		strFlashTag += 'id="' + id + '" ';
		strFlashTag += 'salign="LT" ';
		strFlashTag += 'wmode="transparent" ';
		strFlashTag += 'allowScriptAccess="always" ';
		if(flashvars != null) {strFlashTag += 'flashvars="' + flashvars + '" '};
		strFlashTag += 'type="application/x-shockwave-flash" ';
		strFlashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
		strFlashTag += '</embed>';
	}

	document.write(strFlashTag);
}



function parentHeightResize(id, time){
	if(time == null) time = 1;
	//parent.GEID(id).style.height = hInfo.scrollHeight + "px";
		var hInfo = getHtmlInfo();
	setTimeout(new Function("parent.GEID(\""+id+"\").style.height = getHtmlInfo().scrollHeight + \"px\""), time);
}

function setParentScrollTop(){
	if(parent.document.documentElement.scrollTop) parent.document.documentElement.scrollTop = "0px";
	else parent.document.body.scrollTop = "0px";
}


function prt_chk(domain, id){
	if(parent.G_ID != id) {
		top.document.location.href = domain + "/" + id;
	}

}



 function show_delbox(c_no){
	document.getElementById("del_form").c_no.value=c_no;
	document.getElementById("del_form").del_password.value="";
	dbox = document.getElementById("delbox");
	dbox.style.left = _x-220+"px";
	dbox.style.top  = _y+"px";
	dbox.style.visibility='visible';
  }


   function delComment2(gid,c_no,m_no){
	if(confirm('해당리플을 진짜 삭제 하시겠습니까?')){
	try{
		document.getElementById("del_form").gid.value=gid;
		document.getElementById("del_form").c_no.value=c_no;
		document.getElementById("del_form").m_no.value=m_no;
		document.getElementById("del_form").del_password.value="";
		document.del_form.submit();
	}catch(e){
		//return false;
	}
	}
   }


/*	function setPng24(obj) { 
	  obj.width=obj.height=1; 
	  obj.className=obj.className.replace(/\bpng24\b/i,''); 
	  obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
	  obj.src='';  
	  return ''; 
	}*/




   
function copyToClipboard(value)
{
    try{
		if (window.clipboardData.setData('Text', value)) alert("주소가 복사되었습니다.\n Ctrl+V를 눌러 사용하십시오.");
    }catch (e){

    }    
}


// gallog, scrap common func
function namecheck(flag) {
	if(flag) {
		disOff(GEID('tblNchk'));
	}
}


// reply
var isNchkLoad = false;
function nameChk(){
	try{
		GEID('nchkIFrame').src = nameChkUrl;
		GEID('nchkIFrame').style.height="170px";// = nameChkUrl;
		//GEID('nchkIFrameDiv').style.display="";
		isNchkLoad=true;
		parentHeightResize('mainIFrameObj');
	}catch(e){
		//alert(e);
	}

}


function flash_mov(id, url, width, height, wmode) {
	var flashStr = '<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+'" id="player" align="middle">'
		+ '<param name="wmode" value="transparent" />'
		+ '<param name="allowScriptAccess" value="always" />'
		+ '<param name="allowFullScreen" value="true" />'
		+ '<param name="movie" value="'+url+'?pudtv" />'
		+ '<param name="quality" value="high" />'
		+ '<param name="bgcolor" value="#0A0C0F" />'
		+ '<embed src="'+url+'"?pudtv quality="high" bgcolor="#0A0C0F" width="'+width+'" height="'+height+'" name="player" align="middle" allowScriptAccess="always" '
		+ ' allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" '
		+ ' />'
		+ ' </object>';
	document.write(flashStr);
}

//[js] .10
function getCookie(name){ 
	var Found = false;
	var start, end;
	var i = 0;
	// cookie 문자열 전체를 검색 
	while(i <= document.cookie.length){ 
		start = i;
		end = start + name.length;
		//alert(document.cookie.substring(start, end));
		// name과 동일한 문자가 있다면 
		if(document.cookie.substring(start, end) == name){ 
			Found = true;
			break;
		} 
		i++;
	} 
	// name 문자열을 cookie에서 찾았다면 
	if(Found == true) { 
		start = end + 1 
		end = document.cookie.indexOf(";", start) 
		// 마지막 부분이라 는 것을 의미(마지막에는 ";"가 없다) 
		if(end < start) end = document.cookie.length 
		// name에 해당하는 value값을 추출하여 리턴한다. 
		return document.cookie.substring(start, end) 
	} 
	// 찾지 못했다면 
	return "" 
}
function setCookie( name, value, expiredays ) { 
	domain = ".dcinside.com";
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ((domain) ? "; domain=" + domain : "") +";" 
} 
function block_alert(msg,uno){
	var blockCookie = getCookie("inside_"+uno);
	//alert("inside_"+uno);
	//alert(blockCookie);
	if(blockCookie != 'bmain'){
		var obj = document.getElementById('block_msg');
		obj.innerHTML        = msg;
		obj.style.display = '';
	}
}
function block_alert_hide(){
	var obj = document.getElementById('block_msg');
	obj.style.display = 'none';
}
function block_alert_close(uno){
	setCookie("inside_"+uno, "bmain" , 1); // 1일 간 쿠키적용
	block_alert_hide();
}
