

/*** EGCRF POST-PROC, ADAPTED FROM new js for the new-look NGRF, especially some clientside post-processing of FT content  ***/

var g_special_FT_handling = 'none', g_thisHref = this_url, g_thisInfoBranch = '', g_thisENGLISHBranch, g_thisCOUNTRYBranch, g_thisContentTitle

var g_dynamicStyleSheet, d_jsWritingStepsPending = '--make dropdown links--'

var g_addFTsubmenusToMainNav = g_thisHref.indexOf(portal_url + '/future-trends') > -1

function detectSpecialHandlingNeeds(){

    var path = g_thisHref.split(portal_url + '/country/')
    
    if (path.length < 2){
        detectSpecial_ENGLISH_HandlingNeeds()
        return
    }
    path = path[1].split('/')
    
    g_thisCOUNTRYBranch = path[0]

    if (path.length < 2){
        g_special_FT_handling = 'EGCRF_COUNTRY_top'
        return
    }

    g_special_FT_handling = 'EGCRF_COUNTRY'
    

}

function detectSpecial_ENGLISH_HandlingNeeds(){

    var path = g_thisHref.split(portal_url + '/english/')
    
    if (path.length < 2){
        return
    }
    path = path[1].split('/')
    
    g_thisENGLISHBranch = path[0]

    if (path.length < 2){
        g_special_FT_handling = 'EGCRF_ENGLISH_top'
        return
    }

    g_special_FT_handling = 'EGCRF_ENGLISH'
    
 
}

detectSpecialHandlingNeeds()


function addDynamicStylesheet(){        // not using this yet

    g_dynamicStyleSheet = document.createElement('style');
    g_dynamicStyleSheet.type = 'text/css';
    g_dynamicStyleSheet.rel = 'stylesheet';
    g_dynamicStyleSheet.media = 'screen';
    g_dynamicStyleSheet.title = 'dynamicSheet';
    document.getElementsByTagName("head")[0].appendChild(g_dynamicStyleSheet);

}


function repositionNavwidgets(){ } // stub to be over-ridden by footer-loaded js

function changePagePrintHeader(mainhead, subhead){

    var headel = document.getElementById('portalHeader')
    if (headel) headel.innerHTML = mainhead + (subhead ? ' <i>' + subhead + '</i>' : '')

    document.title = mainhead + ' - ' + (g_thisContentTitle ? g_thisContentTitle + ' (' + subhead + ')' : subhead)

    repositionNavwidgets() // hack to put this here - now we have abs-pos inner nav, they have to be repositoned after adding content above

    window.setTimeout('repositionNavwidgets(),500')}



function hiliteCurrentInNavTree(){
    var navtree = document.getElementById('portlet-navigation-tree')
    if (navtree) {}
    else navtree = document.getElementById('EG_navigation_portlet')
    
    if (navtree){
        var links = navtree.getElementsByTagName('A'), N= links.length, compareCurURL = g_thisHref + '/'

        for(var i=0; i < N; i++){
            if (compareCurURL.indexOf(links[i].href) > -1){
                links[i].className = links[i].className + ' hilited'
            }else if (links[i].className.indexOf(' hilited') > -1){            
                links[i].className = links[i].className.split(' hilited').join('')
            }
        }
    }
}

function process_ENGLISHTops(){

    process_ENGLISH_Depths()

}


function process_ENGLISH_Depths(){  //// CHANGE TO ENGLISH / another for country

    var branch =  g_thisENGLISHBranch /// gk_EG_pseudoBranch[g_thisENGLISHBranch]
    
    var s = gk_EGCRF_english_DeepHeadReplaceStr

    var crumbsEl = document.getElementById('portlet-breadcrumbs')
    var crumbs = crumbsEl.getElementsByTagName('A')
    var localCrumbs = ''
    
    var descrel = filterForClass('documentDescription', document.getElementsByTagName('DIV'), 1)
    var mainh1el = filterForClass('documentFirstHeading', document.getElementsByTagName('H1'), 1)


    if(g_special_FT_handling != 'EGCRF_ENGLISH_top'){
        var startLocalCrumbs = 3, endLocalCrumbs = crumbs.length - 1
        localCrumbs = gk_EGtop_linkStrFromDeep.split('**branch**').join(g_thisENGLISHBranch)
        localCrumbs = localCrumbs.split('**branchTitle**').join(gk_EGCRF_topTitles['english_' + branch])
       

        for(var i= startLocalCrumbs; i < endLocalCrumbs; i++){
            localCrumbs += ' <a href="' + crumbs[i].href + '" title="Navigate up to the '
                + crumbs[i].title.split('go to').join('') + ' page"><em>&gt;</em> ' + crumbs[i].innerHTML + '</a>'
        }
        
       g_thisContentTitle = mainh1el.innerHTML
    }


    localCrumbs = localCrumbs.split('/EG/').join('/english/') // quick hack to re-use strs from ngrf EG


    var s = gk_EGCRF_english_DeepHeadReplaceStr.split('**localcrumbs**').join(localCrumbs)
    
    s = s.split('**curTitleStr**').join(mainh1el.innerHTML)

    s = s.split('**descr**').join((descrel ? descrel.innerHTML : ''))

    mainh1el.innerHTML = s
    mainh1el.className = 'EGCRFH1 englishegcrf ' + (g_special_FT_handling == 'EGCRF_ENGLISH_top' ? 'english_' + branch + '_top' : 'english_' + branch)
    if (descrel) descrel.style.display = 'none'
    if (crumbsEl) crumbsEl.style.display = 'none'
    

    
    changePagePrintHeader('EGCRF (english materials)', gk_EGCRF_topTitles['english_' + branch]) //  + '; Making Guidance More Effective')
    
}

function process_COUNTRYTops(){

    process_COUNTRY_Depths()

}


