﻿<!--
/*
F_WriteSwf(strParamPath, width, height) swf 파일 쓰기
F_getQuery(name)                        쿼리 파라미터 얻기
F_ViewDetail(idInfo, idM)               웹퍼즈 포폴 보기
F_ViewTagImage(idInfo, idM, tagImage)   태그이미지 보기
F_sendMemo(IdUser, NameUser)            메모 보내기
F_sendMemoNo()                          자신에게 메모 보낼때 에러
F_readMemo(idm)                         메모 읽기
F_userInfo(typeInfo, typePos, IdUser)   사용자 이름 셋팅
F_getURL(idInfo, idM, siteURL)          웹퍼즈 홈페이지 연결
F_viewProfile(IdUser)                   프로필 보기
F_number(obj)                           숫자만 가능
F_engNum(obj)                           영어와 숫자만 가능
F_eng(obj)                              영어만 가능
F_url(obj)                              홈페이지 URL
F_image(obj)                            이미지만 가능
F_sendMail(obj)                         메일보내기
F_modalAlert(msg, width, height)        모달 메세지창 띄우기
Check2Char(obj)                         2글자이상 체크
*/


function F_WriteSwf(strParamPath, width, height)
{
	var strObject;
	
	strObject =		"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + width + "' height='" + height + "'  id='sub_navi' align='middle' />" + 
						"<param name='movie' value='" + strParamPath + "'/>" + 
						"<param name='quality' value='high'/>" + 
						"<param name='bgcolor' value='#000000'/>" + 
						"<param name='menu' value='false'>" +
						"<embed src='" + strParamPath + "' quality='high' bgcolor='#000000' width='" + width + "' height='" + height + "' name='sub_navi' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />" +
						"</object>"

	document.write(strObject);
}

function F_getQuery(name)
{
    url = new String(location.href.toLowerCase());
    
    tempPos = url.indexOf("?");

    str = url.substring(tempPos+1, url.length)

    var v="";
    var pos, endPos;
    pos = str.indexOf(name);

    if(pos > -1)
    { 
        endPos = str.indexOf("&", pos)
        if(endPos == -1) 
            endPos = str.length;
        var tmp = str.substr(pos, endPos-pos);
        v = tmp.substring(tmp.indexOf("=")+1, endPos)
    }
    
    return v;
}

function F_searchUser(typeInfo, typePos, IdUser)
{
        var paramM = F_getQuery("m");
        var paramIdM = F_getQuery("idm");
        var paramCp = F_getQuery("cp");
        var targetURL;

        targetURL = url.replace("content","list");
        targetURL = targetURL.replace("m="+paramM, "m=1");
        //targetURL = targetURL.replace("idrole=" + F_getQuery("idrole"), "idrole=0");
        
        paramKt = F_getQuery("kt");
        paramKw = F_getQuery("kw");
        
        targetURL = targetURL.replace("&kt=" + paramKt, "");
        targetURL = targetURL.replace("&kw=" + paramKw, "");
        
        targetURL = targetURL + "&kt=" + typePos + "&kw=" + escape(IdUser);
        
        targetURL = targetURL.replace("cp=" + paramCp, "cp=1");
        targetURL = targetURL.replace("&idm=" + paramIdM, "");        
        
        location.href(targetURL);
}

function F_ViewDetail(idInfo, idM)
{
    //window.showModalDialog("/WEBPerse/ViewDetail.aspx?idInfo=" + idInfo + "&idM=" + idM, null, "dialogWidth:1070px; dialogHeight:" + (screen.availHeight-100) + "px; edge:sunken; center:yes; resizable:no; status:no; help:no; scrollbars:yes;");
    //window.open("/webperse/viewdetail.aspx?idInfo=" + idInfo + "&idM=" + idM, null, "dialogWidth:1070px; edge:sunken; center:yes; resizable:yes; status:no; help:no; scrollbars:yes;");
    window.open("/webperse/viewdetail.aspx?idInfo=" + idInfo + "&idM=" + idM, "detailView","width=1100, height=" + (screen.availHeight-100) + ", top=50, left=10, scrollbars=yes, status=yes, location=no");
}

function F_ViewTagImage(idInfo, idM, tagImage)
{
    window.open("/modules/tag/include/viewtagimage.aspx?idInfo=" + idInfo + "&idM=" + idM + "&tag=" + tagImage, "detailView","width=1100, height=" + (screen.availHeight-100) + ", top=50, left=10, scrollbars=yes, status=yes, location=no");
}

function F_getURL(idInfo, idM, upCol, siteURL)
{	
	window.open("/Modules/Function/getURL.aspx?idInfo="+idInfo+"&idM="+idM+"&upCol=" + upCol +"&siteURL="+siteURL,"","");
}

