﻿
//From http://www.dynamic-tools.net/toolbox/copyToClipboard/
function copyToClipboard(s) {
    if (window.clipboardData && clipboardData.setData) {
        clipboardData.setData("Text", s);
    }
    else {
        // You have to sign the code to enable this or allow the action in about:config by changing
        user_pref("signed.applets.codebase_principal_support", true);
        netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

        var clip = Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip) return;

        // create a transferable
        var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable);
        if (!trans) return;

        // specify the data we wish to handle. Plaintext in this case.
        trans.addDataFlavor('text/unicode');

        // To get the data from the transferable we need two new objects
        var str = new Object();
        var len = new Object();

        var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString);

        var copytext = meintext;

        str.data = copytext;

        trans.setTransferData("text/unicode", str, copytext.length * [[[[2]]]]);

        var clipid = Components.interfaces.nsIClipboard;

        if (!clip) return false;

        clip.setData(trans, null, clipid.kGlobalClipboard);
    }
}

function createTabs() {
    $(document).ready(function() {
        $('.tab_content').hide(); // Hide all divs
        $('ul.nav li:first').addClass('active').show();
        $('.tab_content:first').show();

        $('ul.nav li').click(function() {
            $('ul.nav li').removeClass('active');
            $(this).addClass('active');
            $('.tab_content').hide();

            var activeTab = $(this).find('a').attr('href');
            $(activeTab).fadeIn();
            return false;
        });
    });
}


$(document).ready(function() {

    $('#example').hide();
    $('#example-show').click(function() {
        if ($('#example').css('display') == 'none') {
            $('#example-show').css('display', 'none');

            $('#example').slideToggle('slow', function() {
                $(this).css('display', 'inline-block');
            });
            $('#example-hide').css('display', 'inline-block');

        }
        return false;
    });

    $('#example-hide').click(function() {

    if ($('#example').css('display') == 'inline-block') {
        $('#example-hide').css('display', 'none');
        $('#example').slideToggle('slow');
        
        $('#example-show').css('display', 'inline-block');
        }


        
        return false;
    });
});

function triggerContact(action) {
    var bubbleInfoDivs = document.getElementById('popupContactContainer').getElementsByTagName('div')[0];
    if (bubbleInfoDivs != null) {
        if (action == "show") {
            bubbleInfoDivs.style.display = 'block';
            bubbleInfoDivs.style.top = '-95px';
            bubbleInfoDivs.style.left = '120px';
        }
        else {
            bubbleInfoDivs.style.display = 'none';
        }
    }
};

function BasketIsFull() {
    alert("Your Job Basket is full. As the limit is 20 jobs you\'ll need to remove some before adding more.");
}


