﻿function processRedirect()
{
        
    if (readCookie("FCBonusStatus") == "0")
    {
        //need to goto original URL
        history.back(-2);
    }
    else if (readCookie("FC_FrontBurner_Signedup") == "1")
    {
        var url = document.getElementById("ctl00_ContentPlaceHolder1_hiddenURL").value;
        var newWindow = document.getElementById("ctl00_ContentPlaceHolder1_hiddenNewWindow").value;
        createCookie("FCBonusStatus","0");
        if (newWindow == "1")
        {
            window.open(url);
            history.back();
        }
        else
            window.location.href=url;
    } 
    else
    {
        doAds();
    } 
    
    
    
    
}

function showProtectedContent(url,newWindow)
{
    if (newWindow == null)
        newWindow = "0";
    if (window.location.href.indexOf(url) > -1)   //Are we already here
        return;

    //See if we already signed up
    if (readCookie("FC_FrontBurner_Signedup") == "1")
    {
        if (newWindow == "1")
        {
            window.open(url);
            //history.back();
        }
        else
            window.location.href=url;
    }
    else
    {
        var hidden_location = document.getElementById("hidden_location");
        hidden_location.value = url;
        createCookie("ContentDestination",url);
        createCookie("FCLetterOriginal",window.location.href);
        createCookie("FCBonusStatus","1");
        var newURL = "/eLetterSignUp.aspx?newWindow="+newWindow;
        window.location.href=newURL;
    }
    
    


}

