var errmsg = ""; 
var errfld; 

function check_field(fld, msg) 
{ 
if ((fld.value = trim(fld.value)) == "") 
error_field(fld, msg); 
else 
clear_field(fld); 
return; 
} 

function error_field(fld, msg) 
{ 
if (msg != "") 
errmsg += msg + "\n"; 
if (!errfld) errfld = fld; 
fld.style.background = "#BDDEF7"; 
} 

function clear_field(fld) 
{ 
fld.style.background = "#FFFFFF"; 
} 

function trim(s) 
{ 
var t = ""; 
var from_pos = to_pos = 0; 

for (i=0; i<s.length; i++) 
{ 
if (s.charAt(i) == ' ') 
continue; 
else 
{ 
from_pos = i; 
break; 
} 
} 

for (i=s.length; i>=0; i--) 
{ 
if (s.charAt(i-1) == ' ') 
continue; 
else 
{ 
to_pos = i; 
break; 
} 
} 

t = s.substring(from_pos, to_pos); 
return t; 
} 

function number_format(data) 
{ 

var tmp = ''; 
var number = ''; 
var cutlen = 3; 
var comma = ','; 
var i; 

len = data.length; 
mod = (len % cutlen); 
k = cutlen - mod; 
for (i=0; i<data.length; i++) 
{ 
number = number + data.charAt(i); 

if (i < data.length - 1) 
{ 
k++; 
if ((k % cutlen) == 0) 
{ 
number = number + comma; 
k = 0; 
} 
} 
} 

return number; 
} 

function popup_window(url, winname, opt) 
{ 
window.open(url, winname, opt); 
} 


function popup_formmail(url) 
{ 
opt = 'scrollbars=yes,width=417,height=385,top=10,left=20'; 
popup_window(url, "wformmail", opt); 
} 

function popup_large_image(wai_id, img, width, height, shop_dir) 
{ 
var top = 10; 
var left = 10; 
url = "./?recode="+shop_dir+"/largeimage.php&wai_id=" + wai_id + "&img=" + img; 
width = width + 50; 
height = height + 70; 
opt = 'scrollbars=yes,width='+width+',height='+height+',top='+top+',left='+left; 
popup_window(url, "largeimage", opt); 
} 

function no_comma(data) 
{ 
var tmp = ''; 
var comma = ','; 
var i; 

for (i=0; i<data.length; i++) 
{ 
if (data.charAt(i) != comma) 
tmp += data.charAt(i); 
} 
return tmp; 
} 

function del(href) 
{ 
if(confirm("ÇÑ¹ø »èÁ¦ÇÑ ÀÚ·á´Â º¹±¸ÇÒ ¹æ¹ýÀÌ ¾ø½À´Ï´Ù.\n\nÁ¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) 
document.location.href = href; 
} 

function set_cookie(name, value, expirehours) 
{ 
var today = new Date(); 
today.setTime(today.getTime() + (60*60*1000*expirehours)); 
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"; 
} 

function get_cookie(name) 
{ 
var find_sw = false; 
var start, end; 
var i = 0; 

for (i=0; i<= document.cookie.length; i++) 
{ 
start = i; 
end = start + name.length; 

if(document.cookie.substring(start, end) == name) 
{ 
find_sw = true 
break 
} 
} 

if (find_sw == true) 
{ 
start = end + 1; 
end = document.cookie.indexOf(";", start); 

if(end < start) 
end = document.cookie.length; 

return document.cookie.substring(start, end); 
} 
return ""; 
} 

function delete_cookie(name) 
{ 
var today = new Date(); 

today.setTime(today.getTime() - 1); 
var value = getCookie(name); 
if(value != "") 
document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString(); 
} 

function popup_zip(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2, dir, top, left) 
{ 
url = './?filetype='+dir+'/mbzip.php&frm_name='+frm_name+'&frm_zip1='+frm_zip1+'&frm_zip2='+frm_zip2+'&frm_addr1='+frm_addr1+'&frm_addr2='+frm_addr2; 
opt = 'scrollbars=yes,width=417,height=250,top='+top+',left='+left; 
window.open(url, "mbzip", opt); 
} 

function winopen(url, name, option) 
{ 
window.open(url, name, option); 
return ; 
} 

function textarea_size(fld, size) 
{ 
var rows = parseInt(fld.rows); 

rows += parseInt(size); 
if (rows > 0) { 
fld.rows = rows; 
} 
} 

var old=''; 
function menu(name){ 

submenu=eval(name+".style"); 

if (old!=submenu) 
{ 
if(old!='') 
{ 
old.display='none'; 
} 
submenu.display='block'; 
old=submenu; 
} 
else 
{ 
submenu.display='none'; 
old=''; 
} 
} 

function image_window(img, w, h) 
{ 
var tmp_w = w; 
var tmp_h = h; 
winl = (screen.width-w)/2; 
wint = (screen.height-h)/3; 

if (w >= screen.width) { 
winl = 0; 
w = screen.width - 10; 
h = (parseInt)(w * (h / w)); 
} 

if (h >= screen.height) { 
wint = 0; 
h = screen.height - 80; 
w = (parseInt)(h * (w / h)); 
} 

var settings ='width='+w+','; 
settings +='height='+h+','; 
settings +='top='+wint+','; 
settings +='left='+winl+','; 
settings +='scrollbars=no,'; 
settings +='resizable=no,'; 
settings +='status=no'; 

win=window.open("","newWindow",settings); 
win.document.open(); 
win.document.write ("<html><head><meta http-equiv='content-type' content='text/html; charset=euc-kr'>"); 
win.document.write ("<title>ÀÌ¹ÌÁö º¸±â</title></head>"); 
win.document.write ("<body leftmargin=0 topmargin=0>"); 
win.document.write ("<img src='"+img+"' width='"+w+"' height='"+h+"'border=0 onclick='window.close();' style='cursor:hand'>"); 
win.document.write ("</body></html>"); 
win.document.close(); 

if(parseInt(navigator.appVersion) >= 4){win.window.focus();} 
} 

function flash_movie(src, ids, width, height, wmode) 
{ 
return "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width="+width+" height="+height+" id="+ids+"><param name=wmode value="+wmode+"><param name=movie value="+src+"><param name=quality value=high><embed src="+src+" quality=high wmode="+wmode+" type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?p1_prwao_version=shockwaveflash' width="+width+" height="+height+"></embed></object>"; 
} 

function recowad_write(cont) 
{ 
document.write(cont); 
} 






