//
// site.js
//
var ADDRESSES = {
    'General':'info@restenjones.com',
    'Warren':'warren.mcgrath@restenjones.com',
    'CV':'cv@restenjones.com'
}
var SERVICES = {
    'Contract':'<h1>Contract</h1>' +
               '<p>Technology-specific recruiter teams deliver perfectly tailored ' +
               '   solutions in the fast-moving contractor market.</p>' +
               '<p>Resten Jones is staffed by a team of highly-experienced ' +
               '   recruitment consultants assigned to specialist technology ' +
               '   teams. All of these consultants have proven skills, knowledge ' +
               '   and experience in there specialist markets. We provide ' +
               '   continuity of service.</p>',
    'Permanent':'<h1>Permanent</h1>' +
               '<p>We understand the importance of providing the right permanent ' +
               '   people at the right time to help drive your business forward. ' +
               '   Therefore, in an increasingly competitive market for the best ' +
               '   IT candidates, we provide a comprehensive, flexible and ' +
               '   quality service to meet both client and candidates needs.',
    'OnSite':'<h1>Resource Management/Onsite Recruitment</h1>' +
               '<p>Resten Jones provides tailored recruitment solutions through ' +
               '   interim or permanent experienced recruiters, who work onsite ' +
               '   at client companies, building and managing their recruitment model.</p>' +
               '<p>Our approach has delivered our clients significant savings in ' +
               '   time, money and resource.</p>' +
               '<p>We work with companies who, typically, are planning to make ' +
               '   between 15- 100 hires a year, on either a UK or EMEA wide basis.</p>' +
               '<p>Resten Jones can benefit your business if you are:</p>' +
               '<ul>' +
               '  <li>Not currently attracting the right quality or quantity of candidates to meet your hiring needs.</li>' +
               '  <li>Planning a rapid growth in headcount.</li>' +
               '  <li>Would like more direct control over your recruitment activities.</li>' +
               '  <li>Wish to raise your profile and build your \'employer brand\'.</li>'  +
               '</ul>',
    'Retained':'<h1>Retained search</h1>' +
               '<p>A retained search can be the most suitable approach, given ' +
               '   certain market conditions and client requirements, for example:</p>' +
               '<ul>' +
               '  <li>Where a skill-set is extremely specific.</li>' +
               '  <li>If there is a shortage of available candidates within an industry .</li>' +
               '  <li>If the seniority of the role brings with it certain confidentiality requirements. </li>' +
               '  <li>Time-scale pressure. </li>' +
               '  <li>When a comprehensive market analysis is needed.</li>' +
               '</ul>' +
               '<p>We research individuals based on your requirements and using ' +
               '   our market knowledge we assess their suitability and availability ' +
               '   for your role, provide a shortlist for interview and work with ' +
               '   you through the interview process to secure the right individual ' +
               '   through to placement.</p>',
    'Tailored':'<h1>Tailored Recruitment Solutions</h1>' +
               '<p>Resten Jones strongly believe in developing strategic ' +
               '   relationships with our clients through focused specialist ' +
               '   teams who concentrate on your fulfilling your individual needs.</p>' +
               '<p>Our role is to alleviate the frustration from the recruitment ' +
               '   process, save you time and money in identifying the best ' +
               '   candidate for your organisation.</p>' +
               '<p>We have an in-depth understanding of the markets we work and ' +
               '   the information technology they use therefore enabling us ' +
               '   to partner with the client and focus on providing the following ' +
               '   services described here.</p>'
}

$(document).ready(

    function() {

        $('span.mailAddress').each(
            function() {
                var id, addr
                id   = $(this).attr('id')
                addr = ADDRESSES[id]
                $(this).html('<a href="mailto:' + addr + '">' + addr + '</a>')
            })
        $('div.header').click(
            function() {
                location.replace('index.html')
            })
        $('div.inset').each( function() { colourFlash($(this)) })
        $('div.insetWide').each( function() { colourFlash($(this)) })
        $('div.testimonial').each( function() { colourFlash($(this)) })
        $('div.company').each( function() { colourFlash($(this)) })

        $('li.servicesLi').mouseover(
            function() {
                $('li.servicesLi').each(
                    function() {
                        $(this).css('color','#0F195E')
                    })
                $(this).css('color','#777777')
                $('div#serviceDescription').html(SERVICES[$(this).attr('id')])
            })
            
        colourFlash($('input#submitForm'))
        $('input#submitForm').click( submitContact )
    }
)

function colourFlash(elem) {

    $(elem).mouseover(
        function() {
            $(this).css('background-color','#EDEEEA')
            $(this).css('color','#000000')
        })
    $(elem).mouseout(
        function() {
            $(this).css('background-color','#D6D8CF')
            $(this).css('color','#666666')
        })
}

function submitContact() {

    var firstName = $('input#firstName').val()
    var surname   = $('input#Surname').val()
    var email     = $('input#Email').val()
    var comment   = $('textarea#Comment').val()
    var cv        = $('input#CV').val()
    
    // Validation
    //
    if (email == '' || comment == '') {
        alert('Please enter both an email and a comment')
        return false
    }
    if (cv != '' && (firstName == '' || surname == '')) {
        alert('Please enter your first name and surname so we can identify your CV')
        return false
    }
}

