// krypterad epostadress till klarskrift
function eposttext(myarray, uttext){var encryptedemail=''; //variable to contain encrypted email 
	for (var i=0; i<myarray.length; i++)
		encryptedemail+=String.fromCharCode(myarray[i]);
	encryptedemail='<strong><a href="mailto:'+encryptedemail+'">'+uttext+'</a></strong>';
	return encryptedemail;
}
function epost(myarray) {var encryptedemail=''; //variable to contain encrypted email 
	for (var i=0; i<myarray.length; i++)
		encryptedemail+=String.fromCharCode(myarray[i]);
		encryptedemail='<a href="mailto:'+encryptedemail+'">'+encryptedemail+'</a>';
	 return encryptedemail; 
}
var gh=[105,110,102,111,64,103,104,110,101,116,46,115,101]
$(function() {
//bildvisare					 	
	$("a[rel='example1']").colorbox({opacity:0.6});					 
// lägg till uppdateringsdatum					 
		var datum = new Date(document.lastModified)
		datum= $.formatDate(datum,"d MMMM yyyy");
			$("li#datum span").html(datum);							 
// gör epostlänk
	$("p#epost1 span").html(epost(gh));						

});		// $ slut
/*
$.toFixedWidth(value,length,fill)
Formats the passed value as a fixed-width field of the specified length. An optional fill character can be supplied. If the numeric value exceeds the specified length, its higher order digits will be truncated to fit the length.
Parameters
value (Number) The value to be formatted.
length (Number) The length of the resulting field.
fill (String) The fill character used when front-padding the value. If omitted, 0 is used.
Returns
The fixed-width field.
*/
(function($){
$.toFixedWidth = function(value,length,fill) {
var result = value.toString();
if (!fill) fill = '0';
var padding = length - result.length;
if (padding < 0) {
result = result.substr(-padding);
}
else {
for (var n = 0; n < padding; n++)
result = fill + result;
}
return result;
};
})(jQuery);
/*
$.formatDate(date,pattern) Formats the passed date according to the supplied pattern. The tokens that are substituted in the pattern are as follows:
yyyy: the 4-digit year, yy: the 2-digit year, MMMM: the full name of the month, MMM: the abbreviated name of the month, MM: the month number as a 0-filled, 2-character field, M: the month number, dd: the day in the month as a 0-filled, 2-character field, d: the day in the month
EEEE: the full name of the day of the week, EEE: the abbreviated name of the day of the week, a: the meridium (AM or PM), HH: the 24-hour clock hour in the day as a 2-character, 0-filled field, 
H: the 24-hour clock hour in the day, hh: the 12-hour clock hour in the day as a 2-character, 0-filled field, h: the 12-hour clock hour in the day, mm: the minutes in the hour as a 2-character, 0-filled field, m: the minutes in the hour, ss: the seconds in the minute as a 2-character, 0-filled field, s: the seconds in the minute, S: the milliseconds in the second as a 3-character, 0-filled field, Parameters, date (Date) The date to be formatted., pattern (String) The pattern to format the date into. Any characters not matching pattern, tokens are copied as-is to the result. ReturnsThe formatted date.
*/
(function($){$.toFixedWidth = function(value,length,fill) {var result = value.toString();if (!fill) fill = '0';var padding = length - result.length;if (padding < 0) {result = result.substr(-padding);}else {for (var n = 0; n < padding; n++)result = fill + result;}return result;};})(jQuery);(function($){$.formatDate = function(date,pattern) {var result = [];while (pattern.length > 0) {$.formatDate.patternParts.lastIndex = 0;var matched = $.formatDate.patternParts.exec(pattern);if (matched) {result.push($.formatDate.patternValue[matched[0]].call(this,date));pattern = pattern.slice(matched[0].length);} else {result.push(pattern.charAt(0));pattern = pattern.slice(1);}}return result.join('');};$.formatDate.patternParts =/^(yy(yy)?|M(M(M(M)?)?)?|d(d)?|EEE(E)?|a|H(H)?|h(h)?|m(m)?|s(s)?|S)/;$.formatDate.monthNames = [
'Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'];$.formatDate.dayNames = ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'];$.formatDate.patternValue = {yy: function(date) {return $.toFixedWidth(date.getFullYear(),2);},yyyy: function(date) {return date.getFullYear().toString();},MMMM: function(date) {return $.formatDate.monthNames[date.getMonth()];},MMM: function(date) {return $.formatDate.monthNames[date.getMonth()].substr(0,3);},MM: function(date) {return $.toFixedWidth(date.getMonth() + 1,2);},M: function(date) {return date.getMonth()+1;},dd: function(date) {return $.toFixedWidth(date.getDate(),2);},d: function(date) {return date.getDate();},EEEE: function(date) {return $.formatDate.dayNames[date.getDay()];},EEE: function(date) {return $.formatDate.dayNames[date.getDay()].substr(0,3);},HH: function(date) {return $.toFixedWidth(date.getHours(),2);},H: function(date) {return date.getHours();},hh: function(date) {var hours = date.getHours();return $.toFixedWidth(hours > 12 ? hours - 12 : hours,2);},h: function(date) {return date.getHours() % 12;},mm: function(date) {return $.toFixedWidth(date.getMinutes(),2);},m: function(date) {return date.getMinutes();},ss: function(date) {return $.toFixedWidth(date.getSeconds(),2);},s: function(date) {return date.getSeconds();},S: function(date) {return $.toFixedWidth(date.getMilliseconds(),3);},a: function(date) {return date.getHours() < 12 ? 'AM' : 'PM';}};})(jQuery);	