// enter check
function submitCheck(form)
{
	if(event.keyCode==13)
	{
		login_check(form);
	}
}


// notice popup
function WindowOpen_middle(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// window center
function WindowOpen(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	if (myname == 'lost'){ window.close();}
}
/*
// postcode window
function zipwindow(ref,what){ 
	var window_left = (screen.width - 640) / 2; 
	var window_top = (screen.heigth - 480) / 2; 
	if(what=="5" || what=="6")
		ref = ref + '&what=' + what; 
	else		
		ref = ref + '?what=' + what; 
	window.open(ref,'','width=416, height=210, status=yes, scrollbars=yes, top=' + window_top + ',left=' + window_left + ''); 
}
*/

// cookie check
function setCookie( name, value, expiredays ){
  var todayDate = new Date();
  todayDate.setDate( todayDate.getDate() + expiredays );
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}


function getCookie( name ){
  var nameOfCookie = name + "=";
  var x = 0;
  while ( x <= document.cookie.length ){
	var y = (x+nameOfCookie.length);
	if ( document.cookie.substring( x, y ) == nameOfCookie ) {
	  if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
		endOfCookie = document.cookie.length;
	  return unescape( document.cookie.substring( y, endOfCookie ) );
	}
	x = document.cookie.indexOf( " ", x ) + 1;
	if ( x == 0 )
	  break;
  }
  return "";
}


// xp2 check
function chk_sp2()
{    
	tmp_MSIE = window.navigator.userAgent.indexOf("MSIE");
	if(tmp_MSIE && window.navigator.userAgent.indexOf("SV1") > tmp_MSIE){   
		//This browser is Internet Explorer with SP2.   
		return true; 
	} else {
		//This browser is not Internet Explorer with SP2.
		return false;
	}
}


// popup open check
function chk_popup_open(obj)
{
	if(obj==null)		return true;
	else				return false;
}


// credit settlement sp2 check 
function chk_sp2_credit(payfeewindow)
{
	if(chk_sp2() && chk_popup_open(payfeewindow))
	{
		parent.document.all.submitIngImage.style.display = "none";
		parent.document.all.submitCreditImage.style.display = "block";

		alert("popup break");
		return;
	}
	else
	{
	    cardpayment.submit();
		payfeewindow.focus();
	}

}


// agree form download
function down_form(mode)
{
	if(mode=="1")			file = "entrance.doc";
	else if(mode=="2")	file = "entrance.hwp";
	else						return;

	if(typeof(document.all.down_hidden_frame)!="object")
	{
		var frame_str = "<iframe name='down_hidden_frame' style='display:none' src='/blank.php'></iframe>";
		var frame_obj = document.createElement(frame_str);		
		down_hidden_zone.insertAdjacentElement('BeforeEnd', frame_obj);
	}

	down_hidden_frame.location.href = "down.php?data=" + file;
}




// new window
function winOpen_b(url, width, height)
{
	//scroll = (scroll) ? scroll : "no";
	scrolls = "no";
	var property = "width=" + width + ", height=" + height + ", toolbars=no, menubar=no, scrollbars=" + scrolls + ", top=0, left=0";

	window.open(url, '', property);

}


document.write("<div id='down_hidden_zone'><iframe name='down_hidden_frame' style='display:none' src='/blank.php'></iframe></div>");
