﻿
FS_CreateSlot();
FS_AttachCodeCreationFunctionToLoadEvent();

function FS_CreateSlot() {
    
    if (typeof (fs_ad_slot) == 'undefined')
        return;
    if (typeof (fs_ad_client) == 'undefined')
        return;

    document.write("<div id='fs_adslot_" + fs_ad_slot + "' style='width:" + (typeof (fs_ad_width) == 'undefined' ? 100 : fs_ad_width) + "px;height:" + (typeof (fs_ad_height) == 'undefined' ? 200 : fs_ad_height) + "px;border:none;display:block;padding:0;margin:0;visibility:visible;position:relative;'></div>");
}

function FS_AttachCodeCreationFunctionToLoadEvent() {
    if (typeof (fs_ad_slot) == 'undefined')
        return;
    if (typeof (fs_ad_client) == 'undefined')
        return;
    if (typeof (fs_ad_site) == 'undefined')
        return;

    var loadEventCall = "FS_GetAdCode('" + fs_ad_slot + "', '" + fs_ad_client + "', '" + fs_ad_site + "', " + (typeof (fs_ad_size) == 'undefined' ? 0 : fs_ad_size) + ", " + (typeof (fs_ad_width) == 'undefined' ? 100 : fs_ad_width) + ", " + (typeof (fs_ad_height) == 'undefined' ? 200 : fs_ad_height) + ")";
    eval(loadEventCall);

}


function FS_GetAdCode(ad_slot, ad_client, ad_site, ad_size, ad_width, ad_height) {
    var insTag = document.getElementById("fs_adslot_" + ad_slot);
    if (insTag == null)
        return;

    var iframe = document.createElement('iframe');
    iframe.setAttribute('vspace', 0);
    iframe.setAttribute('height', ad_height);
    iframe.setAttribute('marginHeight', 0);
    iframe.setAttribute('frameBorder', 0);
    iframe.setAttribute('width', ad_width);
    iframe.setAttribute('allowTransparency', 1);
    iframe.setAttribute('name', 'fs_add_iframe' + ad_slot);
    iframe.setAttribute('marginWidth', 0);
    iframe.setAttribute('scrolling', 'no');
    iframe.setAttribute('hspace', 0);

    var adhost = typeof (fs_ad_host) == 'undefined' ? 'http://www.folkspel.se' : fs_ad_host;
    var adpath = typeof (fs_ad_path) == 'undefined' ? '/bannergateway' : fs_ad_path;
    var adsource = typeof (fs_ad_source) == 'undefined' ? '' : fs_ad_source;
    var bannerid = typeof (fs_ad_bannerid) == 'undefined' ? '' : fs_ad_bannerid;
    iframe.setAttribute('src', adhost + adpath + adsource + "?fs_ad_slot=" + ad_slot + "&fs_ad_client=" + ad_client + "&fs_ad_site=" + ad_site + "&fs_ad_size=" + ad_size + "&fs_ad_bannerid=" + bannerid);

    insTag.appendChild(iframe);

}





