/*
 * jQuery Templating Plugin
 *   NOTE: Created for demonstration purposes.
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */
(function($) {
	var oldManip = jQuery.fn.domManip;
	jQuery.fn.extend({
		render: function( data ) {
			var rendered = this.map(function(i, tmpl){
				rendered = jQuery.render( tmpl, data );
				return  jQuery(
					jQuery('<div>'+
						( jQuery.isArray(rendered) ? rendered.join('') : rendered ) +
					'</div>')[0].childNodes
				).get();
			});
			return rendered;
		},
		domManip: function( args ) {
			if ( args.length > 1 && args[0].nodeType ) {
				arguments[0] = [ jQuery.makeArray(args) ];
			}
			if ( args.length === 2 && typeof args[0] === "string" && typeof args[1] !== "string" ) {
				arguments[0] = jQuery.render( args[0], args[1] );
				arguments[0] = jQuery.isArray(  arguments[0] ) ?
					[ arguments[0].join('') ] :
					[ arguments[0] ];
			}
			return oldManip.apply( this, arguments );
		}
	});
	jQuery.extend({
		render: function( tmpl, data ) {
			var fn, request;
			if ( jQuery.templates[ tmpl ] ) {
				fn = jQuery.templates[ tmpl ];
			} else if ( tmpl.nodeType ) {
				var node = tmpl, elemData = jQuery.data( node )||{};
				if(node.src){
					return jQuery.render({
						async: false,
						url: node.src,
						templateData: data
					});
				}else{
					fn = elemData.tmpl || jQuery.tmpl( node.innerHTML );
				}
			} else if ( jQuery.isPlainObject( tmpl ) ){
				var options = jQuery.extend( {}, tmpl, {
					type: 'GET',
					dataType: 'text',
					success: function( text ){
						jQuery.templates[ tmpl.url ] = jQuery.tmpl( text );
						if( tmpl.success )
							tmpl.success( jQuery.render( tmpl.url, tmpl.templateData ) );
					},
					error: function( xhr, status, e ){
						jQuery.templates[ tmpl.url ] = jQuery.tmpl(
							'Failed to load template from '+tmpl.url +
							'('+status+')'+e
						);
						if( tmpl.error )
							tmpl.error( jQuery.render( tmpl.url, tmpl.templateData ) );
					}
				})
				request = jQuery.ajax( options );
				return ( tmpl.async === false ) && !tmpl.success ?
					jQuery.render( tmpl.url, tmpl.templateData ) : request;
			}
			fn = fn || jQuery.tmpl( tmpl );
			if ( jQuery.isArray( data ) ) {
				return jQuery.map( data, function( data, i ) {
					return fn.call( data, jQuery, data, i );
				});

			} else {
				return fn.call( data, jQuery, data, 0 );
			}
		},
		templates: {},
		encode: function( text ) {
			return text != null ? document.createTextNode( text.toString() ).nodeValue : "";
		},
		tmpl: function(str, data, i) {
			if(!(TAG && EXPRESSION)){
				TAG = new RegExp(
					jQuery.tmpl.startTag +
					'\\s*(\\/?)(\\w+|.)(?:\\((.*?)\\))?(?: (.*?))?\\s*'+
					jQuery.tmpl.endTag, 'g'
				);
				EXPRESSION = new RegExp(
					jQuery.tmpl.startExpression +
					'([^'+jQuery.tmpl.endExpression+']*)'+
					jQuery.tmpl.endExpression, 'g'
				);
				jQuery.tmpl.startTag = jQuery.tmpl.startTag.replace('\\','', 'g');
				jQuery.tmpl.endTag = jQuery.tmpl.endTag.replace('\\','', 'g');
			}
			var fn,
				fnstring = "\n\
	var $ = jQuery, \n\
		T = [], \n\
		_ = $.tmpl.filters; \n\
	\n\
	//make data available on tmpl.filters as object not part of global scope \n\
	_.data = T.data = $data; \n\
	_.$i = T.index = $i||0; \n\
	T._ = null; //can be used for tmp variables\n\
	function pushT(value, _this, encode){\n\
		return encode === false ? \n\
			T.push(typeof value ==='function'?value.call(_this):value) : \n\
			T.push($.encode(typeof( value )==='function'?value.call(_this):value));\n\
	}\n\
	\n\
	// Introduce the data as local variables using with(){} \n\
	with($.extend(true, {}, _, $data)){\n\
	try{\n\
		T.push('" +
			str .replace(/([\\'])/g, "\\$1")
				.replace(/[\r\t\n]/g, " ")
				.replace(EXPRESSION, jQuery.tmpl.startTag+"= $1"+jQuery.tmpl.endTag)
				.replace(TAG, function(all, slash, type, fnargs, args) {
					var tmpl = jQuery.tmpl.tags[ type ];
					if ( !tmpl ) {
						throw "Template not found: " + type;
					}
					var def = tmpl._default||[];
					var result = "');" + tmpl[slash ? "suffix" : "prefix"]
						.split("$1").join(args || def[0])
						.split("$2").join(fnargs || def[1]) +
						"\n        T.push('";

					return result;
				})
	+ "');\n\
	}catch(e){\n\
		if($.tmpl.debug){\n\
			T.push(' '+e+' ');\n\
		}else{\n\
			T.push('');\n\
		}\n\
	}//end try/catch\n\
	}\n\
	//reset the tmpl.filter data object \n\
	_.data = null;\n\
	return T.join('')";
			try{
				fn = new Function("jQuery","$data","$i",fnstring );
			}catch(e){
				throw(e);
			}
			return data ? fn.call( this, jQuery, data, i ) : fn;
		}
	});
	jQuery.extend( jQuery.tmpl, {
		debug : false,
		startTag : '{{',
		endTag : '}}',
		startExpression :'\\${',
		endExpression :'}'
	});
	var TAG, EXPRESSION;
	jQuery.tmpl.filters = {
		//default filters
		join: function(){
		   return Array.prototype.join.call(arguments[0], arguments[1]);
		}
	};
	jQuery.tmpl.tags = {
		'comment': {
			prefix: "\n\
			/*",
			suffix: "\n\
			*/"
		},// iterate over items in an array
		'each': {
			_default: [ null, "$i" ],
			prefix: "\n\
				jQuery.each( $1, function($2){\n\
					with(this){",
			suffix: "\n\
					}\n\
				});"
		},// if/elseif/else - a general logical operator
		'if': {
			prefix: "\n\
				if( $1 ){",
			suffix: "\n\
				}"
		},
		'elseif': {
			prefix: "\n\
				}else if( $1 ){"
		},
		'else': {
			prefix: "\n\
				}else{"
		},// allows for html injection
		'html': {
			prefix: "\n\
				pushT($1, this, false);"
		},// allows for html injection?
		'ignore': {
			prefix: "",
			suffix: ""
		},// provides support for alternate evaluation tag syntax, reused internally
		'=': {
			_default: [ "this" ],
			prefix: "\n\
				pushT($1, this);"
		}
	};//end jQuery.tmpl.tags
})(jQuery);

/**
 * $LastChangedDate: 2007-12-20 09:02:08 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4265 $
 * Version: 3.0
 * Requires: $ 1.2.2+
 */
$.event.special.mousewheel = {
	setup: function() {
		var handler = $.event.special.mousewheel.handler;
		if ( $.browser.mozilla )
			$(this).bind('mousemove.mousewheel', function(event) {
				$.data(this, 'mwcursorposdata', {
					pageX: event.pageX,
					pageY: event.pageY,
					clientX: event.clientX,
					clientY: event.clientY
				});
			});
		if ( this.addEventListener )
			this.addEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = handler;
	},
	teardown: function() {
		var handler = $.event.special.mousewheel.handler;
		$(this).unbind('mousemove.mousewheel');
		if ( this.removeEventListener )
			this.removeEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = function(){};
		$.removeData(this, 'mwcursorposdata');
	},
	handler: function(event) {
		var args = Array.prototype.slice.call( arguments, 1 );
		event = $.event.fix(event || window.event);
		$.extend( event, $.data(this, 'mwcursorposdata') || {} );
		var delta = 0, returnValue = true;
		if ( event.wheelDelta ) delta = event.wheelDelta/120;
		if ( event.detail     ) delta = -event.detail/3;
		event.data  = event.data || {};
		event.type  = "mousewheel";
		args.unshift(delta);
		args.unshift(event);
		return $.event.handle.apply(this, args);
	}
};
$.fn.extend({
	mousewheel: function(fn) {
		return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
	},
	unmousewheel: function(fn) {
		return this.unbind("mousewheel", fn);
	}
});

/*!
 * Base64 encode / decode
 * http://www.webtoolkit.info/
 */
var Base64 = {
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
		input = Base64._utf8_encode(input);
		while (i < input.length) {
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}
			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
		}
		return output;
	},
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
		while (i < input.length) {
			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
			output = output + String.fromCharCode(chr1);
			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}
		}
		output = Base64._utf8_decode(output);
		return output;
	},
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
		for (var n = 0; n < string.length; n++) {
			var c = string.charCodeAt(n);
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
		}
		return utftext;
	},
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
		while ( i < utftext.length ) {
			c = utftext.charCodeAt(i);
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
		}
		return string;
	}
}

