function coswidget(options){
		var frame = document.createElement('iframe');		
		frame.setAttribute("src","http://www.communityofsweden.com/pages/common/widgetwrapper.aspx?referral=" + window.location.href + "&width=" + options.width +"&height=" + contentHeight +"&photos=" + options.photos +"&stories=" + options.stories +"&className=" + options.className +"&userid=" + options.userid  +"&winter=" + options.winter +"&spring=" + options.spring +"&summer=" + options.summer +"&autumn=" + options.autumn +"&geoFilter=" + options.geoFilter + "&tagCombo=" + options.tagCombo + "&partnerRegion=" + options.partnerRegion);	 
		//frame.setAttribute("src","widget.html?width=" + options.width +"&photos=" + options.photos +"&stories=" + options.stories +"&className=" + options.class +"&userid=" + options.userid);
		frame.setAttribute('frameborder','0');
		frame.setAttribute('border','0');
		frame.setAttribute('scrolling','no');
		frame.setAttribute('style', 'background:#DFDFDF;border-bottom:1px solid #dfdfdf;');
		frame.setAttribute('width',((options.width*172)+11)+'px');
		
		var contentAmount = parseInt(options.stories)+parseInt(options.photos);
		var contentBlock = 172;
		var contentHeight;
		
		switch(parseInt(options.width)){
			case 1: 
				switch(contentAmount){
					case 1: contentHeight = contentBlock; break;
					case 2: contentHeight = 2*contentBlock; break;
					case 3: contentHeight = 3*contentBlock; break;
					case 4: contentHeight = 4*contentBlock; break;
					case 5: contentHeight = 5*contentBlock; break;
					case 6: contentHeight = 6*contentBlock; break;
					case 7: contentHeight = 7*contentBlock; break;
					case 8: contentHeight = 8*contentBlock; break;
					case 9: contentHeight = 9*contentBlock; break;
					case 10: contentHeight = 10*contentBlock; break;
					case 11: contentHeight = 11*contentBlock; break;
					case 12: contentHeight = 12*contentBlock; break;
				};
				frame.setAttribute('height',contentHeight+213+'px');
				break;
			case 2:
				switch(contentAmount){
					case 1: 
					case 2: contentHeight = contentBlock; break;
					case 3: 
					case 4: contentHeight = 2*contentBlock; break;
					case 5: 
					case 6: contentHeight = 3*contentBlock; break;
					case 7: 
					case 8: contentHeight = 4*contentBlock; break;
					case 9: 
					case 10: contentHeight = 5*contentBlock; break;
					case 11: 
					case 12: contentHeight = 6*contentBlock; break;
				};
				frame.setAttribute('height',contentHeight+161+'px');
				break;
			case 3:
				switch(contentAmount){
					case 1: 
					case 2: 
					case 3: contentHeight = contentBlock; break;
					case 4: 
					case 5: 
					case 6: contentHeight = 2*contentBlock; break;
					case 7: 
					case 8: 
					case 9: contentHeight = 3*contentBlock; break;
					case 10: 
					case 11: 
					case 12: contentHeight = 4*contentBlock; break;
				};
				frame.setAttribute('height',contentHeight+147+'px');
				break;
			default:
				contentHeight = contentBlock;
				break;
		};

		var scr = document.getElementById('coswidget'); 
		scr.parentNode.insertBefore(frame, scr);
};	