function alert_emptych(pid,na){
	if(pid.value ==""){ alert(na + " Ç×¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä");	pid.focus(); return; }return 1;
}
function alert_emptych_radio(pid,na){		
	ii=0;	reval=""; 
	for(i=0;i<pid.length;i++){if(pid[i].checked == true){ii = pid[i].checked;reval=pid[i].value;}}
	if(ii ==0){alert(na + " Ç×¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä");	pid[0].focus();return;}return reval;	
}
function base_radio_value(pid){	ii=0;	reval=""; for(i=0;i<pid.length;i++){if(pid[i].checked == true){reval=pid[i].value;}}return reval;	}
function base_checkbox_value(pid){	ii=0;	reval=""; for(i=0;i<pid.length;i++){if(pid[i].checked == true){reval=reval+"^"+pid[i].value;}}return reval;	}
function base_try_radio(pid){
		try{	
			 base_radio_value(pid);
		} catch(e) { 
			return;
		}
}
function base_div_close(){
	document.all.item('base_loading_layer').style.top = -2000;
	document.all.item('base_loading_layer').style.visibility = 'hidden'; 
	document.all.item('base_trans_layer').style.visibility = 'hidden'; 
	document.all.item('base_trans_layer').style.height = 0; 
}
function base_div_loading(){	
	var winl = (screen.width ) / 2 -200 ;
	document.all.item('base_loading_layer').style.top = document.body.scrollTop +100;
	document.all.item('base_loading_layer').style.left = winl;
	document.all.item('base_loading_layer').style.visibility = 'visible'; 

	document.all.item('base_trans_layer').style.top = 0;
	document.all.item('base_trans_layer').style.left = 0;	
	document.all.item('base_trans_layer').style.height =document.body.scrollHeight +100;
	document.all.item('base_trans_layer').style.visibility = 'visible'; 
}
function base_div_trans(){	
	var winl = (screen.width ) / 2 -200 ;
	document.all.item('base_trans_layer').style.top = 0;
	document.all.item('base_trans_layer').style.left = 0;	
	document.all.item('base_trans_layer').style.height =document.body.scrollHeight +100;
	document.all.item('base_trans_layer').style.visibility = 'visible'; 
}
/* ÆË¾÷Ã¢ ¸¸µé±â*/
function windows_open(ref, what, window_width, window_height,s) {	
	if(what !="member_login" && s == "") s = ",scrollbars=yes";	
	if(window_width && window_height){
		var window_left = (screen.width-window_width)/2;
		var window_top = (screen.height-window_height)/2;
	}else{
		var window_left = 0;
		var window_top = 0;
		window_width = screen.width;
		window_height = screen.height;
		s = ",scrollbars=yes,menubar=yes,toolbar=yes,location=yes";
	}
	window.open(ref,what,'width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + s);//,status=no
}
window_xmiddle=0;
window_ymiddle=0;
function base_get_window_middle(iw,ih){
	var sw = screen.availWidth;
	var sh = screen.availHeight;
	
	if ( ih > sh - 30 ) ih = sh - 30;
	
	var window_xmiddle = ( sw - iw ) / 2;
	var window_ymiddle = ( sh - ih - 45 ) / 2;			
}
var actdivname = "";
function simpleajax_local_innerHtml(body){	
	document.getElementById(actdivname).innerHTML=body;
}

function FlashMainbody(Ftrans,wid,hei) {
	mainbody = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+ wid +"' height='"+ hei +"'>";
	mainbody += "<param name='movie' value='"+ Ftrans +"'>";
	mainbody += "<param name='quality' value='high'>";
	mainbody += "<param name='wmode' value='transparent'>";
	mainbody += "<param name='menu' value='false'>";
	mainbody += "<embed src='"+ Ftrans +"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ wid +"' height='"+ hei +"'></embed>"
	mainbody += "</object>";

	//document.body.innerHTML = mainbody;
	document.write(mainbody);
	return;
}
function FlashMainbody2(Ftrans,wid,hei,FlashVars,sname) {
    	
	mainbody = "<object id='"+sname+"'  classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='"+ wid +"' height='"+ hei +"'>";
	mainbody += "<param name='movie' value='"+ Ftrans +"'>";
	mainbody += "<param name='quality' value='high'>";
	mainbody += "<param name='wmode' value='transparent'>";
	mainbody += "<param name='FlashVars' value='"+ FlashVars +"'>";
	mainbody += "<param name='menu' value='false'>";
	mainbody += "<embed name='"+sname+"' src='"+ Ftrans +"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ wid +"' height='"+ hei +"'></embed>"
	mainbody += "</object>";

	//document.body.innerHTML = mainbody;
	document.write(mainbody);
	return;
}
function init_vars(){
}
extArray = new Array("gif", "jpg", "png", "jpeg");
function LimitAttach(file) {
	
	allowSubmit = false;
	if (!file) return;
	var cc= file.split(".");
	a = cc.length;
	ext = cc[a-1];
	
	
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) { allowSubmit = 1; break; }
	}
	
	if (allowSubmit) return 1;
	else	{
		alert("ÀÌ¹ÌÁö ÇüÅÂÀÇ ÆÄÀÏ¸¸ µî·Ï °¡´ÉÇÕ´Ï´Ù.(gif,jpg,png,jpeg)");
		return "2";
	}	
}
//ÆË¾÷°ü·Ã ¹× ÄíÅ°
function base_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	if (scrollbar == '0') {
		scrollbar_str = 'no';
	} else {
		scrollbar_str = 'yes';
	}
	if (resizable == '0') {
  		resizable_str = 'no';
	} else {
		resizable_str = 'yes';
	}	
	
	//window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
	window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}
