//this is the single call from openX
var OA_source;
if (typeof(OA_zones) != 'undefined') {
var OA_zoneids = '';
for (var zonename in OA_zones) OA_zoneids += escape(zonename+'=' + OA_zones[zonename] + "|");
OA_zoneids += '&nz=1';
} else {
var OA_zoneids = escape('1|2|3|4');
}
if (typeof(OA_source) == 'undefined') { OA_source = ''; }
var OA_p=location.protocol=='https:'?'https:':'http:';
var OA_r=Math.floor(Math.random()*99999999);
var OA_output = new Array();

var OA_fo = '';
OA_fo += "<"+"script type=\'text/javascript\' src=\'http://openx.chelseatechnology.co.uk/www/delivery/fl.js\'><"+"/script>\n";
document.write(OA_fo);

var OA_spc="<"+"script type='text/javascript' ";
OA_spc+="src='"+OA_p+"//openx.chelseatechnology.co.uk/www/delivery/spc.php?zones="+OA_zoneids;
OA_spc+="&amp;source="+escape(OA_source)+"&amp;r="+OA_r;
    OA_spc+="&amp;blockcampaign=1&amp;target=_blank";
OA_spc+=(document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));

if (window.location) OA_spc+="&amp;loc="+escape(window.location);
if (document.referrer) OA_spc+="&amp;referer="+escape(document.referrer);
OA_spc+="'><"+"/script>";
document.write(OA_spc);

function OA_show(name) {
if (typeof(OA_output[name]) == 'undefined') {
return;
} else {
document.write(OA_output[name]);
}
}
function OA_showpop(name) {
zones = window.OA_zones ? window.OA_zones : false;
var zoneid = name;
if (typeof(window.OA_zones) != 'undefined') {
if (typeof(zones[name]) == 'undefined') {
return;
}
zoneid = zones[name];
}
var OA_pop="<"+"script type='text/javascript' ";
OA_pop+="src='"+OA_p+"//openx.chelseatechnology.co.uk/www/delivery/apu.php?zoneid="+zoneid;
OA_pop+="&amp;source="+escape(OA_source)+"&amp;r="+OA_r;
        OA_spc+="&amp;blockcampaign=1&amp;target=_blank";
if (window.location) OA_pop+="&amp;loc="+escape(window.location);
if (document.referrer) OA_pop+="&amp;referer="+escape(document.referrer);
OA_pop+="'><"+"/script>";
document.write(OA_pop);
}

//this is the call to put back the ads in their divs at the end of the page load

var adPositions = new Array;

// Write out the placeholder <div> and add an entry to the adPositions array to indicate that this ad position is present on the current page
function writeAdDiv(name, ad_width, ad_height) {
    // Write the placeholder <div>
    document.write('<div  id="'+name+'" style="padding:0; margin:0; position: relative;"></div>');
    // Add an item to the adPositions array
    adPositions[name] = name;
}


// DIV moving code
function OpenX_findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curleft += obj.offsetLeft
            obj = obj.offsetParent;
        }
    } else if (obj.x) {
        curleft += obj.x;
    }
    return curleft;
}

function OpenX_findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curtop += obj.offsetTop
            obj = obj.offsetParent;
        }
    } else if (obj.y) {
        curtop += obj.y;
    }
    return curtop;
}

function setParent(el, newParent) {
newParent.appendChild(el);
}

function OpenX_moveAbove(sourceObj,targetObj) {
    sourceObj.style.display='none';
    sourceObj.style.position="relative";
    setParent(sourceObj, targetObj);
    sourceObj.style.top="0px";
    sourceObj.style.left="0px";
    sourceObj.style.display='inline';
    
}

function OpenX_positionDivs() {
    var targetZoneDivID=null;
    var sourceZoneDivID=null;
    for (var zoneName in adPositions) {
        var offScreenZoneName = zoneName + '-Hidden';
        if (document.getElementById) {
            targetZoneDivID = document.getElementById(zoneName);
            sourceZoneDivID = document.getElementById(offScreenZoneName);
        } else if (document.all) {
            targetZoneDivID = document.all[zoneName];
            sourceZoneDivID = document.all[offScreenZoneName];
        } else if (document.layers) {
            targetZoneDivID = document.layers[zoneName];
            sourceZoneDivID = document.layers[offScreenZoneName];
        }
        if ((targetZoneDivID != null) && (sourceZoneDivID != null)) {
            OpenX_moveAbove(sourceZoneDivID, targetZoneDivID);
        }
    }
}



