  
/*
 * jQuery Tooltip plugin 1.3
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).mouseover(save).mouseout(hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else
show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return;}if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
helper.parent.stop().fadeOut(tsettings.fade,complete);}else
complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}})(jQuery);

/* Cookie 1.2*/
jQuery.jCookie=function(i,b,l,j){if(!navigator.cookieEnabled){return false}var j=j||{};if(typeof(arguments[0])!=="string"&&arguments.length===1){j=arguments[0];i=j.name;b=j.value;l=j.expires}i=encodeURI(i);if(b&&(typeof(b)!=="number"&&typeof(b)!=="string"&&b!==null)){return false}var e=j.path?"; path="+j.path:"";var f=j.domain?"; domain="+j.domain:"";var d=j.secure?"; secure":"";var g="";if(b||(b===null&&arguments.length==2)){l=(l===null||(b===null&&arguments.length==2))?-1:l;if(typeof(l)==="number"&&l!="session"&&l!==undefined){var k=new Date();k.setTime(k.getTime()+(l*24*60*60*1000));g=["; expires=",k.toGMTString()].join("")}document.cookie=[i,"=",encodeURI(b),g,f,e,d].join("");return true}if(!b&&typeof(arguments[0])==="string"&&arguments.length==1&&document.cookie&&document.cookie.length){var a=document.cookie.split(";");var h=a.length;while(h--){var c=a[h].split("=");if(jQuery.trim(c[0])===i){return decodeURI(c[1])}}}return false};

/* 	gaTracker 1.0.1: jQuery Google Analytics Integration 
	A quicker, automated way to embed Google Analytics.
	(c)2007 Jason Huck/Core Five Creative
	
	* BETA Support for new Analytics API (ga.js) by Jamie Thompson - http://jamazon.co.uk
	* Requires jQuery 1.2.x or higher (for cross-domain $.getScript)
	* TODO: more testing, delay after $.getScript for Safari
	
	Usage:
	Only a tracking code is required:
	$.gaTracker('UA-XXXXX-XX');

	...but other options can be specified:
	$.gaTracker(
		'UA-XXXXX-XX',
		{
			external:	'/external/',
			mailto:		'/mailto/',
			download:	'/downloads/',
			extensions:	[
				'pdf','doc','xls','csv','jpg','gif', 'mp3',
				'swf','txt','ppt','zip','gz','dmg','xml'		
			]
		}
	);

*/


(function($){
	$.gaTracker = function(code, opts){
		opts = jQuery.extend({
			external:	'/external/',
			mailto:		'/mailtos/',
			download:	'/downloads/',
			extensions: [
					'pdf','doc','xls','csv','jpg','gif', 'mp3',
					'swf','txt','ppt','zip','gz','dmg','xml', 'js'		
			]	
		}, opts);
		
		// Returns the given URL prefixed if it is:
		//		a) a link to an external site
		//		b) a mailto link
		//		c) a downloadable file
		// ...otherwise returns an empty string.
		function decorateLink(u){
			var trackingURL = '';
			
			if(u.indexOf('://') == -1 && u.indexOf('mailto:') != 0){
				// no protocol or mailto - internal link - check extension
				var ext = u.split('.')[u.split('.').length - 1];			
				var exts = opts.extensions;
				
				for(i = 0; i < exts.length; i++){
					if(ext == exts[i]){
						trackingURL = opts.download + u;
						break;
					}
				}				
			} else {
				if(u.indexOf('mailto:') == 0){
					// mailto link - decorate
					trackingURL = opts.mailto + u.substring(7);					
				} else {
					// complete URL - check domain
					var regex = /([^:\/]+)*(?::\/\/)*([^:\/]+)(:[0-9]+)*\/?/i;
					var linkparts = regex.exec(u);
					var urlparts = regex.exec(location.href);					
					if(linkparts[2] != urlparts[2]) trackingURL = opts.external + u;
				}
			}
			
			return trackingURL;			
		}
		
		// add tracking code to the current page
		function addTracking(){
			$.pageTracker = _gat._getTracker(code);
			$.pageTracker._initData();
			$.pageTracker._trackPageview();
		
			// examine every link in the page
			$('a').each(function(){
				var u = $(this).attr('href');
				
				if(typeof(u) != 'undefined'){
					var newLink = decorateLink(u);

					// if it needs to be tracked manually,
					// bind a click event to call GA with
					// the decorated/prefixed link
					if(newLink.length){
						$(this).click(function(){
							$.pageTracker._trackPageview(newLink);
						});
					}
				}				
			});
		}
		
		// include the external GA script in try/catch to play nice
		function initGA(){
			try{
				// determine whether to include the normal or SSL version
				var gaURL = (location.href.indexOf('https') == 0 ? 'https://ssl' : 'http://www');
				gaURL += '.google-analytics.com/ga.js';
		
				// include the script
				$.getScript(gaURL, function(){
					addTracking();
				});
			} catch(err) {
				// log any failure
				console.log('Failed to load Google Analytics:' + err);
			}
		}
		
		initGA();
	}
})(jQuery);
 (function()
        {
            $.fn.QRCode = function(url, options)
            {
                var settings = 
                {
                    width: 200,
                    height: 200
                };

                if (options) { $.extend(settings, options); }
                
                this.each(function()
                {
                    $(this).html("<img src='https://chart.googleapis.com/chart?cht=qr&chs=" + 
                        settings.width + "x" + settings.height + "&chl=" + escape(url) + "' alt='QR Code' />");
                });
            }
        })(jQuery);

