var jq = jQuery.noConflict();
jq(document).ready(function(){
    jq('#modules').Fisheye({
        items: 'a',
        itemsText: 'span',
        container: '.fisheyeContainter',
        itemWidth: 48,
        maxWidth: 16,
        proximity: 50,
        alignment   : "center",
        valign  : 'bottom',
        halign : 'center'
    });

   jQuery('#mycarousel').jcarousel({
        scroll: 3,
        itemFirstInCallback: function(carousel, item, idx, state) {
  //          top.console.debug(item);
            jq(item).find('div').click();
//            top.console.debug('Item #' + idx + ' is now the first item');
        }
    });

//    jq('#mycarousel').jcarousel();
    var softwaremodule = jq("div#softwareModule");
    var softwaremoduleList = jq("ul#softwareModuleList");
    var productArea = jq("div#productArea");
    var productAreaList = jq("ul#productAreaList");
    softwaremodule.click(function() {
    var productAreaListClass = productAreaList.hasClass("open");
        if(softwaremoduleList.hasClass("open")) {
            if(productAreaListClass) {
                productAreaList.removeClass("open").slideUp("fast");
            }
            softwaremoduleList.removeClass("open").slideToggle("slow");
        } else {
            if(productAreaListClass) {
                productAreaList.removeClass("open").slideUp("fast");
            }
            softwaremoduleList.addClass("open").slideToggle("slow");
        }
    });
    productArea.click(function() {
    var softwaremoduleListClass = softwaremoduleList.hasClass("open");
        if(productAreaList.hasClass("open")) {
            if(softwaremoduleListClass) {
                softwaremoduleList.removeClass("open").slideUp("fast");
            }
            productAreaList.removeClass("open").slideToggle("slow");
        } else {
            if(softwaremoduleListClass) {
                softwaremoduleList.removeClass("open").slideUp("fast");
            }
            productAreaList.addClass("open").slideToggle("slow");
        }
    });
    jq("div#new_form div#basicform input[type='text']").addClass("mod_text");
    jq("div#new_form div#basicform input[name='email']").addClass("mod_email");
    jq("div#new_form div#basicform input[type='submit']").addClass("mod_submit");
    jq("div#new_form div#basicform input[type='submit']:hover").fadeTo("slow", 0.8);
    /* Careers */
/*
    html = '<h1>Our Staff</h1>\
            <p><strong>Paula Luoto, Product Manager</strong><br />\
            I spent most of my career working in marketing on the insurance company side, but in 2004 I decided to try something different and so joined Profit Software. Today I work as part of the product development team, helping to plan our roadmap and specify the new business functionalities to include in our core software. I have to say that I’ve learned more about the insurance and banking business industry here than I did working in an actual insurance company or a bank!</p>';
    jq("#careers #preface").html(html);

    jq("ul#mycarousel li div#first").addClass("selected");
*/
    jq("ul#mycarousel li div").bind('click', function() {
        jq("ul#mycarousel li div").each(function() {
            jq(this).removeClass("selected");
        });
        jq(this).addClass("selected");
        switch(jq(this).attr("id")) {
            case "first":
                html = '<h1>Our Staff</h1>\
                <p><strong>Paula Luoto, Product Manager</strong><br />\
                I spent most of my career working in marketing on the insurance company side, but in 2004 I decided to try something different and so joined Profit Software. Today I work as part of the product development team, helping to plan our roadmap and specify the new business functionalities to include in our core software. I have to say that I’ve learned more about the insurance and banking business industry here than I did working in an actual insurance company or a bank!</p>';
                jq("#preface").html(html);
                jq("#selected-person").animate({
                    width   : "491px"
                }, 500);
                break;
            case "second":
                html = '<h1>Our Staff</h1>\
                <p><strong>Axel Waal, Project Manager</strong><br />\
                As a project manager I need to bring clear structure, goals and timelines to our customer deliveries. This role gives me the opportunity to communicate with interesting and intelligent people both on the client side and internally, which is what keeps me inspired and on track. Since starting here in 2006 I’ve not only developed my expertise in software development, but also my knowledge of insurance, legal and business issues. There is a great team atmosphere here and we support one another very well.</p>';
                jq("#preface").html(html);
                jq("#selected-person").animate({
                    width   : "665px"
                }, 500);
                break;
            case "third":
                html = '<h1>Our Staff</h1>\
                <p><strong>Karina Bjorklund, Business Analyst</strong><br />\
                One of the great things about Profit Software is that you are able to rotate between different roles, so you get to know many different sides of the company. I started here in 2007 as a test engineer, but today I work as a business analyst, feeding specifications into our product development process. This is an interesting position with quite a bit of responsibility, as you need to get the specs correct right at the start in order to avoid issues further down the line.</p>';
                jq("#preface").html(html);
                jq("#selected-person").animate({
                    width   : "830px"
                }, 500);
                break;
            case "fourth":
                html = '<h1>Our Staff</h1>\
                <p><strong>Pasi Honkanen, Software Engineer</strong><br />\
                What I like about Profit Software is that we are always in close contact with customers in order to feed their requirements back into our software development processes. This makes R&D concrete and meaningful for the developer, as we are constantly making improvements that will really help our customers in their business. The employee setup is great at Profit Software and there is a wide range of people from multiple different countries. Best of all, there is not a single day without laughter!</p>';
                jq("#preface").html(html);
                jq("#selected-person").animate({
                    width   : "461px"
                }, 500);
                break;
            case "fifth":
                html = '<h1>Our Staff</h1>\
                <p><strong>Vladislav Golodov, Software Engineer</strong><br />\
                For me the great thing about working for Profit Software is that the industry we serve, insurance, is a serious business. It’s inspiring to know that our customers are depending on us to develop core systems that are absolutely critical to their success. I also like the fact that I can choose and influence the kind of work I do. And when I do run into challenges I can always find somebody to discuss them with, as there are a lot of incredibly experienced people here.</p>';
                jq("#preface").html(html);
                jq("#selected-person").animate({
                    width   : "650px"
                }, 500);
                break;
            case "sixth":
                html = '<h1>Our Staff</h1>\
                <p><strong>Heidi Puurunen, Test Engineer</strong><br />\
                I began working at Profit Software in early 2009 and soon started running software testing in a specific client project. Testing is a good place to begin in this company, as you quickly get to know the insurance industry and become familiarized with our products at quite a deep level. We’re constantly developing our testing environment here and we all take pride in the fact that our job is about ensuring the end quality of our products out in the marketplace.</p>';
                jq("#preface").html(html);
                jq("#selected-person").animate({
                    width   : "770px"
                }, 500);
                break;
            default:
                break;
        }
    }).bind('mouseleave', function() {
    });
    jq(".network-card").each(function() {
        jq(this).addClass("network-card-minimized");
    });
    jq("a.network-topic").each(function() {
        jq(this).click(function() {
            jq(this).closest("div").find("div.network-content").slideToggle("slow")
            //jq(this).closest("div").toggleClass("network-card-minimized");
        });
    });


    /* Careers */
});