<!--
/**
 * Popup Script for Quiz
 */

function openquiz(vtheanswer) {

var form = document.forms[0];
var vtherandom = form.vtherandomnumber.value

var vtheanswer = 0
for (i=0; i<form.quizsel.length;i++){
	if (form.quizsel[i].checked == true)
	vtheanswer = i + 1
}

if (vtheanswer == 0){
	alert ("Please make a selection.")
	return;
}

version=parseInt(navigator.appVersion);



      if (navigator.appVersion.indexOf('5.')>-1)
      {version=5};

      if (navigator.appVersion.indexOf('6.')>-1)
      {version=6};

      if (((navigator.appName=='Microsoft Internet Explorer') && (version > 4)) || ((navigator.userAgent.indexOf('Netscape') == -1) && (navigator.userAgent.indexOf('Opera') == -1)))
        {
          NewWinWidth=320;
          NewWinHeight=300;
          NewWinTop = (screen.availHeight / 2) - (NewWinHeight / 2);
          NewWinLeft = (screen.availWidth / 2) - (NewWinWidth / 2);
        }
      else
        {
          NewWinWidth=320;
          NewWinHeight=300;
          NewWinTop = 1;
          NewWinLeft = 1;
        }
      window.open("/quiz/answer.asp?answer=" + vtheanswer + "&vtherandom=" + vtherandom, "Quiz", "address=yes,resizable=no,scrollbars=yes,status=1,height=" + NewWinHeight + ",width=" + NewWinWidth + ",toolbar=0,left=" + NewWinLeft + ",top=" + NewWinTop);
      //
    }


function Horoscopes() {
   /* if(document.all)
        form = document.formA
    else if(document.layers) {
        form = document.form1html.document.forms[0]
    }*/

   form = document.forms[0]
   
   if(form.sign.value == "Select Star Sign") {	
		  alert("Please select a star sign");	
          }
    else {
          
        var submitSign = form.sign.value 
        remoteWin = window.open(submitSign, "Horoscope","top=0,left=0,width=" + (getWidth()*0.95) + ",height=" + (getHeight()*1.40) + ",scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,location=yes,toolbar=yes")

    }

}


/**
 * Popup Script
 */

function openpopup(vtheaddress, vwidth, vheight, vscroll, vresize){

	
      version=parseInt(navigator.appVersion);

      if (navigator.appVersion.indexOf('5.')>-1)
      {version=5};

      if (navigator.appVersion.indexOf('6.')>-1)
      {version=6};

      if (((navigator.appName=='Microsoft Internet Explorer') && (version > 4)) || ((navigator.userAgent.indexOf('Netscape') == -1) && (navigator.userAgent.indexOf('Opera') == -1)))
        {
          NewWinWidth=vwidth;
          NewWinHeight=vheight;
          NewWinTop = (screen.availHeight / 2) - (NewWinHeight / 2);
          NewWinLeft = (screen.availWidth / 2) - (NewWinWidth / 2);
        }
      else
        {
          NewWinWidth=vwidth;
          NewWinHeight=vheight;
          NewWinTop = 1;
          NewWinLeft = 1;
        }
      window.open(vtheaddress ,"Request","toolbar=0,menubar=0," + vresize + "," + vscroll + ",status=1,height=" + NewWinHeight + ",width=" + NewWinWidth + ",toolbar=0,left=" + NewWinLeft + ",top=" + NewWinTop);
      //
    }
// -->

/**------------------
* font size change, used in news/article.aspx page
------------------- */
    var curHeadSize = 16; 	
    var curDateSize = 10;
    var curBodySize = 12;
    var curHeadLineHeight = 20;
    var curBodyLineHeight = 15;
    var fontEditor = 2; 	
    var lineEditor = 2;



