/*
	Developer : Lee,Young-Hwa
*/

function smallWindow(name,value,width,height,scroll)
{
	url = name+"?value="+value;
	myWindow = window.open(url,"thewindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scroll+",resizable=0,copyhistory=0,width="+width+",height="+height+"");
}

function smallWindow_apply(name,value,width,height,scroll)
{
	url = name+"?value="+value+"&type=apply";
	myWindow = window.open(url,"thewindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scroll+",resizable=0,copyhistory=0,width="+width+",height="+height+"");
}

function smallWindow_(url,width,height,scroll)
{
	myWindow = window.open(url,"thewindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scroll+",resizable=0,copyhistory=0,width="+width+",height="+height+"");
}

function sideWindow(name,mode,sub)
{
	url = name+"?mode="+mode+"&sub="+sub;
	myWindow = window.open(url,"thewindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,copyhistory=0,width=450 ,height=200");
}

function imageSubmit(formName)
{
	formName.submit();
	return false;
}

function changePage(formName)
{
	var item = formName.selectedIndex;
	self.location = formName.options[item].value;
	formName.selectedIndex = 0;
}
function validsNO(value)
{
	var weight = new Array(2,3,4,5,6,7,8,9,2,3,4,5);
	var weightedValue = 0;
	var yoliswa;
	var checkValue = 0;
	var buffer = value;
	var validation;

	for (temp = 0; temp < buffer.length-1; temp++) {
		yoliswa = Number(weight[temp])*Number(buffer.charAt(temp));
		weightedValue += yoliswa;
	}

	checkValue = (11-weightedValue%11)%10;

	if (checkValue == Number(buffer.charAt(buffer.length-1))) {
		return validation = true;
	}
	else {
		window.alert("정확한 주민등록번호가 아닙니다.");
		return validation = false;
	}
}

function sNOcheck(form,value,url,width,height,scroll)
{
	var buffer = value;
	if (buffer.length > 0 && buffer.length == 13) {
		for(temp = 0; temp < buffer.length-1; temp++) {
			compareValue = buffer.charAt(temp)-1;
			if (compareValue >= -1 && compareValue <= 8) {
				var flag = 1;
			}
			else {
				var flag = 0;
			}
		}
	}
	else {
		var flag=0;
	}

	if (flag == 1 && validsNO(value) == true) {
		smallWindow(url,value,width,height,scroll);
	}
	else if (flag == 0 || validsNO(value) == false) {
		window.alert("정확한 주민등록번호가 아닙니다.");
		form.sNO1.focus();
	}
}