/*
* jQuery Bit.Ly Shorten Url Plugin
* 2010 Justin Swan
* License: Creative Commons Attribution-Share Alike 3.0 Australia Licence
* Original Author: Uzbekjon (http://jquery-howto.blogspot.com/2009/04/shorten-long-urls-with-jquery-bitly.html)
* Version: 1.0.0
*
* Grateful for any feedback on improvements.
*
* Call: $(input field).shorten_url(long url)
* Returns: shortened url as value for input field.
*
*/
 
//
// start closure
//
(function($){
$.fn.shorten_url = function(url,options){
// Extend our default options with those provided.
var opts = $.extend($.fn.shorten_url.defaults, options);
 
return this.each(function(){
$this = $(this);
 
// format url to request
var daurl = "http://api.bit.ly/shorten?"
+"version="+opts.version
+"&longUrl="+url
+"&login="+opts.login
+"&apiKey="+opts.apiKey
+"&history="+opts.history
+"&format=json&callback=?";
 
// Utilize the bit.ly API
$.getJSON(daurl, function(data){
// Make a good use of short URL
$this.val(data.results[url].shortUrl);
});
});
};
 
$.fn.shorten_url.defaults = {
version: '2.0.1',
login: 'techabo', // your bit.ly account login
apiKey: 'R_bf66d754a519bce82470d1b098b2bccd', // your api key here
history: '0',
};
//
// end of closure
//
})(jQuery);

//** jQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09')
//** v1.1 (April 7th, 09'):
//** 1) Adds ability to scroll to an absolute position (from top of page) or specific element on the page instead.
//** 2) Fixes scroll animation not working in Opera. 


