var ribbonConfig = function() {
	var config = {};
	return {
		set : function (name,value) {
			config[name] = value;
		},
		get : function (name) {

			if( typeof(config[name]) == 'undefined' ) {
				return false;
			}

			return config[name];
		}
	}
}();


/* usage : ribbonAgent.isIE*/
var ribbonAgent =  function () {
	var _browser 	= navigator.userAgent.toLowerCase();
	var _isIE		= false;
	var _isIE6		= false;
	var _isIE7		= false;
	var _isIE8		= false;
	var _isFireFox	= false;
	var _isOpera		= false; 
	var _isChrome		= false; 
	var _isSafari		= false; 
	var _isMobile		= false;  


	var UserAgent = navigator.userAgent;
	if (UserAgent.match(/iPhone|iPod|Android|Windows CE|BlackBerry|Symbian|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson/i) != null || UserAgent.match(/LG|SAMSUNG|Samsung/) != null) {
		_isMobile = true;
	}


	if (_browser.indexOf('msie') != -1) {
		_isIE = true;

		if (_browser.indexOf('msie 8') != -1) {
			_isIE8 = true;
		} else if (_browser.indexOf('msie 7') != -1) {
			_isIE7 = true;
		} else if (_browser.indexOf('msie 6') != -1) {
			_isIE6 = true;
		} else {
		}
	}	else	{
		if (_browser.indexOf('firefox') != -1) {
			_isFireFox = true;
		} else if (_browser.indexOf('opera') != -1) {
			_isOpera =true;
		} else if (_browser.indexOf('chrome') != -1) {
			_isChrome =true;
		} else if (_browser.indexOf('safari') != -1) {
			_isSafari =true;
		} else {
		} 
	}

	// °ËÅä agent
	return {
		isIE : _isIE
		,isIE6 : _isIE6
		,isIE7 : _isIE7
		,isIE8 : _isIE8
		,isFireFox : _isFireFox
		,isOpera : _isOpera
		,isChrome : _isChrome
		,isSafari : _isSafari
		,isMobile : _isMobile
	}
}();
  


// ie6 È£È¯ png Åõ¸íÀÌ¹ÌÁö
function setPng24(obj) {
	if (obj.src) {
	  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');";
	  return '';
	}
} 

String.prototype.trim = function() {
	var str = this;
	str1 = str.replace( /(\s+$)/gi, "" );
	return str1.replace( /(^\s*)/g, "" );
}

var center_move_win = function (w,h) {
	if( navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4) {
		if(w < window.screen.width && h < window.screen.height) {
			var windowX = Math.ceil( (window.screen.width  - w) / 2 );
			var windowY = Math.ceil( (window.screen.height - h) / 2 );
		} else {
			var windowX = w;
			var windowY = h;
		}

	} else {
		var windowX = 100;
		var windowY = 100;
	}
	window.moveTo(windowX,windowY);
}

var center_open_win = function (url, name, width, height, feature) {
	var o_win;

	if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4) { // browser version >= ie 4
		if(width < window.screen.width && height < window.screen.height) {
			var windowX = Math.ceil( (window.screen.width  - width) / 2 );
			var windowY = Math.ceil( (window.screen.height - height) / 2 );

			o_win = window.open(url, name, feature+",width=" + width +",height=" + height+",left="+windowX+",top="+windowY);
		} else {
			o_win = window.open(url, name, feature+",width=" + width +",height=" + height);
		}
	} else {
		o_win = window.open(url, name, feature+",width=" + width +",height=" + height);
	}
	return o_win;
}


/*
	var ribbon_ajax = {
		'url':'/hi_hint/saver.php', // ½ÇÇàÇÒ ÆÄÀÏ
		'data':"#frm", // Æûid
		'loading_div' : 'ajax_load_indicator', //·ÎµùÁß ÀÌ¹ÌÁö
		'success_fuc' : function (response) { // ¼º°ø¹ÝÈ¯Á¤º¸
				alert(msg);
		}
	} 

	exec_ajax(ribbon_ajax);
*/
var exec_ajax = function (o) {

	if( typeof(o.dataType) == 'undefined') {
		var _dataType = "text";
	} else {
		var _dataType = o.dataType;
	}

    // ·Î±×ÀÎ ÇÁ·Î¼¼½º È£Ãâ
    $.ajax({
        type: o.type
        , async: true
        , url: o.url
        , dataType: _dataType
        , data: $(o.data).serialize() 
        , beforeSend: function() { 
			
			if( typeof(o.loading_div) != 'undefined') {
				var _scroll_top = document.body.scrollTop;
				var _scroll_left = document.body.scrollLeft;

				var _client_width = document.body.clientWidth;
				var _client_height = document.body.clientHeight;

				var _new_x = _scroll_left + eval(_client_width) / 2 - 50;
				var _new_y = (_scroll_top + eval(_client_height) / 2 - 50);
	  
				$(o.loading_div).css('top',_new_y).css("left",_new_x + 'px').show().fadeIn('fast');  
			}
          }
        , success: function(data) {
            var response = data; 
			o.success_fuc(response); 
          }
        , error: function(data, status, err) { 
            alert('¼­¹ö¿ÍÀÇ Åë½ÅÀÌ ½ÇÆÐÇß½À´Ï´Ù.' + status);
          }
        , complete: function() { 
			if( typeof(o.loading_div) != 'undefined') {
        		$(o.loading_div).fadeOut();
			}
          }
    });
}