function process_COUNTRY_Depths(){  //// CHANGE TO ENGLISH / another for country

    var branch = g_thisCOUNTRYBranch //  gk_EG_pseudoBranch[g_thisENGLISHBranch]
    
    var s = gk_EGCRF_country_DeepHeadReplaceStr

    var crumbsEl = document.getElementById('portlet-breadcrumbs')
    var crumbs = crumbsEl.getElementsByTagName('A')
    var localCrumbs = ''
    
    var descrel = filterForClass('documentDescription', document.getElementsByTagName('DIV'), 1)
    var mainh1el = filterForClass('documentFirstHeading', document.getElementsByTagName('H1'), 1)


    if(g_special_FT_handling != 'EGCRF_ENGLISH_top'){
        var startLocalCrumbs = 3, endLocalCrumbs = crumbs.length - 1
        localCrumbs = gk_EGtop_linkStrFromDeep.split('**branch**').join(g_thisCOUNTRYBranch)
        localCrumbs = localCrumbs.split('**branchTitle**').join(gk_EGCRF_topTitles['country_' + branch])
       
 
        for(var i= startLocalCrumbs; i < endLocalCrumbs; i++){
            localCrumbs += ' <a href="' + crumbs[i].href + '" title="Navigate up to the '
                + crumbs[i].title.split('go to').join('') + ' page"><em>&gt;</em> ' + crumbs[i].innerHTML + '</a>'
        }
        
       g_thisContentTitle = mainh1el.innerHTML
    }


    localCrumbs = localCrumbs.split('/EG/').join('/country/') // quick hack to re-use strs from ngrf EG


    var s = gk_EGCRF_country_DeepHeadReplaceStr.split('**localcrumbs**').join(localCrumbs)
    
    s = s.split('**curTitleStr**').join(mainh1el.innerHTML)

    s = s.split('**descr**').join((descrel ? descrel.innerHTML : ''))

    mainh1el.innerHTML = s
    mainh1el.className = 'EGCRFH1 egcrfcountry ' + (g_special_FT_handling == 'EGCRF_COUNTRY_top' ? 'country_' + branch + '_top' : 'country_' + branch)
    if (descrel) descrel.style.display = 'none'
    if (crumbsEl) crumbsEl.style.display = 'none'
    

    changePagePrintHeader('EGCRF (country-specific)', gk_EGCRF_topTitles['country_' + branch]) //  + '; Making Guidance More Effective')
}



function insertSubsectionLinks(){
    var s = gk_subsection_linksStr
    
    var clel = document.getElementById('contentsListing')
    
    var contentEl = clel.parentNode
    var linksDashboard = document.createElement('DIV')
    linksDashboard.id = 'sector_subs_nav'
    linksDashboard.innerHTML = s
    contentEl.insertBefore(linksDashboard, clel)
}



function makeSectionsMenuHTML(id, spec, urlpre, titlepost){
    var s = '<div class="subsectionsDropdown" id="ssdd_' + id + '" onMouseDown="donowt();return true;">'
    for (var i = 0; i < spec.length; i++){
        var linkid = spec[i][0], title = spec[i][1]
        if (linkid == ''){
            s += '<h6>' + title + '</h6>'
        }else{
            s += '<a href="' + (linkid.indexOf('http://') == 0 ? linkid + '" target="_blank"' : urlpre + linkid + '"')
                + ' title= "go to the *' + title + '*' + titlepost
              ////////  + ' title= "' + spec[i].length > 2 ? spec[i][2] : 'go to the *' + title + '*' + titlepost
            if (id == 'FT'){
                s += '" class="dropDownFTlink" onMouseOver="showSubNav(event, this);return true;" onMouseOut="mouseOutSubNav();return true;'
            }
            s += '">' + title + '</a>'
        }
    }
    s += '</div>'
    return s
}

function makeSectionsMenus(){

    makeDropdownMenuLinks()
    
    var s = gk_textsizerHTML // dynamically write the textsize changer since it depends on javascript anyway
    for (var i = 0; i < gk_subsectionMenuSpecs.length; i++){
        var branchID = gk_subsectionMenuSpecs[i][0]
            , branchURLid = gk_subsectionMenuSpecs[i][1]
            , spec = gk_subsectionMenuSpecs[i][2], titlepost = gk_subsectionMenuSpecs[i][3]
            , urlpre = portal_url + '/' + branchURLid + (branchURLid == '' ? '' : '/')
        s += makeSectionsMenuHTML(branchID, spec, urlpre, titlepost)
    }
    
    s += makeFromHereMenu()
    
    var newel = document.createElement('DIV')
    
    newel.className = 'visualNoPrint'
    newel.innerHTML = s
    
    
//    document.getElementById('portal-column-content').appendChild(newel)
 //   document.getElementById('portal-top').appendChild(newel)
    
        
    document.getElementById('portal-footer').appendChild(newel) // tuck it at bottom for the has-js no-css case

///////    addFTSectorInfoSubNav()
    
    hiliteCurrentInNavTree()
    
    if (document.images) {
        var imgpre = '/webdav_uploads/NEWNGRF_FILES/css_images/'
        var dummyPrecache = new Image(220,894), dummyPrecache2 = new Image(200,40)
        dummyPrecache.src = imgpre + navigator.appVersion.indexOf('MSIE 6') > -1 ? 'notrans_darkmenubg_60.jpg' : 'darkdropdownBG_200.png'
        dummyPrecache2.src = imgpre + 'navtab_showing.png'
    }
  
}

function insertDropdownMenuLink(branch, branchURLid){



    var s = gk_dropdownlinkStr.split('**key**').join(branch)
    s = s.split('**ID**').join(branchURLid)
    
    var li_el = document.getElementById('tab_' + branch)

    if (li_el){
        li_el.innerHTML = li_el.innerHTML.split('</A>').join('</A>' + s)
        li_el.innerHTML = li_el.innerHTML.split('</a>').join('</a>' + s)
    }


}


function makeDropdownMenuLinks(){

    if (d_jsWritingStepsPending.indexOf('--make dropdown links--') > -1){
        if(document.getElementById('tab_english')){
            d_jsWritingStepsPending =  d_jsWritingStepsPending.split('--make dropdown links--').join('- -')
            for (var i = 0; i < gk_subsectionMenuSpecs.length; i++){
            
            
                var branchID = gk_subsectionMenuSpecs[i][0] , branchURLid = gk_subsectionMenuSpecs[i][1]
                insertDropdownMenuLink(branchID, branchURLid)
            }
            insertDropdownMenuLink('fromhere', 'navigate_from_here')
        }else{
            window.setTimeout('makeDropdownMenuLinks()', 100)
        }
    }
}


