

// include other javascripts
document.write('<script language="javascript" type="text/javascript" src="http://dyn.icbdr.com/Plink/JS/QuickSearchBox2.aspx?countrycode=uk"><\/script>');
document.write('<script language="javascript" type="text/javascript" src="http://dyn.icbdr.com/Plink/JS/JobSeekerBoxLink.aspx?countrycode=uk"><\/script>');
document.write('<script language="javascript" type="text/javascript" src="http://dyn.icbdr.com/Plink/JS/JobPosterBoxLink.aspx?countrycode=uk"><\/script>');

// arrays for stuff
var sectorArray = new Array;
var keywordsArray = new Array;
var locationArray = new Array;

// add custom sectors/keywords
function addSector(sectorName, keywords)
{
    sectorArray[sectorArray.length] = (sectorName != null) ? sectorName : '';
    keywordsArray[keywordsArray.length] = (keywords != null) ? keywords : '';
}

// add custom locations
function addLocation(locationName)
{
    locationArray[locationArray.length] = locationName;
}

function careerCenterTemplateUK(lrCode)
{
    // get site id prefix
    var siteIdPrefix = ((lrCode.substring(0, 3) == 'int') ? lrCode : lrCode.substring(2));
    
    document.write('<link href="http://img.icbdr.com/css/plink/uk.css" type="text/css" rel="stylesheet">');
    document.write('<div class="cbuk">');
    document.write('    <div id="cbukCareerCenter">');

    quickSearchBox2(lrCode);

    document.write('        <div id="cbukJobLinks">');
    document.write('            <div id="cbukJobSector">');
    document.write('                <h1>Jobs by Sector</h1>');
    document.write('                <ul>');
    
    if(sectorArray.length == 0)
    {
        // add default sector links
        addSector('Accountancy');
        addSector('Banking - Finance');
        addSector('Sales');
        addSector('Retail - Wholesale');
        addSector('IT');
        addSector('Admin - Secretarial');
        addSector('Customer Service - Call Centres');
        addSector('Senior Appointments');
    }
    
    // render sector/keywords links form array
    for(var i = 0; i < sectorArray.length; i++)
    {
        document.write('<li>-&nbsp;<a href="http://www.careerbuilder.co.uk/plink/redirect/jobresults.aspx?' +
            'sectorname=' + sectorArray[i].replace(/[ ]/g, '+').toLowerCase() +
            '&keywords=' + keywordsArray[i].replace(/[ ]/g, '+').toLowerCase() +
            '&lr=' + lrCode +
            '&siteid=' + siteIdPrefix + 'ukccjsec">' +
            ((keywordsArray[i].length > 0) ? keywordsArray[i] : sectorArray[i]) +
            '</a></li>');
    }
    
    document.write('                </ul>');
    document.write('            </div>');
    document.write('            <div id="cbukJobLocation">');
    document.write('                <h1>Jobs by Location</h1>');
    document.write('                <ul>');
    
    if(locationArray.length == 0)
    {
        // add default location links
        addLocation('London');
        addLocation('Birmingham');
        addLocation('Manchester');
        addLocation('Leeds');
        addLocation('Edinburgh');
        addLocation('Bristol');
        addLocation('Liverpool');
        addLocation('Newcastle');
    }
    
    // render location links from arrays
    for(var i = 0; i < locationArray.length; i++)
    {
        document.write('<li>-&nbsp;<a href="http://www.careerbuilder.co.uk/plink/redirect/jobresults.aspx?location=' + locationArray[i].replace(/[ ]/g, '+') + '&lr=' + lrCode + '&siteid=' + siteIdPrefix + 'ukccjloc">' + locationArray[i] + '</a></li>');
    }

    document.write('                </ul>');
    document.write('            </div>');
    document.write('        </div>');
    document.write('        <div id="cbukPostBoxes">');

    jobSeekerBoxLink(lrCode);

    jobPosterBoxLink(lrCode);

    document.write('            <div class="clear"></div>');
    document.write('        </div>');
    document.write('    </div>');
    document.write('    <div class="clear"></div>');
    document.write('</div>');
}