function base_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 '';
}
function base_changenum(instring)                {
      var pnumresult="";
       for (ic=0; ic<instring.length; ic++)       {
          charpnum = instring.substr(ic,1);
          if (charpnum.charCodeAt(0) > 47 && charpnum.charCodeAt(0) < 58)          {
                     pnumresult = pnumresult + charpnum;
          }
       }
        return pnumresult;
} 
function base_commaSplit(srcNumber) {
var txtNumber = '' + srcNumber;
if (isNaN(txtNumber) || txtNumber == "") {
alert("¼ýÀÚ¸¸ ÀÔ·Â ÇÏ¼¼¿ä");
fieldName.select();
fieldName.focus();
}
else {
var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
var arrNumber = txtNumber.split('.');
arrNumber[0] += '.';
do {
arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
} while (rxSplit.test(arrNumber[0]));
if (arrNumber.length > 1) {
return arrNumber.join('');
}
else {
return arrNumber[0].split('.')[0];
      }
   }
}

/* ¿µ¹® ¼Ò¹®ÀÚ ¼ýÀÚ¸¸*/
function isID(id) 
{
  for (var i = 0; i < id.length; i++)
  {
		var chr = id.substr(i,1);
    if ((chr < '0' || chr > '9') && (chr < 'a' || chr > 'z')) 
    {
    	return false;
    }
	}
  return true;
}
/* °ø¹éÀÖ´ÂÁöÃ¼Å©*/
function isempty(id) 
{
  for (var i = 0; i < id.length; i++){
	var chr = id.substr(i,1);
    	if (chr ==" ") {return false;}
  }
  return true;
}
/* ¼ýÀÚ¸¸ Ã¼Å©*/
function isnum(id) 
{
  for (var i = 0; i < id.length; i++){
	var chr = id.substr(i,1);
	if(chr !=","){
	    	if ((chr < '0' || chr > '9') ) {
	    		return false;
	    	}
	}
  }
  return true;
}
var crybody="";
function cry_js(pid){
	return pid;
	// »ç¿ë±ÝÁö °£È¤ ¾Ë¼ö ¾ø´Â ¿¡·¯ »ý±è
	crybody="";
	for(i=0;i<=pid.length-1;i++){			
		c = pid.charAt(i);		
		ra = getnum(c);			
		crybody = crybody +","+ra;
	}
	return crybody;
}
function getnum(pidc){
	for(i2=0;i2<arrayn.length;i2++){
		if(arrayn[i2] == pidc) return i2;			
	}
	pidc = "T"+pidc;
	return pidc;
}
/*************************************************************/
/***********¾Ë¸®±â ±â´Éµé *********************/
/*************************************************************/
function sendTwitter(title,url) {
	var wp = window.open("http://twitter.com/home?status=" + encodeURIComponent(title) + " " + encodeURIComponent(url), 'twitter', '');
	if ( wp ) {
		wp.focus();
	}
}
function sendMe2Day(title,url,tag) {
	var wp = window.open("http://me2day.net/posts/new?new_post[body]=" + encodeURIComponent(title) + " " + encodeURIComponent(url) + "&new_post[tags]=" + encodeURIComponent(tag), 'me2Day', '');
	if ( wp ) {
		wp.focus();
	}
}
function sendFaceBook(title,url) {
	var wp = window.open("http://www.facebook.com/sharer.php?u=" + url + "&t=" + encodeURIComponent(title), 'facebook', '');
	if ( wp ) {
		wp.focus();
	}
}
function sendCyWorld(no) {
	
}

