function fast_open(url,width,height) 
{
	window.open(url,"",'width='+width+',height='+height+',status=no,scrollbars=yes,resizable=yes');  
}

function s_location(url)
{	
	location.href=url;
}
	
function s_confirm(str,v,dep)
{
	if(confirm(str))
	{
		if(dep<=1)
		{
			s_location(v);
		}
		else
		{
			var str2 = str + "\n\n선택하신 정보와 연관된 모든 정보가 삭제됩니다.";
			if(confirm(str2))
			{
				s_location(v);
			}
			else
			{
				return;
			}
		}
	}
	else
	{
		return;
	}
} 

function getStrOrNumberToPrice(priceStrOrNumber) {
	if(priceStrOrNumber == null) {
		return priceStrOrNumber;
	}
	var priceStr = new String(priceStrOrNumber);
	var price = new String();
	var repeatSize = 3;
	var delimiter = ",";
	for(var len = priceStr.length; true ; len-=repeatSize) {
		if((len-repeatSize) <= 0) {
			price = priceStr.substring(0,len) + price;
			break;
		} else {
			price = delimiter + priceStr.substring(repeatSize, len) + price;
		}
	}
	
	return price;
}

	function revcheck(theform)
	{
		var f = eval(theform);
		var check_nums = f.elements.length;
		for( var i=0; i < check_nums; i++) {
			var ele = eval("f.elements[" + i + "]");
			if(ele.name == "check[]")
			ele.checked = !ele.checked;
		}
		return;
	}

	function allcheck(theform)
	{
		var f = eval(theform);
		for( var i=0; i<f.elements.length; i++) {
		var ele =eval("f.elements[" + i + "]");
		if(ele.name == 'check')
		ele.checked = true;
		}
		return;
	}
								  
	function check_process(theform,action) {
		var f = eval(theform);
		var check_nums = f.elements.length;
		for(var i = 0; i < check_nums; i++) {
			var checkbox_obj = eval("theform.elements[" + i + "]");
			if(checkbox_obj.checked == true) {
				break;
			}
		}
		if(i == check_nums) {
			alert("Select Check Box");
			return;   
		}else{		
			if(confirm('ok?')){
				f.action=action;
				theform.submit();
			}else{
				return;
			}		
		}   
	}



var banner_1_mouseEvent = 1;
var banner_2_mouseEvent = 1;
// banner_roll("div태그 id", 배너1개높이, 딜레이, 1칸이동속도, 0);
function banner_roll(div_id, banner_height, banner_delay, banner_speed, this_height){

if(eval(div_id + "_mouseEvent")){
var div_tag = document.getElementById(div_id);
var a_tag, i;
this_height++;
if(this_height < banner_height){
div_tag.style.top = -this_height;
setTimeout("banner_roll('" + div_id + "', " + banner_height + ", " + banner_delay + ", " + banner_speed + ", " + this_height + ");", banner_speed);
}
else{
a_tag = div_tag.getElementsByTagName("TABLE");
div_tag.appendChild(a_tag[0]);
div_tag.style.top = 0;
setTimeout("banner_roll('" + div_id + "', " + banner_height + ", " + banner_delay + ", " + banner_speed + ", 0);", banner_delay);
}
}
else{
setTimeout("banner_roll('" + div_id + "', " + banner_height + ", " + banner_delay + ", " + banner_speed + ", " + this_height + ");", banner_speed);
}
return true;
}



function select_input(input_name,input_value) {
    for ( i = 0 ; i < document.forms.length; i ++ ) {
        for ( j = 0 ; j < document.forms[i].elements.length; j++) {
            with(document.forms[i].elements[j]) {
                if(name == input_name) {
                    if( value == input_value) { checked=true; }
                        else if(type!='radio' && type != 'checkbox') { value=input_value; }
                }
            }
        }
    }
}

function pviiClassNew(obj, new_style) {
    obj.className = new_style;
}

function layerShow(blockID) {
	if( document.getElementById ) {
		document.getElementById(blockID).style.display = "";
	}
}

function layerHide(blockID) {
	if( document.getElementById ) {
		document.getElementById(blockID).style.display = "none";
	}
}

function setLayerClass(blockID, newClass) {
     document.getElementById(blockID).className = newClass;
}

