function checkRadio(check){
	var radio= check;
	var val='';
		for(var i = 0;  i < radio.length; i++) { 
			if(radio[i].checked == true) {
				val=radio[i].value;
			}
        } 
		return val;   
}

function checkBox(check){	
	var radio= check;
	var val='';
	if(radio.length==undefined){
		if(radio.checked==true) 
			val=radio.value;
	}else{
		for(var i = 0;  i < radio.length; i++) { 
			if(radio[i].checked == true) {				
				if(i!=0) val+=',';
				val += radio[i].value;
			}
        } 
	}
	return val;   
}

function checkNumber(check){
	var val 	= document.getElementById(check);
	if(val.value.length==0){
		return false;
	}
	for(var i=0;i < val.value.length;i++){
		var chr 	= val.value.substr(i,1);
		if(chr < '0' || chr > '9'){
			return false;
		}
	}

	return true;
}

function adminorderSearch(url){
	document.form1.action=url;
	document.form1.submit();
}

<!--이미지 자동 띄우기 팝업 시작 -->
function Img_newview(filename)
{
     var widths=100;    // 가로
     var heights=100;  // 세로
     var winl = (screen.width-widths)/2;
     var wint = (screen.height-heights)/2 - 25 ;// title 바 크기;
     window.open("../../inc/PhotoView_Name.asp?FileName="+escape(filename),"_blank","scrollbars=1,toolbar=no, resize=yes, status=no,menubar=no,width="+widths+",height="+heights+",left="+winl+",top="+wint)
}
<!--이미지 자동 띄우기 팝업 끝 -->


/*************************************************************************************
* 이미지 리사이즈 팝업
* 사용법 javascript:imgResize(이미지경로)
**************************************************************************************/
function imgResize(img){ 
  img1= new Image(); 
  img1.src=(img); 
  imgControll(img); 
} 
function imgControll(img){ 
  if((img1.width!=0)&&(img1.height!=0)){ 
    viewImage(img); 
  } 
  else{ 
    controller="imgControll('"+img+"')"; 
    intervalID=setTimeout(controller,20); 
  } 
} 
function viewImage(img){ 
    W=img1.width; 
    H=img1.height; 
    O="width="+W+",height="+H; 
    imgWin=window.open("","",O); 
    imgWin.document.write("<html><head><title>Imgage Popup</title></head>");
    imgWin.document.write("<body topmargin=0 leftmargin=0>");
    imgWin.document.write("<img src="+img+" onclick='self.close()' style=cursor:hand>");
    imgWin.document.close();
} 

function windowPop(url,w,h)
{
	if(w=='' && h=='') window.open(url,"",''); 
	else window.open(url,"",'width='+w+',height='+h); 
}

/***************************************************************************************************
*메뉴관련 스크립트
***************************************************************************************************/
var menu='F';
function MenuSetting(m1,m2,type,t1,t2){
	if(menu=='T'){
		var menuImg='';
		var menuImg2='';
		if(type==1){
			for(i=0;i<t1;i++){		
				menuImg=document.getElementById('mTopimg'+i).src;
				if(i==m1){
					dis='';				
					menuImg=menuImg.replace('0_','1_');
				}else{
					dis='none';
					menuImg=menuImg.replace('1_','0_');
				}
				document.getElementById('mTopimg'+i).src=menuImg;
				document.getElementById('TopSubMenu'+i).style.display=dis;			
			}		
		}
		if(type==2){
			for(j=0;j<t2;j++){
				menuImg2=document.getElementById('mSubimg'+j).src;
				if(j==m2){
					menuImg2=menuImg2.replace('0_','1_');
				}else{
					menuImg2=menuImg2.replace('1_','0_');
				}
				document.getElementById('mSubimg'+j).src=menuImg2;		
			}
		}
	}
}

function MenuSettingOut(m1,m2,t1,t2,type){
	if(type==1){
		for(i=0;i<t1;i++){		
			menuImg=document.getElementById('mTopimg'+i).src;
			if(i==m1 &&m1!=''){
				dis='';				
				menuImg=menuImg.replace('0_','1_');

			}else{
				dis='none';
				menuImg=menuImg.replace('1_','0_');
			}
			document.getElementById('mTopimg'+i).src=menuImg;
			document.getElementById('TopSubMenu'+i).style.display=dis;			
		}
		for(j=0;j<t2;j++){
			menuImg2=document.getElementById('mSubimg'+j).src;
			if(j==m2 &&m2!=''){
				menuImg2=menuImg2.replace('0_','1_');
			}else{
				menuImg2=menuImg2.replace('1_','0_');
			}
			document.getElementById('mSubimg'+j).src=menuImg2;		
		}
	}
}