var scrolltotop={
	//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
	//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
	setting: {startline:140, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
	controlHTML: '<img src="/images/up.png" style="width:48px; height:48px" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
	controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
	anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

	state: {isvisible:false, shouldvisible:false},

	scrollup:function(){
		if (!this.cssfixedsupport) //if control is positioned using JavaScript
			this.$control.css({opacity:0}) //hide control immediately after clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},

	keepfixed:function(){
		var $window=jQuery(window)
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},

	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:'Scroll Back to Top'})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
				mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
};
/*
 * jQuery OpenX ad tags plugin
 *
 * Tested with OpenX Community Edition 2.8.8-rc6
 *
 * @version 1.1
 * @date Fri Jul 15 14:27:52 2011 +0400
 * @requires jQuery
 * @url http://plugins.jquery.com/project/openxtag
 *
 * @author Nikolay Morev <kolia@denivip.ru>
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 *
 */(function($){function _buildStandardRequestParameters(a){var b={charset:a.charset,target:a.target,source:a.source,extra:a.extra,loc:window.location.href};typeof a.block!="undefined"&&(b.block=a.block?1:0),typeof a.blockcampaign!="undefined"&&(b.blockcampaign=a.blockcampaign?1:0),document.referrer&&(b.referer=document.referrer);for(var c in b)typeof b[c]=="undefined"&&delete b[c];return b}function _validateSettings(a){location.protocol=="https:"?typeof a.deliverySSL!="string"&&$.error('please set "deliverySSL" option for openxtag'):typeof a.delivery!="string"&&$.error('please set "delivery" option for openxtag')}function _genericZoneCall(a,b,c,d){if(typeof b=="object"||typeof b=="function")d=c,c=b,b=null;typeof c=="function"&&(d=c,c=null);var e=$.extend(defaults,c);b!=null&&(e.zoneID=b);return a.apply(this,[b,e,d])}function _documentWriteSafeAppend(a,b){var c=0;(function(a){if(a.match(/document\.write|<script/)){var d=document.write,e="";document.write=function(a){e+=a},b.append(a),document.write=d,c++,c>_loopIterations&&$.error("openxtag: document.write loop stopped after "+_loopIterations+" iterations"),arguments.callee(e)}else b.append(a),typeof success=="function"&&setTimeout(success,0)})(a)}var _loopIterations=10,defaults={jsPrefix:"OA_",swfObjectJS:"fl.js",delivery:null,deliverySSL:null,jsTagScript:"ajs.php",spcTagScript:"spc.php",iframeTagScript:"afr.php",adViewScript:"avw.php",clickScript:"ck.php",charset:"UTF-8",zoneID:null,target:undefined,source:undefined,blockcampaign:undefined,block:undefined,forceAsync:!1,refresh:undefined,resize:undefined,allowtransparent:undefined,width:undefined,height:undefined,extra:undefined},init=function(a){defaults=$.extend(defaults,a)},jsZone=function(a,b,c){return this.each(function(){var a=$(this),c=$.extend({},b);typeof $.metadata!="undefined"&&(c=$.extend(c,a.metadata())),_validateSettings(c);var d=c.zoneID;d==null&&$.error('please set "zoneID" option for openxtag jsZone');var e=_buildStandardRequestParameters(c);e.zoneid=d,e.cb=Math.floor(Math.random()*99999999999),document.MAX_used||(document.MAX_used=","),document.MAX_used!=","&&(e.exclude=document.MAX_used),document.context&&(e.context=document.context),document.mmm_fo&&(e.mmm_fo=1);var f=(location.protocol=="https:"?c.deliverySSL:c.delivery)+"/"+c.jsTagScript;$.ajax({url:f,data:e,dataType:"html",async:c.forceAsync,success:function(b){_documentWriteSafeAppend('<script type="text/javascript">'+b+"</script>",a)}})})},iFrameZone=function(a,b,c){return this.each(function(){var a=$(this),c=$.extend({},b);typeof $.metadata!="undefined"&&(c=$.extend(c,a.metadata())),_validateSettings(c);var d=c.zoneID;d==null&&$.error('please set "zoneID" option for openxtag iframe');var e=_buildStandardRequestParameters(c);e.zoneid=d,e.cb=Math.floor(Math.random()*99999999999),typeof c.refresh!="undefined"&&(e.refresh=c.refresh),typeof c.resize!="undefined"&&(e.resize=c.resize?1:0),typeof c.width=="undefined"&&$.error("openxtag: width parameter is required for iframe tag");var f=c.width;typeof c.height=="undefined"&&$.error("openxtag: height parameter is required for iframe tag");var g=c.height,h="";typeof c.allowtransparent!="allowtransparent"&&c.allowtransparent&&(h=' allowtransparency="true" ');var i="a"+Math.floor(Math.random()*999999),j=typeof c.target=="undefined"?"_blank":c.target,k=location.protocol=="https:"?c.deliverySSL:c.delivery,l=k+"/"+c.iframeTagScript,m=k+"/"+c.clickScript,n=k+"/"+c.adViewScript;a.append("<iframe id='"+i+"' name='"+i+"' src='"+l+"?"+$.param(e)+"' frameborder='0' scrolling='no' width='"+f+"' height='"+g+"'"+h+"><a href='"+m+"?n="+i+"&amp;cb="+e.cb+"' target='"+j+"'><img src='"+n+"?zoneid="+d+"&amp;cb="+e.cb+"&amp;n="+i+"' border='0' alt='' /></a></iframe>")})},spcTag=function(zoneID,settings,success){var zones={},i=0,chainObj=this.each(function(){var a=$(this),b=$.extend({},settings);typeof $.metadata!="undefined"&&(b=$.extend(b,a.metadata()));var c=b.zoneID;c==null&&$.error('please set "zoneID" option for openxtag jsZone');var d="z"+i;zones[d]=c,a.data("openxtag",{zn:d}),i++}),thesettings=$.extend({},settings);_validateSettings(thesettings);var data=_buildStandardRequestParameters(thesettings);data.zones=Object.keys(zones).map(function(a){return a+"="+zones[a]}).join("|"),data.nz=1,data.r=Math.floor(Math.random()*99999999999);var scriptURL=(location.protocol=="https:"?thesettings.deliverySSL:thesettings.delivery)+"/"+thesettings.spcTagScript,that=this;$.ajax({url:scriptURL,data:data,dataType:"html",async:thesettings.forceAsync,success:function(data){var flJsURL=(location.protocol=="https:"?thesettings.deliverySSL:thesettings.delivery)+"/"+thesettings.swfObjectJS;$.getScript(flJsURL,function(){var output=eval("(function () {"+data+";return "+thesettings.jsPrefix+"output;})()");that.each(function(){var a=$(this);_documentWriteSafeAppend(output[a.data("openxtag").zn],a)})})}});return chainObj},fnMethods={zone:jsZone,jsZone:jsZone,spc:spcTag,iframe:iFrameZone};$.fn.extend({openxtag:function(a){if(fnMethods[a])return _genericZoneCall.apply(this,[fnMethods[a]].concat(Array.prototype.slice.call(arguments,1)));$.error("Method "+a+" does not exist on jQuery.openxtag")}});var methods={init:init};$.extend({openxtag:function(a){if(methods[a])return methods[a].apply(this,Array.prototype.slice.call(arguments,1));if(typeof a=="object"||!a)return methods.init.apply(this,arguments);$.error("Method "+a+" does not exist on jQuery.openxtag")}})})(jQuery);
