function isFormValue(obj,objType,bleEmpty,objName) {
	if(bleEmpty && obj.value == '') {
		alert(objName + ' 필드를 입력하여 주십시요.');
		obj.focus();
		return false;
	} else {
		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;
			default:
				return true;
				break;
		}
	}

}

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 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=yes, resizable=no'
	window.open(sURL, sName, sFeatures)
}

function View(strPageName, strArgName, Seq, goPage) {
	var SearchPos = location.search.indexOf('goPage')
	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 goPage2(strPageName, strArgName, gp) {
	var SearchPos = location.search.toLowerCase().indexOf(strArgName)
	if(SearchPos < 0) document.location.href = strPageName + '?goPage=' + gp;
	else document.location.href = strPageName + '?goPage=' + gp + '&' + location.search.substr(SearchPos);
}

function goPage_Param(strPageName, strArgName, gp, index_cd) {
	var SearchPos = location.search.indexOf(strArgName)
	if(SearchPos < 0) document.location.href = strPageName + '?goPage=' + gp +'&index_cd='+index_cd;
	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 LinkImage(img) {
var thumb = new Image;
thumb.src = img.src;
var height = 100;
var width = 100;

	if ((thumb.width!=0) && (thumb.height!=0))
		{
					if (height > thumb.height) {
					img.height = thumb.height;

					}
					else
					{
					img.height = 100;
					} 
		}

return;
}

function two_path(kind_scr,button_kind,bg_size){
	
	var dest1,dest2,sub_path, width,height;

	if(kind_scr.substring(0,6) =="buddha")
		sub_path = "_Daehaeng_"+kind_scr.substring(7,10);
	else 
		sub_path = "_buddha_"+kind_scr;

	switch(bg_size)
	{
		case "800":
			size_string = "width=800,height=600";
			width="800"
			height="600"
			break;

		case "1024":
			size_string = "width=1024,height=768";
			width="1024"
			height="768"
			break;

		case "1280":
			size_string = "width=1280,height=1024";
			width="1280"
			height="1024"
			break;
	}

	scr_path = "/screensaver_file/HBMC Screensaver"+sub_path+".exe";
	dest1 = "/_Service/BUDDHAPIA/0000003314/flash_preview.asp?sub_path="+sub_path;
	dest2 = "/_Service/BUDDHAPIA/0000003314/size.asp?sub_path="+sub_path+"&width="+width+"&height="+height+"&bg_size="+bg_size;
		
	if (button_kind == "preview")
	{
		newWin = window.open(dest1,"preview_sv","width=610,height=500 style=cursor:hand");
		newWin.focus();
	}
	else if(button_kind == "down")
	{
		location.href = scr_path;
	}
	else if(button_kind == "back")
	{
		newWin = window.open(dest2,"hbmc_bg",size_string);
		newWin.focus();
	}
	else
	{
		alert("관리자에게 문의하여 주십시오.");
		return;
	}
}