//*¿£ÅÍ°Ë»ö
function EnterSearch(val)
{
	if(window.event.keyCode == 13)
	{
		SearchData(val);
	}
}

//°Ë»ö
function SearchData(val){
	frm.action=""+val+"";
	frm.submit() ;
}

function isInserted(msg) {
	if(arguments.length > 1) {
		for(i=1; i<arguments.length; i++) {
			if(arguments[i] && arguments[i].value.replace(/ /g, '') == '') {
				if(msg != '') {				
					alert(msg + ' ÀÔ·ÂÇÏ¼¼¿ä');			
				}			
			arguments[i].focus();			
			return false;		
			}	
		}
	}
	return true;
}


//ÀÌ¹ÌÁö¿øº»»çÀÌÁî
function ImgPopup(img2){

	poto= new Image();
	poto.src=(img2);
	Controlla(img2);
}

function Controlla(img2){
	if((poto.width!=0)&&(poto.height!=0)){
		winopen(img2,poto.width,poto.height);
	}else{
		funzione="Controlla('"+img2+"')";
		intervallo=setTimeout(funzione,20);
	}
}
//ÀÌ¹ÌÁö ÆË¾÷
function winopen(img_view, Width, Height) {
	var winHandle = window.open("" ,"windowName","toolbar=no,scrollbars=auto,resizable=no, top=200, left=200 ,width=" + Width + ",height=" + Height)
		if(winHandle != null) {
		var htmlString = "<html><head><title>ÀÌ¹ÌÁö</title></head>" 
			htmlString += "<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>"
			htmlString += "<a href=javascript:window.close()><img src=" + img_view + " border=0 alt=ÀÌ¹ÌÁöÅ¬¸¯:È­¸é´Ý±â></a>"
			htmlString += "</body></html>"
			winHandle.document.open()
			winHandle.document.write(htmlString)
			winHandle.document.close()
		} 
		if(winHandle != null) winHandle.focus()
			return winHandle
}

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_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_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 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 setCookie( name, value,domain ,expiredays)
	{
		var todayDate = new Date();

		todayDate.setDate(todayDate.getDate() + expiredays);

		document.cookie = name + "=" + escape( value ) + "; path=/; domain=" + domain + "; expires=" + todayDate.toGMTString() +";"
	}

function setCookies( name, value, expiredays) 
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays);
	//todayDate.setHours(0,0,0); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}



//ÇÃ·¹½¬ ½ºÅ©¸³Æ®
function addActiveObject(objSrc) {

  var tmpObj;

  //tmpObj = eval("document.all."+objName);
  //tmpObj.innerHTML = ""+objSrc+"";

  document.write	(""+objSrc+"");

}


function gfrmSrch(folderpath, bbsID){

		location.href= "/" + folderpath + "/bbs/frame.asp?bbsID=" + bbsID + "" ;

	}
	
function gaddMyProgram(bbsMenuID){
	if(confirm('°ü½ÉÇÁ·Î±×·¥À¸·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?\n\r')){
		var ischekURL = "http://www.chtvn.com/Comn/AddMyPrg.asp?bbsID="+bbsMenuID+"" ;
		var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp.open("GET", ischekURL, "false");
		xmlhttp.send();
		
		recode = xmlhttp.responseText;
		
		if (recode == "OK" ) {
			alert("µî·Ï¿Ï·á");
		}
		if(recode == "DUP" ){
			alert("ÀÌ¹Ì µî·ÏµÈ ÇÁ·Î±×·¥ÀÔ´Ï´Ù.");
		}
		if(recode == "0000" ){
			alert("µî·Ï½ÇÆÐ");
		}
	}
}





//°ü½É¶óÀÌºê·¯¸® µî·Ï
function gaddMyLibrary(bbscode_, bbsID){
			if(confirm('°ü½É¶óÀÌºê·¯¸®·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?\n\r')){
				var ischekURL = "http://www.chtvn.com/Comn/AddMyLibrary.asp?bbsID="+bbsID+"&bbscode_="+bbscode_+"" ;
				var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				xmlhttp.open("GET", ischekURL, "false");

				xmlhttp.send();
				

				recode = xmlhttp.responseText;

					if (recode == "OK" ) {
						alert("µî·ÏÀÌ ¿Ï·á µÇ¾ú½À´Ï´Ù.");
					}
					if(recode == "DUP" ){
						alert("ÀÌ¹Ì µî·ÏµÈ ¶óÀÌºê·¯¸®ÀÔ´Ï´Ù.");
					}
					if(recode == "0000" ){
						alert("µî·Ï¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.");
					}
				
				}
	

}
	
	
	