function F_viewProfile(IdUser)
{
    //if(window.opener == undefined)
        location.href("/profile/content.aspx?idinfo=8&m=0&idrole=0&pagesize=12&cp=1&idm=" + IdUser);
    //else
      //  opener.location.href("/profile/content.aspx?idinfo=8&m=0&idrole=0&pagesize=12&cp=1&idm=" + IdUser);
}

function F_sendMemo(IdUser, NameUser)
{
    window.open("/memo/write.aspx?receiveId="+IdUser+"&receiveName="+escape(NameUser),"sendMemo","width=400, height=430");
}

function F_sendMemoNo()
{
    F_modalAlert("자신에게는 쪽지를 보낼수 없습니다.", 300, 280);
}

function F_scrapNo()
{
    F_modalAlert("자기 자신은 스크랩 할수 없습니다.", 300, 280);
}

function F_readMemo(mode, idm)
{
    window.open("/memo/read.aspx?mode=" + mode + "&idm=" + idm ,"readMemo","width=400, height=430");
}

//################## 공백제거

String.prototype.trim = function() 
{
    return this.replace(/^\s*(\b.*\b|)\s*$/, "$1"); // 문장의 앞과 뒤의 공백 제거
}

String.prototype.trimAll = function() 
{
    return this.replace(/\s/g,'');
}

// 서버컨트롤 아이디찾기 변수

GetId = document.getElementById;

// 한레이어만 보이고 나머지는 감추기
// who 보일 레이어
// whoGroup 감출 레이어그룹


function checkSpecial(obj)
{

    // 특수문자 체크
    var specialRe = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/
    
    if(specialRe.test(obj.value))
    {
        openModalDialog(106, null, null);
        obj.focus();
        return false;            
    }
    else
    {
        
        obj.value = obj.value.trimAll();
        return true;
    }
}

function F_checkSpecial(obj)
{
    // 특수문자 체크
    var specialRe = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/
    
    if(specialRe.test(obj.value))
    {
        alert("특수 문자는 사용할수 없습니다.");
        obj.focus();
        return false;            
    }
    else
        return true;
}


//Open Modal Dialog
function openModalDialog(msg, winWidth, winHeight)
{
    if(!winWidth || 'undefined' == typeof(winWidth))
      var winWidth = 300;
    if(!winHeight || 'undefined' == typeof(winHeight))
      var winHeight = 280;
      
	window.showModalDialog("/Modules/Error/ModalAlert.htm?msg="+msg, null, "dialogWidth:"+winWidth+"px; dialogHeight:"+winHeight+"px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");
}

function F_modalAlert(msg, winWidth, winHeight)
{
    if(winWidth == 0)
      var winWidth = 300;
    if(winHeight == 0)
      var winHeight = 280;
      
    window.showModalDialog("/Modules/Error/ModalAlert.htm?msg="+msg+"&isMsg=yes", null, "dialogWidth:"+winWidth+"px; dialogHeight:"+winHeight+"px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");
}


//################## 5글자 이하는 체크한 후 포커스 주기

function Check5Char(obj)
{   
    if(obj.value.trimAll().length < 5)
    {
        obj.focus();
        openModalDialog(502, null, null);
        return false;
    }
    else
        return true;
}

function Check2Char(obj)
{   
    if(obj.value.trimAll().length < 2)
    {
        openModalDialog(501, null, null);
        obj.focus();
        return false;
    }
    else
        return true;
}

function F_character2(obj)
{
    if(obj.value.trimAll().length < 2)
    {
        openModalDialog(501, null, null);
        obj.focus();
        return false;
    }
    else
        return true;
}

// #################### 한글만 쓸수있게 ###################### //
function onlyKor() 
	{
		var e1 = event.srcElement;
		var e1value = event.srcElement.value;
		
		var f=document.cnjform;
		
		strarr = new Array(e1value.length);
		
		schar = new Array('/','.','>','<',',','?','}','{',' ','\\','|','(',')','+','=');
		
		for (i=0; i<e1value.length; i++) 
		{
			for (j=0; j<schar.length; j++) 
			{
				if (schar[j] ==e1value.charAt(i)) 
				{
					openModalDialog(400, null, null);
					e1.focus();
					e1.select(); 
					return false;
				}
				else
				continue;
			}
		
			strarr[i] =e1value.charAt(i)
			
			if ((strarr[i] >=0) && (strarr[i] <=9)) 
			{
				openModalDialog(400, null, null);
				e1.focus(); 
				e1.select(); 
				return false;
			}
			else if ((strarr[i] >='a') && (strarr[i] <='z')) 
			{
				openModalDialog(400, null, null);
				e1.focus(); 
				e1.select();
				return false;
			}
			else if ((strarr[i] >='A') && (strarr[i] <='Z')) 
			{
				openModalDialog(400, null, null);
				e1.focus(); 
				e1.select(); 
				return false;
			}
			else if ((escape(strarr[i]) > '%60') && (escape(strarr[i]) <'%80') ) 
			{
				openModalDialog(400, null, null);
				e1.focus(); 
				e1.select(); 
				return false;
			} 
			else 			
			continue;			
		}
	}
	
	
    //	이메일 체크
