
function openwin(pUrl,pName,pScroll,pWidth,pHeight,pLeft,pTop)
{
	newwin=window.open(pUrl,pName,"width="+pWidth+", height="+pHeight+", left="+pLeft+", top="+pTop+", scrollbars="+pScroll+", toolbars=no, status=no");
	newwin.focus();
}

function openwinChk(pUrl,pName,pScroll,pWidth,pHeight,pLeft,pTop)
{
	var newwinchk;
	if (!newwinchk)
	{
		window.open(pUrl,pName,"width="+pWidth+", height="+pHeight+", left="+pLeft+", top="+pTop+", scrollbars="+pScroll+", toolbars=no, status=no");
	}
}

function addfavorites()
{
	if (document.all)
		window.external.AddFavorite("http://www.scout.co.kr/","Ãë¾÷, °æ·Â°ü¸® Æ÷Å» ½ºÄ«¿ìÆ®")
}

function editphoto()
{
	openwin("/myscout/popup/upphoto.asp","photo","no","492", "299","100","100");
}

function openwin_directly(pUrl,pName,pScroll,pWidth,pHeight,pLeft,pTop)
{
	newwin = window.open(pUrl,pName,"width="+pWidth+", height="+pHeight+", left="+pLeft+", top="+pTop+", scrollbars="+pScroll+", toolbars=no, status=no");
	newwin.focus();
}


/*Ãë¾÷´º½º/ BBS È®´ë/Ãë¼Ò½ºÅ©¸³Æ®*/
function setClassProperty (strClassName, strPropVal) {
  var objLastStyleSheet =
      document.styleSheets[document.styleSheets.length - 1];
  if (document.all) {
    var strSelector = '.' + strClassName;
    objLastStyleSheet.addRule(strSelector, strPropVal);
  }
  else if (document.getElementById) {
    var strRule = '.' + className + ' { ' + strPropVal + '}';
    objLastStyleSheet.insertRule(strRule, objLastStyleSheet.cssRules.length);
  }
}
/*End*/


/*±³À°Á¤º¸ °øÅë*/

function Radio_Checked(pname, ptext)
{
	var vnum;
	vnum = 0;
	var chr2 = eval("document.FormAD."+pname);
	for( var i=0; i < chr2.length; i++)
	{
		if(chr2[i].checked) {
			vnum = vnum + 1;
		}
	}
	if( vnum <= 0 ){
		alert(ptext);
		eval("document.FormAD." + pname + "[0].focus();");
		return false;
	}
	else{
		return true;
	}
}
function checkdigit(pValue)
{
	var validstr="0123456789";
	len = pValue.length;

	for (var i=0; i<len; i++)
	{
		if(validstr.indexOf(pValue.substring(i,i+1))<0)
		{
			return false;
		}
	}
	return true;
}


function Number_MakeCurrency(num) {
	var tempvalue ="";
	if(isNaN(num)) {
		return num;
	}
	else {
		if(num.length < 4) {
			return num;
		}
		else {
			for(var i = 0; i< num.length; i++) {
				if ((i+1) % 3 == 0) {
					if (i+1 != num.length) {
						tempvalue =","+num.charAt(num.length-i-1)+ tempvalue;
					}
					else {
						tempvalue = num.charAt(num.length-i-1)+tempvalue;
					}
				}
				else {
					tempvalue =num.charAt(num.length-i-1)+ tempvalue;
				}
			}
			num = tempvalue;
			return num;
		}
	}
}

/*************************************/
/** ÀÛ¼ºÀÚ : ±è¼®¿ø (2005.5.13)**/
/** ³»¿ë    : Å¸ÄÏ¿¡ µû¸¥ ¾×¼Ç   **/
/*************************************/
	function Script_TargetUrl(pURL, pTarget) {

		switch (pTarget.toLowerCase()) {
			case "_top" :
				top.location.href = pURL;
				break;
			case "_self" :
				self.location.href = pURL;
				break;
			case "_blank" :
				window.open(pURL);
				break;
			case "_new" :
				window.open(pURL);
				break;
			default :
				window.location.href = pURL;
				break;
		}
	}



/*************************************/
/** ÀÛ¼ºÀÚ : Á¶¿µ±æ , ¼ÛÇØ¼± (2006.3.30)**/
/** ³»¿ë    : Ã­Æ®Ãâ·Â  **/
/*************************************/
function setEmbed() {

  var obj = new String;
  var parameter = new String;
  var embed = new String;
  var html = new String;
  var allParameter = new String;
  var clsid = new String;
  var codebase = new String;
  var pluginspace = new String;
  var embedType = new String;
  var src = new String;
  var width = new String;
  var height = new String;

  this.init = function(getType, s, w, h) {

      if( getType == "flash") {
        clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";
        codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
        pluginspage = "http://www.macromedia.com/go/getflashplayer";
        embedType = "application/x-shockwave-flash";
      }
      parameter += "<param name=\"movie\" value=\""+ s + "\">\n";
      parameter += "<param name=\"quality\" value=\"high\">\n";

      src = s;
      width = w;
      height = h;
  }

  this.parameter = function(parm, value) {
      parameter += "<param name=\"" + parm + "\" value=\"" + value + "\">\n";
      allParameter += " " + parm + "=\"" + value + "\"";
  }

  this.show = function() {
      if( clsid ) {
        obj = "<object classid=\"clsid:" + clsid + "\" codebase=\"" + codebase + "\" width=\"" + width + "\" height=\"" + height + "\">\n";
      }
      embed = "<embed src=\"" + src + "\" pluginspage=\"" + pluginspage + "\" type=\"" + embedType + "\" width=\"" + width + "\" height=\"" + height + "\"" + allParameter + "></embed>\n";

      if ( obj ) {
        embed += "</object>\n";
      }

      html = obj + parameter + embed;
      document.write( html );
  }
}

