Cufon.replace('div.post h2'); // replace as necessaryCufon.replace('h1'); // replace as necessaryCufon.replace('#tags a'); // replace as necessaryCufon.replace('.author-info h2'); // replace as necessaryvar wpurl = 'http://nyheter.findus.se';var mainurl = 'http://nyheter.findus.se/wp-content/themes/findus_nyheter/';$(document).ready(function(){$("#video-chooser li a").live("click", get_video);$('#scrollpane').jScrollPane();$('#tabpane').tabs({ selected: 1 });$('#flickrtabs').tabs({ selected: 1 });//$("#newstabs").idTabs();	$('#newstabs li a').click(function () {			$('#shareit-box').hide();  			$('#shareit-field').val('');	});$("#playerTabs").idTabs();$('.tipsy').tipsy({gravity: 'e'}); // n | s | e | w$('.tipsy-share').tipsy({gravity: 'n'}); // n | s | e | w// Google news//tillsatser OR "onödiga tillsatser" OR färdigmat OR "fryst färdigmat" OR livsmedelstillsatser//http://news.google.com/news?pz=1&ned=sv_se&hl=sv&q=tillsatser+OR+%22on%C3%B6diga+tillsatser%22+OR+f%C3%A4rdigmat+OR+%22fryst+f%C3%A4rdigmat%22+OR+livsmedelstillsatser&output=rss//http://news.google.com/news?ned=tsv_se&hl=sv&q=tillsatser+OR+%22on%C3%B6diga+tillsatser%22+OR+f%C3%A4rdigmat+OR+%22fryst+f%C3%A4rdigmat%22+OR+livsmedelstillsatser&scoring=n&output=rss//http://feeds.feedburner.com/findus_nyheter?format=xml//http://feeds.feedburner.com/findus_gnd?format=xml//Yahoo news//http://news.search.yahoo.com/news/rss;_ylt=A0WTTkoCDaBKfysBXzPQtDMD;_ylu=X3oDMTA3MTBsZGZsBHNlYwNhZG0-?ei=UTF-8&va=&va_vt=any&vp=&vp_vt=any&vo=tillsatser+OR+%22on%C3%B6diga+tillsatser%22+OR+f%C3%A4rdigmat+OR+%22fryst+f%C3%A4rdigmat%22+OR+livsmedelstillsatser&vo_vt=any&ve=&ve_vt=any&datesort=1&pub=&timeago=&smonth=8&sday=4&emonth=9&eday=3&source=&location=&fl=1&vl=lang_sv&n=15&eo=UTF-8var url1 = "http://feeds.feedburner.com/findus_news?format=xml";// Twingly bloggsök//http://www.twingly.com/search.rss?q=tillsatser%2c+|+%22on%C3%B6diga+|+tillsatser%22%2c+|+f%C3%A4rdigmat%2c+|+%22fryst+|+f%C3%A4rdigmat%22%2c+|+livsmedelstillsatser&lang=sv&site=// by date// http://www.twingly.com/search.rss?q=tillsatser%2c+|+%22on%C3%B6diga+|+tillsatser%22%2c+|+f%C3%A4rdigmat%2c+|+%22fryst+|+f%C3%A4rdigmat%22%2c+|+livsmedelstillsatser&lang=sv&sort=published// Google blogsearch//http://blogsearch.google.com/blogsearch_feeds?client=news&hl=sv&q=tillsatser+OR+%22on%C3%B6diga+tillsatser%22+OR+f%C3%A4rdigmat+OR+%22fryst+f%C3%A4rdigmat%22+OR+livsmedelstillsatser&ie=utf-8&num=10&output=rss//http://feeds.feedburner.com/findus_google_blog?format=xmlvar url2 = "http://feeds.feedburner.com/findus_blog?format=xml";//http://feeds.feedburner.com/findus_blog?format=xml// Twingly Microbloggsök// tillsatser OR "onödiga tillsatser" OR färdigmat OR "fryst färdigmat" OR livsmedelstillsatservar url3 = "http://feeds.feedburner.com/findus_microblog?format=xml";gMicroFeed(url3, '#mikrobloggar', 'mikrobloggar');$('#contributors').cycle({     fx:     'scrollRight',     speed:  'fast',     timeout: 0,     next:   '#next2',     prev:   '#prev2' });shareIt();$('.tipsy').click(function () {	return false;});});jQuery(function(){     $('#flickr').flickr({         api_key: 'd05c1fefec54c64b28b840ee974ad7e5',    photoset_id: '72157622068790635',    type: 'photoset',    user_id: '42017787@N03',    per_page: 18,    callback: liteboxCallback1 });$('#flickr-2').flickr({         api_key: "d05c1fefec54c64b28b840ee974ad7e5",    photoset_id: '72157622284713050',    type: 'photoset',    user_id: '42017787@N03',    per_page: 18,    callback: liteboxCallback2 });$('#flickr-3').flickr({         api_key: "d05c1fefec54c64b28b840ee974ad7e5",    photoset_id: '72157622161573603',    type: 'photoset',    user_id: '42017787@N03',    per_page: 18,    callback: liteboxCallback3 });}); function liteboxCallback1(el){  jQuery("#flickr a.prettyPhoto").prettyPhoto({				animationSpeed: 'normal',				padding: 30, 				opacity: 0, 				showTitle: false,				allowresize: true, 				counter_separator_label: '/', 				theme: 'dark_rounded', 				callback: function(){}			});}function liteboxCallback2(el){  jQuery("#flickr-2 a.prettyPhoto").prettyPhoto({				animationSpeed: 'normal',				padding: 30, 				opacity: 0, 				showTitle: false,				allowresize: true, 				counter_separator_label: '/', 				theme: 'dark_rounded', 				callback: function(){}			});}function liteboxCallback3(el){  jQuery("#flickr-3 a.prettyPhoto").prettyPhoto({				animationSpeed: 'normal',				padding: 30, 				opacity: 0, 				showTitle: false,				allowresize: true, 				counter_separator_label: '/', 				theme: 'dark_rounded', 				callback: function(){}			});}// ******************************************* Get feeds via google ajax apifunction gFeed(feedUrl, targetDiv, feedName) {$.jGFeed(feedUrl,function(feeds){  // Check for errors  if(!feeds){    // there was an error    return false;  }  // Output feed  var html = '<ul>';  for(var i=0; i<feeds.entries.length; i++){    var entry = feeds.entries[i];    	var date = new Date(entry.publishedDate);    	    	// Entry    	html += '<li>' +    	'<h3><a href ="' + entry.link + '" target="_blank" class="external">' + entry.title + '</a></h3> ' +    	'<abbr class="timeago">' + date.time_ago_in_words() + ' sedan  - <a class="share-it" href="' + entry.link + '|' + entry.title +'" rel="shareit">Dela med andra</a></abbr>' +    	'<p>' + entry.content + '</p>' +    	'</li>';  }  html += '</ul>';  $(targetDiv).html('<div>'+html+'</div><p><a class="feed" href="'+feedUrl+'">Prenumerera på '+feedName+' med RSS</a>');  shareIt();  }, 4);}function gBlogFeed(feedUrl, targetDiv, feedName) {$.jGFeed(feedUrl,function(feeds){  // Check for errors  if(!feeds){    // there was an error    return false;  }  // Output feed  var html = '<ul>';  for(var i=0; i<feeds.entries.length; i++){    var entry = feeds.entries[i];    	var date = new Date(entry.publishedDate);    	var shortcontent = entry.content;    	// Entry    	html += '<li>' +    	'<h3><a href ="' + entry.link + '" target="_blank" class="external">' + entry.title + '</a></h3> ' +    	'<abbr class="timeago">' + date.time_ago_in_words() + ' sedan  - <a class="share-it" href="' + entry.link + '|' + entry.title +'" rel="shareit">Dela med andra</a></abbr>' +    	'<p>' + shortcontent.substr(0,400) + '...</p>' +    	'</li>';  }  html += '</ul>';  $(targetDiv).html('<div>'+html+'</div><p><a class="feed" href="'+feedUrl+'">Prenumerera på '+feedName+' med RSS</a>');  shareIt();  }, 4);}function gMicroFeed(feedUrl, targetDiv, feedName) {$.jGFeed(feedUrl,function(feeds){  // Check for errors  if(!feeds){    // there was an error    return false;  }  // Output feed  var html = '<ul>';  for(var i=0; i<feeds.entries.length; i++){    var entry = feeds.entries[i];    	var date = new Date(entry.publishedDate);      	// Entry    	html += '<li>' +    	'<abbr class="timeago">' + date.time_ago_in_words() + ' sedan  - <a href ="' + entry.link + '" target="_blank" class="external">Gå till mikrobloggen</a> - <a class="share-it" href="' + entry.link + '|' + entry.title +'" rel="shareit">Dela med andra</a></abbr>' +    	'<p>' + entry.content + '</p>' +    	'</li>';  }  html += '</ul>';  $(targetDiv).html('<div>'+html+'</div><p><a class="feed" href="'+feedUrl+'">Prenumerera på '+feedName+' med RSS</a></p>');  shareIt();  }, 6);}// ******************************************* Share boxesfunction shareIt() {	//grab all the anchor tag with rel set to shareit	$('a[rel=shareit]').mouseenter(function() {						//get the height, top and calculate the left value for the sharebox		var height = $(this).height();		var top = $(this).offset().top;				//get the left and find the center value		var left = $(this).offset().left + ($(this).width() /2) - ($('#shareit-box').width() / 2);						//grab the href value and explode the bar symbol to grab the url and title		//the content should be in this format url|title		//var value = $(this).attr('href').split('|');		var value = "link-location";		var value = $(this).attr('href').split('|');				//assign the value to variables and encode it to url friendly		var field = value[0];		var url = encodeURIComponent(value[0]);		var title = encodeURIComponent(value[1]);				//assign the height for the header, so that the link is cover		$('#shareit-header').height(height);				//display the box		$('#shareit-box').show();				//set the position, the box should appear under the link and centered		$('#shareit-box').css({'top':top, 'left':left});				//assign the url to the textfield		$('#shareit-field').val(field);				//make the bookmark media open in new tab/window		$('a.shareit-sm').attr('target','_blank');				//Setup the bookmark media url and title		$('a[rel=shareit-mail]').attr('href', 'mailto:?subject=' + title);		$('a[rel=shareit-delicious]').attr('href', 'http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=' + url + '&title=' + title);		$('a[rel=shareit-google]').attr('href', 'http://www.google.com/bookmarks/mark?op=edit&bkmk=' + url + '&title=' + title + '&annotation=' + title);		$('a[rel=shareit-pusha]').attr('href', 'http://www.pusha.se/posta?url=' + url + '&title=' + title + '&description=');		$('a[rel=shareit-facebook]').attr('href', 'http://www.facebook.com/share.php?u=' + url + '&t=' + title);		$('a[rel=shareit-twitter]').attr('href', 'http://twitter.com/home?status=' + title + '%20-%20' + url);			});	//onmouse out hide the shareit box	$('#shareit-box').mouseleave(function () {			$(this).hide();  			$('#shareit-field').val('');	});	/*t = setTimeout(function(){			$('#shareit-box').hide();  			$('#shareit-field').val('');                                          		}, 500); // adjust your time here*/		//hightlight the textfield on click event	$('#shareit-field').click(function () {		$(this).select();	});}// ******************************************* Date in wordsDate.prototype.time_ago_in_words = function() {    var words;    distance_in_milliseconds = new Date() - this;    distance_in_minutes = Math.round(  Math.abs(distance_in_milliseconds / 60000)  );    if (distance_in_minutes == 0) {      words = "mindre än en minut";    } else if (distance_in_minutes == 1) {      words = "1 minut";    } else if (distance_in_minutes < 45) {      words = distance_in_minutes + " minuter";    } else if (distance_in_minutes < 90) {      words = "1 timme";    } else if (distance_in_minutes < 1440) {      words = "" + Math.round(distance_in_minutes / 60) + " timmar";    } else if (distance_in_minutes < 2160) {      words = "1 dag";    } else if (distance_in_minutes < 43200) {      words = Math.round(distance_in_minutes / 1440) + " dagar";    } else if (distance_in_minutes < 86400) {      words = "1 månad";    } else if (distance_in_minutes < 525600) {      words = Math.round(distance_in_minutes / 43200) + " månader";    } else if (distance_in_minutes < 1051200) {      words = "1 år";    } else {      words = "över " + Math.round(distance_in_minutes / 525600) + " år";    }    return words;};function get_video(event){	event.preventDefault();	$("#video-chooser li a").removeClass('selected');	$(this).addClass('selected');	$(".loadvideo").hide();	var id = $(this).attr("href").replace("#video_", "");	//$("#ajaxload").fadeIn();	$("#player").load(wpurl+"/ajax", {id: id}, function(){		$("#player").show();	});};
