// --------------------------------------------------------------------
// PRELOAD IMAGES ? SEE NeillAnthony JS AND http://jquery-howto.blogspot.com/2009/02/preload-images-with-jquery.html
// --------------------------------------------------------------------

//var image1 = $('<img />').attr('src', 'images/temp_logo.jpg');
//var image2 = $('<img />').attr('src', 'images/temp_nav_unhover.jpg');

// --------------------------------------------------------------------

$(document).ready(function(){

// --------------------------------------------------------------------
// ON LOAD
// NB fadeIn WILL display a DIV which was display:none, but animate WON'T
// --------------------------------------------------------------------


// --------------------------------------------------------------------
// NAV FUNCTIONALITY
// --------------------------------------------------------------------

$("#homebutton").hover( 
        function () {
          $(this).attr('src', 'images/home-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/home-button.gif'); return true;
        });

//$("#aboutbutton").hover( 
//        function () {
//          $(this).attr('src', 'images/about-button-over.gif'); return true;
//        }, function () { 
//          $(this).attr('src', 'images/about-button.gif'); return true;
//        });

//$("#operationsbutton").hover( 
//        function () {
//          $(this).attr('src', 'images/operations-button-over.gif'); return true;
//        }, function () { 
//          $(this).attr('src', 'images/operations-button.gif'); return true;
//        });

//$("#investorcentrebutton").hover( 
//        function () {
//          $(this).attr('src', 'images/investor-centre-button-over.gif'); return true;
//        }, function () { 
//          $(this).attr('src', 'images/investor-centre-button.gif'); return true;
//        });

$("#contactusbutton").hover( 
        function () {
          $(this).attr('src', 'images/contact-us-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/contact-us-button.gif'); return true;
        });

$("#searchbutton").hover( 
        function () {
          $(this).attr('src', 'images/search-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/search-button.gif'); return true;
        });

$("#joinmailinglistbutton").hover( 
        function () {
          $(this).attr('src', 'images/join-mailing-list-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/join-mailing-list-button.gif'); return true;
        });


// --------------------------------------------------------------------
// ***DROPDOWN MENUS below 3 of the nav buttons***
// --------------------------------------------------------------------

// ABOUT DROPDOWN - NB OVERVIEW PAGE IS OMITTED, SO BUTTON DOESNT NEED TO TURN YELLOW ON HOVER
$("#aboutbutton").hover(
	function() {
//			$(this).stop(true,false).animate({opacity: 1}, 300); // SEE NB ABOVE
			$("#aboutdropdown").stop(true,false).fadeTo(300,1);
	}, function() {
//			$(this).stop(true,false).animate({opacity: 0}, 600); // SEE NB ABOVE
			$("#aboutdropdown").stop(true,false).fadeOut(600);
});
$("#aboutdropdown").hover(
	function() {
			$(this).stop(true,false).fadeTo(300,1);
//			$("#logonav2").stop(true,false).animate({opacity: 1}, 0); // SEE NB ABOVE
	}, function() {
			$(this).stop(true,false).fadeOut(600);
//			$("#logonav2").stop(true,false).animate({opacity: 0}, 600); // SEE NB ABOVE
});

$("#companyprofile").hover( 
        function () {
          $(this).attr('src', 'images/companyprofile-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/companyprofile-button.gif'); return true;
        });
$("#recentdevelopments").hover( 
        function () {
          $(this).attr('src', 'images/recentdevelopments-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/recentdevelopments-button.gif'); return true;
        });
$("#directorsbiographies").hover( 
        function () {
          $(this).attr('src', 'images/directorsbiographies-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/directorsbiographies-button.gif'); return true;
        });


// --------------------------------------------------------------------


// OPERATIONS DROPDOWN - NB OVERVIEW PAGE IS OMITTED, SO BUTTON DOESNT NEED TO TURN YELLOW ON HOVER
$("#operationsbutton").hover(
	function() {
//			$(this).stop(true,false).animate({opacity: 1}, 300); // SEE NB ABOVE
			$("#operationsdropdown").stop(true,false).fadeTo(300,1);
	}, function() {
//			$(this).stop(true,false).animate({opacity: 0}, 600); // SEE NB ABOVE
			$("#operationsdropdown").stop(true,false).fadeOut(600);
});
$("#operationsdropdown").hover(
	function() {
			$(this).stop(true,false).fadeTo(300,1);
//			$("#logonav3").stop(true,false).animate({opacity: 1}, 0); // SEE NB ABOVE
	}, function() {
			$(this).stop(true,false).fadeOut(600);
//			$("#logonav3").stop(true,false).animate({opacity: 0}, 600); // SEE NB ABOVE
});

$("#projectsincolombia").hover( 
        function () {
          $(this).attr('src', 'images/projectsincolombia-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/projectsincolombia-button.gif'); return true;
        });
$("#projectsinparaguay").hover( 
        function () {
          $(this).attr('src', 'images/projectsinparaguay-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/projectsinparaguay-button.gif'); return true;
        });

// --------------------------------------------------------------------

// INVESTORCENTRE DROPDOWN - NB OVERVIEW PAGE IS OMITTED, SO BUTTON DOESNT NEED TO TURN YELLOW ON HOVER
$("#investorcentrebutton").hover(
	function() {
//			$(this).stop(true,false).animate({opacity: 1}, 300); // SEE NB ABOVE
			$("#investorcentredropdown").stop(true,false).fadeTo(300,1);
	}, function() {
//			$(this).stop(true,false).animate({opacity: 0}, 600); // SEE NB ABOVE
			$("#investorcentredropdown").stop(true,false).fadeOut(600);
});
$("#investorcentredropdown").hover(
	function() {
			$(this).stop(true,false).fadeTo(300,1);
//			$("#logonav5").stop(true,false).animate({opacity: 1}, 0); // SEE NB ABOVE
	}, function() {
			$(this).stop(true,false).fadeOut(600);
//			$("#logonav5").stop(true,false).animate({opacity: 0}, 600); // SEE NB ABOVE
});

$("#shareprice").hover( 
        function () {
          $(this).attr('src', 'images/shareprice-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/shareprice-button.gif'); return true;
        });
$("#rnsannouncements").hover( 
        function () {
          $(this).attr('src', 'images/rnsannouncements-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/rnsannouncements-button.gif'); return true;
        });
$("#reportspresentations").hover( 
        function () {
          $(this).attr('src', 'images/reportspresentations-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/reportspresentations-button.gif'); return true;
        });
$("#annualreport").hover( 
        function () {
          $(this).attr('src', 'images/annualreport-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/annualreport-button.gif'); return true;
        });
$("#advisers").hover( 
        function () {
          $(this).attr('src', 'images/advisers-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/advisers-button.gif'); return true;
        });
$("#aimrule26").hover( 
        function () {
          $(this).attr('src', 'images/aimrule26-button-over.gif'); return true;
        }, function () { 
          $(this).attr('src', 'images/aimrule26-button.gif'); return true;
        });


// --------------------------------------------------------------------
// ***OTHER FUNCTIONALITY***
// --------------------------------------------------------------------



// --------------------------------------------------------------------
}); // end JQ document ready