function makeFromHereMenu(){

    var s = '<div class="subsectionsDropdown" id="ssdd_fromhere" onMouseDown="donowt();return true;">'


    var crumbsEl = document.getElementById('portlet-breadcrumbs')
    var siblingsPortlet = document.getElementById('in_this_section')
    
    if (crumbsEl){
        
        var crumbstxt = crumbsEl.innerHTML.split('</h5>')
        if (crumbstxt.length == 1) crumbstxt = crumbsEl.innerHTML.split('</H5>')
        crumbstxt = crumbstxt[1]
        
        
        crumbstxt = "<h6>'ancestors'  - &uarr; - upwards links:</h6>" + crumbstxt
        
        var newcrumbss = "<h6>'ancestors'  - &uarr; - upwards links</h6>"
            + '<a title="back to the top of the EGCRF site" href="' + portal_url + '">EGCRF Home</a>'
        var crumbsDivs = crumbsEl.getElementsByTagName('DIV'), N = crumbsDivs.length, M = N - 1
        
        for (var i=0; i < N; i++){       
            if (i==M){
                newcrumbss += "<h6>'here' - permalink to current page:</h6>"
                crumbsDivs[i].innerHTML = crumbsDivs[i].innerHTML.split('"go to ').join('"this is a shareable permanent link to the current page: ')
            }
            newcrumbss += '<div class="knsubnav" style="padding-left: ' + (i*4) + 'px;">'
            newcrumbss += crumbsDivs[i].innerHTML + '</div>'
        }
         
        crumbstxt = newcrumbss
        
        s += crumbstxt

/*      /// poss if level 3 within FT or EG ue the main nav instead of siblings

        var navtree = document.getElementById('portlet-navigation-tree')
        if (navtree) {}
        else navtree = document.getElementById('EG_navigation_portlet')
        
        if (navtree){
            var nts = navtree.innerHTML.replace(/<h5>[^<]+/, "<h5>'children': downwards links")           
            s += nts
        }
*/        
        if (siblingsPortlet){
            var siblingstxt = siblingsPortlet.innerHTML.split('</h5>')
            if (siblingstxt.length == 1) siblingstxt = siblingsPortlet.innerHTML.split('</H5>')
            if(siblingstxt.length > 1){
                siblingstxt = siblingstxt[1]
                var splitbeforeLinkToParent = siblingstxt.indexOf('<a class="link_to_parent"') > -1 
                    ? siblingstxt.split('<a class="link_to_parent"')[0] 
                    : siblingstxt.split('<A class="link_to_parent"')[0];
                siblingstxt = "<h6>'siblings'  <<- >> sideways links:</h6>" + siblingstxt.split('<a class="link_to_parent"')[0]
            }else{
                siblingstxt = "<h6>There are no sideways links</h6>"
            }
            s += siblingstxt
            var dls = document.getElementsByTagName('DL')
            var subsections = filterForClass('related subsection', dls), subsectionstxt = ''
            
            if (subsections.length){    // suck the links out of subsection dls; use them as child links in menu
                var N = subsections.length, oneDL, oneDT, oneLinkStr
                for (var i=0; i < subsections.length; i++){
                    oneDT = subsections[i].getElementsByTagName('DT')
                    oneLinkStr = oneDT[0].innerHTML
                    if (i % 2) oneLinkStr = oneLinkStr.split('<a ').join('<a class="odd"')
                    subsectionstxt += oneLinkStr
                }
            }else{    // see if there is a summary of contents; use its dd's html as child links in menu
                subsections = filterForClass('related summary_subs', dls)
                if(subsections.length){
                    var onedd = subsections[0].getElementsByTagName('DD')
                    if (onedd.length){
                        var links = onedd[0].getElementsByTagName('P'), M = links.length, oneLinkStr
                        for(var j=0; j < M; j++){
                            oneLinkStr = links[j].innerHTML.split('<img')[0] + '</a>'
                            if (j % 2) oneLinkStr = oneLinkStr.split('class="sub"').join('class="odd"')
                            subsectionstxt += oneLinkStr
                        }
                    }
                }
            }

            if (subsectionstxt != ''){
                s += "<h6>'children' - &darr; - downwards links:</h6>" + subsectionstxt
            }else{
                s += "<h6>There are no downwards links</h6>"
            }
         

        }
    }
    s += '</div>'
    return s        
}

var gk_hackedStylesStr = '<link rel="stylesheet" '
    + 'href="/webdav_uploads/NEWNGRF_FILES/ft_tops_expts.css?v=d0" '
    + 'type="text/css" media="screen" />'


var gk_subsection_linksStr = '<a id="sector_subs_nav_info" title="SECTOR INFORMATION: This contains '
    + 'an overview of the sector as a whole, details future trends '
    + ' in employment together with skill gaps and workforce development issues."  '
    + 'href="info"><img src="/is_single_pixel_gif.gif" '
    + ' border="0" height="110" width="115" /></a>'
    + '<a id="sector_subs_nav_data-charts" title="DATA &amp; CHARTS: Links to the charts contained within this sector are listed."  '
    + 'href="data-charts"><img src="/is_single_pixel_gif.gif"  '
    + 'border="0" height="99" width="85" /></a>'
    + '<a id="sector_subs_nav_regional" title="REGIONAL / NATIONAL DIMENSION: Information on regional trends and differences, together  '
    + 'with the trends in the home nations including Scotland and Wales" href="regional"><img src="/is_single_pixel_gif.gif" border="0"'
    + ' height="126" width="136" /></a>'
    + '<a id="sector_subs_nav_occupations" title="OCCUPATIONS: Information and trends on sectoral occupations"  '
    + 'href="occupations"><img src="/is_single_pixel_gif.gif" border="0" height="76" width="128" /></a>'
    + '<a id="sector_subs_nav_equalop" title="EQUAL OPPORTUNITIES: Key information on equal opportunity issues  '
    + 'specific to the sector" href="equal-op"><img src'
    + '="/is_single_pixel_gif.gif" border="0" height="118" width="86" /></a>'
    + '<a id="sector_subs_nav_ed-training" title="EDUCATION &amp; TRAINING: Education and training information  '
    + 'and issues including work-based learning, apprenticeships, vocational qualifications, and further '
    + ' and higher education courses" href="ed-training"><img src="/is_single_pixel_gif.gif" '
    + ' border="0" height="130" width="128" /></a>'
    + '<a id="sector_subs_nav_research" title="RESEARCH: A list of recent research publications which is intended to be a '
    + ' starting for those wishing for more detail on the sector." href="research"><img '
    + ' src="/is_single_pixel_gif.gif" border="0" height="120" width="119" /></a>'
    + '<a id="sector_subs_nav_links" title="LINKS &amp; SOURCES: This contains direct links to all the materials used to compile this sector. '
    + ' More in-depth and detailed information can be found in the source materials as only key points have been extracted. In addition, '
    + ' websites and further sources which may be of interest have been included." href="links"><img  '
    + 'src="/is_single_pixel_gif.gif" border="0" height="92" width="106" /></a>'
    + '<a id="sector_subs_nav_summary" title="SECTOR SUMMARY: This summary gives a brief overview of the key trends in the sector." '
    + ' href="summary"><img src="/is_single_pixel_gif.gif" '
    + ' border="0" height="119" width="123" /></a>'
    
