﻿$(document).ready(function() {
    $(".breadcrumb a:last").toggleClass("active");
    $(".subNav > ul > li > a").wrap('<span></span>');

    var searchPlacholderText = "Search";

    $(".headersearchfield").attr("value", searchPlacholderText);

    $(".headersearchfield").focus(function() {
        if ($(this).attr("value") == searchPlacholderText) $(this).attr("value", "");
    });

    $(".headersearchfield").blur(function() {
        if ($(this).attr("value") == "") $(this).attr("value", searchPlacholderText);
    });


    var operationsMapBaseImg = "../UploadedResources/cg_operations_map_base.gif";
    var operationsMapCaptionBase = $('#OperationsMapImg').attr('alt');

    $('#operationsMapCaption').html(operationsMapCaptionBase);

    $('#Kalsaka').hover(function() {
        $('#OperationsMapImg').attr('src', '../UploadedResources/cg_operations_map_kalsaka.gif');
        $('#operationsMapCaption').html($('#Kalsaka').attr('alt'));
    }, function() {
        operationsMapReset();
    });

    $('#Angovia').hover(function() {
        $('#OperationsMapImg').attr('src', '../UploadedResources/cg_operations_map_angovia.gif');
        $('#operationsMapCaption').html($('#Angovia').attr('alt'));
    }, function() {
        operationsMapReset();
    });

    $('#Baomahun').hover(function() {
        $('#OperationsMapImg').attr('src', '../UploadedResources/cg_operations_map_Baomahun.gif');
        $('#operationsMapCaption').html($('#Baomahun').attr('alt'));        
    }, function() {
        operationsMapReset();
    });

    function operationsMapReset() {
        $('#OperationsMapImg').attr('src', operationsMapBaseImg);
        $('#operationsMapCaption').html(operationsMapCaptionBase);
    }


    $(".footer li:last a").attr('target', '_blank');


});

function primaryNavNew() {
    $(".primary_nav > ul > li > a").wrap('<span></span>');
    
    $('.primary_nav > ul > li').hover(function() {

        var listItem = $('.primary_nav > ul > li').index(this);
        var panelClass = 'panelBck' + listItem;

        if ($('.home_pane_a').length) {
            $('.primary_nav').append('<div class="homePanel ' + panelClass + ' "></div>').stop(true, true);
        }

        $(this).addClass('active');
        $('.primary_nav li.active ul').css('display', 'block');

    }, function() {
        $(this).removeClass('active');
        $('.primary_nav').find('.homePanel').remove();
        $('.primary_nav li ul').css('display', 'none');
    });
}





/* DISCLAIMER POP-UP */

var popupStatus = 0;
var popUpDiv = "#popupDisclaimer";
var popUpBgDiv = "#popupDisclaimerBg";

function loadPopup() {

    $("body").append('<div id="popupDisclaimerBg"></div>');
    $("body").append('<div id="popupDisclaimer"><h1>Disclaimer</h1>I/We understand that:<br /><ul><li>The analyst reports contained on this website are for distribution (a) in the United Kingdom only to (i) investment professionals as defined in Article 19(5) of the Financial Services and Markets Act 2000 (Financial Promotion) Order 2005 (as amended) (“FPO”) or (ii) persons falling within Article 49(2) of the FPO (including high net worth companies and unincorporated associations, descriptions of which and of other persons falling within Article 49(2) are set out in Article 49(2)), and those other persons to whom it may otherwise be lawful to distribute them and (b) in any territory outside the United Kingdom only to those persons to whom it may otherwise be lawful to distribute them under the laws of the relevant jurisdiction and by accessing the analysts reports you will be deemed to have warranted that you are such a person. The analyst reports are not intended to be, and must not be, distributed, passed on or disclosed, directly or indirectly, to any other class of persons.</li><li>The analyst reports contained on this website are each subject to the disclaimer contained therein. The analyst reports have been prepared by the firms which have issued them and not by Cluff Gold plc or any of its directors, officers, partners, employees, agents or other advisers. Accordingly, no representation or warranty or other assurance, express or implied, is made or given by or on behalf of Cluff Gold plc or any of its directors, officers, partners, employees, agents or other advisers as to the accuracy, completeness or fairness of the information or opinions contained in the analyst reports and no liability or responsibility is accepted by any of them for any such information or opinions.</li><li>The analyst reports are supplied to you solely for your information.  They must not be distributed, published or reproduced, in whole or in part, by you or any other person for any purpose.  In particular, the analyst reports must not be distributed or transmitted in or into the United States of America, Canada, Australia, Japan or South Africa or in any other country outside the United Kingdom where such distribution may lead to a breach of law or regulatory requirements or transmitted, distributed or sent to or by any national, resident or citizen of such countries or to any US person (within the definition of Regulation S made under the US Securities Act 1933 (as amended).</li></ul><br />By clicking on the "I Accept" button below, I/We acknowledge that I/We have read, understood and agreed to the above conditions.<br /><br /><noscript><strong>YOU MUST HAVE JAVASCRIPT ENABLED TO ACCEPT THIS DISCLAIMER. PLEASE ENABLE JAVASCRIPT ON YOUR WEB BROWSER AND REFRESH THE PAGE.</strong><br /><br /></noscript><strong><a id="popupDisclaimerClose">Accept</a> / <a href="/Operations/Overview">Reject</a></strong></div>');
    

    if (popupStatus === 0) {
        $('#header').css('z-index', '1');
        $(popUpBgDiv).css({
            "opacity": "0.7"
        });
        $(popUpBgDiv).fadeIn("slow");
        $(popUpDiv).fadeIn("slow");
        popupStatus = 1;
    }
}
function disablePopup() {
    if (popupStatus === 1) {
        $(popUpBgDiv).fadeOut("slow");
        $(popUpDiv).fadeOut("slow", function() {
            $('#header').css('z-index', '100');
        });
        popupStatus = 0;
    }
}