/*
 * Metadata - jQuery plugin for parsing metadata from elements
 *
 * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $
 *
 */

/**
 * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
 * in the JSON will become a property of the element itself.
 *
 * There are four supported types of metadata storage:
 *
 *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
 *          
 *   class: Inside the class attribute, wrapped in curly braces: { }
 *   
 *   elem:  Inside a child element (e.g. a script tag). The
 *          name parameter indicates *which* element.
 *   html5: Values are stored in data-* attributes.
 *          
 * The metadata for an element is loaded the first time the element is accessed via jQuery.
 *
 * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
 * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
 * 
 * @name $.metadata.setType
 *
 * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("class")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from the class attribute
 * 
 * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("attr", "data")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a "data" attribute
 * 
 * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
 * @before $.metadata.setType("elem", "script")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a nested script element
 * 
 * @example <p id="one" class="some_class" data-item_id="1" data-item_label="Label">This is a p</p>
 * @before $.metadata.setType("html5")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a series of data-* attributes
 *
 * @param String type The encoding type
 * @param String name The name of the attribute to be used to get metadata (optional)
 * @cat Plugins/Metadata
 * @descr Sets the type of encoding to be used when loading metadata for the first time
 * @type undefined
 * @see metadata()
 */

(function($) {

$.extend({
  metadata : {
    defaults : {
      type: 'class',
      name: 'metadata',
      cre: /({.*})/,
      single: 'metadata'
    },
    setType: function( type, name ){
      this.defaults.type = type;
      this.defaults.name = name;
    },
    get: function( elem, opts ){
      var settings = $.extend({},this.defaults,opts);
      // check for empty string in single property
      if ( !settings.single.length ) settings.single = 'metadata';
      
      var data = $.data(elem, settings.single);
      // returned cached data if it already exists
      if ( data ) return data;
      
      data = "{}";
      
      var getData = function(data) {
        if(typeof data != "string") return data;
        
        if( data.indexOf('{') < 0 ) {
          data = eval("(" + data + ")");
        }
      }
      
      var getObject = function(data) {
        if(typeof data != "string") return data;
        
        data = eval("(" + data + ")");
        return data;
      }
      
      if ( settings.type == "html5" ) {
        var object = {};
        $( elem.attributes ).each(function() {
          var name = this.nodeName;
          if(name.match(/^data-/)) name = name.replace(/^data-/, '');
          else return true;
          object[name] = getObject(this.nodeValue);
        });
      } else {
        if ( settings.type == "class" ) {
          var m = settings.cre.exec( elem.className );
          if ( m )
            data = m[1];
        } else if ( settings.type == "elem" ) {
          if( !elem.getElementsByTagName ) return;
          var e = elem.getElementsByTagName(settings.name);
          if ( e.length )
            data = $.trim(e[0].innerHTML);
        } else if ( elem.getAttribute != undefined ) {
          var attr = elem.getAttribute( settings.name );
          if ( attr )
            data = attr;
        }
        object = getObject(data.indexOf("{") < 0 ? "{" + data + "}" : data);
      }
      
      $.data( elem, settings.single, object );
      return object;
    }
  }
});

/**
 * Returns the metadata object for the first member of the jQuery object.
 *
 * @name metadata
 * @descr Returns element's metadata object
 * @param Object opts An object contianing settings to override the defaults
 * @type jQuery
 * @cat Plugins/Metadata
 */
$.fn.metadata = function( opts ){
  return $.metadata.get( this[0], opts );
};

})(jQuery);