var gk_ftinfosportlet_HTML =  '<img  src="/webdav_uploads/NEWNGRF_FILES/ngrf_content/ft_sector_imgs/FT_portlet_bg.jpg" width="176" height="197" border="0" />'
//    + '<a id="FT_portlet_backtosector" href="" title="Go back up to the main page for this sector"><img src="/is_single_pixel_gif.gif" '
//    + ' border="0" width="150" height="20" /></a>'
	+ '<div id="FTsector_detail_icons">'
    + '<a id="FT_portlet_backtosector" href="" title="Go back up to the main page for this sector"><img src="/is_single_pixel_gif.gif" '
    + ' border="0" width="150" height="20" /></a>'
	+ '<a id="FT_portlet_info" title="SECTOR INFORMATION: This contains '
    + 'an overview of the sector as a whole, details future trends '
    + ' in employment together with skill gaps and workforce development issues."  '
    + 'href="info"><img src="/is_single_pixel_gif.gif" '
    + ' border="0" width="54" height="58" /></a>'
    + '<a id="FT_portlet_charts" title="DATA &amp; CHARTS: Links to the charts contained within this sector are listed."  '
    + 'href="data-charts"><img src="/is_single_pixel_gif.gif"  '
    + 'border="0" width="48" height="53" /></a>'
    + '<a id="FT_portlet_regional" title="REGIONAL / NATIONAL DIMENSION: Information on regional trends and differences, together  '
    + 'with the trends in the home nations including Scotland and Wales" href="regional"><img src="/is_single_pixel_gif.gif" border="0"'
    + ' width="66" height="47" /></a>'
    + '<a id="FT_portlet_occupations" title="OCCUPATIONS: Information and trends on sectoral occupations"  '
    + 'href="occupations"><img src="/is_single_pixel_gif.gif" border="0" width="68" height="42" /></a>'
    + '<a id="FT_portlet_eo" title="EQUAL OPPORTUNITIES: Key information on equal opportunity issues  '
    + 'specific to the sector" href="equal-op"><img src'
    + '="/is_single_pixel_gif.gif" border="0" width="61" height="49" /></a>'
    + '<a id="FT_portlet_training" title="EDUCATION &amp; TRAINING: Education and training information  '
    + 'and issues including work-based learning, apprenticeships, vocational qualifications, and further '
    + ' and higher education courses" href="ed-training"><img src="/is_single_pixel_gif.gif" '
    + ' border="0" width="61" height="55" /></a>'
    + '<a id="FT_portlet_research" title="RESEARCH: A list of recent research publications which is intended to be a '
    + ' starting for those wishing for more detail on the sector." href="research"><img '
    + ' src="/is_single_pixel_gif.gif" border="0" width="64" height="43" /></a>'
    + '<a id="FT_portlet_links" title="LINKS &amp; SOURCES: This contains direct links to all the materials used to compile this sector. '
    + ' More in-depth and detailed information can be found in the source materials as only key points have been extracted. In addition, '
    + ' websites and further sources which may be of interest have been included." href="links"><img  '
    + 'src="/is_single_pixel_gif.gif" border="0" width="53" height="49" /></a>'
    + '<a id="FT_portlet_summary" title="SECTOR SUMMARY: This summary gives a brief overview of the key trends in the sector." '
    + ' href="summary"><img src="/is_single_pixel_gif.gif" '
    + ' border="0" width="59" height="53" /></a>'
	+ '</div>'
    
var gk_textsizerHTML = '<div id="changeTextSize_widget">'
    + '<a href="javascript:void(fontsizeDel(0))"'
    + ' title="Make Text Smaller"><img src="/is_single_pixel_gif.gif" border="0" height="18" width="13" /></a>'
    + '<a href="javascript:void(fontsizeMid())"'
    + ' title="Normal Text Size"><img src="/is_single_pixel_gif.gif" border="0" height="18" width="14" /></a>'
    + '<a href="javascript:void(fontsizeDel(1))"'
    + ' title="Make Text Larger"><img src="/is_single_pixel_gif.gif" border="0" height="18" width="15" /></a>'
    + '</div>'


var gk_dropdownlinkStr = '<a class="navtabdd" href="' + portal_url + '/**ID**" id="ddarrow_**key**"'
    + 'onClick="showSectionsMenu(\'**key**\');return false;"'
    + 'onMouseDown="donowt();return true;"'
    + 'title="Click for a menu of subsections"><img src="/is_single_pixel_gif.gif" width="26" height="22" border="0"></a>'
    

var gk_crumbsFromFTSector = '<span class="crumbsinhead"><a id="crumbToLevel0"'
+' title="navigate up to the NGRF home" href="'
    + portal_url + '">NGRF</a> <a id="crumbToLevel1" '
+' title="navigate up to the main NGRF LMI future-trends page" href="'
    + portal_url + '/future-trends">:: LMI Future-Trends</a> ::</span>'

var gk_crumbsFromFTRegion = '<span class="crumbsinhead"><a id="crumbToLevel0"'
+' title="navigate up to the NGRF home" href="'
    + portal_url + '">NGRF</a> <a id="crumbToLevel1" '
+' title="navigate up to the main NGRF LMI future-trends page" href="'
    + portal_url + '/future-trends">:: LMI Future-Trends</a> <a id="crumbToLevel2" '
+' title="navigate up to the regions/nations interface for NGRF LMI future-trends" href="'
    + portal_url + '/future-trends/regions">:: Regional / National Information</a> ::</span>'

var gk_crumbsFromEG = '<span class="crumbsinhead"><a id="crumbToLevel0"'
+' title="navigate up to the NGRF home" href="'
    + portal_url + '">NGRF</a> <a id="crumbToLevel1" '
+' title="navigate up to the main NGRF Making Guidance More Effective page" href="'
    + portal_url + '/EG"><em>&gt;</em> Making Guidance More Effective</a> **localcrumbs** ::</span>'
    + '<img style="float:right;margin:0;" class="EGBG_rightshiv" src="/is_single_pixel_gif.gif" '
    + ' border="0" width="100" height="20" />'

    
var gk_ftsector_linkStrFromtop = '<b class="ftsectortitle"><a class="sectorHeadLink" href="**sectorURL**"'
    + ' onMouseOver="showSubNav(event, this);return true;"'
    + ' onMouseOut="mouseOutSubNav();return true;"'
    + ' title="This is a link to the current page - the **sector** LMI future-trends sector page">**sector**</a> <em>::</em></b>'
    
var gk_ftsector_linkStrFromDeep = '<b class="ftsectortitle"><a class="sectorHeadLink" href="**sectorURL**"'
    + ' title="navigate up to the **sector** LMI future-trends sector page">**sector**</a></b>'

            
var gk_level2HeadReplaceStr = '<img class="visualNoPrint" src="/webdav_uploads/NEWNGRF_FILES/ngrf_content/ft_sector_imgs/**imgsrc** />'
    + gk_crumbsFromFTSector
    + '**sectorLinkStr** **branch**'
    + '<span class="descrinhead">**descr**</span>'

            