function isLayerShowed(blockID) {
	if( document.getElementById ) {
		if (document.getElementById(blockID).style.display != "none") {
			return true;
		}
	}	
	return false;
}


function getCookie(Name) {
   var search = Name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search)
      if (offset != -1) { // if cookie exists
          offset += search.length
          // set index of beginning of value
         end = document.cookie.indexOf(";", offset)
          // set index of end of cookie value
         if (end == -1)
             end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      }
    }
}

var today = new Date();
var expires = new Date();
expires.setTime(today.getTime() + 1000*60*60*24*365);
function setCookie(name, value) {
   document.cookie = name + "=" + escape(value)   
   			  + "; expires=" + expires.toGMTString();
}

loginShow = '';
function adjustLayers(what) {
   if (loginShow != '') {
      layerHide(loginShow + 'Show');
      layerHide(loginShow + 'Opened');
      layerShow(loginShow + 'Closed');
   }
   
   if (what != 'close') {
      layerShow(what + 'Show');
      layerShow(what + 'Opened');
      layerHide(what + 'Closed');
      setCookie('loginShow', what);
      loginShow = what;
   }

   return false; 
}

function loadCookie() {
   what = getCookie('loginShow');
   if (what) {
      adjustLayers(what);
   }
}

function check_bg(bool,id)
{
	if(bool)
	{
		document.getElementById(id).style.cssText='background:#FFFFCC';
	}
	else
	{
		document.getElementById(id).style.cssText='background:#ffffff';

	}
}

function mcheck(oElement,form_name){
	
	var len = form_name.mck.length;
	var chkArr = form_name.mck;
	var boolv =  oElement.checked;
	for(var i=0;i<len;i++)
	{
		chkArr[i].checked = boolv;		
		if(chkArr[i].value != 'on')
		{
			var idc = 'bg_'+chkArr[i].value;
			check_bg(boolv,idc);
		}
	}
}

function round(elm, bgcolor, border, mode) {
  var top = document.createElement('div'); top.style.cssText = 'height:5px';
  var bottom = document.createElement('div');bottom.style.cssText = 'height:5px';
  var temp = document.createElement('div'); temp.setAttribute('id', 'template');
  var border2 = (border) ? ";border-left:2px solid "+border+";border-right:2px solid "+border : "";
  var border1 = (border) ? ";border-left:1px solid "+border+";border-right:1px solid "+border : "";
  var bgcolor2 = (bgcolor) ? ";background:"+bgcolor : "";
  var bgcolor1 = (border) ? ";background:" + border : (bgcolor) ? ";background:" + bgcolor : "";

  var top_r = new Array(), bottom_r =new Array();
  var box = elm.cloneNode(true);
  for (i=1; i < 5 ;i++ )
  { top_r[i] = document.createElement('div')}

  top_r[1].style.cssText = 'overflow:hidden;margin:0px 5px;height:1px' + bgcolor1;
  top_r[2].style.cssText = 'overflow:hidden;margin:0px 3px;height:1px' + border2 + bgcolor2;
  top_r[3].style.cssText = 'overflow:hidden;margin:0px 2px;height:1px' + border1 + bgcolor2;
  top_r[4].style.cssText = 'overflow:hidden;margin:0px 1px;height:2px' + border1 + bgcolor2;

 
  for (i=1; i < 5 ;i++ ) {
    if (mode!='bottom') { top.appendChild(top_r[i]);temp.appendChild(top); }
    bottom_r[i] = top_r[i].cloneNode(true);    
  }

  temp.appendChild(box);
  box.style.cssText =  border1 + bgcolor2;
  var clear = document.createElement('div');clear.style.cssText = 'clear:both';
  temp.appendChild(clear);
  temp.appendChild(bottom);

  if (mode!='top') {
    for (i=4; i > 0 ;i-- ) {
      bottom.appendChild(bottom_r[i]);
    }
  }
  elm.parentNode.replaceChild(temp, elm);
} 

