/*
	String Prototype
	trim() : ¾çÂÊ °ø¹éÁ¦°Å
	ltrim() : ÁÂÃø °ø¹éÁ¦°Å
	rtrim() : ¿ìÃø °øÀèÁ¦°Å

	Function Define
	popWin(ÆË¾÷ÆÄÀÏ, ÆË¾÷Ã¢ ÀÌ¸§, ¼Ó¼º) : ÆË¾÷¶Ù¿ì±â, return void
	activexShow(Active X ¼Ò½º ¾ÆÀÌµð-textarea) : Active X º¸ÀÌ±â, return void
	isNumeric(¼ýÀÚ) : Á¤¼öÀÎÁö È®ÀÎ, return boolean
	isYYYYMMDD(³âµµ, ¿ù, ÀÏ) : ³¯Â¥ È®ÀÎ, return boolean
	isCheck(¶óµð¿À  or Ã¼Å©¹Ú½º) : ¼±ÅÃ Çß´Â Áö °Ë»ç, return boolean
	countCheck(Ã¼Å©¹Ú½º) : ¼±ÅÃ °¹¼ö, return int
	allCheck(¶óµð¿À  or Ã¼Å©¹Ú½º, Ã¼Å©°ª - boolean) : ÀüÃ¼ ¼±ÅÃ / ÇØÁ¦, return void
*/

document.title = "Seoul United FC Supporters Club :: RedPower";

/*
	.trim()
*/
String.prototype.trim = function() {
    return this.replace(/(^ *)|( *$)/g, "");
}

/*
	.ltrim()
*/
String.prototype.ltrim = function() {
    return this.replace(/(^ *)/g, "");
}

/*
	.rtrim()
*/
String.prototype.rtrim = function() {
    return this.replace(/( *$)/g, "");
}

/*
	ÆË¾÷Ã¢ ¶ç¿ì±â
	url = ÆË¾÷ÆÄÀÏ
	name = ÆË¾÷Ã¢ ÀÌ¸§
	attributes = ¼Ó¼º
	return = void;
*/
function popWin(url, name, attributes){
	window.open(url, name, attributes);
}

/*
	Active X º¸ÀÌ±â
	obj = Active X ¼Ò½º ¾ÆÀÌµð
	return = void
*/
function activexShow(obj){
	document.write(document.getElementById(obj).value);
}

/*
	Á¤¼öÀÎÁö È®ÀÎ
	s = ¼ýÀÚ
	return = boolean
*/
function isNumeric(s) { 
	for (i=0; i<s.length; i++) { 
		c = s.substr(i, 1); 
		if (c < "0" || c > "9"){
			return false; 
		}
	} 
	return true; 
}

/*
	³¯Â¥ È®ÀÎ
	y = ³âµµ
	m = ¿ù
	d = ÀÏ
	return = boolean
*/
function isYYYYMMDD(y, m, d) { 
	if (d < 1){
		return false;
	}

	switch (m) { 
		case 2: // 2¿ùÀÇ °æ¿ì 
			if (d > 29){
				return false; 
			}
			if (d == 29) { 
				// 2¿ù 29ÀÇ °æ¿ì ´çÇØ°¡ À±³âÀÎÁö¸¦ È®ÀÎ 
				if ((y % 4 != 0) || (y % 100 == 0) && (y % 400 != 0)) {
					return false; 
				}
			} 
			break; 
		case 4: // ÀÛÀº ´ÞÀÇ °æ¿ì 
			if (d > 30){
				return false; 
			}
			break; 
		case 6: 
			if (d > 30){
				return false; 
			}
			break; 
		case 9: 
			if (d > 30){
				return false; 
			}
			break; 
		case 11: 
			if (d > 30){
				return false; 
			}
			break; 
		default:
			if (d > 31){
				return false; 
			}
			break; 
	} 
	return true; 
} 