var gk_regiontosectorHeadReplaceStr = '<img class="visualNoPrint" '
    + 'src="/webdav_uploads/NEWNGRF_FILES/ngrf_content/ft_regions_imgs/**regionid**_tiny.jpg" />'
    + gk_crumbsFromFTRegion
    + '<b class="ftsectortitle"><a class="sectorHeadLink"' // **regionLinkStr**</span> <span class="demotedFTHeadElements"><em>::</em>'
    + ' href="' + portal_url + '/future-trends/regions/'
    + '**regionid**" title="navigate up to the **regionName** regional/national page"> **regionName**</a></b>'
    + ' <em>::</em> Regional information by sector'




            
var gk_levelDeepHeadReplaceStr = '<img class="visualNoPrint" src="/webdav_uploads/NEWNGRF_FILES/ngrf_content/ft_sector_imgs/**imgsrc** />'
    + gk_crumbsFromFTSector
    + '<span class="demotedSectorName">**sectorLinkStr**</span> <span class="demotedFTHeadElements"><em>::</em>'
    + '<a class="demotedFTbranch" href="**branchURL**" title="navigate up to the **branch** page for this sector"> **branch**</a>'
    + '**localCrumbsstr**'     
    + ' <em>::</em> </span>**curTitleStr**'
    + '<span class="descrinhead">**descr**</span>'




var gk_crumbsFromEGCRF_english = '<span class="crumbsinhead"><a id="crumbToLevel0"'
+' title="navigate up to the EGCRF home" href="'
    + portal_url + '">EGGRF</a> <a id="crumbToLevel1" '
+' title="navigate up to the main EGCRF English-Language Materials page" href="'
    + portal_url + '/english"><em>&gt;</em> English-Language Materials</a> **localcrumbs** ::</span>'
    + '<img style="float:right;margin:0;" class="EGBG_rightshiv" src="/is_single_pixel_gif.gif" '
    + ' border="0" width="100" height="20" />'


var gk_crumbsFromEGCRF_country = '<span class="crumbsinhead"><a id="crumbToLevel0"'
+' title="navigate up to the EGCRF home" href="'
    + portal_url + '">EGGRF</a> <a id="crumbToLevel1" '
+' title="navigate up to the main EGCRF Country-Specific Areas page" href="'
    + portal_url + '/country"><em>&gt;</em> Country-Specific Areas</a> **localcrumbs** ::</span>'
    + '<img style="float:right;margin:0;" class="EGBG_rightshiv" src="/is_single_pixel_gif.gif" '
    + ' border="0" width="100" height="20" />'

    
var gk_EGCRF_english_DeepHeadReplaceStr = gk_crumbsFromEGCRF_english
    + '<b class="curtitle">**curTitleStr**</b>'
    + '<span class="descrinhead">**descr**</span>'
    
var gk_EGCRF_country_DeepHeadReplaceStr = gk_crumbsFromEGCRF_country
    + '<b class="curtitle">**curTitleStr**</b>'
    + '<span class="descrinhead">**descr**</span>'
    

var gk_EGtop_linkStrFromDeep = ' <b class="EGtop_title"><a class="EGtop_Link" href="'
    + portal_url + '/EG/**branch**"'
    + ' title="navigate up to the overview page for the **branchTitle** area of the EGCRF."><em>&gt;</em> **branchTitle**</a></b>'


var gk_datachartsThumbnailStr = '<img src="/webdav_uploads/NEWNGRF_FILES/FT_DC_thumbnails/**sector**/TNS/small_**id**.jpg" height="80" border="0" />'



var gk_iconsForSubsection = [], gk_bgForInfoBranch = [], gk_iconsForSubsectionBase = '/webdav_uploads/NEWNGRF_FILES/ngrf_content/ft_sector_imgs/teensy_xpts/'

gk_subsection_linksStr = gk_subsection_linksStr.split('<img src="').join('<img src="' + gk_iconsForSubsectionBase)


var gk_EG_pseudoBranch = [], gk_EGCRF_topTitles = [], gk_EG_branchTitles = []


gk_EG_pseudoBranch['impprac'] = 'practice'
gk_EG_pseudoBranch['ip'] = 'practice'
gk_EG_pseudoBranch['new-approach'] = 'practice'
gk_EG_pseudoBranch['benefits'] = 'effective'
gk_EG_pseudoBranch['impact'] = 'effective'
gk_EG_pseudoBranch['equal-opps'] = 'effective'
gk_EG_pseudoBranch['LLL'] = 'building'
gk_EG_pseudoBranch['RIP'] = 'building'
gk_EG_pseudoBranch['policy'] = 'building'


gk_EG_branchTitles['practice'] = 'Guidance Practice'
gk_EG_branchTitles['effective'] = 'Effective Guidance'
gk_EG_branchTitles['building'] = 'Building Capacity'


gk_EGCRF_topTitles['english_UK'] = 'UK - english materials'
gk_EGCRF_topTitles['english_greece'] = 'Greek Translated Materials'
gk_EGCRF_topTitles['english_finland'] = 'Finnish Translated Materials'
gk_EGCRF_topTitles['english_denmark'] = 'Danish Translated Materials'
gk_EGCRF_topTitles['english_slovenia'] = 'Slovenian Translated Materials'
gk_EGCRF_topTitles['english_transnational'] = 'Transnational themes'
gk_EGCRF_topTitles['country_SLOVENIA'] = 'Slovenia'
gk_EGCRF_topTitles['country_FINLAND'] = 'Finland'
gk_EGCRF_topTitles['country_GREECE'] = 'Greece'
gk_EGCRF_topTitles['country_Denmark'] = 'Denmark'
gk_EGCRF_topTitles['country_UK'] = 'UK'

var g_curshowing_submenu = 0, g_semaphore_inmenu = 0, g_curshowingmenu_navtab

function showSectionsMenu(branch){
    var ulel = document.getElementById('ssdd_' + branch)
    var tabel = document.getElementById('ddarrow_' + branch), leftpos = 100;
    var liel = document.getElementById('tab_' + branch)

    var posY = 78

    if (tabel){
        leftpos = getPageOffsetLeft(tabel) - 181 // 160
        posY = getPageOffsetTop(tabel) + 16
        
        if (navigator.appVersion.indexOf("MSIE 6") > -1) leftpos += 3
    }
    if (ulel){
        if (g_curshowing_submenu == ulel){  // close on 2nd click
            hidesubmenus()
            return 0
        }
        
        if (g_curshowing_submenu){  // close previous menu - this is a new one
            hidesubmenus()
        }
        
        g_curshowing_submenu = ulel
        g_curshowing_submenu.style.left = leftpos + 'px'
        g_curshowing_submenu.style.top = posY + 'px'
        g_curshowing_submenu.style.display = 'block'
        g_semaphore_inmenu = 0
    }
    
    if (liel) {
        g_curshowingmenu_navtab = liel
        liel.className = 'menushowing';
    }
}

