document.domain = 'bizfree.kr';
// Created : click2copy() by trauma2u in 20090306
var app;
switch( navigator.appName ) {
case "Microsoft Internet Explorer" :
app = "ie";
break;
case "Netscape" :
app = "ns";
break;
}
function bluring() {
try {
if( event.srcElement.tagName.toUpperCase() == "A" || event.srcElement.tagName.toUpperCase() == "IMG" || event.srcElement.type == "radio" || event.srcElement.type == "checkbox" || event.srcElement.type == "image" ) {
document.body.focus();
}
}
catch(e) {}
}
function show_layer( chk, layerid ) {
var layer = document.getElementById( layerid );
if( chk ) layer.style.display = "";
else layer.style.display = "none";
}
function show_layer_yn( val, layerid ) {
var layer = document.getElementById( layerid );
if( val == "n" ) layer.style.display = "none";
else if( val == "y" ) layer.style.display = "";
}
function show_layer_no_chk( layerid ) {
var layer = document.getElementById( layerid );
if( layer.style.display == "none" ) layer.style.display = "";
else layer.style.display = "none";
}
function load_flash( src, w, h, id ) {
if( typeof( id ) == "undefined" ) id = "";
html = '';
html += '';
document.writeln( html );
}
function defense_null() {
if( event.keyCode == 32 ) event.returnValue = false;
}
function only_number() {
var rtn = false;
if( !event.shiftKey ) {
if( event.keyCode >= 33 && event.keyCode <= 40 ) rtn = true;
if( event.keyCode >= 48 && event.keyCode <= 57 ) rtn = true;
if( event.keyCode >= 96 && event.keyCode <= 105 ) rtn = true;
if( event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 13 || event.keyCode == 46 ) rtn = true;
}
if( rtn ) {
return;
}
else{
event.returnValue = false;
}
}
//okj üũ¹Ú½º Ŭ¸¯½Ã Àüü ¼±ÅÃ, ÇØÁ¦. ÀÌ¹Ì ¸¸µé¾îÁø°Í. ÁÖ¼®¸¸ ó¸®
function check_all( form, chk ) {
if( chk == true ) {
for( var i = 0; i < form.length; i++ ) {
if( form[i].type == "checkbox" && form[i].checked == false ) {
form[i].checked = true;
}
}
}
else {
for( var i = 0; i < form.length; i++ ) {
if( form[i].type == "checkbox" && form[i].checked == true ) {
form[i].checked = false;
}
}
}
}
function check_all_with_name( form, name, chk ) {
if( chk == true ) {
for( var i = 0; i < form.length; i++ ) {
if( form[i].type == "checkbox" && form[i].name == name && form[i].checked == false ) {
form[i].checked = true;
}
}
}
else {
for( var i = 0; i < form.length; i++ ) {
if( form[i].type == "checkbox" && form[i].name == name && form[i].checked == true ) {
form[i].checked = false;
}
}
}
}
function script_src( url ) {
var scripts = document.createElement( "SCRIPT" );
document.body.appendChild( scripts );
scripts.src = url;
}
function get_query_from_form( form ) {
var rtn = "";
rtn += "&form_name=" + form.name;
for( var i = 0; i < form.length; i++ ) {
if( !form[i].name ) continue;
switch( form[i].type ) {
case "checkbox" :
case "radio" :
if( form[i].checked ) rtn += "&" + form[i].name + "=" + encodeURIComponent( form[i].value );
break;
case "select-one" :
if( form[i].selectedIndex >= 0 ) {
rtn += "&" + form[i].name + "=" + encodeURIComponent( form[i][form[i].selectedIndex].value );
}
break;
default :
rtn += "&" + form[i].name + "=" + encodeURIComponent( form[i].value );
break;
}
}
return rtn;
}
function trim( str ) {
return str.replace( /(^\s*)|(\s*$)/g, "" );
}
function form_var_chk( form, form_name, form_val ) {
var obj = form.elements[form_name];
var chk = false;
var obj_type;
if( typeof( obj ) == "object" ) {
if( obj.type == undefined ) obj_type = "radio";
else obj_type = obj.type;
switch( obj_type ) {
case "text" :
case "textarea" :
case "password" :
case "hidden" :
if( obj.value == form_val ) chk = true;
break;
case "checkbox" :
if( obj.checked && obj.value == form_val ) chk = true;
break;
case "radio" :
if( typeof( obj.length ) == "number" ) {
for( var i = 0; i < obj.length; i++ ) {
if( obj[i].checked && obj[i].value == form_val ) chk = true;
}
}
else {
if( obj.checked && obj.value == form_val ) chk = true;
}
break;
case "select-one" :
if( obj[obj.selectedIndex].value == form_val ) chk = true;
break;
}
}
return chk;
}
function form_empty_chk( form, form_name, msg, target_form_name ) {
if( msg == null ) msg = "";
if( target_form_name == null ) target_form_name = "";
var obj = form.elements[form_name];
var obj_target = target_form_name ? form.elements[target_form_name] : null;
var chk = false;
var focus = false;
var select = false;
var obj_type;
if( typeof( obj ) == "object" || typeof( obj ) == "function" ) {
if( obj.type == undefined ) obj_type = "radio";
else obj_type = obj.type;
switch( obj_type ) {
case "text" :
case "textarea" :
obj.value = trim( obj.value );
if( obj.value != "" ) chk = true;
focus = true;
break;
case "password" :
obj.value = trim( obj.value );
if( obj.value != "" ) chk = true;
select = true;
break;
case "checkbox" :
if( obj.checked ) chk = true;
break;
case "radio" :
if( typeof( obj.length ) == "number" ) {
for( var i = 0; i < obj.length; i++ ) {
if( obj[i].checked ) chk = true;
}
}
else {
if( obj.checked ) chk = true;
}
break;
case "select-one" :
if( obj.selectedIndex > 0 ) chk = true;
focus = true;
break;
case "hidden" :
obj.value = trim( obj.value );
if( obj.value != "" ) chk = true;
break;
}
}
if( chk == true ) {
return true;
}
else {
if( msg ) alert( msg );
if( focus ) obj.focus();
if( select ) obj.select();
if( obj_target ) obj_target.focus();
return false;
}
}
function form_length_chk( form, form_name, msg, min, max ) {
if( msg == null ) msg = "";
if( min == null ) min = 0;
if( max == null ) max = 0;
var obj = form.elements[form_name];
var chk = true;
var focus = false;
var select = false;
if( typeof( obj ) == "object" ) {
switch( obj.type ) {
case "text" :
case "textarea" :
obj.value = trim( obj.value );
if( min && obj.value.length < min ) chk = false;
if( max && obj.value.length > max ) chk = false;
focus = true;
break;
case "password" :
obj.value = trim( obj.value );
if( min && obj.value.length < min ) chk = false;
if( max && obj.value.length > max ) chk = false;
select = true;
break;
}
}
if( chk == true ) {
return true;
}
else {
if( msg ) alert( msg );
if( focus ) obj.focus();
if( select ) obj.select();
return false;
}
}
function form_regexp_chk( form, form_name, msg, regexp ) {
if( msg == null ) msg = "";
if( regexp == null ) regexp = "";
var obj = form.elements[form_name];
var chk = false;
var focus = false;
var select = false;
if( typeof( obj ) == "object" && regexp ) {
var re = new RegExp( regexp, "g" );
switch( obj.type ) {
case "text" :
case "textarea" :
obj.value = trim( obj.value );
if( obj.value.match( re ) ) chk = true;
focus = true;
break;
case "password" :
obj.value = trim( obj.value );
if( obj.value.match( re ) ) chk = true;
select = true;
break;
}
}
if( chk == true ) {
return true;
}
else {
if( msg ) alert( msg );
if( focus ) obj.focus();
if( select ) obj.select();
return false;
}
}
//okj ºñ¹Ð¹øÈ£ ¿µ¹®´ë¼Ò¹®ÀÚ, ¼ýÀÚÆ÷ÇÔ È®ÀÎ
function form_passwd_chk(pwdval){
var chk_pwdinput =/^(?=.{6,16})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).*$/g;
var chk_pwdval = chk_pwdinput.test(pwdval);
return chk_pwdval;
}
function form_same_chk( form, form_name1, form_name2, msg ) {
if( msg == null ) msg = "";
var obj1 = form.elements[form_name1];
var obj2 = form.elements[form_name2];
var chk = false;
var focus = false;
var select = false;
if( typeof( obj1 ) == "object" && typeof( obj2 ) == "object" ) {
if( obj1.type == obj2.type ) {
switch( obj1.type ) {
case "text" :
case "textarea" :
obj1.value = trim( obj1.value );
obj2.value = trim( obj2.value );
if( obj1.value == obj2.value ) chk = true;
focus = true;
break;
case "password" :
obj1.value = trim( obj1.value );
obj2.value = trim( obj2.value );
if( obj1.value == obj2.value ) chk = true;
select = true;
break;
}
}
}
if( chk == true ) {
return true;
}
else {
if( msg ) alert( msg );
if( focus ) obj2.focus();
if( select ) obj2.select();
return false;
}
}
function make_target( targetName ) {
if( targetName == null ) targetName = "_mySubmitFrame";
var oIFRAME = document.createElement( "IFRAME" );
oIFRAME.name = targetName;
oIFRAME.id = targetName;
oIFRAME.style.display = "none";
document.body.appendChild( oIFRAME );
return targetName;
}
function exe_submit( frmObj ) {
if( app == "ie" ) {
var oIFRAME = document.createElement( "" );
}
else {
var oIFRAME = document.createElement( "IFRAME" );
oIFRAME.name = "_mySubmitFrame";
oIFRAME.id = "_mySubmitFrame";
oIFRAME.style.display = "none";
}
document.body.appendChild( oIFRAME );
frmObj.target = '_mySubmitFrame';
frmObj.submit();
}
function exe_onsubmit(frmObj) {
frmObj.target = make_target();
}
String.prototype.url_encode = function url_encode() {
var SAFECHARS = "0123456789" + // Numeric
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
"abcdefghijklmnopqrstuvwxyz" +
"-_.!~*'()"; // RFC2396 Mark characters
var HEX = "0123456789ABCDEF";
var plaintext = this;
var encoded = "";
for( var i = 0; i < plaintext.length; i++ ) {
var ch = plaintext.charAt( i );
if( ch == " " ) {
encoded += "+"; // x-www-urlencoded, rather than %20
}
else if( SAFECHARS.indexOf( ch ) != -1 ) {
encoded += ch;
}
else {
var charCode = ch.charCodeAt( 0 );
if( charCode > 255 ) {
/*
alert( "Unicode Character '"
+ ch
+ "' cannot be encoded using standard URL encoding.\n" +
"(URL encoding only supports 8-bit characters.)\n" +
"A space (+) will be substituted." );
encoded += "+";
*/
encoded += ch;
}
else {
encoded += "%";
encoded += HEX.charAt( ( charCode >> 4 ) & 0xF );
encoded += HEX.charAt( charCode & 0xF );
}
}
} // for
return encoded;
};
String.prototype.url_decode = function url_decode() {
var HEXCHARS = "0123456789ABCDEFabcdef";
var encoded = this;
var plaintext = "";
var i = 0;
while( i < encoded.length ) {
var ch = encoded.charAt( i );
if( ch == "+" ) {
plaintext += " ";
i++;
}
else if( ch == "%" ) {
if( i < ( encoded.length - 2 )
&& HEXCHARS.indexOf( encoded.charAt( i + 1 ) ) != -1
&& HEXCHARS.indexOf( encoded.charAt( i + 2 ) ) != -1 ) {
plaintext += unescape( encoded.substr( i, 3 ) );
i += 3;
}
else {
alert( 'Bad escape combination near ...' + encoded.substr( i ) );
plaintext += "%[ERROR]";
i++;
}
}
else {
plaintext += ch;
i++;
}
} // while
return plaintext;
};
function sess_var_set( name, value ) {
script_src( "/js/set_session.php?name=" + name + "&value=" + value );
return;
}
function make_form( name, method, target, action ) {
var oForm = document.createElement( "FORM" );
oForm.style.display = "none";
if( name ) oForm.name = name;
if( method ) oForm.method = method;
if( target ) oForm.target = target;
if( action ) oForm.action = action;
document.body.appendChild( oForm );
return oForm;
}
function make_elements( oForm, type, name, value ) {
var oInput = document.createElement( "INPUT" );
oInput.type = type;
oInput.name = name;
oInput.value = value;
//oForm.insertBefore( oInput );
oForm.appendChild( oInput );
}
function download( dir, file ) {
var oForm = make_form( "", "post", "", "/download/download.html" );
make_elements( oForm, "hidden", "dir", dir );
make_elements( oForm, "hidden", "file", file );
exe_submit( oForm );
}
function show_whois( domain ) {
var url = "http://whoisdomain.kr/whois/?domain=" + domain;
var whois_win = window.open( url, "whois_win", "width=100, height=100" );
whois_win.focus();
}
function inner_html( layer_name, html ) {
var layer = document.getElementById( layer_name );
if( layer ) layer.innerHTML = html;
}
function click2copy(txt) {
if( window.clipboardData ) {
return window.clipboardData.setData('Text', txt);
}
}
function setPng24(obj) {
obj.width=obj.height=1;
obj.className=obj.className.replace(/\bpng24\b/i,'');
obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
obj.src='';
return '';
}
function pop_coupon() {
var url = '/common2/pop_coupon.html';
var win_coupon = window.open(url, 'win_coupon', 'width=680 ,height=700, top=100, left=200, scrollbars=yes');
win_coupon.focus();
}
function apiguidePOP(uri) {
if( uri != "")
window.open(uri,"","scrollbars=yes, menubar=no, statusbar=no, width=440, height=600, top=150, left=200" );
}
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 "";
}