function gpinAuth(return_url)
{
	wWidth = 360;
	wHight = 120;

	wX = (window.screen.width - wWidth) / 2;
	wY = (window.screen.height - wHight) / 2;
	var theForm = document.createElement("FORM");
	theForm.name = "ipin_form";
	theForm.action = "/g-pin/Sample-AuthRequest.asp";
	theForm.target = "gPinLoginWin"
	theForm.method = "POST";
	document.body.appendChild(theForm);

	// ÀÌµ¿ÆäÀÌÁö »ý¼º
	var input_return_url = document.createElement("INPUT");
	input_return_url.type = "HIDDEN";
	input_return_url.name = "action_url";
	input_return_url.value = return_url;
	theForm.appendChild(input_return_url);

	var gPinLoginWin = window.open("/G-PIN/gpin_blank.html", "gPinLoginWin", "toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHight);
	theForm.submit();

	// Request Page Call
	// var w = window.open("/g-pin/Sample-AuthRequest.asp", "gPinLoginWin", "directories=no,toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHight);
}

/*
* ´ÙÀÌ·ºÆ® ¸µÅ©.
*/
function ipin_open_get(href) {
	wWidth = 360;
	wHight = 120;
	wX = (window.screen.width - wWidth) / 2;
	wY = (window.screen.height - wHight) / 2;
	var w = window.open(href, "", "toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHight);

	return false;
}

/*
* À¥ ¹æÈ­º® ¶§¹®¿¡ ÆÄ¶ó¸ÞÅÍ·Î ±æ°³ ³Ñ¾î°¡´Â °æ¿ì¿¡ ¹®Á¦°¡ ÀÖ¾î¼­ POST°ªÀ¸·Î Àü´Þ ÇÕ´Ï´Ù.
*/
function ipin_open(href, return_url, sourceForm, enc_type) {
	wWidth = 360;
	wHight = 120;
	wX = (window.screen.width - wWidth) / 2;
	wY = (window.screen.height - wHight) / 2;
	var theForm = document.createElement("FORM");
	theForm.name = "ipin_form";
	theForm.action = href;
	theForm.target = "gPinLoginWin"
	theForm.method = "POST";
	document.body.appendChild(theForm);
	// ÀÌµ¿ÆäÀÌÁö »ý¼º
	var input_return_url = document.createElement("INPUT");
	input_return_url.type = "HIDDEN";
	input_return_url.name = "action_url";
	input_return_url.value = return_url;
	theForm.appendChild(input_return_url);

	// create form's child 
	// todo : radio type, checkbox type, select type input tag's not validate data.
	var grepForm = sourceForm ? sourceForm : document.frm;
	// type 
	var input_return_url;
	if ( enc_type ) {
		input_return_url = document.createElement("INPUT");
		input_return_url.type = "HIDDEN";
		input_return_url.name = "enctype";
		input_return_url.value = enc_type;
		theForm.appendChild(input_return_url);
	}

	for(var i=0; i < grepForm.elements.length; i++) {
		var isValidate = grepForm.elements[i] && grepForm.elements[i].name && grepForm.elements[i].value;
		
		if ( isValidate ) {
			switch( grepForm.elements[i].type.substring(0, 4).toUpperCase() ) {
				case "RADI" : 
				case "CHEC" : 
					if ( !grepForm.elements[i].checked )
						isValidate = false;
					break;
			}
		}

		if ( isValidate )  {
			input_return_url = document.createElement("INPUT");
			input_return_url.type = "HIDDEN";
			input_return_url.name = grepForm.elements[i].name;
			input_return_url.value = grepForm.elements[i].value;
			theForm.appendChild(input_return_url);
		}
	}

	var gPinLoginWin = window.open("/G-PIN/gpin_blank.html", "gPinLoginWin", "toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHight);
	theForm.submit();
}

//select check_realname_type check
function doClick_check_realname(element) {
	if ( element.value == "I") {
		document.getElementById("check_realname_type_r").style.display = "none";
		document.getElementById("check_realname_type_i").style.display = "";
	} else if ( element.value == "R" ) {
		document.getElementById("check_realname_type_r").style.display = "";
		document.getElementById("check_realname_type_i").style.display = "none";
	}
}
