function WeatherPic(Location,Offset)
{
var siteName = "http://www.metvuw.com/forecast/"
var fctime = "00"
var fijigif = "0640"
var fijicap = "Weather at 0600 FST (1800 GMT) issued at 0900 FST (2100 GMT the day before)"
var d=new Date()
var gmtMS = d.getTime() + (d.getTimezoneOffset() * 60000)
var gmtDate =  new Date(gmtMS)
var hr = gmtDate.getHours()
if (hr>=5 && hr<21)
{
	if (hr<15)
	{
		fijigif = "0641"
    fijicap = "Weather at 1500 FST (0300 GMT) issued at 1700 FST (0500 GMT)"
	}
	else
	{
		fijigif = "0642"
    fijicap = "Weather at 0000 FST (1200 GMT) issued at 0300 FST (1500 GMT the day before)"
	}
}
if (hr<7)
 {
 d = new Date(gmtDate.getTime() - 86400000)
 if (hr<=1)
 {
 fctime = "12"
 }
 else
 {
 fctime = "18"
 }
 Offset = Offset + 12
 }
else
 {
 	d = new Date(gmtDate)
	if (hr>=7 && hr<13)
 	{
 		fctime = "00"
 		Offset = Offset + 12
 	}
	if (hr>=13 && hr<19)
 		{
 		fctime = "06"
 		Offset = Offset + 12
 		}
	if (hr>=19)
 	{
 		fctime = "12"
 		Offset = Offset + 12
 	}
 }
// emergency update take next 3 lines out when MetVUW site is fixed
// d = new Date(gmtDate.getTime() - 86400000)
// d = new Date(gmtDate.getTime())
// fctime = "00"
// end of update
day = d.getDate()
month = d.getMonth() + 1
year = d.getFullYear()
if (Offset<10)
 {
 strOffset = "0" + Offset.toString()
 }
 else
 {
 strOffset = Offset.toString()
 }
if (day<10)
 {
 strDay = "0" + day.toString()
 }
 else
 {
 strDay = day.toString()
 }
if (month<10)
 {
 strMonth = "0" + month.toString()
 }
 else
 {
 strMonth = month.toString()
 }
var strDate = year.toString() + strMonth + strDay
GifName = siteName + strDate + fctime + "/rain-" + Location + "-" + strDate + fctime + "-" + strOffset + ".gif"
FijiMap = fijigif
FijiCaption = fijicap
return FijiMap; FijiCaption; GifName;
}
function GetWindFile(AreaCode)
{
var siteName = "http://www.weatheronline.co.uk/daten/segel/"
var fctime = "12"
var d=new Date()
var gmtMS = d.getTime() + (d.getTimezoneOffset() * 60000) + 86400000
var gmtDate =  new Date(gmtMS)
var hr = gmtDate.getHours()
var datedelim = "/"
var Dates = new Array
var DateHeader = new Array
var i = 0
if (hr<12)
 {
 	d = new Date(gmtDate.getTime() - 86400000)
 }  
else
 {
      d = new Date(gmtDate)
 }
day = d.getDate()
month = d.getMonth() + 1
year = d.getFullYear()
if (day<10)
 {
 strDay = "0" + day.toString()
 }
 else
 {
 strDay = day.toString()
 }
if (month<10)
 {
 strMonth = "0" + month.toString()
 }
 else
 {
 strMonth = month.toString()
 }
var strDate = year.toString() + datedelim + strMonth + datedelim + strDay + datedelim
Dates[0] = strDate
DateHeader[0] = strDay + datedelim + strMonth + datedelim + year.toString()
for (i=1;i<7;i++)
  {
	e = new Date(d.getTime() + 86400000)
	d = new Date(e)
	day = d.getDate()
 	month = d.getMonth() + 1
 	year = d.getFullYear()
	if (day<10)
 	{
 	strDay = "0" + day.toString()
 	}
 	else
 	{
 	strDay = day.toString()
 	}
	if (month<10)
 	{
 	strMonth = "0" + month.toString()
 	}
 	else
 	{
 	strMonth = month.toString()
 	}	
	strDate = year.toString() + datedelim + strMonth + datedelim + strDay + datedelim
	Dates[i] = strDate
	DateHeader[i] = strDay + datedelim + strMonth + datedelim + year.toString()
  }
WeatherFileA = siteName + Dates[0] + AreaCode + fctime + ".gif"
WeatherFileB = siteName + Dates[1] + AreaCode + fctime + ".gif"
WeatherFileC = siteName + Dates[2] + AreaCode + fctime + ".gif"
WeatherFileD = siteName + Dates[3] + AreaCode + fctime + ".gif"
WeatherFileE = siteName + Dates[4] + AreaCode + fctime + ".gif"
WeatherFileF = siteName + Dates[5] + AreaCode + fctime + ".gif"
DateHeaderA = DateHeader[0] + " " + fctime + ":00 GMT"
DateHeaderB = DateHeader[1] + " " + fctime + ":00 GMT"
DateHeaderC = DateHeader[2] + " " + fctime + ":00 GMT"
DateHeaderD = DateHeader[3] + " " + fctime + ":00 GMT"
DateHeaderE = DateHeader[4] + " " + fctime + ":00 GMT"
DateHeaderF = DateHeader[5] + " " + fctime + ":00 GMT"
}
function BrazilPic()
{
var siteName = "https://www.mar.mil.br/dhn/chm/meteo/prev/cartas/C"
var fctime = "00"
var d=new Date()
var gmtMS = d.getTime() + (d.getTimezoneOffset() * 60000)
var gmtDate =  new Date(gmtMS)
var hr = gmtDate.getHours()
if (hr<3)
 {
 d = new Date(gmtDate.getTime() - 86400000)
 if (hr<3)
  	{
 	fctime = "12"
  	}
 }
else
 {
 	d = new Date(gmtDate)
	if (hr>=3 && hr<15)
 	{
 		fctime = "00"
 	}
	else
	{
 		fctime = "12"
 	}
 }
day = d.getDate()
month = d.getMonth() + 1
year = d.getFullYear() - 2000
if (day<10)
 {
 strDay = "0" + day.toString()
 }
 else
 {
 strDay = day.toString()
 }
if (month<10)
 {
 strMonth = "0" + month.toString()
 }
 else
 {
 strMonth = month.toString()
 }
var strDate = year.toString() + strMonth + strDay
PicName = siteName + strDate + fctime + ".jpg"
return PicName
}