/*!
 * jQuery jPopup plugin v0.1
 * http://jpopup.kenphan.info/
 * Copyright 2010, Ken Phan
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */
$(function(){
	$.jPopup.config = {};
    $('body').append(
        $.jPopup.config.jTMP     = $('<div id="jTMP"></div>'), // for inline content
        $.jPopup.config.jOverlay = $('<div id="jPopupOverlay"></div>'), // for popup
        $.jPopup.config.jPopup   = $('<div id="jPopup"></div>')
    );
    $.jPopup.config.jPopupOuter = $('<div id="jPopupOuter"></div>')
        .append('<div class="jPopupStructure" id="jPopupStructureN"></div><div class="jPopupStructure" id="jPopupStructureNE"></div><div class="jPopupStructure" id="jPopupStructureE"></div><div class="jPopupStructure" id="jPopupStructureSE"></div><div class="jPopupStructure" id="jPopupStructureS"></div><div class="jPopupStructure" id="jPopupStructureSW"></div><div class="jPopupStructure" id="jPopupStructureW"></div><div class="jPopupStructure" id="jPopupStructureNW"></div>')
        .appendTo($.jPopup.config.jPopup);
    $.jPopup.config.jPopupOuter.append(
        $.jPopup.config.jPopupInner  = $('<div id="jPopupInner" />'),
        $.jPopup.config.jPopupClose  = $('<a id="jPopupClose" href="javascript:;" />')
    );
	$.jPopup.config.jPopupClose.click($.jPopup.hide);
});
$.jPopup = function(defaults){
	$.jPopup.defaults = {
		jInline: null,
		padding: 10,
		shadow: 20,
		overlay: true,
		bgcolor: '#000',
		bgopacity: .6,
		fnDone: function(){},
		fnClose: function(){}
	};
	$.jPopup.config.opts = $.extend({}, $.jPopup.defaults, defaults);
	$.jPopup.setSize($.jPopup.config.opts.jInline);
	$.jPopup.config.jTMP.html($.jPopup.config.opts.jInline.show());
	$.jPopup.config.jPopupInner.html($.jPopup.config.jTMP.contents()).css({
		top: $.jPopup.config.opts.padding,
		left: $.jPopup.config.opts.padding,
		width: $.jPopup.getSize.widthInner + 'px',
		height: $.jPopup.getSize.hightInner + 'px'
	});
	$.jPopup.config.jPopupOuter.css({
		width: $.jPopup.getSize.widthOuter + 'px',
		height: $.jPopup.getSize.hightOuter + 'px'
	});
	$.jPopup.config.open = function(){
		$.jPopup.config.jPopup.css({
			left: $.jPopup.getSize.leftX,
			marginTop: - $.jPopup.getSize.centerY
		}).show().animate({ left: $.jPopup.getSize.centerX }, 500, function(){
			$.jPopup.config.jPopupClose[0].style.display = 'block';
			$.jPopup.config.opts.fnDone.call($.jPopup.config);
		});
	}
	if($.jPopup.config.opts.overlay) {
		$.jPopup.config.jOverlay.css({
            opacity: $.jPopup.config.opts.bgopacity,
            backgroundColor: $.jPopup.config.opts.bgcolor
        }).fadeIn(300, function(){
			$.jPopup.config.open();
			$.jPopup.config.jOverlay.bind('click.jPopupHide', $.jPopup.hide);
		});
	} else {
		$.jPopup.config.open();
	}
};
$.jPopup.hide = function(){
	$.jPopup.config.jPopupClose[0].style.display = 'none';
	$.jPopup.config.jPopup.clearQueue().animate({ left: $.jPopup.getSize.leftX }, 500, function(){
		$.jPopup.config.jPopup.hide();
		$.jPopup.config.opts.fnClose();
		$.jPopup.config.jPopupInner.children('div').hide();
		$('body').append($.jPopup.config.jPopupInner.contents());
		$.jPopup.config.jOverlay.unbind('click.jPopupHide').fadeOut();
	});
};
$.jPopup.setSize = function(obj){
	var w = obj.width(), h = obj.height();
    $.jPopup.getSize = {
        windowW: $(window).width(),
        windowH: $(window).height(),
		scrollX: $(document).scrollLeft(),
		scrollY: $(document).scrollTop(),
        widthOuter: (w + ($.jPopup.config.opts.padding * 2)),
        hightOuter: (h + ($.jPopup.config.opts.padding * 2)),
		widthInner: w,
		hightInner: h
    };
	$.jPopup.getSize.widthPopup = $.jPopup.getSize.widthOuter + $.jPopup.config.opts.shadow;
	$.jPopup.getSize.hightPopup = $.jPopup.getSize.hightOuter + $.jPopup.config.opts.shadow;
	$.jPopup.getSize.leftX = - $.jPopup.getSize.widthPopup;
	$.jPopup.getSize.centerX = (($.jPopup.getSize.windowW - $.jPopup.getSize.widthPopup) * 0.5 + $.jPopup.getSize.scrollX);
	$.jPopup.getSize.centerY = $.jPopup.getSize.hightPopup/2;//(($.jPopup.getSize.windowH - $.jPopup.getSize.hightPopup) * 0.5 + $.jPopup.getSize.scrollY);
};

