﻿// JScript File
<!--

/**
 * Returns the named object from the document.
 */
function getDOMObject(name)
{
  var obj = null;
  if (document.getElementById) {
    obj = document.getElementById(name);
  } else if (document.all) {
    obj = document.all[name];
  } else if (document.layers) {
    obj = document.layers[name];
  }
  return obj;
}

function showForecast(day)
{   
    if (typeof arrDates != "undefined")
    {
        var dateHeader = getDOMObject('date');
        if (dateHeader)
            dateHeader.innerHTML = arrDates[day];
            
        var pnlLocation = getDOMObject('Locations');
        if (pnlLocation)
            pnlLocation.innerHTML = panel[day];
            
        //change the style
        if (document.getElementsByName)
        {
            var dateLink = document.getElementsByName('WeatherDateLink');
            for (var i=0;i<dateLink.length;i++) 
            {
                if (i == day)
                    dateLink[i].className = 'date-list-a-selected';
                else
                    dateLink[i].className = 'date-list-a-normal';
            }
        }
    }
        
}


function LoadRadar(type, code)
{
    if (window.frames['iframRadar'])
    {
        //window.frames['iframRadar'].location.href = 'http://data.theweather.com.au/access/animators/radar.jsp?user=10094&lt=' + type + '&lc=' + code;
        var ifrm = getDOMObject('iframRadar');
        if (ifrm)
            ifrm.src = 'http://data.theweather.com.au/access/animators/radar.jsp?user=10094&lt=' + type + '&lc=' + code;
        return false;      
    }      
    else return true;
}

/**------------------
* Google Search Section, used in home page menu bar
------------------- */
function goSearch()
{
    var KeyWords = '';
    var SearchOption = 'web';
    var URLRedirTo = 'http://www.mywestnet.com.au';

    KeyWords = document.getElementById('txtSearch').value;
    if (document.getElementById('rdAustralia').checked)
        SearchOption = 'au';
    if (document.getElementById('rdWestnet').checked)
        SearchOption = 'wn';

    if (SearchOption == 'web')
        URLRedirTo = 'http://search.mywestnet.com.au/search.aspx?q=' + escape(KeyWords);
    if (SearchOption == 'au')
        URLRedirTo = 'http://search.mywestnet.com.au/search.aspx?s=au&q=' + escape(KeyWords);
    if (SearchOption == 'wn')
        URLRedirTo = 'http://search.mywestnet.com.au/search.aspx?s=wn&q=' + escape(KeyWords);

    window.document.location = URLRedirTo;
}

/**------------------
* function for default submit button - used when more than one button exist on the page
------------------- */
function clickButton(e, buttonid)
{
var btn = document.getElementById(buttonid);
if (typeof btn == 'object'){
		if(navigator.appName.indexOf("Netscape")>(-1)){
			if (e.keyCode == 13){
					btn.click();
					return false;
			}
		}
		if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){
			if (event.keyCode == 13){
					btn.click();
					return false;
			}
		}
	}
} 

-->