function hidesubmenus(e){
    if(g_semaphore_inmenu){
        g_semaphore_inmenu = 0;
        return 0;
    }
    
    if(g_curshowing_submenu){
        g_curshowingmenu_navtab.className = ''
        g_curshowing_submenu.style.display = 'none'
        g_curshowing_submenu = 0;
    }
}

function donowt(e){
    g_semaphore_inmenu = 1
}


var gk_country_menu_spec =    [['', 'Country-Specific Areas']
	, ['Denmark', 'Denmark']
	, ['FINLAND', 'Finland']
	, ['GREECE', 'Greece']
	, ['SLOVENIA', 'Slovenia']
	, ['UK', 'UK']]

var gk_english_menu_spec =    [['', 'Materials in English']
    , ['transnational', 'Trans-national comparisons']
	, ['denmark', 'Denmark']
	, ['finland', 'Finland']
	, ['greece', 'Greece']
	, ['slovenia', 'Slovenia']
	, ['UK', 'UK']]

var gk_links_menu_spec =    [['', 'Other links of interest']
    , ['about', 'About the EGCRF']
	, ['http://www.guidance-research.org', 'NGRF - UK National Guidance Research Forum']
	, ['about-site/bookmarks', 'EGCRF social bookmarks']
	, ['http://www.derby.ac.uk/NLRG', 'NLRG - UK National Library Resource for Guidance']
	, ['about-site/bibmarks', 'CeGS social bookmarks']
	, ['discussions', 'Weblogs & Discussions']]



var gk_subsectionMenus = []

var gk_subsectionMenuSpecs = [['english', 'english', gk_english_menu_spec, ' subsection of English-Language EGCRF']
    , ['country', 'country', gk_country_menu_spec, ' country-specific content']
    , ['links', '', gk_links_menu_spec, ' link']]
    

/*** following iis from the former special ftsubnav.js file added in portlet in FT branch **/

function showSubNav(e, obj){

	if (!e) var e = window.event;  // MIM note to self: get rid of this if ends up we do not need it
    
    if (g_ft_curSubNavLink) g_ft_curSubNavLink.className = g_ft_curSubNavLink.hackatt_realclassname

    var url = obj.href, title = obj.innerHTML.replace(/^\W+/,'')
    title=title.replace(/\W+$/,'')    
    
    if (url.indexOf('future-trends/lmiresources') > -1) return 0
    if (url.indexOf('future-trends/what-is') > -1) return 0
    if (url.indexOf('future-trends/lmift-bookmarks') > -1) return 0
    
    
  
    var tmpl = (url.indexOf('future-trends/regions') > -1) ? g_ft_regionsTempl : subULTmpl
    
    if ((url.indexOf('future-trends/custodial') > -1) || (url.indexOf('future-trends/police') > -1) ){
        tmpl = replacedByJusticeTmpl /// Sally emailed sept 20 06 for this change
    }
    
    if(url.charAt(url.length-1) != '/') url += '/'

    var html = tmpl.split('**URLBASE**').join(url)
    html = html.split('**title**').join(title)
    g_ft_navDiv.innerHTML = html

    var posY = getPageOffsetTop(obj)
    var posX = 170; // **** CONSTANT ***** - just at right of portlet links
    
    if (obj.className == 'sectorHeadLink'){
        posY = e.clientY + 5
        posX = e.clientX + 10
    }
    
    if (obj.className == 'dropDownFTlink'){
        posX = e.clientX
        var tabel = document.getElementById('ddarrow_FT')
        if (tabel) posX = getPageOffsetLeft(tabel)
    }
    
    
    
    g_ft_navDiv.style.top = (posY) + 'px'
    g_ft_navDiv.style.left = (posX) + 'px'
    g_ft_navDiv.style.display = 'block'
    g_ft_navDiv_mouseoutSem = 1
    
    g_ft_curSubNavLink = obj
    g_ft_curSubNavLink.hackatt_realclassname = g_ft_curSubNavLink.className
    g_ft_curSubNavLink.className = 'as_hovered'
    

    
}

function disposeSubNav(){
    if(g_ft_navDiv_mouseoutSem){
    }else{
        g_ft_navDiv.style.display = 'none'
        g_ft_curSubNavLink.className = g_ft_curSubNavLink.hackatt_realclassname
    }
}

function mouseOutSubNav(){
    g_ft_navDiv_mouseoutSem = 0
    window.setTimeout('disposeSubNav()', 300)
}

function mouseInSubNavDIV(){
    g_ft_navDiv_mouseoutSem = 1
}

var g_ft_navDiv, g_ft_navDiv_mouseoutSem = 0, g_ft_curSubNavLink



function filterForClass(aClass, aNodeList, firstEl){
	var aClass = new String(aClass);
	aClass=aClass.toLowerCase();
	var filteredNodeList = new Array();
	if(!(aNodeList.length > 0)){return filteredNodeList}
	for(var i=0; i<aNodeList.length; i++){
		var nodeString = new String(aNodeList[i].className);
		nodeString = nodeString.toLowerCase();
		if(nodeString == aClass){
			filteredNodeList[filteredNodeList.length] = aNodeList[i];
//			filteredNodeList.push(aNodeList[i]);
		}
	}
	if (firstEl){
		if(filteredNodeList.length > 0) return filteredNodeList[0]
		else return null;
	}
	return filteredNodeList;
}


function getPageOffsetTop(el) {
    
    var y;
    
    // Return the x coordinate of an element relative to the page.
    
    y = el.offsetTop;
    if (el.offsetParent != null){
        y += getPageOffsetTop(el.offsetParent);
    }
    return y;
}

var subULTmpl = '<ul>'
    + '<li><a href="**URLBASE**info" title="go to **title** :: Sector information">Sector information</a></li>'
	+ '<li><a href="**URLBASE**data-charts" title="go to **title** :: Data and charts">Data and charts</a></li>'
	+ '<li><a href="**URLBASE**regional" title="go to **title** :: Regional / national dimension">Regional/National</a></li>'
	+ '<li><a href="**URLBASE**occupations" title="go to **title** :: Occupations">Occupations</a></li>'
	+ '<li><a href="**URLBASE**equal-op" title="go to **title** :: Equal opportunities">Equal opportunities</a></li>'
	+ '<li><a href="**URLBASE**ed-training" title="go to **title** :: Education and training">Education and training</a></li>'
	+ '<li><a href="**URLBASE**research/" title="go to **title** :: Research">Research</a></li>'