function ChangeFontSize(act) {
    if (document.getElementById) {
        headLine = document.getElementById("head-line");
        dateLine = document.getElementById("date-line");
        bodyText = document.getElementById("body-text");
        if (act == 'up') {
            curHeadSize += fontEditor;
            curHeadSize = Math.min(curHeadSize, 24);
            curDateSize += fontEditor;
            curDateSize = Math.min(curDateSize, 18);
            curBodySize += fontEditor;
            curBodySize = Math.min(curBodySize, 20);
            curHeadLineHeight += lineEditor;
            curHeadLineHeight = Math.min(curHeadLineHeight, 28);
            curBodyLineHeight += lineEditor;
            curBodyLineHeight = Math.min(curBodyLineHeight, 23);
        }
        else if (act == 'down') {
            curHeadSize -= fontEditor;
            curHeadSize = Math.max(curHeadSize, 12);
            curDateSize -= fontEditor;
            curDateSize = Math.max(curDateSize, 6);
            curBodySize -= fontEditor;
            curBodySize = Math.max(curBodySize, 8);
            curHeadLineHeight -= lineEditor;
            curHeadLineHeight = Math.max(curHeadLineHeight, 16);
            curBodyLineHeight -= lineEditor;
            curBodyLineHeight = Math.max(curBodyLineHeight, 11);
        }
        headLine.style.fontSize = curHeadSize + "px";
        headLine.style.lineHeight = curHeadLineHeight + "px";
        dateLine.style.fontSize = curDateSize + "px";
        bodyText.style.fontSize = curBodySize + "px";
        bodyText.style.lineHeight = curBodyLineHeight + "px";
    }
    
    //alert(curHeadSize + "," + curDateSize + "," + curBodySize);
	
	// set cookie with font size
	var expdate = new Date();
	expdate.setDate(expdate.getDate() + 30); // 30 days
	SetCookie("customerfont",curHeadSize + "," + curDateSize + "," + curBodySize ,expdate);		
	
	//return(false);
}

/**------------------
* cookie section
------------------- */

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i=0;
	while (i < clen) {	
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
		}
	return null;
}

function SetCookie(name,value,expires,path,domain,secure) {
	document.cookie = name + "=" + escape (value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}

/**------------------
* fuel watch section 
------------------- */
function initialFuelBox()
{
    var cFuel = GetCookie('fuelwatch');
    if (cFuel != null)
    {
        displayFuelInfo(cFuel);
    }
    else
    {
        document.getElementById('fuel-city').style.display = 'block';
    }
    
}

function changeFuelBox() {
   var city = document.getElementById('sFuelCities').value;
   if(city == '') {		
        alert('Please select a city');
   }
   else {
        displayFuelInfo(city);
        
        //set a cookie
	    var expdate = new Date();
	    expdate.setDate(expdate.getDate() + 30); // 30 days
        SetCookie('fuelwatch',city,expdate)
   }
}

function displayFuelInfo(city)
{
    document.getElementById('fuel-city').style.display = 'none';
    document.getElementById('fuel-info').style.display = 'block';
    if (city != 'OzBest')
    {
        document.getElementById('Fuelbox').innerHTML = '<a href="javascript:;" onclick="window.open(\'http://motormouth.com.au/webwindows/webwindow.aspx?fueltypeid=2&Region=' + city + '&windowtype=city\',\'\',\'width=340,resizable=yes,scrollbars = yes \')"> <img alt="Where to find the cheapest petrol in ' + city + '" BORDER="0" src="http://www.motormouth.com.au/webwindows/images/bestprices_' + city + '.jpg" width="125" height="125"></a>';
    }
    else
    {
        document.getElementById('Fuelbox').innerHTML = '<a href="javascript:;" onclick="window.open(\'http://motormouth.com.au/webwindows/webwindow.aspx?fueltypeid=2&windowtype=ozbest\',\'\',\'width=340,resizable=yes,scrollbars = yes \')"><img alt="Where to find the cheapest petrol in Australia" BORDER="0" src="http://www.motormouth.com.au/webwindows/images/oz_bestprices.jpg"></a>';
    }
}

function changeFuelLocation()
{
    document.getElementById('fuel-city').style.display = 'block';
}

/**------------------
* Entertainment - TV Guide section 
------------------- */
function TVGuideInfoPopup(strURLToShow){
	    NewWinWidth= 520;
	    NewWinHeight= 500;
	    NewWinTop = (screen.availHeight / 2) - (NewWinHeight / 2);
	    NewWinLeft = (screen.availWidth / 2) - (NewWinWidth / 2);
	    theWin = window.open(strURLToShow,"","height=" + NewWinHeight + ",width=" + NewWinWidth + ",toolbar=0,scrollbars=1,resizable=1,left=" + NewWinLeft + ",top=" + NewWinTop);
}

//function setTimeSlot()
//{
//    var today = new Date();
//    var hr = today.getHours();
//    var timeslot = (Math.floor(hr / 3) * 3) + '-' + (Math.floor(hr / 3) * 3 + 3);
//    return  timeslot;
//}


/**------------------
* Entertainment - DVD section 
------------------- */
function DVDDetails(strURLToShow){
        NewWinWidth= 520;
        NewWinHeight= 500;
        NewWinTop = (screen.availHeight / 2) - (NewWinHeight / 2);
        NewWinLeft = (screen.availWidth / 2) - (NewWinWidth / 2);
        theWin = window.open(strURLToShow,"","height=" + NewWinHeight + ",width=" + NewWinWidth + ",toolbar=0,scrollbars=1,resizable=1,left=" + NewWinLeft + ",top=" + NewWinTop);
}

/**------------------
* 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;
			}
		}
	}
} 