/*!
 * jQuery jFile plugin v0.1
 * http://blog.kenphan.info/
 * Copyright 2010, Ken Phan
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */
$.fn.jFile = function(defaults){
	$.fn.jFile.defaults = {
		onChange: function(cf){}
	};
	$.fn.jFile.config = $.extend({}, $.fn.jFile.defaults, defaults);
	return this.each(function(i){
		$(this).css({
			opacity: 0
		}).wrap('<div class="jFileWrapper" />').after(
			$.fn.jFile.config.file = $('<span class="filename" />').text(config.transition.common_c40),
			$.fn.jFile.config.action = $('<span class="action" />').text(config.transition.common_c41)
		).change(function(){
			$.fn.jFile.config.text = this.value;
			$.fn.jFile.config.file.text( $.fn.jFile.config.text );
			$.fn.jFile.config.onChange.call(this, $.fn.jFile.config);
		});
	});
};

/*!
 * jQuery jScroll plugin v0.1
 * http://blog.kenphan.info/
 * Copyright 2010, Ken Phan
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */
$.fn.jScroll = function(defaults){
	$.fn.jScroll.defaults = {
		trackWidth: 10
	};
	$.fn.jScroll.config = $.extend({}, $.fn.jScroll.defaults, defaults);
	return this.each(function(i){
		$.fn.jScroll.config.self = this;
		$.fn.jScroll.config.width = this.clientWidth;
		$.fn.jScroll.config.height = this.clientHeight;

		if($(this).parent().is('.jScroll')) { // refresh
			$.fn.jScroll.config.width = $(this)
				.attr('w');
			$.fn.jScroll.config.height = $(this)
				.css({ marginTop: '0px'})
				.attr('h');
			$.fn.jScroll.config.jScroll = $('#jScroll_' + i);
			$.fn.jScroll.config.jScrollTrack = $('#jScrollTrack_' + i);
			$.fn.jScroll.config.jScrollTrackItem = $('#jScrollTrackDrag_' + i)
				.css({ marginTop: '0px'});
		} else {
			$(this).attr({
				'w': $.fn.jScroll.config.width,
				'h': $.fn.jScroll.config.height
			}).width($.fn.jScroll.config.width - $.fn.jScroll.config.trackWidth).addClass('jScrollPanel').wrap(
				$.fn.jScroll.config.jScroll = $('<div class="jScroll" id="jScroll_' + i + '" />').css({
					height: $.fn.jScroll.config.height
				})
			).after(
				$.fn.jScroll.config.jScrollTrack = $('<div class="jScrollTrack" id="jScrollTrack_' + i + '" />').css({
					width:  $.fn.jScroll.config.trackWidth,
					height: $.fn.jScroll.config.height
				}).append(
					$.fn.jScroll.config.jScrollTrackItem = $('<div class="jScrollTrackDrag" id="jScrollTrackDrag_' + i + '" />')
				)
			);
		}
		// if height seebox more than scrollbox
		if($.fn.jScroll.config.height >= $.fn.jScroll.config.self.clientHeight) {
			$.fn.jScroll.config.jScrollTrack.hide();
			return null;
		} else { // else ...
			$.fn.jScroll.config.jScrollTrack.show();
		}
		// calculator percent set to height of trackbar
		$.fn.jScroll.config.jScrollTrackItem.css({
			height: (($.fn.jScroll.config.height / $.fn.jScroll.config.self.clientHeight) * 100) + '%'
		});
		// scrolling action
		$.fn.jScroll.config.balanceHeightHide = $.fn.jScroll.config.self.clientHeight - $.fn.jScroll.config.height;
		$.fn.jScroll.config.endDownHeight = $.fn.jScroll.config.height - $.fn.jScroll.config.jScrollTrackItem.height(); // end down height
		$.fn.jScroll.config.scrolling = function(offsetY){
			var flag = true;
			if(offsetY < 0) {
				offsetY = 0;
				flag = true;
			} else if(offsetY > $.fn.jScroll.config.endDownHeight) {
				flag = true;
				offsetY = $.fn.jScroll.config.endDownHeight;
			} else {
				flag = false;
			}
			$.fn.jScroll.config.jScrollTrackItem[0].style.marginTop = offsetY + 'px';
			$.fn.jScroll.config.self.style.marginTop = (- offsetY * $.fn.jScroll.config.balanceHeightHide / $.fn.jScroll.config.endDownHeight) + 'px';
			return flag;
		};
		// mouse move
		var moving = false, offset = { x: 0, y: 0 };
		$(document).mouseup(function(e) {
			moving = false;
		});
		$.fn.jScroll.config.jScrollTrackItem.mousedown(function(e) {
			e.preventDefault();
			moving = true;
			offset.y = (e.pageY - $.fn.jScroll.config.jScrollTrackItem[0].offsetTop);
			offset.x = (e.pageX - $.fn.jScroll.config.jScrollTrackItem[0].offsetLeft);
		});
		$(document).mousemove(function(e) {
			if(moving) {
				var o = {
					x: (e.pageX - offset.x),
					y: (e.pageY - offset.y)
				};
				$.fn.jScroll.config.scrolling(o.y)
			}
		});
		//mouse wheel
		$(this).bind('mousewheel.jScroll', function(event, delta) {
			if($.fn.jScroll.config.jScrollTrack.is(':hidden')) {
				return true;
			}
			var offsetY = parseFloat( $.fn.jScroll.config.jScrollTrackItem.css('marginTop').replace(/px/gi, '') );
				offsetY = isNaN(offsetY) ? 0 : offsetY;
			if(delta > 0) {
				offsetY = offsetY - 5;
			} else {
				offsetY = offsetY + 5;
			}
			return $.fn.jScroll.config.scrolling(offsetY);
		});
	});
};

