﻿/************************************************
Copyright 2beknown 2011
Custom JS File by Tavis Basing
Last Updated: 01/05/2011
www.2beknown.co.uk

************************************************/

// Homepage hoverfade effect on divs
$(document).ready(function () {
    $('.fastfade').each(function () {
        var $span = $('> div.hover', this).css('opacity', 0);
        var $inner = $('> div.inner', this).css('opacity', 1);
        $(this).hover(function () {
            $span.stop().fadeTo(500, 1);
            $inner.stop().fadeTo(500, 0);
        }, function () {
            $span.stop().fadeTo(500, 0);
            $inner.stop().fadeTo(500, 1);
        });
    });

    // Jquery fix for placeholders

    $('[placeholder]').focus(function () {
        var input = $(this);
        if (input.val() == input.attr('placeholder')) {
            input.val('');
            input.removeClass('placeholder');
        }
    }).blur(function () {
        var input = $(this);
        if (input.val() == '' || input.val() == input.attr('placeholder')) {
            input.addClass('placeholder');
            input.val(input.attr('placeholder'));
        }
    }).blur();
});

// Hide and Show Panels using buttons
// Animation
$(document).ready(function () {
    $("#btnProceed").click(function () {
         $("#africasia_Disclaimer").hide("slow");
         $("#disclaimer_proceed").show("slow");

     });

     // Sri Lanka Plantations
     $("#btnSL1").hover(function () {
         $("#sl1").show("slow");
         $("#sl2").hide("slow");
         $("#sl3").hide("slow");
         $("#sl4").hide("slow");
         $("#sl5").hide("slow");
         $("#sl6").hide("slow");
         $("#sl7").hide("slow");
         $("#sl8").hide("slow");
     });

     $("#btnSL2").hover(function () {
         $("#sl1").hide("slow");
         $("#sl2").show("slow");
         $("#sl3").hide("slow");
         $("#sl4").hide("slow");
         $("#sl5").hide("slow");
         $("#sl6").hide("slow");
         $("#sl7").hide("slow");
         $("#sl8").hide("slow");
     });

     $("#btnSL3").hover(function () {
         $("#sl1").hide("slow");
         $("#sl2").hide("slow");
         $("#sl3").show("slow");
         $("#sl4").hide("slow");
         $("#sl5").hide("slow");
         $("#sl6").hide("slow");
         $("#sl7").hide("slow");
         $("#sl8").hide("slow");
     });
     $("#btnSL4").hover(function () {
         $("#sl1").hide("slow");
         $("#sl2").hide("slow");
         $("#sl3").hide("slow");
         $("#sl4").show("slow");
         $("#sl5").hide("slow");
         $("#sl6").hide("slow");
         $("#sl7").hide("slow");
         $("#sl8").hide("slow");
     });
     $("#btnSL5").hover(function () {
         $("#sl1").hide("slow");
         $("#sl2").hide("slow");
         $("#sl3").hide("slow");
         $("#sl4").hide("slow");
         $("#sl5").show("slow");
         $("#sl6").hide("slow");
         $("#sl7").hide("slow");
         $("#sl8").hide("slow");
     });
     $("#btnSL6").hover(function () {
         $("#sl1").hide("slow");
         $("#sl2").hide("slow");
         $("#sl3").hide("slow");
         $("#sl4").hide("slow");
         $("#sl5").hide("slow");
         $("#sl6").show("slow");
         $("#sl7").hide("slow");
         $("#sl8").hide("slow");
     });
     $("#btnSL7").hover(function () {
         $("#sl1").hide("slow");
         $("#sl2").hide("slow");
         $("#sl3").hide("slow");
         $("#sl4").hide("slow");
         $("#sl5").hide("slow");
         $("#sl6").hide("slow");
         $("#sl7").show("slow");
         $("#sl8").hide("slow");
     });
     $("#btnSL8").hover(function () {
         $("#sl1").hide("slow");
         $("#sl2").hide("slow");
         $("#sl3").hide("slow");
         $("#sl4").hide("slow");
         $("#sl5").hide("slow");
         $("#sl6").hide("slow");
         $("#sl7").hide("slow");
         $("#sl8").show("slow");
     });

     // Thailand Plantations
     $("#btnTH1").hover(function () {
         $("#th1").show("slow");
         $("#th2").hide("slow");
         $("#th3").hide("slow");
         $("#th4").hide("slow");
         $("#th5").hide("slow");
        
     });

     $("#btnTH2").hover(function () {
         $("#th1").hide("slow");
         $("#th2").show("slow");
         $("#th3").hide("slow");
         $("#th4").hide("slow");
         $("#th5").hide("slow");
        
     });

     $("#btnTH3").hover(function () {
         $("#th1").hide("slow");
         $("#th2").hide("slow");
         $("#th3").show("slow");
         $("#th4").hide("slow");
         $("#th5").hide("slow");
        
     });
     $("#btnTH4").hover(function () {
         $("#th1").hide("slow");
         $("#th2").hide("slow");
         $("#th3").hide("slow");
         $("#th4").show("slow");
         $("#th5").hide("slow");
        
     });
     $("#btnTH5").hover(function () {
         $("#th1").hide("slow");
         $("#th2").hide("slow");
         $("#th3").hide("slow");
         $("#th4").hide("slow");
         $("#th5").show("slow");
         
     });
    


    // Added animation for the Meet the Team
     // Dean Henry
    $("dt#Dean").click(function () {
        var dd = $("dd#Deandd");    

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Deandt").toggleClass('opened');           
        }
    });
    // Leigh Charlton
    $("dt#Leigh").click(function() {
    var dd = $("dd#Leighdd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Leighdt").toggleClass('opened');
        }
    });
    // Satish Wadhwani
    $("dt#Satish").click(function() {
    var dd = $("dd#Satishdd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Satishdt").toggleClass('opened');
        }
    });
    // Shelley Low
    $("dt#Shelley").click(function() {
    var dd = $("dd#Shelleydd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Shelleydt").toggleClass('opened');
        }
    });
    // Ricky Sandhu
    $("dt#Ricky").click(function() {
    var dd = $("dd#Rickydd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Rickydt").toggleClass('opened');
        }
    });
    // Alice Woodland
    $("dt#Alice").click(function() {
    var dd = $("dd#Alicedd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Alicedt").toggleClass('opened');
        }
    });
    // Adam Pittwood
    $("dt#Adam").click(function() {
    var dd = $("dd#Adamdd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Adamdt").toggleClass('opened');
        }
    });

    // Ben Sunnucks
    $("dt#Ben").click(function() {
    var dd = $("dd#Bendd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Bendt").toggleClass('opened');
        }
    });
    // Adam Amode
    $("dt#Amode").click(function() {
    var dd = $("dd#Amodedd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Amodedt").toggleClass('opened');
        }
    });
    // Paul Bennett
    $("dt#itdevelopment").click(function() {
        var dd = $("dd#itdevelopmentdd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#itdevelopmentdt").toggleClass('opened');
        }
    });
    // Rajiv Patel
    $("dt#Rajiv").click(function() {
    var dd = $("dd#Rajivdd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Rajivdt").toggleClass('opened');
        }
    });
    // Neil Macvicar
    $("dt#Neil").click(function() {
    var dd = $("dd#Neildd");

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $("dt#Neildt").toggleClass('opened');
        }
    });
    
});