function isEmail(obj)
{
	//var emailfilter = /^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i ; 기존 정규식
	//var emailfilter = /^((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$/i ;
    //if(!emailfilter.test(obj.value))
	//{
        //openModalDialog(102, null, null);
	    //obj.focus();
		//return false;
    //}
    if(obj.value.indexOf("@") == -1)
    {
        F_modalAlert("메일주소가 옳바르지 않습니다.", 0, 0);
        obj.focus();
        return false;
    }
    else
	return true;
}
	
// 숫자만 가능하게
function F_number(obj)
{
	//var e1 = event.srcElement;
	//var e1value = event.srcElement.value;
	
	var num ="0123456789";

	for (var i=0;i<obj.value.length;i++)
	{
		if(num.indexOf(obj.value.charAt(i)) == -1)
		{
            obj.value = "";
            return false;
            obj.focus();
		}
	}
}

function F_engNum(obj)
{
    var returnValue = "";
    
    var num ="0123456789";
    	
    for (var i = 0; i < obj.value.length; i++)
    {
        if ((obj.value.charAt(i) >= "a" &&  obj.value.charAt(i) <= "z") || (obj.value.charAt(i) >= "A" && obj.value.charAt(i) <= "Z") || (num.indexOf(obj.value.charAt(i)) != -1))
        {
            returnValue += obj.value.charAt(i).toLowerCase();
        }
        else
        {
            returnValue += "";
        }
    }

 obj.value = returnValue;
 obj.focus();
}

function F_eng(obj){

 var returnValue = "";
 for (var i = 0; i < obj.value.length; i++){
  if ((obj.value.charAt(i) >= "a" &&  obj.value.charAt(i) <= "z") || (obj.value.charAt(i) >= "A" && obj.value.charAt(i) <= "Z") ){
   returnValue += obj.value.charAt(i).toLowerCase();
  }else{
   returnValue += "";
  }
 }

 obj.value = returnValue;
 obj.focus();
}

function F_isNumber(obj)
{
    var numberStr = "0123456789";

    if (numberStr.indexOf(obj) > 0 )
    {
        obj.value = "";
        return false;
    }
}

function F_url(obj)
{
    var returnValue = "";
    
    for (var i = 0; i < obj.value.length; i++)
    {    
        if ((obj.value.charAt(i) >= "0" && obj.value.charAt(i) <= "9") || (obj.value.charAt(i) >= "a" &&  obj.value.charAt(i) <= "z") || (obj.value.charAt(i) >= "A" && obj.value.charAt(i) <= "Z") || (obj.value.charAt(i) == "/" || obj.value.charAt(i) == ":" || obj.value.charAt(i) == "." || obj.value.charAt(i) == "-"))
        {
            returnValue += obj.value.charAt(i);
        }
        else
        {
            returnValue += "";
        }
    }
    
        obj.value = returnValue;
        obj.focus();
}

function F_sendMail(idUser)
{	
	window.open("/Mail/sendMail.aspx?idUser=" + idUser ,"sendMail","width=500, height=600");
}

function F_sendMailToMember(idUser, nick, idRole)
{
    nick = escape(nick);
	window.open("/Mail/SendMailToMember.aspx?idUser=" + idUser + "&nick=" + nick + "&idRole=" + idRole,"sendMail","width=500, height=400");
}

function F_sendMailToMemberNo()
{
    F_modalAlert("자신에게는 메일을 보낼수 없습니다.", 300, 280);
}

function F_image(obj) 
{
    pathpoint = obj.value.lastIndexOf('.');
    filepoint = obj.value.substring(pathpoint+1,obj.value.length);
    filetype = filepoint.toLowerCase();
    
    if(filetype == 'jpg' || filetype == 'gif' || filetype == 'png' || filetype == 'jpeg' || filetype == 'bmp') 
    {
        return true;
    }
    else
    {
        openModalDialog(112, null, null);
        obj.select();
        document.selection.clear();
        return false;
    }
}

//-->