//°ü½ÉVOD µî·Ï
function gaddMyVod(prgID, bbsID){
			if(confirm('°ü½ÉVOD·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?\n\r')){
				var ischekURL = "http://www.chtvn.com/Comn/AddMyVod.asp?bbsID="+bbsID+"&prgID="+prgID+"" ;

				var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				xmlhttp.open("GET", ischekURL, "false");

				xmlhttp.send();
				

				recode = xmlhttp.responseText;

					if (recode == "OK" ) {
						alert("µî·ÏÀÌ ¿Ï·á µÇ¾ú½À´Ï´Ù.");
					}
					if(recode == "DUP" ){
						alert("ÀÌ¹Ì µî·ÏµÈ VodÀÔ´Ï´Ù.");
					}
					if(recode == "0000" ){
						alert("µî·Ï¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.");
					}
				
				}
	
	

}
	
	
	
//°ü½ÉÆ÷Åä µî·Ï
function gaddMyPhoto(bbscode, bbsID, bbsimgID){
		if(confirm('°ü½ÉÆ÷Åä·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?\n\r')){
			var ischekURL = "http://www.chtvn.com/Comn/AddMyPhoto.asp?bbsID="+bbsID+"&bbscode="+bbscode+"&bbsimgID="+bbsimgID+"" ;
			var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			xmlhttp.open("GET", ischekURL, "false");

			xmlhttp.send();

			recode = xmlhttp.responseText;

			if (recode == "OK" ) {
				alert("µî·ÏÀÌ ¿Ï·á µÇ¾ú½À´Ï´Ù.");
			}
			if(recode == "DUP" ){
				alert("ÀÌ¹Ì µî·ÏµÈ Æ÷ÅäÀÔ´Ï´Ù.");
			}
			if(recode == "0000" ){
				alert("µî·Ï¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.");
			}	
		}
	
}
	
	
function gaddMyEnews(newsID){
		
			if(confirm('°ü½É¶óÀÌºê·¯¸®·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?\n\r')){
				var ischekURL = "http://www.chtvn.com/Comn/AddMyEnews.asp?newsID="+newsID+"" ;
				var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				xmlhttp.open("GET", ischekURL, "false");

				xmlhttp.send();
				

				recode = xmlhttp.responseText;

				if (recode == "OK" ) {
					alert("µî·ÏÀÌ ¿Ï·á µÇ¾ú½À´Ï´Ù.");
				}
				if(recode == "DUP" ){
					alert("ÀÌ¹Ì µî·ÏµÈ ¶óÀÌºê·¯¸®ÀÔ´Ï´Ù.");
				}
				if(recode == "0000" ){
					alert("µî·Ï¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.");
				}
				
			}
		
	}
	

function copyit(theField) {
//alert("ss");
var IE=(document.all)?true:false;
if (IE) {
	if(confirm("º¹»çÇÏ½Ã°Ú½À´Ï±î?")){
		var tempval=eval("document."+theField);
			therange=tempval.value;
			//alert(therange);
			window.clipboardData.setData("Text", therange);	
				
		}
	}
			
}

function pop_14(member_id){
		if (getCookie( "zxcvzxcv" ) != "close" ) {
				window.open("/popup/pop_14.asp?member_id="+member_id+"","bbbb","width=400, height=415, left=0, top=0, scrollbar=no");
		}
	}

function foreigner(){
	if (getCookie( "asdfasdfasdf" ) != "close" ) {
			window.open("/popup/pop_foreigner.asp", "aaaa","width=400, height=515, left=0, top=0, scrollbar=no");
	}
}

function PhotoPop(bbscode, bbsID,bbsConID) {
	window.open("/Comn/Photo_Popup.asp?bbsConID="+bbsConID+"&bbsID="+bbsID+"&bbscode="+ bbscode +"","PhotoPop","width=600, height=769,top=0 ");
} 

function cal(obj, obj2){

	window.open("/comn/cal.asp?cn=" + obj.name + "." + obj2.name,"wincal","width=200,height=200") ;
	return ;
}


function nowMonth(val) {
	if (val == 1)
		return "january";
	else if (val == 2)
		return "february";
	else if (val == 3)
		return "march";
	else if (val == 4)
		return "april";
	else if (val == 5)
		return "may";
	else if (val == 6)
		return "june";
	else if (val == 7)
		return "july";
	else if (val == 8)
		return "august";
	else if (val == 9)
		return "september";	
	else if (val == 10)
		return "october";
	else if (val == 11)
		return "november";
	else if (val == 12)
		return "december";
}
function setCookies_time12( name, value, expiredays) 
{
	var todayDate_ = new Date();
	var todayDate = new Date(nowMonth(todayDate_.getMonth()+1) +" "+ todayDate_.getDate() + ", " + todayDate_.getYear() +" 00:00:00") ;
	todayDate.setDate( todayDate.getDate() + expiredays);
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
