<!--
// ########################################################################################
//
// week_image.js
//
// Copyright (c) MindIT Solutions AS
//    
// Author(s):    Kristian Jordheim (KJ)
//
// Change Log:
//   30.10.2007 - (KJ) - Created script
//   15.11.2007 - (KJ) - Added images for des07, jan08
//   30.01.2008 - (KJ) - Added pictures week 6 - 22 '08
//   03.06.2008 - (KJ) - Added pictures week 24 - 39 '08
//   06.10.2008 - (KJ) - Added pictures week 41 - 45 '08
//   10.11.2008 - (KJ) - Added pictures week 46 - 10 '09
//   27.03.2009 - (KJ) - Added pictures week 13 - 36 '09
//   09.09.2009 - (KJ) - Added pictures week 38 - 50 '09
//   04.01.2010 - (KJ) - Added pictures week 01 - 04 2010
//   10.02.2010 - (KJ) - Added pictures week 06 - 10 2010
//   18.03.2010 - (KJ) - Added pictures week 11 - 17 2010
//   19.04.2010 - (KJ) - Added pictures week 18 - 24 2010
//   04.05.2010 - (KJ) - Added pictures week 25 - 34 2010
//   07.09.2010 - (KJ) - Added pictures week 36 - 42 2010
//
// ########################################################################################

var sBaseURL = 'http://www.radiofolgefonn.no/system/forms/getimage.aspx?img=';
var aWeekImages=new Array()

aWeekImages[37]='1951.jpg';
aWeekImages[38]='1952.jpg';
aWeekImages[39]='1953.jpg';
aWeekImages[40]='1954.jpg';
aWeekImages[41]='1955.jpg';
aWeekImages[42]='1956.jpg';
aWeekImages[43]='1957.jpg';


function get_week_no() {
	var today = new Date();
	Year = get_year(today);
	Month = today.getMonth();
	Day = today.getDate();
	now = Date.UTC(Year,Month,Day+1,0,0,0);
	var Firstday = new Date();
	Firstday.setYear(Year);
	Firstday.setMonth(0);
	Firstday.setDate(1);
	then = Date.UTC(Year,0,1,0,0,0);
	var Compensation = Firstday.getDay();
	if (Compensation > 3) Compensation -= 4;
	else Compensation += 3;
	NumberOfWeek =  Math.round((((now-then)/86400000)+Compensation)/7);
	return NumberOfWeek+1;
}

function get_year(dDate) {
	x = dDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}
function display_image(sUrl) {
	if (sUrl.indexOf("http://") == -1) {
		sUrl = sBaseURL + sUrl + "&mw=800&mh=600";
	}
	open_window(sUrl,'week_image',800,600,1,0);
}

function get_week_image() {
	var s = '<a href="javascript:display_image(\'';
	var iWeekNo = get_week_no();
	var sImage = "";

	if (aWeekImages[iWeekNo]) {
		sImage = aWeekImages[iWeekNo];
		if (sImage == '') {
			sImage = "269.jpg";
		}
	} else {
		sImage = "269.jpg";
	}
	s+=sImage+'\');">';
	if (sImage.indexOf("http://") == -1) {
		sImage = sBaseURL + sImage + "&mw=180&mh=180";
	}
	document.write(s+'<img src="'+sImage+'" width=180 border=0></a>');
}

//-->