//var Yr = sd.split("/");
//text_month = new Array("","January","February","March","April","May","June","July","August","September","October","November","December");

//function txtMonth(dateStr) {
//	var strg = dateStr.split(" ");
//	var mth = strg[1];
//	return mth;
//}
// Email addresses
var mto = "mailto:";
var web = "webmaster@cliftonweather.co.uk";

function emailadd(y){
var add = "<a href='" + mto + y + "'>" + y + "</a>";
return add;
}
// counter
var sc_project=612076; 
var sc_partition=4; 
var sc_security="a2c0e6a1"; 
var sc_invisible=0; 

// Cascading Popup Menus v5.2 - Single Frame Menu example script.
var hBar = new ItemStyle(40, 10, '', 0, 0, '15#336699', '10#6699CC', 'highText', 'highText', '', '', null, null, 'hand', 'default');
var vert = new ItemStyle(21, 0, '<img src="http://www.cliftonweather.co.uk/images/arrow.gif" width=7 height=11>',-15, 3, '#336699', '#336699', 'highText', 'lowText', 'itemBorder', 'itemBorder', 100, 70, 'hand', 'default');
var subM = new ItemStyle(21, 0, '<img src="http://www.cliftonweather.co.uk/images/arrow.gif" width=7 height=11>', -15, 3, '#336699', '#336699', 'highText', 'lowText', 'itemBorder', 'itemBorder', 100, 60, 'hand', 'default');
var subBlank = new ItemStyle(22, 1, '&gt;', -15, 3, '#CCCCDD', '#6699CC', 'lowText', 'highText', 'itemBorderBlank', 'itemBorder', null, null, 'hand', 'default');
var button = new ItemStyle(22, 1, '&gt;', -15, 2, '10#006633', '10#CC6600', 'buttonText', 'buttonHover', 'buttonBorder', 'buttonBorderOver', 80, 95, 'crosshair', 'default');

