$(document).ready(function(){
closetimer = 0;
  if($("#nav")) {
    $("#nav b").mouseover(function() {
    clearTimeout(closetimer);
      if(this.className.indexOf("clicked") != -1) {
        $(this).parent().next().slideUp(500);
        $(this).removeClass("clicked");
      }
      else {
        $("#nav b").removeClass();
        $(this).addClass("clicked");
        $("#nav ul:visible").slideUp(500);
        $(this).parent().next().slideDown(500);
      }
      return false;
    });
    $("#nav").mouseover(function() {
    clearTimeout(closetimer);
    });
    $("#nav").mouseout(function() {
      closetimer = window.setTimeout(function(){
      $("#nav ul:visible").slideUp(500);
      $("#nav b").removeClass("clicked");
      }, 2000);
    }); 
  }
});


// timer setting (milliseconds)
        var timeToChange = 8000;

        // text to be inserted
        var batchtxt = [];
        
        batchtxt.push("<p>Over 50% of Australians already use a Huawei product.<\/p><br><p align='right'><a href='About-Huawei.html' style='padding:0;'><img src='images/home/btn_more.gif' alt='more' /><\/a><\/p>");
        batchtxt.push("<p>Huawei’s products and solutions support the communications needs of one third of the world’s population.<\/p><br><p align='right'><a href='About-Huawei.html' style='padding:0;'><img src='images/home/btn_more.gif' alt='more' /><\/a><\/p>");
        batchtxt.push("<p>Huawei's products and solutions are deployed in over 100 countries and serve 45 of the world's top 50 operators.<\/p><p align='right'><a href='About-Huawei.html' style='padding:0;'><img src='images/home/btn_more.gif' alt='more' /><\/a><\/p>");
        batchtxt.push("<p>Huawei partners with Australia's top telecom operators to provide end-to-end network solutions.<\/p><p align='right'><a href='About-Huawei.html' style='padding:0;'><img src='images/home/btn_more.gif' alt='more' /><\/a><\/p>");

        // background files to be updated
        var batchbg = [];
        
        
        batchbg.push("images/bgs/laptop-mountains.jpg");
        batchbg.push("images/bgs/dune.jpg");
        batchbg.push("images/bgs/boy-in-wheat-field.jpg");
        batchbg.push("images/bgs/kids.jpg");

        // slideshow counter
        var iCount = 0;

        

        // preload routine
        (function($) {
            var cache = [];
            // Arguments are image paths relative to the current page.
            $.preLoadImages = function() {
                var args_len = arguments.length;
                for (var i = args_len; i--; ) {
                    var cacheImage = document.createElement('img');
                    cacheImage.src = arguments[i];
                    cache.push(cacheImage);
                }
            }
        })(jQuery)

        // preload the background images
        for (var i = 0; i < batchbg.length; ++i) {
            jQuery.preLoadImages(batchbg[i]);
        }

