WidgetItems = [{"href":"http:\/\/freelancefolder.com\/10-amazing-free-online-writing-courses\/","title":"10 Amazing Free Online Writing Courses","source":"freelancefolder.com"},{"href":"http:\/\/designshack.co.uk\/articles\/critique-articles\/web-design-critique-15-we-can-service-your-car","title":"Web Design Critique #15: We Can Service Your Car","source":"designshack.co.uk"},{"href":"http:\/\/psd.tutsplus.com\/articles\/inspiration\/garry-milne-skating-his-way-to-the-top\/","title":"Garry Milne: Skating His Way to the Top","source":"psd.tutsplus.com"},{"href":"http:\/\/net.tutsplus.com\/tutorials\/html-css-techniques\/typography-on-the-web\/","title":"An Analysis of Typography on the Web","source":"net.tutsplus.com"},{"href":"http:\/\/css-tricks.com\/how-long-should-we-ban-ips\/","title":"How Long Should We Ban\u00a0IPs?","source":"css-tricks.com"},{"href":"http:\/\/psd.tutsplus.com\/freebies\/wallpapers\/psdtuts-presents-exclusive-wallpapers-by-jennifer-cirpici\/","title":"Psdtuts Presents Exclusive Wallpapers by Jennifer Cirpici","source":"psd.tutsplus.com"},{"href":"http:\/\/www.hongkiat.com\/blog\/website-speed-and-performance-check-tools\/","title":"18 Website Speed and Performance Checking Tools","source":"hongkiat.com"},{"href":"http:\/\/designshack.co.uk\/articles\/graphics\/10-tips-for-designing-presentations-that-dont-suck-pt-1","title":"10 Tips for Designing Presentations That Don\u2019t Suck: Pt.1","source":"designshack.co.uk"},{"href":"http:\/\/psd.tutsplus.com\/tutorials\/illustration\/create-a-graffiti-inspired-illustration-using-photoshop-and-illustrator\/","title":"Create a Graffiti-Inspired Illustration Using Photoshop and Illustrator","source":"psd.tutsplus.com"},{"href":"http:\/\/freelancefolder.com\/how-to-land-more-projects-with-smarter-follow-up\/","title":"How to Land More Projects with Smarter Follow-Up Steps","source":"freelancefolder.com"}];
SmashingWidget = {
	filtersource : null,
	params_def : new Array(),
	params : new Array(),
	init : function() {
		this.params_def['items'] = 5;	
		this.params_def['cssclass'] = 'default';	
	},
	getparam : function(opt) { 
		if(typeof(SmashingWidgetConfig) !== 'undefined' && typeof(SmashingWidgetConfig[opt]) !== 'undefined')
		{
			return SmashingWidgetConfig[opt];
		}
		if(typeof(this.params_def[opt]) !== 'undefined')
		{ 
			return this.params_def[opt];
		}
		return false;
	},
	myMatch : function(obj,filter)
	{
		if(filter === false || filter.length < 1)
		{
			return false;
		}
		filter = filter.replace(/[^a-z]/, '');
		pattern=eval("/"+filter + "/");
		if(obj.match(pattern) !== null)
		{
			//console.log('filtering:'+filter);
		}
		return obj.match(pattern) !== null;
	},				
	addItem : function(item,last)
	{
		if(!SmashingWidget.myMatch(item.source,SmashingWidget.filtersource))
		{
			document.write('<l'+'i class="'+(last?'sw-last':'')+'"><'+'a class="sw-title" hr'+'ef="'+item.href+'">'+item.title+'</'+'a><d'+'iv class="sw-source">'+item.source+'</d'+'iv></l'+'i>');
			return true;
		}
		
		return false;
	},
	printlist : function() 
	{
		document.write('<d'+'iv cl'+'ass="smashingwidget '+SmashingWidget.getparam('cssclass')+'"><h'+'3 onclick="window.location = \'http://www.smashingmagazine.com/network-posts/\'"><'+'a h'+'ref="http://www.smashingmagazine.com/network-posts/"><s'+'pan>Smashing Network</s'+'pan><'+'i'+'mg s'+'rc="http://media.smashingmagazine.com/cdn_smash/files/smashing-widget/v006/img/sn-icon-style-6-32px.png?v=006" a'+'lt="Smashing Network"/></'+'a></h'+'3><o'+'l>');
		var added = 0; SmashingWidget.filtersource = SmashingWidget.getparam('filtersource');
		
		for(var i = 0; i<WidgetItems.length-1 && added<parseInt(SmashingWidget.getparam('items'),10)-1;i++)
		{
			if(WidgetItems[i] !== undefined && SmashingWidget.addItem(WidgetItems[i], false))
			{
				added++;
			}
		}
		
		//console.log('added:'+added+', i:'+i);
		added = 0;
		for(var y = i; y<WidgetItems.length && added<1;y++)
		{
			if(WidgetItems[y] !== undefined && SmashingWidget.addItem(WidgetItems[y], true))
			{
				added++;
			}
		}
		//console.log('added:'+added+', i:'+i);
		document.write('</o'+'l></di'+'v>');
	}				
}

SmashingWidget.init();
SmashingWidget.printlist();