function AjaxRequest(url,pars,success,error,async,type){
	$.ajax({
		type:"POST",
		url:url,
		data:pars,
		dataType: type != null ? "text" : "json",
		async: (async == null || async == true) ? true : false,
		error: error!=null?error:function(req, s, e) {alert(req.responseText);},
		success:success
	});
}

function enter(callback){
	var code = window.event.keyCode;
	if(code==13){
		callback();
	}
}

function imgWidthResize(limitSize, obj){
	var w = obj.width;
	var h = obj.height;
	if(w>limitSize){
		obj.width = limitSize;
		obj.height = h*(limitSize/w);
	}
}

function imgHightResize(limitSize, obj){
	var w = obj.width;
	var h = obj.height;
	if(h>limitSize){
		obj.height = limitSize;
		obj.width = w*(limitSize/h);
	}
}

function autoTabFocus(thisObj,id){
	if(id==null){
		return;
	}
	var maxLen=thisObj.getAttribute("maxlength");
	if(thisObj.value.length>=maxLen){
		document.getElementById(id).select();
	}
}

function rPad(val, len, char){
	var temp = "";
	if(val.length<len){
		for(var i=0;i<len-val.length;i++){
			temp += char;
		}
	}

	return val+temp;
}
function lPad(val, len, char){
	var temp = "";
	if(val.length<len){
		for(var i=0;i<len-val.length;i++){
			temp += char;
		}
	}
	return temp+val;
}



//날짜 체크
function isValidDate( val ) {

 var sYY = val.substring(0,4);
 var sMM = val.substring(4,6);
 var sDD = val.substring(6,8);

 //alert(sYY + " , " + sMM + " , " + sDD);

 //년도 체크
 //if(isNull(sYY.value)) return true;

 if (sYY.length != 4) {
  alert('입력한 년도를 확인하세요.');
  return false;
 }

 if (sYY.substring(0,2) == "19" || sYY.substring(0,2) == "20") {
  yy = parseFloat(sYY);
 }else {
  alert('입력한 년도를 확인하세요.');
  return false;
 }



 //월 체크
 //if(isNull(sMM.value)) return true;

 //if(!isNull(sMM))plusZero(sMM);

 mm = parseFloat(sMM);

 if (mm == 1)
  max_days = 31;
 else if (mm == 2) {
  if ((( yy % 4 == 0) && (yy % 100 != 0)) || (yy % 400 == 0)) //윤년
    max_days = 29;
  else
    max_days = 28;
 }
 else if (mm == 3)
  max_days = 31;
 else if (mm == 4)
  max_days = 30;
 else if (mm == 5)
  max_days = 31;
 else if (mm == 6)
  max_days = 30;
 else if (mm == 7)
  max_days = 31;
 else if (mm == 8)
  max_days = 31;
 else if (mm == 9)
  max_days = 30;
 else if (mm == 10)
  max_days = 31;
 else if (mm == 11)
  max_days = 30;
 else if (mm == 12)
  max_days = 31;
 else {
  alert("입력한 월(1-12)을 확인하세요.");
  return false;
 }


 //일 체크
 //if(isNull(sDD.value)) return true;

 //if(!isNull(sDD))plusZero(sDD);

 dd = parseFloat(sDD);

 if (dd >= 1 && dd <= max_days) return true;
 else {
  alert("입력한 일(1-31)을 확인하세요.");
  return false;
 }

}



function ImagePop(what)
{
	var imgwin = window.open('','WIN','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=10,height=10');

	imgwin.focus();
	imgwin.document.open();
	imgwin.document.write('<html>\n');
	imgwin.document.write('<head>\n');
	imgwin.document.write('<title>Image</title>\n');
	imgwin.document.write('<sc'+'ript>\n');
	imgwin.document.write('function resize() { \n');
	imgwin.document.write('\t pic = document.il; \n');
	imgwin.document.write('\t if (eval(pic).height) { \n');
	imgwin.document.write('\t\t var name = navigator.appName \n');
	imgwin.document.write('\t\t if (name == \'Microsoft Internet Explorer\') {  \n');
	imgwin.document.write('\t\t\t myHeight = eval(pic).height + 40; myWidth = eval(pic).width + 12; \n');
	imgwin.document.write('\t\t } else { \n');
	imgwin.document.write('\t\t\t myHeight = eval(pic).height + 9; myWidth = eval(pic).width; \n');
	imgwin.document.write('\t\t } \n');
	imgwin.document.write('\t\t clearTimeout(); \n');

	imgwin.document.write('\t\t self.resizeTo(myWidth, myHeight); \n');
	imgwin.document.write('\t }else { \n');
	imgwin.document.write('\t\t setTimeOut(resize(), 100) \n');
	imgwin.document.write('\t } \n');
	imgwin.document.write('} \n');
	imgwin.document.write('</sc'+'ript> \n');
	imgwin.document.write('</head> \n');
	imgwin.document.write('<body topmargin=\'0\' leftmargin=\'0\' marginheight=\'0\' marginwidth=\'0\' bgcolor=\'#FFFFFF\'> \n');
	imgwin.document.write('<img border=0 src='+what+' xwidth=100 xheight=9 name=il onload=\'resize();\' onClick=\'self.close();\' style=\'Cursor:hand\'> \n');
	imgwin.document.write('</body> \n');
	imgwin.document.close();
}
