	
// Status Var Text
var hellotext=""

function hidestatus()	{
	window.status = hellotext;
	return true;
}
	
	
function retFalse()	{
	var objTag = event.srcElement.tagName;
	if ( objTag == "TEXTAREA" || objTag == "INPUT") 
		return true;
	else
		return false;
}
	
function AllretFalse()	{
	var objTag = event.srcElement.tagName;
	if ( objTag == "TEXTAREA" || objTag == "INPUT") 
		return true;
	else
		return false;		
}


// don't support New Window pressed '<A>' tag with Shift key
function NoLinkPopup()	{
    if (event.srcElement.tagName == "A" && event.shiftKey ) 
        	return false;
}

function NoNewWindow()	{
	if (event.keyCode == 78 && event.ctrlKey ) 
        	return false;
	NoReload();				
}
	
//hidestatus();	
	
	
function NoReload()
{
	//alert(event.keyCode);
	if (event.keyCode == 122 || event.keyCode == 116 || (event.keyCode == 82 && event.ctrlKey))
	{
		event.keyCode = 0; 
		event.cancelBubble = true; 
		event.returnValue = false;
	}
}				
	
// don't support Drag & Context Menu

document.oncontextmenu = AllretFalse;
document.ondragstart = retFalse;
document.onselectstart = retFalse; 
document.onmouseover=hidestatus;
document.onmouseout=hidestatus;
document.onclick = NoLinkPopup;
document.onkeydown = NoNewWindow;
document.onkeyup = NoNewWindow;

/*
if(typeof(bCheckURL) == 'undefined' && top.location.pathname.toUpperCase() != '/_HOMPYSYSTEM_/SMHOMPYMAIN.ASP') {
	top.location.href = '/_HompySystem_/SmHompyMain.asp';
}
*/
	