// Settings Used for the Superfish Menu
$(document).ready(function () {
    $('ul.sf-menu').superfish({
        delay: 1000,                            // one second delay on mouseout
        animationShow: { opacity: 'show' },
        animationHide: { opacity: 'hide' },  // slide-down animation 
        speed: 'slow',                          // faster animation speed 
        autoArrows: false,                           // disable generation of arrow mark-up 
        dropShadows: false                            // disable drop shadows  
        //animation: { height: 'show' },  // slide-down animation 
        //speed: '500',                          // faster animation speed 
        //autoArrows: false,                           // disable generation of arrow mark-up 
        //dropShadows: false                            // disable drop shadows 
    });
    $('ul.submenufull').superfish({
        delay: 1000,                            // one second delay on mouseout 
        animationShow: { opacity: 'show' },
        animationHide: { opacity: 'hide' },  // slide-down animation 
        speed: 'slow',                          // faster animation speed 
        autoArrows: false,                           // disable generation of arrow mark-up 
        dropShadows: false                            // disable drop shadows 
    });
});

// Redirection Links

function returnHome() {
    window.location.href = 'default.aspx';
}

// Used in Meet the Team
$(document).ready(function () {
    // Appending the definition list:
   
    $('dt').live('click', function () {
        var dd = $(this).next();

        // If the title is clicked and the dd is not currently animated,
        // start an animation with the slideToggle() method.

        if (!dd.is(':animated')) {
            dd.slideToggle();
            $(this).toggleClass('opened');
        }

    });

    $('a.button').click(function () {

        // To expand/collapse all of the simultaneously,
        // just trigger the click event on the DTs

        if ($(this).hasClass('collapse')) {
            $('dt.opened').click();
        }
        else $('dt:not(.opened)').click();

        $(this).toggleClass('expand collapse');

        return false;
    });

});

// Opens a new window panel - set your own size (pop up)
function OpenWindow(query, w, h, scroll) {
    var l = (screen.width - w) / 2;
    var t = (screen.height - h) / 2;

    winprops = 'resizable=1, height=' + h + ',width=' + w + ',top=' + t + ',left=' + l + 'w';
    if (scroll) winprops += ',scrollbars=1';
    var f = window.open(query, "_blank", winprops);
}

//Map 

//var remote = null;
//function info(wohin, w, h) {
//    remote = eval("window.open(wohin,\'TheRemote\',\'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=" + w + ",height=" + h + "\')")
//    if (navigator.appVersion.indexOf("(X11") != -1) window.open(wohin, 'TheRemote')
//    if ((remote != null) && (remote.opener == null)) { remote.opener = self; }
//    remote.opener.name = "opener"
//}
// Starmap Functions
//wmtt = null;
//document.onmousemove = updateWMTT;
//function updateWMTT(e) {
//    x = (document.all) ? window.event.x + document.getElementById("starmap").scrollLeft : e.pageX;
//    y = (document.all) ? window.event.y + document.getElementById("starmap").scrollTop : e.pageY;
//    document.getElementById("coordinates").firstChild.nodeValue = "x=" + x + ", y=" + y;
//    if (wmtt != null) {
//        wmtt.style.left = (x + 20) + "px";
//        wmtt.style.top = (y + 20) + "px";
//    }
//}
function showWMTT(id) {
    wmtt = document.getElementById(id);
    wmtt.style.display = "block"
}
function hideWMTT() {
    wmtt.style.display = "none";
}


//Display Panel- Africasia