function sendSms(title,code) {

	var wp = window.open("/pages/etc/tosms.php?code="+code+"&title="+encodeURIComponent(title),"","width=445px,height=420px")
	if ( wp ) {
		wp.focus();
	}
}

function sendMail(title,code) {

	var wp = window.open("/pages/etc/tomail.php?code="+code+"&title="+encodeURIComponent(title),"","width=445px,height=420px")
	if ( wp ) {
		wp.focus();
	}
}

function goCyWorld(code,http) {
	var href = "http://api.cyworld.com/openscrap/post/v1/?xu="+http+"/cyworldApi.php?code=" + code +"&sid=s0300011";
	var a = window.open(href, 'cyworld', 'width=450,height=410');
	if ( a ) {
		a.focus();
	}
}
function goYozmDaum(link,prefix,parameter) {
				var href = "http://yozm.daum.net/api/popup/prePost?link=" + encodeURIComponent(link) + "&prefix=" + encodeURIComponent(prefix) + "&parameter=" + encodeURIComponent(parameter);
				var a = window.open(href, 'yozmSend', 'width=466, height=356');
				if ( a ) {
					a.focus();
				}
}
function subscriber_jsf() {
	if(!confirm('±¸µ¶½ÅÃ»À» ÇÏ½Ã°Ú½À´Ï±î?')) return ;
	with(subscriber_form){	
		// && !feedSms.value ¶Ç´Â ÇÚµåÆù
		if(!feedEmail.value){
			alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇÏ¼¼¿ä");
			return;
		}
		if(feedEmail.value) {
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	
			if (!filter.test(feedEmail.value)) { 
				alert('Àß¸øµÈ ÀÌ¸ÞÀÏ ÀÔ´Ï´Ù.');
				feedEmail.focus();
				return ; 
			}
		}
		/*
		if(feedSms.value) {
			if(feedSms.value.length > 3) {
				head = feedSms.value.substr(0,3);
				if(head != "010" && head != "011" && head != "016" && head != "017" && head != "018" && head != "019") {
					alert('ÇÚµåÆù±¸µ¶Àº 010, 011, 016, 017, 018, 019¸¸ ¼­ºñ½º°¡ °¡´ÉÇÕ´Ï´Ù.');
					feedSms.focus();
					return ;
				}
			}
		}
		*/
		target="act_frame";
		submit();
	}		
}
function clocking(dealid, m, d, y, h, mi, s) {
	var now = new Date();
	var dtime = new Date(y,m,d,h,mi,s);
	var toGo = dtime.getTime() - now.getTime();
	document.getElementById('left_time_'+dealid).innerHTML=get_left_time(toGo);
}
function twot(x) {return ((x>9)?"":"0")+x}

function get_left_time(ms) {
	if(ms<0) {
		t = "Á¾·á"
		//$(".remain-time small").hide();
	} else {
		var hours = ms / 3600000;
		var minutes = (ms % 3600000) / 60000;
		var seconds = ((ms % 3600000) / 1000) % 60;

		var h = Math.floor(hours);
		var mi = Math.floor(minutes);
		var se = Math.floor(seconds);

		t = twot(h) + "½Ã°£ " + twot(mi) + "ºÐ " + twot(se) + "ÃÊ";
	}
	return t
}
function base_message(ruid,parentnum){
	urlc = _js_document+"/pages/messenger.php?ruid="+ruid+"&parentnum="+parentnum+"#top";
	base_div_trans();
	var window_left = (screen.width-500)/2;
	document.all.item('chart_div').style.top = mouseY ;
	document.all.item('chart_div').style.left = window_left;
	document.all.item('chart_div').style.visibility = 'visible'; 
	document.all.item('chart_iframe').style.width = 500;
	document.all.item('chart_iframe').style.height = 290;
	chart_iframe.location.href=urlc;	
}
function base_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 '';
}

