
//이메일 체크
function CheckEmail(strText)
{
 if (strText.match(/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+.[a-zA-Z.]+$/))
 {
  return true;
 }
 else
 {
  return false;
 }
}

//파일 다운로드

function FileDown(file,realName){

	if(file.length > 1)
		location.href="/chungam/servlet/dwFile?filename="+encodeURI(file)+"&realName="+encodeURI(realName);
}


function FileDown2(file,realName){

	if(file.length > 1) {
		//location.href="/chungam/servlet/dwFile?filename="+encodeURI(file)+"&realName="+encodeURI(realName);
		location.href = "/asia/research/download.jsp?filename=" + encodeURI(file);
	}
}

	// 2010 new
	function downLoad(path,filename){
	/*
		var frm = document.downForm;
		frm.path.value = path;
		frm.filename.value = filename;
		frm.action = "/2010/application/download.jsp"
		frm.method = "get";
		frm.tager = "hiddenFrm";
		frm.submit();
	*/
		location.href = path + filename;
	}
	

function img_resize(frm,x,y){

	var imgInfo = new Image();
	imgInfo.src = document.getElementById(frm).src;

	var img_x = imgInfo.width;
	var img_y = imgInfo.height;
	var img_basex = x;
	var img_basey = y;
	var modbase;


	if(img_x >= img_y){
		if(img_x > img_basex){
		 modbase = img_basex / img_x ;
			img_x = img_x * modbase;
		
		 if(img_y > img_basey)
		  img_y = img_y * modbase;
	 }


	}else if (img_x < img_y){    //이미지 사이즈가 세로형이라면
	
	
	 if(img_y > img_basey){
	  modbase = img_basey / img_y ;
	   img_y = img_y * modbase;
	  if(img_x > img_basex){
	   img_x = img_x * modbase;
	 }
	}
 

}

document.getElementById(frm).width = img_x;
document.getElementById(frm).height = img_y;

}

	function img_resize2(frm,x){

		var imgInfo = new Image();
		imgInfo.src = document.getElementById(frm).src;
		
		//alert(imgInfo.width);
		
		var img_x = imgInfo.width;
		var img_y = imgInfo.height;
		var img_basex = x;
		var modbase;
	
		 if(img_x > img_basex){
		 	modbase = img_basex / img_x ;
		 	img_x = img_x * modbase;
		 	img_y = img_y * modbase;
		 }
	 
		document.getElementById(frm).width = img_x;
		document.getElementById(frm).height = img_y;
	}


/*
파일 확장자 체크
*/
extArray = new Array(".php", ".php3", ".php5",".phtml",".asp",".aspx",".jsp",".cfm",".pl",".bat",".exe",".dll",".reg",".cgi",".html",".htm",".js",".sh",".com");

function LimitAttach(file) {
var allowSubmit = true;

	if (!file) return true;

	while (file.indexOf("\\") != -1)
		file = file.slice(file.indexOf("\\") + 1);
		
	ext = file.slice(file.indexOf(".")).toLowerCase();
		
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) { allowSubmit = false; break; }
	}

	return allowSubmit;
}

/************************************************************
* Popup Script 시작 
************************************************************/


//  화면 정중앙에 POPUP WINODOW OPEN

function popCwin( url, name, w, h, scroll) {

  var wl = (window.screen.width/2) - ((w/2) + 10);
  var wt = (window.screen.height/2) - ((h/2) + 50);

  var option = "height="+h+",width="+w+",left="+wl+",top="+wt+",screenX="+wl+",screenY="+wt+",scrollbars="+scroll + ", status=yes";

  commonPopWin = window.open( url, name, option );
  commonPopWin.focus();
}

// 원하는 위치에 POPUP WINODOW OPEN

function popUwin( url, name, w, h, wl, wt, scroll,r) {

  var option = "status=no,height="+h+",width="+w+",left="+wl+",top="+wt+",screenX="+wl+",screenY="+wt+",scrollbars="+scroll+",resizable="+r;

  commonPopWin = window.open( url, name, option );
  commonPopWin.focus();
}

/************************************************************
* Popup Script 끝
************************************************************

/****************************************
	file download  시작
****************************************/
function fldown(URL){
	document.all.filedownload.src=URL;
}

/****************************************
	file download  끝 
****************************************/

function fileDownload(sname,rname){
	var frm = document.filedLoadForm;
	frm.sname.value=sname;
	frm.rname.value=rname;
	frm.method="post";
	frm.target = "filedown";
	frm.action = "/2010/common/download.jsp";
	frm.submit();
}