var pMenu = new PopupMenu('pMenu');
with (pMenu)
{

startMenu('root', true, 0, 70, 122, vert);
addItem('Home', 'http://www.cliftonweather.co.uk/index.html', '');
addItem('About', 'mAbout', 'sm:');
addItem('Detailed Weather', 'mWx', 'sm:');
addItem('Data Archive', 'mData', 'sm:');
addItem('Weather News', 'http://www.cliftonweather.co.uk/news.html', '');
addItem('UK Weather', 'mUk', 'sm:');
addItem('Weather Gallery', 'mGal', 'sm:');
addItem('Hill Walking', 'mHill', 'sm:');
addItem('Links', 'http://www.cliftonweather.co.uk/links.html', '');
addItem('Contact', 'mailto:webmaster@cliftonweather.co.uk', '');
addItem('Guest Book', 'mGuest', 'sm:');

startMenu('mAbout', true, 123, 0, 80, subM);
addItem('Station Details', 'http://www.cliftonweather.co.uk/wx/stationinfo.html', '');
addItem('Terminology', 'http://www.cliftonweather.co.uk/terminology.html', '');

startMenu('mWx', true, 123, 0, 100, subM);
addItem('Live data', 'window.open("http://www.cliftonweather.co.uk/live_data.html", "", "width=675,height=431,toolbar=no,location=no")', 'js:', null);
addItem('Live wind data', 'http://www.cliftonweather.co.uk/wind.html', '');
addItem('Latest', 'http://www.cliftonweather.co.uk/wx/current.html', '');
addItem('Last 24 Hours', 'http://www.cliftonweather.co.uk/wx/hist.html', '');
addItem('Last 14 Days', 'http://www.cliftonweather.co.uk/wx/week.html', '');
addItem('Current Month', 'http://www.cliftonweather.co.uk/wx/month.html', '');
addItem('Records', 'http://www.cliftonweather.co.uk/wx/records.html', '');
addItem('Evapotranspiration', 'http://www.cliftonweather.co.uk/wx/et.html', '');

startMenu('mData', true, 123, 0, 120, subM);
addItem('Extremes', 'http://www.cliftonweather.co.uk/wx/stats.html', '');
addItem('Daily Summaries', 'http://www.cliftonweather.co.uk/wx/dailydata.html', '');
addItem('Monthly Summaries', 'http://www.cliftonweather.co.uk/wx/monthlydata.html', '');
addItem('Yearly Summary', 'http://www.cliftonweather.co.uk/wx/yearlydata.html', '');
addItem('Seasonal Summary', 'http://www.cliftonweather.co.uk/wx/seasondata.html', '');
addItem('Raw Data', 'http://www.cliftonweather.co.uk/downld02.txt', '');

startMenu('mUk', true, 123, 0, 100, subM);
addItem('Rainfall Radar', 'mRadar', 'sm:');
addItem('Satellite', 'mSatellite', 'sm:');
addItem('Warnings', 'mWarning', 'sm:');

startMenu('mGal', true, 123, 0, 100, subM);
addItem('Cloud Gallery', 'http://www.cliftonweather.co.uk/clouds/index.html', '');
addItem('Lightning Images', 'http://www.cliftonweather.co.uk/wx/storm280605.html', '');

startMenu('mForcasts', true, 81, 0, 80, subM);
addItem('2 Day Outlook', 'http://www.cliftonweather.co.uk/2day.html', '');
addItem('3 Day Outlook', 'http://www.cliftonweather.co.uk/3day.html', '');
addItem('5 Day Outlook', 'http://www.cliftonweather.co.uk/5day.html', '');

startMenu('mRadar', true, 100, 0, 100, subM);
addItem('Europe', 'http://www.meteox.com/h.aspx?jaar=-3&soort=loop3uur', 'top');
addItem('UK', 'http://www.meteox.com/h.aspx?jaar=-3&soort=loop3uur&c=uk', 'top');

startMenu('mSatellite', true, 100, 0, 100, subM);
addItem('UK Visible', 'http://www.sat24.com/frame.php?html=view&country=gb', '');
addItem('Meteosat IR Image', 'http://www.cliftonweather.co.uk/meteosat.html', '');

startMenu('mWarning', true, 100, 0, 100, subM);
addItem('Flood Warnings', 'http://www.environment-agency.gov.uk/subjects/flood/floodwarning/FL1SL', 'top');
addItem('Met Office', 'http://www.met-office.gov.uk/weather/europe/uk/warnings.html', 'top');

startMenu('mHill', true, 123, 0, 80, subM);
addItem('England', 'mEng', 'sm:');
addItem('Scotland', 'mSco', 'sm:');
addItem('Wales', 'mWal', 'sm:');

startMenu('mEng', true, 81, 0, 100, subM);
addItem('Lake District', 'mLakes', 'sm:');
addItem('Peak District', 'mPeak', 'sm:');
addItem('Yorkshire Dales', 'mDales', 'sm:');
addItem('Miscellaneous', 'http://www.cliftonweather.co.uk/hillwalking/england/hwmisc.html', '');

startMenu('mSco', true, 81, 0, 120, subM);
addItem('A Mharconaich &nbsp;&nbsp;<font color="Yellow">New</font>', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwgealcharn.html', '');
addItem('Aonoch Beag', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwaonachs.html', '');
addItem('Ben Macdui &nbsp;&nbsp;<font color="Yellow">New</font>', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwmacdui.html', '');
addItem('Ben Nevis', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwnevispics.html', '');
addItem('Ben Nevis 2', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwnevis2.html', '');
addItem('Braeriach &nbsp;&nbsp;<font color="Yellow">New</font>', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwbraeriach.html', '');
addItem('Buachaille Etive Mor', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwbuachaillepics.html', '');
addItem('Cairngorm', 'http://www.cliftonweather.co.uk/hillwalking/scotland/cairngorm.html', '');
addItem('Chno Dearg', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwchnodearg.html', '');
addItem('Mamores', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwmamorepics.html', '');
addItem('Sgor an Lochain Uaine &nbsp;&nbsp;<font color="Yellow">New</font>', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwlochainuaine.html', '');
addItem('Sgorr Dhearg', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwsgorrdhearg.html', '');
addItem('Miscellaneous', 'http://www.cliftonweather.co.uk/hillwalking/scotland/hwmiscpics.html', '');

startMenu('mWal', true, 81, 0, 90, subM);
addItem('Moel Siabod', 'http://www.cliftonweather.co.uk/hillwalking/wales/moelsiabod.html', '');

startMenu('mGuest', true, 123, 0, 98, subM);
addItem('View', 'http://htmlgear.tripod.com/guest/control.guest?u=cliftonweatherbeds&i=1&a=view', '');
addItem('<img src="http://htmlgear.lycos.com/img/guest/gb_circuit.gif" border=0 alt="">', 'http://htmlgear.lycos.com/specs/guest.html', '', subM, 40);
addItem('Sign Guestbook', 'http://htmlgear.tripod.com/guest/control.guest?u=cliftonweatherbeds&i=1&a=sign', '');

startMenu('mLakes', true, 101, 0, 150, subM);
addItem('Blencathra', 'http://www.cliftonweather.co.uk/hillwalking/england/hwblencathra.html', '');
addItem('Coniston Old Man', 'http://www.cliftonweather.co.uk/hillwalking/england/hwoldman.html', '');
addItem('Crinkle Crags & Bowfell', 'http://www.cliftonweather.co.uk/hillwalking/england/hwbowfell.html', '');
addItem('Fairfield', 'http://www.cliftonweather.co.uk/hillwalking/england/hwfairfield.html', '');
addItem('Great Gable', 'http://www.cliftonweather.co.uk/hillwalking/england/hwgreatgable.html', '');
addItem('Hallin Fell', 'http://www.cliftonweather.co.uk/hillwalking/england/hwhallin.html', '');
addItem('Hay Stacks', 'http://www.cliftonweather.co.uk/hillwalking/england/hwhaystack.html', '');
addItem('Helvellyn', 'http://www.cliftonweather.co.uk/hillwalking/england/hwhelvellyn.html', '');
addItem('Langdale Pikes', 'http://www.cliftonweather.co.uk/hillwalking/england/hwlangdale.html', '');
addItem('Pillar', 'http://www.cliftonweather.co.uk/hillwalking/england/hwpillar.html', '');
addItem('Scafell Pike', 'http://www.cliftonweather.co.uk/hillwalking/england/hwscafellppics.html', '');
addItem('Skiddaw', 'http://www.cliftonweather.co.uk/hillwalking/england/hwskiddawpics.html', '');

startMenu('mPeak', true, 101, 0, 150, subM);
addItem('Froggatt Edge', 'http://www.cliftonweather.co.uk/hillwalking/england/hwbaslow.html', '');
addItem('Kinder Downfall', 'http://www.cliftonweather.co.uk/hillwalking/england/hwkinder.html', '');
addItem('Stanage Edge', 'http://www.cliftonweather.co.uk/hillwalking/england/hwstanage.html', '');

startMenu('mDales', true, 101, 0, 150, subM);
addItem('3 Peaks', 'http://www.cliftonweather.co.uk/hillwalking/england/hw3peaks.html', '');

}

addMenuBorder(pMenu, window.subBlank,
 null, '#666666', 1, '#CCCCDD', 2);

addDropShadow(pMenu, window.subM,
 [40,"#333333",3,3,0,0]);

if ((navigator.userAgent.indexOf('rv:0.')==-1) &&
    !(isOp&&!document.documentElement) && !(isIE4&&!window.external))
{
 pMenu.showMenu = new Function('mN','menuAnim(this, mN, 10)');
 pMenu.hideMenu = new Function('mN','menuAnim(this, mN, -15)');

}

// This is the "positioning from page anchors" code used by the advanced positioning expressions.
page.elmPos=function(e,p)
{
 var x=0,y=0,w=p?p:this.win;
 e=e?(e.substr?(isNS4?w.document.anchors[e]:getRef(e,w)):e):p;
 if(isNS4){if(e&&(e!=p)){x=e.x;y=e.y};if(p){x+=p.pageX;y+=p.pageY}}
 else while(e){x+=e.offsetLeft;y+=e.offsetTop;e=e.offsetParent}
 return{x:x,y:y};
}

// Animation:

function menuAnim(menuObj, menuName, dir)
{
 // The array index of the named menu (e.g. 'mFile') in the menu object (e.g. 'pMenu').
 var mD = menuObj.menu[menuName][0];
 // Add timer and counter variables to the menu data structure, we'll need them.
 if (!mD.timer) mD.timer = 0;
 if (!mD.counter) mD.counter = 0;

 with (mD)
 {
  // Stop any existing animation.
  clearTimeout(timer);

  // If the layer doesn't exist (cross-frame navigation) quit.
  if (!lyr || !lyr.ref) return;
  // This next line is not strictly necessary, but it stops the one-in-a-hundred menu that
  // shows and doesn't hide on very quick mouseovers.
  if (!visNow && dir>0) dir = 0-dir;
  // Show the menu if that's what we're doing.
  if (dir>0) lyr.vis('visible');
  // Also raise showing layers above hiding ones.
  lyr.sty.zIndex = 1001 + dir;

  lyr.clip(0, 0, menuW+2, (menuH+2)*Math.pow(Math.sin(Math.PI*counter/200),0.75) );

  counter += dir;
  if (counter>100) counter = 100;
  else if (counter<0) { counter = 0; lyr.vis('hidden') }
  else timer = setTimeout(menuObj.myName+'.'+(dir>0?'show':'hide')+'Menu("'+menuName+'")', 40);
 }
}

function menuFilterShow(menuObj, menuName, filterName)
{
 var mD = menuObj.menu[menuName][0];
 with (mD.lyr)
 {
  sty.filter = filterName;
  var f = ref.filter, doF = (f&&f.length&&f[0]);
  if (doF) f[0].Apply();
  vis('visible');
  if (doF) f[0].Play();
 }
}

function addMenuBorder(mObj, iS, alpha, bordCol, bordW, backCol, backW)
{
 // Loop through the menu array of that object, finding matching ItemStyles.
 for (var mN in mObj.menu)
 {
  var mR=mObj.menu[mN], dS='<div style="position:absolute; background:';
  if (mR[0].itemSty != iS) continue;
  // Loop through the items in that menu, move them down and to the right a bit.
  for (var mI=1; mI<mR.length; mI++)
  {
   mR[mI].iX += bordW+backW;
   mR[mI].iY += bordW+backW;
  }
  // Extend the total dimensions of menu accordingly.
  mW = mR[0].menuW += 2*(bordW+backW);
  mH = mR[0].menuH += 2*(bordW+backW);

  // Set the menu's extra content string with divs/layers underneath the items.
  if (isNS4) mR[0].extraHTML += '<layer bgcolor="'+bordCol+'" left="0" top="0" width="'+mW+
   '" height="'+mH+'" z-index="980"><layer bgcolor="'+backCol+'" left="'+bordW+'" top="'+
   bordW+'" width="'+(mW-2*bordW)+'" height="'+(mH-2*bordW)+'" z-index="990"></layer></layer>';
  else mR[0].extraHTML += dS+bordCol+'; left:0px; top:0px; width:'+mW+'px; height:'+mH+
   'px; z-index:980; '+(alpha!=null?'filter:alpha(opacity='+alpha+'); -moz-opacity:'+(alpha/100):'')+
   '">'+dS+backCol+'; left:'+bordW+'px; top:'+bordW+'px; width:'+(mW-2*bordW)+'px; height:'+
   (mH-2*bordW)+'px; z-index:990"></div></div>';
 }
}

function addDropShadow(mObj, iS)
{
 // dropshadow layers (from arrays) and extending the menu dimensions to suit.
 for (var mN in mObj.menu)
 {
  var a=arguments, mD=mObj.menu[mN][0], addW=addH=0;
  if (mD.itemSty != iS) continue;
  for (var shad=2; shad<a.length; shad++)
  {
   var s = a[shad];
   if (isNS4) mD.extraHTML += '<layer bgcolor="'+s[1]+'" left="'+s[2]+'" top="'+s[3]+'" width="'+
    (mD.menuW+s[4])+'" height="'+(mD.menuH+s[5])+'" z-index="'+(arguments.length-shad)+'"></layer>';
   else mD.extraHTML += '<div style="position:absolute; background:'+s[1]+'; left:'+s[2]+
    'px; top:'+s[3]+'px; width:'+(mD.menuW+s[4])+'px; height:'+(mD.menuH+s[5])+'px; z-index:'+
    (a.length-shad)+'; '+(s[0]!=null?'filter:alpha(opacity='+s[0]+'); -moz-opacity:'+(s[0]/100):'')+
    '"></div>';
   addW=Math.max(addW, s[2]+s[4]);
   addH=Math.max(addH, s[3]+s[5]);
  }
  mD.menuW+=addW; mD.menuH+=addH;
 }
}