function jasonpic(ThisPicture,ThisClass,hline,stitle)
{
	var strSubtitle="";
	var jstr="javascript:history.back()";
	var strHeadline="";
	var strStylesheets="";
	
	if (hline==null||hline=="undefined"||hline=="") 
	{
		strHeadline="<div class='pictitle'>Rahula</div>"
	}
	else
	{
		strHeadline="<div class='pictitle'>" + hline + "</div>";
	}

	if (stitle==null||stitle=="undefined"||stitle=="")
	{
		strSubtitle="<div class='picsubtitle'>Click on the picture to return</div>";
	}
	else
	{
		strSubtitle="<div class='picsubtitle'>" + stitle + "</div>";
	}

	if (document.styleSheets.length==0)
	{
		strStylesheets="";
	} 
	else
	{
		for (var i=0; i<(document.styleSheets.length); i++)
		{
			if (navigator.appname == "Microsoft Internet Explorer") 
			{
  			strStylesheets=strStylesheets+'<link rel="stylesheet" type="text/css" href="' + document.styleSheets(i).href + '" />';
			}
			else
			{
  			strStylesheets=strStylesheets+'<link rel="stylesheet" type="text/css" href="' + document.styleSheets[i].href + '" />';
			}
		}
	}
  document.open();
  document.writeln ("<html>");
	document.writeln ("<head>");
	document.writeln ("<title>Rahula</title>");
	document.writeln (strStylesheets);
	document.writeln ("<link rel='shortcut icon' href='favicon.ico' type='image/x-icon' />");
	document.writeln ("</head>");
	document.writeln ("<body>");
	document.writeln ("<div class='centred'>");
	document.writeln (strHeadline);
	document.writeln (strSubtitle);
	document.writeln ("<div><img class='jasonscale' src='jasonscale.jpg' alt='Sea surface height anomaly in millimetres' /></a></div> ");
	document.writeln ("<div><a href='" + jstr + "'><img class='" + ThisClass + "' src='" + ThisPicture + ".jpg' ");
	document.writeln ("alt='Click to return' /></a></div>");
	document.writeln ("</div>");
	document.writeln ("</body></html>");
	document.close();
}