// udiem 
function viewFlash(flash, id, width, height, vars, bgcolor, wmode)
{
	var str  = "<object id='" + id +"' classid=CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000 codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0 width="+width+" height="+height+">";
	str += "<param name=movie value='"+flash+"' />"	;
	str += "<param name=bgcolor value='"+bgcolor+"' />";
	str += "<param name=quality value=high />"		;
	str += "<param name=loop value=false />";
	str += "<param name=menu value=false />";
	str += "<param name=wmode value='"+wmode+"' />";
	str += "<param name=FlashVars value='"+vars+"' />";
	str += "<param name=allowScriptAccess value=always />";
	str += "<embed name='" + id +"' src='"+flash+"' width='"+width+"' height='"+height+"' bgcolor='"+bgcolor+"' wmode='"+wmode+"' allowScriptAccess=always loop=false menu=false quality=high type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer FlashVars="+vars+" />";	
	str += "</object>";
	document.write(str);
}

	function gLogin()
	{
		var f = document.LoginForm;
		if(f.userID.value == "")
		{
			alert("아이디를 입력하세요.");
			f.userID.focus();
			return;
		}
		else if(f.userPass.value =="")
		{
			alert("비밀번호를 입력하세요.");
			f.userPass.focus();
			return;
		}
		f.submit();
	}
	function gLogout()
	{
		var f = document.LoginForm;
		f.submit();
	}
function getSelectObj(fObj) 
{
        for (i=0; i<document.all.length; i++) {
          document.all(i).unselectable = "on";
        }
        document.getElementById(fObj).contentEditable = "true"
        document.getElementById(fObj).unselectable = "off";
        document.getElementById(fObj).focus();

        document.execCommand('SelectAll', true, null);
        document.execCommand('Copy', true, null);
        document.execCommand('Unselect', true, null);

        for (i=0; i<document.all.length; i++) {
            document.all(i).unselectable = "off";
        }
        document.getElementById(fObj).contentEditable = "false";
        window.alert('복사가 되었습니다.');
} 

function data_ajax(result_id,url,data)
{
	  $.ajax({
	    type: "POST",
	    url: url,
	    data: data+"&result_id="+result_id, 
	    success: function(evt, request, settings) 
		{
			$("#"+result_id).html(evt);
	    },
	    error: function(msg) 
		{
	      alert("error");
	    }
	  });
}

function adget_opt(result_id,data)
{
	  $.ajax({
	    type: "POST",
	    url: '/_php/opt/adget_opt_process.php',
	    data: data+"&result_id="+result_id, 
	    success: function(evt, request, settings) 
		{
			$("#"+result_id).html(evt);
	    },
	    error: function(msg) 
		{
	      alert("error");
	    }
	  });
}

function URL_escape(url){if(encodeURIComponent){ return encodeURIComponent(url);}else{ return escape(url);}}

function num_only( Ev ){
    var evCode = ( window.netscape ) ? Ev.which : event.keyCode ;	
    if ( ! ( evCode == 0 || evCode == 8 || ( evCode > 47 && evCode < 58 )|| ( evCode > 95 && evCode < 106 ) ) ) {
		if ( window.netscape )	Ev.preventDefault();
		else							event.returnValue=false;        
    }
}
//############################################################################# 추가
function ImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
 
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function Imgover() { //v3.0
  var i,j=0,x,a=Imgover.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
 
 
function out() { //v3.0
  var i,x,a=document.MM_sr;for(i=0;  a && i<a.length && (x=a[i])&&x.oSrc ;i++) x.src=x.oSrc;
}
 
function over() { //v3.0
  var i,j=0,x,a=over.arguments; document.MM_sr=new Array;   for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null) {document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openflash(width,height,src){
		document.writeln("<object id='adget' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'' width='"+width+"' HEIGHT='"+height+"'>");
		document.writeln("<PARAM NAME='movie' VALUE='"+src+"'>");
		document.writeln("<PARAM NAME='loop' VALUE=false>");
		document.writeln("<PARAM NAME='menu' VALUE=false>");
		document.writeln("<PARAM NAME='quality' VALUE=high>");
		document.writeln("<PARAM NAME='wmode' VALUE=transparent>");
		//document.writeln("<PARAM NAME='wmode' VALUE='opaque'>"); 
		document.writeln("<EMBED src='"+src+"' loop=false menu=false quality=high bgcolor='' WIDTH='"+width+"' HEIGHT='"+height+"' NAME='banner' ALIGN='' type='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'  PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED>");
		document.writeln("</object>");
} 
//############################################################################# 추가