function isFormValue(obj,objType,bleEmpty,objName) {
	if(bleEmpty && obj.value == '') {
		alert(objName + ' ÇÊµå¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä.');
		obj.focus();
		return false;
	} else if(bleEmpty == 1) {
		switch(objType) {
			case 1: // String Value
				return true;
				break;
			case 2: // Numeric Value
				if(!isNum(obj.value)) { 
					alert(objName + ' ÇÊµå´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.');
					obj.select();
					return false;
				} else return true;
				break;
			case 3: // Email Check	
				if(!isEmail(obj.value)) {
					alert(objName + ' Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
					obj.select();
					return false;
				} else return true;
				break;
			case 4: // ÀÌ¹ÌÁö
				if(!isImage(obj.value)) {
					alert(objName + ' Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
					obj.select();
					return false;
				} else return true;
				break;	
			case 5: // asf
				if(!isMovie(obj.value)) {
					alert(objName + ' Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
					obj.select();
					return false;
				} else return true;
				break;	
			case 9: // UserID Check
				if(isCheckID(obj.value) == 1) {
					alert('¾ÆÀÌµð´Â ÇÑ±Û, Æ¯¼ö¹®ÀÚ, °ø¹é¹®ÀÚ¸¦ Æ÷ÇÔÇÒ¼ö ¾ø½À´Ï´Ù.\n\n¿µ¹® È¤Àº ¼ýÀÚ 4ÀÚ ÀÌ»ó 20ÀÚ ÀÌÇÏ·Î ±âÀÔÇØ ÁÖ½Ê½Ã¿ä.');
					obj.select();
					return false;
				} else if(isCheckID(obj.value) == 3) {
					alert('¾ÆÀÌµð´Â 4ÀÚ ÀÌ»ó 12ÀÚ ÀÌÇÏ·Î ±âÀÔÇØ ÁÖ½Ê½Ã¿ä.');
					obj.select();
					return false;
				} else return true;
				break;													
			default:
				return true;
				break;
		}
	} 
	
	return true;

}

function isCheckID(uid) {
	
	for(i=0;i<uid.length;i++) {	
		chr = uid.substr(i,1);
		if((chr < '0' || chr > '9') && (chr < 'a' || chr > 'z') && (chr < 'A' || chr > 'Z')) {
			return 1;
			break;
		}
	}
	str = 0;
	for(i=0;i<uid.length;i++) {	
		chr = uid.substr(i,1);
		if((chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z')) {
			str = 1;
			break;
		}
	}	
	
	str = 1
	if(uid.length < 4 || uid.length > 12) return 3;
	else if(str == 0) return 2;
	else return 4;			
}	

function isEmail(str) {
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}

function isNum(x)
{
	var chkn="0123456789";
	var chkt=x.length;

	for(i=0;i<chkt;i++) if(chkn.indexOf(x.substring(i,i+1))<0) return false;
	return true;
}

function isImage(s) {
	fLen = s.length;
	fExt = s.substr(fLen-3,3)

	if(!(fExt.toUpperCase() == 'JPG' || fExt.toUpperCase() == 'GIF')) {
		return false;
	}

	return true;
}

function isMovie(s) {
	fLen = s.length;
	fExt = s.substr(fLen-3,3)

	if(!(fExt.toUpperCase() == 'ASF')) {
		return false;
	}

	return true;
}


//ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©¼¶
function isSSN(ssn0,ssn1,sday) {
	var SSNS = ssn0 + ssn1;
	
	if(ssn0.length != 6) {
		alert('ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®´Â 6ÀÚ¸®ÀÔ´Ï´Ù.');
		return false;
	}

	if(ssn1.length != 7) {
		alert('ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®´Â 7ÀÚ¸®ÀÔ´Ï´Ù.');
		return false;
	}
	
	var iyear = eval(sday.substring(0,4));
	var imonth = eval(sday.substring(4,6));
	var iday = eval(sday.substring(6,8));

	cyear = '19' + ssn0.substring(0,2);
	cmonth = eval(ssn0.substring(2,4));
	cday = eval(ssn0.substring(4,6));
	
	iAge = iyear - parseInt(cyear);
	if(imonth > cmonth) iBirth = 0
	else if(imonth = cmonth && iday >= cday) iBirth = 0
	else iBirth = 1
	
	iAge = iAge - iBirth;
	
	if(iAge < 19) {
		alert('¸¸19¼¼ ¹Ì¸¸Àº °¡ÀÔÇÒ ¼ö ¾ø½À´Ï´Ù.');
		return false;
	}
	var SSN_tot = 0;
	var SSN_ad = "234567892345"
	for(i=0; i<=11; i++){
		SSN_tot = SSN_tot + parseInt(SSNS.substring(i, i+1)) * parseInt(SSN_ad.substring(i, i+1))
    }
    SSN_tot = 11 - (SSN_tot % 11)
    if(SSN_tot == 10) SSN_tot = 0
    else if(SSN_tot == 11) SSN_tot = 1
    if(parseInt(SSNS.substring(12, 13)) != SSN_tot){
        return false;
    }
	else return true;
}

function doMoveHompy(uid) {
	parent.document.location.href='/_HompySystem_/CreateMyHompy.asp?UserID='+uid;
}

function doReSizeWin() {
	x = document.body.scrollWidth + 10;
	y = document.body.scrollHeight + 50;
	window.resizeTo(x,y)
}

//±×¸² È®´ë
function fnAlbumZoomIn(sImg, iWidth, iHeight) {	
	iW = (screen.availWidth - 100) / 2
	iH = (screen.availHeight - 100) / 2
	sFeatures = 'width='+iWidth+', height='+iHeight+', left='+iW+', top='+iH+',toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no'
	sURL = '/_HompySystem_/Common/ImageZoomIn.asp?sImg='+sImg;
	window.open(sURL, 'ZoomIn', sFeatures)
}

//»õÃ¢ È£Ãâ
function fnWinOpen(sURL,sName,iWidth,iHeight) {	
	iW = (screen.availWidth - iWidth) / 2
	iH = (screen.availHeight - iHeight) / 2
	sFeatures = 'width='+iWidth+', height='+iHeight+', left='+iW+', top='+iH+',toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no'
	window.open(sURL, sName, sFeatures)
}

function doView(strPageName, strArgName, Seq, goPage) {
	var SearchPos = location.search.indexOf('goPage')
//	if(SearchPos < 0) SearchPos = location.search.indexOf('vewType')
	if(SearchPos < 0) document.location.href = strPageName + '?' + strArgName + '=' + Seq + '&goPage=' + goPage;
	else document.location.href = strPageName + '?' + strArgName + '=' + Seq + '&' + location.search.substr(SearchPos);
}

function goPage(strPageName, strArgName, gp) {
	var SearchPos = location.search.indexOf(strArgName)
	if(SearchPos < 0) document.location.href = strPageName + '?goPage=' + gp;
	else document.location.href = strPageName + '?goPage=' + gp + '&' + location.search.substr(SearchPos);
}

function trOver(obj) {
	obj.style.backgroundColor = '#EEEEEE'
}

function trOut(obj) {
	obj.style.backgroundColor = '#FFFFFF'
}

function fnCommonOpenPopup(pop){
	switch(pop) {
		case 'useguide':
			window.open("/Popup/messenger.asp","memberjoin","width=700,height=600,left=100,top=50,resizable=no,scrollbars=yes");
			break;
		case 'memberguide':
			window.open("/CommonSource/member_guide.asp","memberjoin","width=618,height=600,left=100,top=50,resizable=no,scrollbars=yes"); 
			break;
		case 'memberleave':
			window.open("/CommonSource/member_leave.asp","memberjoin","width=618,height=620,left=100,top=50,resizable=no,scrollbars=auto"); 
			break;					
		case 'memberjoin':
			window.open("/CommonSource/member_join.asp","memberjoin","width=618,height=700,left=100,top=50,resizable=no,scrollbars=yes"); 
			break;
		case 'messengerguide':
			window.open("/CommonSource/messenger_guide.asp","memberjoin","width=618,height=1000,left=100,top=50,resizable=yes,scrollbars=yes"); 
			break;
		case 'idsearch':
			window.open("/CommonSource/id_search.asp","memberjoin","width=618,height=300,left=100,top=50,resizable=no,scrollbars=auto"); 
			break;	
		case 'download':
			window.open("/CommonSource/member_join_download.asp","memberjoin","width=618,height=400,left=100,top=50,resizable=no,status=no,scrollbars=auto");
			break;	
		default :
			window.open("/CommonView/"+pop,"memberjoin","width=670,height=650,left=100,top=50,resizable=no,status=no,scrollbars=yes");			
			break;		
	}
}

function fnClose() {
	self.opener = null;
	self.close();
}

function mAl(){
	alert("¸Þ½ÅÀú ÇÁ·Î±×·¥¿¡ ·Î±×ÀÎÇÏ½ÅÈÄ ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.\r\r¸Þ½ÅÀú ÇÁ·Î±×·¥À» ´Ù¿î·Îµå ¹ÞÀ¸¼Å¼­ ¼³Ä¡ÇÏ½Å ÈÄ¿¡ ÀÌ¿ëÇÏ¿© ÁÖ½Ê½Ã¿À.");
}