/*
	¼±ÅÃ Çß´Â Áö °Ë»ç
	obj = ¶óµð¿À/Ã¼Å© ¹Ú½º
	return = boolean
*/
function isCheck(obj){
	var rtn = false;

	if(obj != null){
		if(obj.length == null || obj.length == 1){
			rtn = obj.checked;
		}else{
			for(i = 0; i < obj.length; i++){
				if(obj[i].checked){
					rtn = true;
					i = obj.length;
				}
			}
		}
	}

	return rtn;
}

/*
	¼±ÅÃ ÇÑ °¹¼ö ±¸ÇÏ±â
	obj = Ã¼Å© ¹Ú½º
	return = int(¼±ÅÃ µÈ ¼ö)
*/
function countCheck(obj){
	var rtn = 0;

	if(obj != null){
		if(obj.length == null || obj.length == 1){
			if(obj.checked){
				rtn = 1;
			}
		}else{
			for(i = 0; i < obj.length; i++){
				if(obj[i].checked){
					rtn++;
				}
			}
		}
	}

	return rtn;
}

/*
	ÀüÃ¼ ¼±ÅÃ / Ãë¼Ò
	obj = Ã¼Å©¹Ú½º
	chk = true/false
	return = void
*/
function allCheck(obj, chk){
	if(obj != null){
		if(obj.length == null || obj.length == 1){
			obj.checked = chk;
		}else{
			for(i = 0; i < obj.length; i++){
				obj[i].checked = chk;
			}
		}
	}
}

function blankFunc(){
}

function upImageStillCut(strImg, strtname)
{
	window.open("/2007/common/imgView.asp?upimgName=" + strImg, "upImage", "width=300,height=300,scrollbars=yes");
}

function activeXReg(obj){
	document.write(document.getElementById(obj).value);
}

function setImgSize(img, maxW, maxH){
	var imgW;
	var imgH;

	imgW = img.width;
	imgH = img.height;

	if (maxW > 0){
		if(imgW > maxW){
			imgH = parseInt(maxW / imgW * imgH);
			imgW = maxW;
		}
	}
	if(maxH > 0){
		if(imgH > maxH){
			imgW = parseInt(maxH / imgH * imgW);
			imgH = maxH;
		}
	}
	img.width = imgW;
	img.height = imgH;
}

function ftn_calendar(obj){
	var sdate = obj.value;
	var ret = window.showModalDialog("/2007/common/cal_tab.asp?sdate="+sdate,"","dialogWidth:290px;dialogHeight:230px;status:no;help:no");

	if(ret != "none" && ret != "" && ret + "" != "undefined" ) {
		obj.value=ret
	}
	return;
}

/*
	È®ÀåÀÚ ÇÊÅÍ¸µ
	filename = ÆÄÀÏ¸í
	return = boolean
*/
function checkFile(filename){
	var notEtc = new Array("php", "jsp", "asp", "aspx", "cgi", "pl", "php3", "php4", "exe", "com", "bat", "htm", "html", "js");//ÀÔ·Â ºÒ°¡ È®ÀåÀÚ
	var rtn;
	var etcName;

	rtn = false;
	etcName	= filename.substring(filename.lastIndexOf(".")+1,filename.length);
	etcName = etcName.toLowerCase();
	for(i = 0; i < notEtc.length; i++){
		if(notEtc[i] == etcName){
			rtn = true;
			i = notEtc.length;
		}
	}

	return rtn;
}

/*
	ÀÌ¹ÌÁö ÆÄÀÏ
	filename = ÆÄÀÏ¸í
	return = boolean
*/
function checkImgFile(filename){
	var imgExt = new Array("jpg", "jpeg", "gif", "bmp");
	var rtn;
	var etcName;

	rtn = true;
	etcName	= filename.substring(filename.lastIndexOf(".")+1,filename.length);
	etcName = etcName.toLowerCase();
	for(i = 0; i < imgExt.length; i++){
		if(imgExt[i] == etcName){
			rtn = false;
			i = imgExt.length;
		}
	}

	return rtn;
}

function viewImg(imgSrc){
	window.open("/2007/common/imgView.asp?upimgName=" + imgSrc, "", "width=500, height=500, top=0, left=0,status, scrollbars");
}
