var imgzips = new Array("jpg", "gif", "jpeg", "bmp", "png", "pcx", "zip", "rar");
//var imgs = new Array("jpg", "gif", "jpeg", "bmp", "png", "pcx");
var imgs = new Array("jpg", "gif", "bmp");

function isImgZip(str) {
	var ext = str.substring(str.lastIndexOf(".") + 1, str.length);
	for (var i = 0; i < imgzips.length; i++) {
		if (ext.toLowerCase() == imgzips[i])
			return true;
	}
	return false;
}

function isImg(str) {
	var ext = str.substring(str.lastIndexOf(".") + 1, str.length);
	for (var i = 0; i < imgs.length; i++) {
		if (ext.toLowerCase() == imgs[i])
			return true;
	}
	return false;
}

function isTxt(str) {
	var ext = str.substring(str.lastIndexOf(".") + 1, str.length);
	if (ext.toLowerCase() == "txt")
		return true;
	else
		return false;
}

function isTXTEmpty(chkValue) {
	var isEmpty = true;
	if (chkValue.length == 0) {
		return isEmpty;
	} else {
		for (i = 0; i < chkValue.length; i++) {
			var chk = chkValue.charAt(i);
			if (chk != " ")
				isEmpty = false;
		}
	}
	return isEmpty;
}

function isCHKEmpty(chkEntity) {
	var isEmpty = true;
	for (i = 0; i < chkEntity.length; i++) {
		if (chkEntity(i).checked)
			isEmpty = false;
	}
	return isEmpty;
}

function isHan(chkValue) {
	schar = new Array('!','@','#','$','%','^','&','*','(',')','-','=','+','\\','|','/',',','?','<','>','.','{','}','[',']','`','~');
	for(i = 0; i < chkValue.length; i++) {
		c = chkValue.charAt(i);
		for (j = 0; j < schar.length; j++) {
			if (schar[j] == c)
				return false;
		}
		if(!((c < '0' || c > '9')&&(c < 'a' || c > 'z')&&(c < 'A' || c > 'Z')))
			return false;
	}
	return true;
}

function isHanAlpha(chkValue) {
	schar = new Array('!','@','#','$','%','^','&','*','(',')','-','=','+','\\','|','/',',','?','<','>','.','{','}','[',']','`','~');
	for(i = 0; i < chkValue.length; i++) {
		c = chkValue.charAt(i);
		if(!isNaN(c))		return false;

		for (j = 0; j < schar.length; j++) {
			if (schar[j] == c)		return false;
		}
	}
	return true;
}

function isAlphaNumber(chkValue) {
	for(i = 0; i < chkValue.length; i++) {
		c = chkValue.charAt(i);
		if(!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
		   return false;
	}
	return true;
}

function isAlphaNumUnder(chkValue) {
	for(i = 0; i < chkValue.length; i++) {
		c = chkValue.charAt(i);
		if(!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'))
		   return false;
	}
	return true;
}

function isAlphaNumUnderDot(chkValue) {
	for(i = 0; i < chkValue.length; i++) {
		c = chkValue.charAt(i);
		if(!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == '.'))
		   return false;
	}
	return true;
}

function isAlphaUnder(chkValue) {
	for(i = 0; i < chkValue.length; i++) {
		c = chkValue.charAt(i);
		if(!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'))
		   return false;
	}
	return true;
}

function isAlpha(chkValue) {
	for(i = 0; i < chkValue.length; i++) {
		c = chkValue.charAt(i);
		if(!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
		   return false;
	}
	return true;
}

function isPassword(chkValue) {
	if (isAlpha(chkValue)) {
		return false;
	} else if (!isNaN(chkValue)) {
		return false;
	}

	return true;
}

function isEmail(chkValue) {
	var at = chkValue.indexOf("@");
	var dot = chkValue.indexOf(".");

	if (at < 2)
		return false;
	else {
		for(i = 0; i < chkValue.length; i++) {
			c = chkValue.charAt(i);
			if(!((!isNaN(c)) || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == '-' || c == '@' || c == '.'))
			   return false;
		}
	}
	return true;
}

function txtByte(chkValue) {
	var nbytes = 0;
	for (i=0; i<chkValue.length; i++) {
		var ch = chkValue.charAt(i);
		if(escape(ch).length > 4)					nbytes += 2;
		else if (ch == '\n') {
			if (chkValue.charAt(i-1) != '\r')		nbytes += 1;
		} else if (ch == '<' || ch == '>')			nbytes += 4;
		else										nbytes += 1;
	}
	return nbytes;
}

function isLength(str, len) {
	cnt = txtByte(str);
	if (cnt <= len) {
		return false;
	} else {
		return true;
	}
}

function ampmchange(value, selector) {
	if(value == "am") {
		selector.options[0].text = "00";
	} else {
		selector.options[0].text = "12";
	}
}

function is_yun(yr) {
	if(((yr%4) == 0 && (yr%100) != 0) || (yr%400) == 0)
		return 1;
	else
		return 0;
}

function resetday(yr,mon,selector) {
	monthdays = new Array(12);
	monthdays[0] = 31;
	if(is_yun(eval(yr)))	monthdays[1] = 29;
	else					monthdays[1] = 28;
	monthdays[2] = 31;
	monthdays[3] = 30;
	monthdays[4] = 31;
	monthdays[5] = 30;
	monthdays[6] = 31;
	monthdays[7] = 31;
	monthdays[8] = 30;
	monthdays[9] = 31;
	monthdays[10] = 30;
	monthdays[11] = 31;

	var i=0;
	var	del_idx;
	if(selector.options.length < monthdays[eval(mon)-1]) {
		var NewOpt = Array(3);
		while(selector.options.length < monthdays[eval(mon)-1]) {
			NewOpt[i] = document.createElement('OPTION');
			selector.options.add(NewOpt[i]);
			i++;
		}
	} else if(selector.options.length > monthdays[eval(mon)-1]) {
		while(selector.options.length > monthdays[eval(mon)-1]) {
			del_idx = selector.options.length - 1;
			selector.options.remove(del_idx);
		}
	}
	var	dvalue;
	for(i=1; i<=monthdays[eval(mon)-1]; i++) {
		if(i<10)	dvalue = "0"+i;
		else		dvalue = i;
		selector.options[i-1].value = dvalue;
		selector.options[i-1].text = dvalue;
	}
}

function w3cMovie(fileName, width, height, autoStart, volume) {
	document.write("<embed id='WinMedia' src='"+fileName+"' width='"+width+"' height='"+height+"' autostart='"+autoStart+"' volume='"+volume+"' border='0' ShowControls='False' ShowStatusBar='False'></embed>");
}

function w3cMovieMem(fileName) {
	document.write("<embed src='"+fileName+"'></embed>");
}

function w3cMovieMem2(fileName, width, height) {
	document.write("<embed src='"+fileName+"' width='"+width+"' height='"+height+"' autostart='true'></embed>");
}

function w3cFlash(fileName, width, height, wmode, play, loop) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+width+'" height="'+height+'">');
	document.write('	<param name=movie value="'+fileName+'">');
	document.write('	<param name=quality value="high">');
	document.write('	<param name="play" value="'+play+'">');
	document.write('	<param name="loop" value="'+loop+'">');
	document.write('	<param name="wmode" value="'+wmode+'">');
	document.write('	<embed src="'+fileName+'" quality="high" play="'+play+'" loop="'+loop+'" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'">');
	document.write('	</embed></object>');
}


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_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_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];}
}