// JavaScript Document

	//////////////////////////////
	//  Äõ¸®½º¸µ ºÐ¼® ¹× º¯È¯ (url »ý¼º)
	//////////////////////////////
	
	qryStr = function(str) {
		var str = str ? str : document.location.href;
		this.argv = new Array();
		this.queryString = str.replace(/^[^\?]+\?/, '').replace(/#(.*)$/, '');
		if (!this.queryString) this.queryString = '';
		var _argv = this.queryString.split('&');
		for(var i=0; i<_argv.length; i++) {
			var _key = _argv[i].substring(0, _argv[i].indexOf('='));
			var _val = _argv[i].substring(_argv[i].indexOf('=')+1);
			if(!_key || _argv[i].indexOf('=') == -1) continue;
			this.argv[_key] = _val;
		}
	}
	
	qryStr.prototype.setVar = function(key,val) {
		if (typeof key == 'object') {
			for (var item in key) this.argv[item] = key[item];
		} else {
			this.argv[key] = val;
		}
		return this.getVar();
	}
	
	qryStr.prototype.getVar = function(key) {
		if (key) {
			return this.argv[key] ? this.argv[key] : '';
		} else {
			var _item = new Array();
			for (var x in this.argv) {
				if (this.argv[x]) _item[_item.length] = x + '=' + this.argv[x];
				else continue;
			}
			return '?' + _item.join('&');
		}
	}

	function make_href(strQueries, strValues, Url)
	{
		var qs = new qryStr(Url);
		var aryQuery = ('|'+strQueries).split('|');
		var aryValue = ('|'+strValues).split('|');
		for(i=1;i<aryQuery.length;i++)
		{
			qs.setVar(aryQuery[i], aryValue[i]);
		}
		return Url + qs.getVar();
	}
	
	////////////////////////////////
	// ÀÌ¹ÌÁö ½º¿Ò
	// »ç¿ë¹æ¹ý : ImgSwapOver(this, '_over')
	////////////////////////////////
	
	function ImgSwapOver(obj, strChange)
	{
		var imgurl = obj.src;
		var m=imgurl.lastIndexOf(".");
		var e=imgurl.length;
		obj.src = imgurl.substring(0,m)+strChange+imgurl.substring(m,e);
	}
	
	// ÀÌ¹ÌÁö ½º¿Òº¹±¸
	function ImgSwapOut(obj, strChange)
	{
		var imgurl = obj.src;
		var m=imgurl.lastIndexOf(strChange);
		var e=imgurl.length;
		obj.src = imgurl.substring(0,m)+imgurl.substring(m+strChange.length,e);
		//alert(imgurl.substring(0,m)+imgurl.substring(m+strChange.length,e));
	}
	
	////////////////////////////////
	// ¼¿·ºÆ® or ¸®½ºÆ® ¹Ú½º Á¦¾î
	////////////////////////////////

	//¼¿·ºÆ®¿¡ ¿É¼ÇÇ×¸ñÀ» Ãß°¡
	function OptionAdd(obj, name, value){
	 var aIdx=obj.options.length;
	 var itm= new Option(name);
	 obj.options[aIdx]=itm;
	 obj.options[aIdx].value=value;
	}
	
	//¼±ÅÃ ¿É¼ÇÇ×¸ñÀ» Á¦°Å
	function OptionDel(obj){
	 obj.options[obj.selectedIndex]=null;
	}
	
	////////////////////////////////
	// Äí±â »ç¿ë
	////////////////////////////////

	//ÄíÅ°¸¦ ÀúÀå ÇÒ ¶§
	function setCookie(name, value, day) {
		var ExpDate = new Date();
		ExpDate.setDate(ExpDate.getDate() + day);
		document.cookie = name + "=" + value + "; path=; expires=" + ExpDate.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 ""; 
	} 	

	////////////////////////////////
	// obj À§Ä¡°ª Ã£±â
	////////////////////////////////
	// ¹®¼­¿¡ ¹èÄ¡µÈ ¿ÀºêÁ§Æ®ÀÇ Àý´ë°ªÀ» ¹ÝÈ¯ÇÑ´Ù.
	function getposOffset(obj, from){ // from : left or top
	 var totaloffset=(from=="left")? obj.offsetLeft : obj.offsetTop;
	 var parentEl=obj.offsetParent;
	 while (parentEl!=null){
		totaloffset=(from=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	 }
	 return totaloffset;
	}


	// ÄÞ¸¶ »ðÀÔ
	function Comma(intValue,fLen)
	{ 
		var fLen = fLen || 2; 
	
		var strValue = intValue+''.replace(/,|\s+/g,'');
		var strBeforeValue = (strValue.indexOf('.') != -1)? strValue.substring(0,strValue.indexOf('.')) :strValue ;
		var strAfterValue  = (strValue.indexOf('.') != -1)? strValue.substr(strValue.indexOf('.'),fLen+1) : '' ;
	 
		if(isNaN(strValue))
		{
			 alert(strValue.concat(' -> ¼ýÀÚ°¡ ¾Æ´Õ´Ï´Ù.'));
			 return false;
		}
	
		var intLast =  strBeforeValue.length-1;
	
		var arrValue = new Array;
		var strComma = '';
	
		for(var i=intLast,j=0; i >= 0; i--,j++)
		{ 
					 if( j !=0 && j%3 == 0) 
					 {   
							 strComma = ',';
					 }
					 else
					 {
							 strComma = '';
					 }
					 arrValue[arrValue.length] = strBeforeValue.charAt(i) + strComma  ;
		}
		return  arrValue.reverse().join('') +  strAfterValue; 
	}