//	+ '<li><a href="**URLBASE**discussion" title="go to **title** :: Discussion points">Discussion points</a></li>'
	+ '<li><a href="**URLBASE**summary" title="go to **title** :: Sector summary">Sector summary</a></li>'
	+ '<li><a href="**URLBASE**links" title="go to **title** :: Links and sources">Links and sources</a></li></ul>'


	
var g_ft_regionsTempl = '<ul>'
	+ '<li><a href="**URLBASE**scotland" title = "Click to get information for Scotland">Scotland</a></li>'
	+ '<li><a href="**URLBASE**ni" title = "Click to get information for Northern Ireland">Northern Ireland</a></li>'
	+ '<li><a href="**URLBASE**north-east" title = "Click to get information for North East">North East</a></li>'
	+ '<li><a href="**URLBASE**north-west" title = "Click to get information for North West">North West</a></li>'
	+ '<li><a href="**URLBASE**yorks-humber" title = "Click to get information for Yorkshire and the Humber">Yorkshire and the Humber</a></li>'
	+ '<li><a href="**URLBASE**wales" title = "Click to get information for Wales">Wales</a></li>'
	+ '<li><a href="**URLBASE**east-midlands" title = "Click to get information for East Midlands">East Midlands</a></li>'
	+ '<li><a href="**URLBASE**west-midlands" title = "Click to get information for West Midlands">West Midlands</a></li>'
	+ '<li><a href="**URLBASE**east" title = "Click to get information for East of England">East of England</a></li>'
	+ '<li><a href="**URLBASE**london" title = "Click to get information for Greater London">Greater London</a></li>'
	+ '<li><a href="**URLBASE**south-east" title = "Click to get information for South East">South East</a></li>'
	+ '<li><a href="**URLBASE**south-west" title = "Click to get information for South West">South West</a></li>'
	+ '</ul>'
	
	
var replacedByJusticeTmpl = '<p>This sector information has<br />  been replaced by the new  '
    + '<a href="http://www.guidance-research.org/future-trends/justice">Justice</a> sector.</p>'
    

/**  adapted from QCB for the little pseudo window for display annotated ref more **/
/** june 6 changing to use xmlrpc iso iframes - nasty bug in ie6 **/

var httpMoreViewObject = getHTTPObject()

var g_el_moreinfobox = null, g_el_moreviewarea = null, g_iframe_urlNowShowing = ''


function openInIFrame(title, url, el){



    alert(el.href)
    if (g_iframe_urlNowShowing == url){
        close_info_box()
        return false;
    }
    g_iframe_urlNowShowing = url
    
    if (g_el_moreinfobox) {}
    else    { g_el_moreinfobox = document.getElementById('moreinfobox') }
    if (g_el_iframeObj) {}
    else    { g_el_iframeObj = document.getElementById('iframeInfoArea') }
    
///////    g_el_iframeObj.src = url + '/annotref_quickview'

    g_el_moreinfobox.style.display = 'block' 

    var y = getAbsY(el), x = getAbsX(el)
    
    y += 25
    x = Math.max(10, x-250)

    if ( x > 450 ) x = (x - 250)
    
//    g_el_moreinfobox.style.display = 'block'
    g_el_moreinfobox.style.top = y + 'px'
    g_el_moreinfobox.style.left  = x + 'px'
    
 
    var sy = top.document.body.scrollTop, wh = top.document.body.clientHeight
    if((y - sy) > (wh - 375)){
        top.document.body.scrollTop = (y - (wh - 375))
    }
 /*  
    if (navigator.appVersion.indexOf("MSIE 6")>=0){ // hack -- why???? - no time to find out
        window.setTimeout("g_el_moreinfobox.style.display = 'block'", 800)
    }else{
        g_el_moreinfobox.style.display = 'block'
    }
*/    
    refreshIFrameObj(g_el_iframeObj, url + '/annotref_quickview')
    return false;
}


function openMoreInfo(el){

    var url = el.href + '/annotref_plaindata'
    
    if (g_iframe_urlNowShowing == url){
        close_info_box()
        return false;
    }
    
    g_iframe_urlNowShowing = url
    
    
    if (g_el_moreinfobox) {}
    else    { g_el_moreinfobox = document.getElementById('moreinfobox') }
    
    if (g_el_moreviewarea) {}
    else    { g_el_moreviewarea = document.getElementById('MoreInfoArea') }
    
    
    g_el_moreviewarea.innerHTML = '<h1 class="waitmsg">Please wait...</h1>'
    g_el_moreinfobox.style.display = 'block'
    
    var y = getAbsY(el), x = getAbsX(el)
    
    y += 25
    x = Math.max(10, x-250)

    if ( x > 450 ) x = (x - 250)
    
    
    
    x = 160
    
    
    g_el_moreinfobox.style.top = y + 'px'
    g_el_moreinfobox.style.left  = x + 'px'
    
 
    var sy = top.document.body.scrollTop, wh = top.document.body.clientHeight
    if((y - sy) > (wh - 375)){
        top.document.body.scrollTop = (y - (wh - 375))
    }
    
    httpMoreViewObject.open("GET", url, true);
    httpMoreViewObject.onreadystatechange = handleGotMoreToView;
    httpMoreViewObject.send(null);

}            

function handleGotMoreToView(){
  if (httpMoreViewObject.readyState == 4) {
    results = httpMoreViewObject.responseText;
    g_el_moreviewarea.innerHTML = results;

  }

}

function addMoreViewerToPage(){
    var newdiv = document.createElement('DIV')
    newdiv.innerHTML = gk_moreviewerHTML
    document.body.appendChild(newdiv)
}

if (window.addEventListener) window.addEventListener("load",addMoreViewerToPage,false);
else if (window.attachEvent) window.attachEvent("onload",addMoreViewerToPage);

var gk_moreviewerHTML = '<div id="moreinfobox" class="puwindow" style="left: 190px; top: 304px; z-index: 7; width: 583px; display: none;">'
	+ '<div  class="titleBar">'
	+ '<span id="moreinfobox_title"  class="titleBarText">Further information about this reference</span>'
	+ '<a href="javascript:void(close_info_box())"><b>[ close ]</b>'
	+ '<img style="border: medium none ; margin: 2px 3px 0pt;" src="knotes_ui_imgs/close_icon.gif"'
	+ 'tal:attributes="src string:$portal_url/knotes_ui_imgs/close_icon.gif" height="12" width="12"></a>'
	+ '</div>'
	+ '<div id="MoreInfoArea"></div>'
	+ '</div>'
	
