﻿// JScript File

//-----------------------------------------------------------------//
//                                                                 //
// This creates the hover menu under the header                    //
// Andrew Blyth - 16/06/2006                                       //
//                                                                 //
//-----------------------------------------------------------------//
window.onload=show;
var vTimer;
function show(id) 
{
    var d = document.getElementById(id);
    for (var i = 0; i<=11; i++) 
    {
        if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
    }
    if (d) 
    {
        d.style.display='block';
        d.style.display='block';
    }
}

function hide() 
{
    vTimer = window.setTimeout(show,500);
}

function stopTime() 
{
    window.clearTimeout(vTimer);
}

function txtSearch_onclick(oThis) 
{
    if (document.getElementById(oThis.id).value == "Enter Keywords")
    {
        document.getElementById(oThis.id).value = "";
    }
}

function txtSearch_onblur(oThis) 
{
    if (document.getElementById(oThis.id).value.length == 0)
    {
        document.getElementById(oThis.id).value = "Enter Keywords";
    }
}

//-----------------------------------------------------------------//
//                                                                 //
// This is a fix to prevent the activation of Flash in IE          //
// Andrew Blyth - 16/06/2006                                       //
//                                                                 //
//-----------------------------------------------------------------//
function write_control( text ) {
document.write(text);
}



//-----------------------------------------------------------------//
//                                                                 //
// This adds the current page to the favourites                    //
// Elisa Ang - 16/06/2006                                          //
//                                                                 //
//-----------------------------------------------------------------//
function addToFavorites() 
{ 
    var url = location.href;
    var title = "A-Plant";

    if (window.sidebar) 
    { 
        // Mozilla Firefox Bookmark
        window.sidebar.addPanel(title, url,"");
    } 
    else if( window.external ) 
    { 
        // IE Favorite
        window.external.AddFavorite( url, title); 
    }
    else if(window.opera && window.print) 
    { 
        // Opera Hotlist
        return true; 
    }
}       

function ClientValidation(source, args)
{
     args.IsValid = findObj('ctl00_cphMasterBody_termsConditions').checked;
}

function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

