﻿var is_ie6 = (window.external && typeof window.XMLHttpRequest == "undefined");
var isIE = (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent));

if (!is_ie6) {
    window.onresize = resizeFrames; // Call resizeFrames() function on window resize.
}

/* Screen resizing depends on user screen resolution */
function resizeFrames() {
    var screenHeight = document.body.clientHeight;
    var screenWidth = document.body.clientWidth;
      
    // Minimum screen height
    if (screenHeight < 620) {
        screenHeight = 620;
    }

    // Minimum screen width
    if (screenWidth < 950) {
        screenWidth = 950;
    }

    document.getElementById('flashAS3Client').style.height = screenHeight - 2 + "px";
    document.getElementById('flashAS3Client').style.width = screenWidth - 2 + "px";    
    
    // Other than IE
    if (!isIE) {
        document.getElementById('flashAS3Client2').style.height = screenHeight - 2 + "px";
        document.getElementById('flashAS3Client2').style.width = screenWidth - 2 + "px";
    }
}

function processLead(CustomerID, Mode) {
    document.getElementById('LeadPixelURL').src = 'leadpixel.aspx?CID=' + CustomerID + '&mode=' + Mode;
}

function setLogin(OriginalCustomerID, OriginalProviderID, SerialID, SubSerialID, BannerID) {
    createCookie("OrigCID", OriginalCustomerID, 365);
    createCookie("OriginalProviderID", OriginalProviderID, 365);

    var AffWizCookie = "AffiliateID=" + SerialID + "&ClickBannerID=" + BannerID + "&SubAffiliateID=" + SubSerialID;
    createCookieAdvanced("AffiliateWizAffiliateID", AffWizCookie, 365);
}
function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}