function refreshIFrameObj(IFrameObj, URL){  /// will no be needed if use the ajaxian approach :o(

    var IFrameDoc;

    if (IFrameObj.contentDocument) {
        // For NS6
        IFrameDoc = IFrameObj.contentDocument; 
    } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
        IFrameDoc = IFrameObj.contentWindow.document;
    } else if (IFrameObj.document) {
    // For IE5
        IFrameDoc = IFrameObj.document;
    } else {
        IFrameObj.src = URL
        return true;
    }
    
  IFrameDoc.location.replace(URL);
  
}

function close_info_box(){
    g_iframe_urlNowShowing = ''
    g_el_moreinfobox.style.display = 'none'
}

// get the true offset of anything on NS4, IE4/5 & NS6, even if it's in a table!

function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }
function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }
function getAbsPos(elt,which) {
 iPos = 0;
 while (elt != null) {
  iPos += elt["offset" + which];
  elt = elt.offsetParent;
 }
 return iPos;
} 

/**** from the ratings macro - used to be inline from knotes blogblockmacros ****/

var rated = false;
function dimScreen(){
    bgdiv=document.createElement('div');
    bgdiv.setAttribute('id','dimdiv');
    bgdiv.style.filter="alpha(opacity=60)";  
    bgdiv.style.position='absolute';
    bgdiv.style.zindex='99999'
    bgdiv.style.left='0px';
    bgdiv.style.top='0px';
    bgdiv.style.width=document.documentElement.scrollWidth+"px";
    bgdiv.style.height=document.documentElement.scrollHeight+"px";
    bgdiv.style.background="url("+portal_url+"/knotes_ui_imgs/trans_bg.png)";
    document.body.appendChild(bgdiv);
    popUp(bgdiv)

}

function popUp(obj){
    popup=document.createElement('div');            
    popup.setAttribute('id','popup'); 
    popup.style.position='absolute';
    bgdiv.style.zindex='999999'
    popup.style.left=((document.documentElement.clientWidth /2)+document.documentElement.scrollLeft)-50+'px';
    popup.style.top=((document.documentElement.clientHeight/2)+document.documentElement.scrollTop)-25+'px';
    popup.style.padding="0.5em";
    popup.style.background="#FC4201";
    popup.style.color="white";
    popup.style.border="1px solid #667";
    popup.innerHTML="<span style='font-size:2em;'>Saving ...<"+""+"/span>"
    obj.appendChild(popup);
}
function endScreenDim(){
    obj=document.getElementById("dimdiv")
    if(obj)
        obj.parentNode.removeChild(obj)
}

function rateContent(stars){
    rated=true;
    for(i = 1;i<=stars;i++){
        obj = document.getElementById(i+"starimg");
        obj.src = portal_url+'/knotes_ui_imgs/full_small_star.gif';

    }
    for(i = stars+1;i<=5;i++){
        obj = document.getElementById(i+"starimg");
        obj.src = portal_url+'/knotes_ui_imgs/empty_small_star.gif';
    }
    document.getElementById("rating_score").value=stars;
    document.getElementById("your_rating").innerHTML="You are giving this document a "+stars+" star rating.<br /> Click submit to proceed or cancel if you have changed your mind"
    document.getElementById("submit_rating_form").style.display="inline";
}

function hoverStars(stars){
    if(rated) return false;
    for(i = 1;i<=Math.round(stars);i++){
        obj = document.getElementById(i+"starimg")
        if(stars-i<0)
            obj.src = portal_url+'/knotes_ui_imgs/half_small_star.gif'
        else
            obj.src = portal_url+'/knotes_ui_imgs/full_small_star.gif'

    }
    for(i = Math.round(stars)+1;i<=5;i++){
        obj = document.getElementById(i+"starimg")
        obj.src = portal_url+'/knotes_ui_imgs/empty_small_star.gif'
    }
}
function ajaxPost(){
    dimScreen();
    var url =this_url+"/rateContent?ajax=1&rating="+document.getElementById("rating_score").value
    document.getElementById("submit_rating_form").style.display="none";
    document.getElementById("waiting_post").style.display="block";
    httpRatingObject.open("GET", url, true);
    httpRatingObject.onreadystatechange = handleAjaxPost;
    httpRatingObject.send(null);
}


function handleAjaxPost() {
  if (httpRatingObject.readyState == 4) {
    results = httpRatingObject.responseText;
    ur = document.getElementById("user_rating")
    yr = document.getElementById("rating_score").value
    if(ur)
        ur.innerHTML=yr
    else
        document.getElementById("your_last_rating").innerHTML="Given "+yr+" stars by you"
    r = results.split(':')
    averageRating=r[0]/r[1]+0.0
    document.getElementById("avg_ratings").innerHTML="Rated "+r[1]+" time(s)"            
    hideSubmit();
    setTimeout("endScreenDim()",1000);

  }

}




function setStars(){
    hoverStars(averageRating);
}

function hideSubmit(){
    document.getElementById("submit_rating_form").style.display="none";
    document.getElementById("waiting_post").style.display="none";
    rated=false;
    hoverStars(averageRating);
}
function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

/*** these will only be for logged in users
var httpRatingObject = getHTTPObject()
if (window.addEventListener) window.addEventListener("load",setStars,false);
else if (window.attachEvent) window.attachEvent("onload",setStars);
***/


/** below we add some onload handlers depending on where we are ***/

if (window.addEventListener) window.addEventListener("load",makeSectionsMenus,false);   // includes addFTSectorInfoSubNav
else if (window.attachEvent) window.attachEvent("onload",makeSectionsMenus);


	
switch(g_special_FT_handling) {
    case 'EGCRF_ENGLISH_top':
        if (window.addEventListener) window.addEventListener("load",process_ENGLISHTops,false);
        else if (window.attachEvent) window.attachEvent("onload",process_ENGLISHTops);
        
        
        break;

    case 'EGCRF_ENGLISH':
        
        if (window.addEventListener) window.addEventListener("load",process_ENGLISH_Depths,false);
        else if (window.attachEvent) window.attachEvent("onload",process_ENGLISH_Depths);
  
        break;
    
    case 'EGCRF_COUNTRY_top':
        if (window.addEventListener) window.addEventListener("load",process_COUNTRYTops,false);
        else if (window.attachEvent) window.attachEvent("onload",process_COUNTRYTops);
        
        
        break;

    case 'EGCRF_COUNTRY':
        
        if (window.addEventListener) window.addEventListener("load",process_COUNTRY_Depths,false);
        else if (window.attachEvent) window.attachEvent("onload",process_COUNTRY_Depths);
  
        break;
}
    