/**
* jQuery.ajax mid - CROSS DOMAIN AJAX
* @author James Padolsey (http://james.padolsey.com)
* @version 0.11
* @updated 12-JAN-10
* @info http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/
*/
jQuery.ajax = (function(_ajax){
    var protocol = location.protocol,
        hostname = location.hostname,
        exRegex = RegExp(protocol + '//' + hostname),
        YQL = 'http' + (/^https/.test(protocol)?'s':'') + '://query.yahooapis.com/v1/public/yql?callback=?',
        query = 'select * from html where url="{URL}" and xpath="*"';
    function isExternal(url) {
        return !exRegex.test(url) && /:\/\//.test(url);
    }
    return function(o) {
        var url = o.url;
        if ( /get/i.test(o.type) && !/json/i.test(o.dataType) && isExternal(url) ) {
            o.url = YQL;
            o.dataType = 'json';
            o.data = {
                q: query.replace(
                    '{URL}',
                    url + (o.data ?
                        (/\?/.test(url) ? '&' : '?') + jQuery.param(o.data)
                    : '')
                ),
                format: 'xml'
            };
            if (!o.success && o.complete) {
                o.success = o.complete;
                delete o.complete;
            }
            o.success = (function(_success){
                return function(data) {
                    if (_success) {
						if(data.results.length > 0) {
							var newData = data.results[0].split('<body>');
								newData = newData[1].split('</body>');
							_success.call(this, filter(newData[0]), 'success');
						} else {
							_success.call(this, null, 'success');
						}
                    }
                };
            })(o.success);
			function filter(data) {
				if(typeof data === 'undefined') {
					return null;
				}
				return $.trim(data.replace(new RegExp( "<\/?[^>]+>|\\n", "gi" ), '')).replace(/\s+/g,' ');
			}
        }
        return _ajax.apply(this, arguments);
    };
})(jQuery.ajax);

