#!/bin/bash
tz=$(date "+%:::z" | tr -d "+0")
echo "Content-type: text/html"
echo
cat <<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<meta name="Language" CONTENT="pl"/>
<title>Pogoda Zielona Góra, pogoda w Zielonej Górze, prognoza pogody dla Zielone Góry</title>
<meta http-equiv="expires" content="-1">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<link rel='stylesheet' type='text/css' href='main_new2.css' media="screen" />
 <script type="text/javascript"> 
 //<![CDATA[
  function opengooglemaps(d, om) { 
   var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
   disp_setting+="scrollbars=yes,width=800, height=600, left=100, top=25"; 
   var docprint=window.open("http://www.flightutilities.com/mrgadgetgoogle.aspx?el=" + d + "&om=" + om,"",disp_setting); 
  }
 //]]>
</script> 
</head>
<body>
EOF

echo "<br>"
echo "<h2>Meteoblue:</h2><br>"

home=$(pwd)
rm -Rf $home/tempik/www.meteoblue.com 2>/dev/null
wget -T 30 -t 3 -qpEk --restrict-file-names=windows -P $home/tempik/ -D www.meteoblue.com -np http://www.meteoblue.com/en_GB/weather/charts/allinone/zielona-gora_pl_61241
cp -f $home/tempik/www.meteoblue.com/bloos/stream/binary/index.html* $home/chmura.png
rm -Rf $home/tempik/www.meteoblue.com 2>/dev/null
sleep 0.3
echo "<img src=\"chmura.png\">"
echo "<br>"

echo "<br><br>"
cat << EOF
<h2>Windguru:</h2>
<script src="http://www.gmodules.com/ig/ifr?url=http://www.ppg.zgora.pl/wiatrowka/windguru.xml&amp;up_spotid=145412&amp;up_spotname=Poland%20-%20Zielona%20Gora%20-%20Przylep&amp;up_units=0.514444444&amp;up_model=GFS&amp;synd=open&amp;w=1210&amp;h=235&amp;title=Poland+-+Zielona+Gora+-+Przylep&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>
EOF

echo "<br>"
echo "<br>"

cat << EOF
<table border="0"><tr><td>
<script src="http://www.gmodules.com/ig/ifr?url=http://meteo-icm-gadget.googlecode.com/svn/trunk/meteo-icm-gadget.xml&amp;up_modelName=UM&amp;up_cityName=Zielona%20G%C3%B3ra&amp;up_x=155&amp;up_y=412&amp;up_plotLanguage=pl&amp;up_scaleHeight=0&amp;up_scaleWidth=0&amp;up_lastImageUrl=&amp;up_lastStartData=&amp;synd=open&amp;w=540&amp;h=660&amp;title=Pogoda+ICM+UM+-+Zielona+G%C3%B3ra&amp;lang=pl&amp;country=ALL&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>
</td><td>
<script src="http://www.gmodules.com/ig/ifr?url=http://meteo-icm-gadget.googlecode.com/svn/trunk/meteo-icm-gadget.xml&amp;up_modelName=COAMPS&amp;up_cityName=Zielona%20G%C3%B3ra&amp;up_x=68&amp;up_y=135&amp;up_plotLanguage=pl&amp;up_scaleHeight=0&amp;up_scaleWidth=0&amp;up_lastImageUrl=&amp;up_lastStartData=&amp;synd=open&amp;w=660&amp;h=660&amp;title=Pogoda+ICM+COAMPS+-+Zielona+G%C3%B3ra&amp;lang=pl&amp;country=ALL&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>
</td><tr>
</table>
EOF


echo "<br>"
echo "<br>"

cat << EOF
<br><br><br>
<table border="0"><tr><td valign="top">

<table width="624" height="200"><tr><td>
<h2>TAF EPZG</h2>
<table class="tabelka"><tr><td>
EOF
lynx --dump --source http://www.flightutilities.com/mrgadget.aspx?ic=EPZG\&se=15\&tz=$tz | grep -A 1000 "panMetarDecoded\">" | grep -B 1000 "dechide" | sed -re "s#images/#http://www.flightutilities.com/images/#gi"
cat << EOF
</td></</tr></table></td></tr></table>

</td><td valign="top">

<table width="624" height="200"><tr><td>
<h2>METAR EPZG</h2>
<table class="tabelka"><tr><td>
EOF
lynx --dump --source http://www.flightutilities.com/mrgadget.aspx?ic=EPZG\&se=6\&tz=$tz | grep -A 1000 "panMetarDecoded\">" | grep -B 1000 "dechide" | sed -re "s#images/#http://www.flightutilities.com/images/#gi"
cat << EOF
</td></</tr></table></td></tr></table>

</td></tr></table>
EOF

cat <<EOF
</body>
</html>
EOF