function topSerch(){
	if(document.searchForm.search.value==''){
		alert('검색값을 입력해주세요');
		document.searchForm.search.focus();
		return;
	}
	document.searchForm.submit();
}

/****************mou 협약div팝업띄우기***********/
function chkAjaBrowser()
{
	var a,ua = navigator.userAgent;
	this.bw= { 
	  safari    : ((a=ua.split('AppleWebKit/')[1])?a.split('(')[0]:0)>=124 ,
	  konqueror : ((a=ua.split('Konqueror/')[1])?a.split(';')[0]:0)>=3.3 ,
	  mozes     : ((a=ua.split('Gecko/')[1])?a.split(" ")[0]:0) >= 20011128 ,
	  opera     : (!!window.opera) && ((typeof XMLHttpRequest)=='function') ,
	  msie      : (!!window.ActiveXObject)?(!!createHttpRequest()):false 
	}
	return (this.bw.safari||this.bw.konqueror||this.bw.mozes||this.bw.opera||this.bw.msie)
}

function createHttpRequest()
{
	if(window.ActiveXObject){
		 //Win e4,e5,e6용
		try {
			return new ActiveXObject("Msxml2.XMLHTTP") ;
		} catch (e) {
			try {
				return new ActiveXObject("Microsoft.XMLHTTP") ;
			} catch (e2) {
				return null ;
 			}
 		}
	} else if(window.XMLHttpRequest){
		 //Win Mac Linux m1,f1,o8 Mac s1 Linux k3용
		return new XMLHttpRequest() ;
	} else {
		return null ;
	}
} 

function sendRequest(callback,data,method,url,async,sload,user,password)
{
	//XMLHttpRequest 오브젝트 생성
	var oj = createHttpRequest();
	if( oj == null ) return null;
		
	//강제 로드의 설정
	var sload = (!!sendRequest.arguments[5])?sload:false;
	//브라우저 판정
	var bwoj = new chkAjaBrowser();
	var opera	  = bwoj.bw.opera;
	var safari	  = bwoj.bw.safari;
	var konqueror = bwoj.bw.konqueror;
	var mozes	  = bwoj.bw.mozes ;

	//참고 http://jsgt.org/ajax/ref/test/response/responsetext/try1.php
	if(opera || safari || mozes){
		oj.onload = function () { callback(oj); }
	} else {	
		oj.onreadystatechange =function () 
		{
			if ( oj.readyState == 4 ){
				callback(oj);
			}
		}
	}

	//URL 인코딩
	data = uriEncode(data)
	if(method.toUpperCase() == 'GET') {
		url += data
	}
	//open 메소드
	oj.open(method,url,async,user,password);

	//헤더 application/x-www-form-urlencoded 설정
	setEncHeader(oj)			
	//send 메소드
	oj.send(data);

	//URI 인코딩 헤더 설정
	function setEncHeader(oj){
		var contentTypeUrlenc = 'application/x-www-form-urlencoded; charset=EUC-KR';
		if(!window.opera){
			oj.setRequestHeader('Content-Type',contentTypeUrlenc);
		} else {
			if((typeof oj.setRequestHeader) == 'function')
				oj.setRequestHeader('Content-Type',contentTypeUrlenc);
		}	
		return oj
	}
	//URL 인코딩
	function uriEncode(data){
		if(data!=""){
			//&와=로 일단 분해해서 encode
			var encdata = '';
			var datas = data.split('&');
			for(i=1;i<datas.length;i++)
			{
				var dataq = datas[i].split('=');
				encdata += '&'+encodeURIComponent(dataq[0])+'='+encodeURIComponent(dataq[1]);
			}
		} else {
			encdata = "";
		}
		return encdata;
	}
	return oj
}


function selectMou(seq){
	var data="";
	data+="&seq="+seq;
	if (seq!="")	document.getElementById('d').style.display = "block";
	else	document.getElementById('d').style.display = "none";
	sendRequest(setMou,data,"POST",'/tools/selectMou.php',true,true);	
}

function setMou(oj) {	
	data=oj.responseText;	
	document.getElementById('mouContent').innerHTML=data;	

}