// Flash Àü¿ë È£ÃâÇÔ¼ö p_id_name : ID¶Ç´ÂName °ª, p_swf_name : ¼îÅ©¿þÀÌºêÆÄÀÏ °æ·Î(ÀÌ¸§,GET°ªÆ÷ÇÔ), wdith: ³ÐÀÌ°ª, height: ³ôÀÌ°ª
function swf_func(p_id_name,p_swf_name,p_width,p_height){
document.writeln("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='/asset/flash/swflash.cab#version=8,0,0,0' width='"+p_width+"' height='"+p_height+"' id='"+p_id_name+"' align='middle'>");
document.writeln("<param name='allowScriptAccess' value='always'>");
document.writeln("<param name='movie' value='"+p_swf_name+"'>");
document.writeln("<param name='quality' value='high'>");
document.writeln("<param name='bgcolor' value='#F4F6EB'>");
document.writeln("<param name='wmode' Value='Transparent'>");
document.writeln("<param name='scale' value='noscale' />");
document.writeln("<param name='salign' value='lb' />");
document.writeln("</object>");
}

// Ãµ´ÜÀ§·Î ÄÞ¸¶Âï´Â ÇÔ¼ö
function commify(n) {
	var reg = /(^[+-]?\d+)(\d{3})/;
	n += '';

	while (reg.test(n))
		n = n.replace(reg, '$1' + ',' + '$2');
		
	return n
}

/****************************************/
/* HttpRequest °´Ã¼ »ý¼º 							*/
/****************************************/
function createAjax() {
  if(typeof(ActiveXObject) == "function") {
    return new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if(typeof(XMLHttpRequest) == "object" || typeof(XMLHttpRequest) == "function") {
    return new XMLHttpRequest();
  }
  else {
    self.alert("ºê¶ó¿ìÀú°¡ AJAX¸¦ Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.");
    return null;
  }
}

//  AJax »ç¿ë¿¡ ÇÊ¿äÇÑ ÇÔ¼ö¸ðÀ½
function sendRequest(callback,data,method,url,async,sload,user,password){
	var oj = createHttpRequest();
	if( oj == null ) return null;
	var sload = (!!sendRequest.arguments[5])?sload:false;
	if(sload || method.toUpperCase() == 'GET')url += "?";
	//if(sload)url=url+"t="+(new Date()).getTime();
	var bwoj = new chkAjaBrowser();
	var opera	  = bwoj.bw.opera;
	var safari	  = bwoj.bw.safari;
	var konqueror = bwoj.bw.konqueror;
	var mozes	  = bwoj.bw.mozes ;
	if(method.toUpperCase() == 'GET') {
		url += data
	}
	if(oj){
		oj.open(method,url,async,user,password);
		setEncHeader(oj)
		oj.onreadystatechange =function ()
		{
			if ( oj.readyState == 4 ){
				callback(oj);
			}
		}
	}
	oj.send(data);
	return oj
}
function createHttpRequest()
{
	if(window.ActiveXObject){
		 //Win e4,e5,e6éÄ
		try {
			return new ActiveXObject("Msxml2.XMLHTTP") ;
		} catch (e) {
			try {
				return new ActiveXObject("Microsoft.XMLHTTP") ;
			} catch (e2) {
				return null ;
 			}
 		}
	} else if(window.XMLHttpRequest){
		 //Win Mac Linux m1,f1,o8 Mac s1 Linux k3éÄ
		return new XMLHttpRequest() ;
	} else {
		return null ;
	}
}
function setEncHeader(oj){
	var contentTypeUrlenc = 'application/x-www-form-urlencoded; charset=euc-kr';
	if((typeof oj.setRequestHeader) == 'function')
		oj.setRequestHeader('Content-Type',contentTypeUrlenc);
	return oj
}
function chkAjaBrowser()
{
	var a,ua = navigator.userAgent;
	this.bw= { 
	  safari    : ((a=ua.split('AppleWebKit/')[1])?a.split('(')[0]:0)>=124 ,
	  konqueror : ((a=ua.split('Konqueror/')[1])?a.split(';')[0]:0)>=3.3 ,
	  mozes     : ((a=ua.split('Gecko/')[1])?a.split(" ")[0]:0) >= 20011128 ,
	  opera     : (!!window.opera) && ((typeof XMLHttpRequest)=='function') ,
	  msie      : (!!window.ActiveXObject)?(!!createHttpRequest()):false
	}
	return (this.bw.safari||this.bw.konqueror||this.bw.mozes||this.bw.opera||this.bw.msie)
}
// AJax ÇÔ¼ö ¸ðÀ½ ³¡
function SetNum(obj){	//  onkeypress='SetNum(this)' onblur='SetNum(this)'
	var val=obj.value;
	re=/[^0-9]/gi;
	obj.value=val.replace(re,"");
}