/*
 * display / hidden the loading
 * @hidden: true is display
 * @flash: true is used flash mode
 * @erturn: object this
 */
$.fn.jBusy = function(hidden) {
    $.fn.jBusy.self = this;
    if(hidden == true) { // if action hidden loading
        $.fn.jBusy.self.hide().unbind('click');
        clearInterval($.fn.jBusy.timer);
    } else { // else display loading
        $.fn.jBusy.self.jBusy(true); // stop running around image background
        $.fn.jBusy.frame = 1; // currently frame run
        $.fn.jBusy.self.show();
		$.fn.jBusy.self.click(function(){
			$.fn.jBusy.self.jBusy(true);
		});
        $.fn.jBusy.timer = setInterval(function(){ // loop image around
            if (!$.fn.jBusy.self.is(':visible')){
                $.fn.jBusy.self.jBusy(true);
            }
            $.fn.jBusy.self.children('div#jBusyInner').css('top', ($.fn.jBusy.frame * -40) + 'px');
            $.fn.jBusy.frame = ($.fn.jBusy.frame + 1) % 12;
        }, 66);
    }
    return $.fn.jBusy.self;
};

/*!
 * object base method v0.1
 * http://blog.kenphan.info/
 * Copyright 2010, Ken Phan
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */
function fns(){
	this.evals = function(str){
		try {
			return eval( '(' + str + ')' );
		} catch(e) {
			return false;
		}
	};
	this.parseStringToSize = function(rawSize){
		if(rawSize / 1048576 > 1) {
			return floatPoint(rawSize/1048576) + ' MB';
		}else if( rawSize / 1024 > 1) {
			return floatPoint( rawSize/1024) + ' KB';
		}else if(rawSize > 1) {
			return floatPoint(rawSize) + ' bytes';
		}
		function floatPoint(str){
			str = str.toString();
			if(str.lastIndexOf('.') != -1){
				var aStr = str.split('.');
				if(aStr[1].length > 2){
					var of = parseInt(aStr[1].substring(2,3));
					if(of < 5){
						return aStr[0] + '.' + aStr[1].substring(0,2);
					}else{
						return aStr[0] + '.' + aStr[1].substring(0,1) + parseInt(aStr[1].substring(1,2)) ;
					}
				}
			}
			return str;
		}
		return 'unknown';
	};
	this.parseStringToTime = function(du){
		var m = Math.floor( du / 60), s = Math.round(du - m * 60);
		if(m < 10){
			m = '0' + m;
		}
		if(s < 10){
			s = '0' + s;
		}
		return m + ':' + s;
	};
}