/* 	Twitter Friends v1.0
	Blog : http://www.moretechtips.net
	Project: http://code.google.com/p/twitter-friends-widget/
	Date: 2011-06-09
	Copyright 2009 [Mike @ moretechtips.net] 
	Licensed under the Apache License, Version 2.0 
	(the "License"); you may not use this file except in compliance with the License. 
	You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
*/
(function(d){d.fn.twitterFriends=function(o){var s={debug:0,username:"",friends:0,users:20,users_max:100,loop:0,user_link:0,user_image:48,user_animate:"opacity",user_change:200,user_swap:5E3,user_append:1,header:"",tweet:0,tweet_avatar:1,tweet_author:0,tweet_date:1,tweet_source:1,tweet_image:48,tweet_stay:5E3,tweet_change:200,tweet_animate:"opacity",info:'<div class="tf-info"><a title="get Twitter Friends & Followers Widget!" target="_blank" href="http://www.moretechtips.net/">.i</a></div>'};o=d.extend({},
s,o);return this.each(function(){var t=0,f=[],i=-1,k=-1,l=-1,g=d(this),j=null,m=null,p=null,b=o;if(g.attr("options")){try{b=eval("("+g.attr("options")+")")}catch(B){g.html('<b style="color:red">'+B+"</b>");return}b=d.extend({},s,b)}var q=function(){if((i+1)*b.users>=f.length)if(b.loop)i=-1;else return;j.html("");i++;for(var a=i*b.users;a<(i+1)*b.users;a++){if(a>=f.length)break;var c=f[a],e=b.user_link&&c.url?c.url:"http://twitter.com/"+c.screen_name,h=c.name+(c.status&&b.tweet?": "+c.status.text:
"");h=h.replace(/"/g,"&quot;").replace(/'/g,"&#39;");d('<a style="display:none;height:'+b.user_image+'px" href="'+e+'" title="'+h+'"><img src="'+c.profile_image_url+'" border="0" height="'+b.user_image+'" width="'+b.user_image+'"/></a>').appendTo(j)}k=b.user_append?-1:d("a",j).length;u();l=-1;b.tweet&&v()},u=function(){k=b.user_append?k+1:k-1;var a=d("a:eq("+k+")",j);if(a.length){var c={};c[b.user_animate]="show";a.animate(c,b.user_change,"linear",u)}else b.tweet||j.animate({opacity:1},b.user_swap,
"linear",q)},v=function(){l>-1?d("div",m).fadeOut(b.tweet_change,w):w()},w=function(){for(var a=null,c=null;!c;){l++;if(l>=d("a",j).length){q();return}a=f[i*b.users+l];c=a.status}a=a;c=c;var e=b.user_link&&a.url?a.url:"http://twitter.com/"+a.screen_name,h=a.name;m.html('<div style="display:none;">'+(b.tweet_avatar?'<span class="tf-avatar"><a href="'+e+'" title="'+h+'"><img src="'+a.profile_image_url+'" height="'+b.tweet_image+'" width="'+b.tweet_image+'" border="0"/></a></span>':"")+'<span class="tf-body">'+
(b.tweet_author?'<strong><a href="'+e+'" title="'+h+'">'+a.screen_name+"</a></strong>":"")+'<span class="tf-content">'+C(c.text)+'</span><span class="tf-meta">'+(b.tweet_date?'<a class="tf-date" href="http://twitter.com/'+a.screen_name+"/status/"+c.id+'">'+D(c.created_at)+"</a>":"")+(b.tweet_source?'<span class="tf-source"> from '+c.source.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"')+"</span>":"")+"</span></span></div>");a={};a[b.tweet_animate]="show";d("div",m).animate(a,b.tweet_change,
"linear",E)},E=function(){d("div",m).animate({opacity:1},b.tweet_stay,"linear",v)},C=function(a){return a.replace(/\bhttps?\:\/\/\S+/gi,function(c){var e="";c=c.replace(/(\.*|\?*|\!*)$/,function(h,r){e=r;return""});return'<a class="tf-link" href="'+c+'">'+(c.length>25?c.substr(0,24)+"...":c)+"</a>"+e}).replace(/\B\@([A-Z0-9_]{1,15})/gi,'@<a class="tf-at" href="http://twitter.com/$1">$1</a>').replace(/\B\#([A-Z0-9_]+)/gi,'<a class="tf-hashtag" href="http://search.twitter.com/search?q=%23$1">#$1</a>')},
D=function(a){if(/^(\w\w\w) (\w\w\w) (\d\d?) (\d\d?:\d\d?:\d\d?) ([\+\-]\d+) (\d\d\d\d)$/i.test(a))a=a.replace(/^(\w\w\w) (\w\w\w) (\d\d?) (\d\d?:\d\d?:\d\d?) ([\+\-]\d+) (\d\d\d\d)$/i,"$1, $3 $2 $6 $4 $5");var c=new Date,e=new Date;c.setTime(Date.parse(a));var h=e.getDate(),r=e.getMonth()+1,F=e.getFullYear(),G=e.getHours(),n=e.getMinutes();e=e.getSeconds();var x=c.getDate(),y=c.getMonth()+1,z=c.getFullYear(),H=c.getHours(),I=c.getMinutes();a=c.getSeconds();if(z==F&&y==r&&x==h){c=G-H;if(c>0)return c+
" hour"+(c>1?"s":"")+" ago";n=n-I;if(n>0)return n+" minute"+(n>1?"s":"")+" ago";a=e-a;return a+" second"+(a>1?"s":"")+" ago"}else return y+"/"+x+"/"+z},J=function(a){A();if(a.screen_name)p.html(b.header.replace(/_tp_/g,"http://twitter.com/"+a.screen_name).replace(/_fr_/g,a.friends_count).replace(/_fo_/g,a.followers_count).replace(/_ti_/g,a.profile_image_url));else if(b.debug)p.html('<b style="color:red">Error:'+(a.error?a.error:"unkown")+"</b>")},A=function(){if(!t){t=1;g.html("");b.info&&g.append(b.info);
if(b.header)p=d('<div class="tf-header"></div>').appendTo(g);j=d('<div class="tf-users"></div>').appendTo(g);if(b.tweet)m=d('<div class="tf-tweet"></div>').appendTo(g)}};b.header&&d.ajax({url:"http://api.twitter.com/1/users/show.json",data:{screen_name:b.username},success:J,dataType:"jsonp",cache:true});d.ajax({url:b.friends?"http://api.twitter.com/1/statuses/friends.json":"http://api.twitter.com/1/statuses/followers.json",data:{screen_name:b.username,cursor:-1},success:function(a){if(a.users){f=
a.users;if(f.length!=0){if(f.length>b.users_max)f.length=b.users_max;f=f.reverse();A();i=-1;q()}}else if(b.debug)g.html('<b style="color:red">Error:'+(a.error?a.error:"unkown")+"</b>")},dataType:"jsonp",cache:true})})}})(jQuery);jQuery(document).ready(function(){jQuery("div.twitter-friends").twitterFriends()});

