jQuery.noConflict();
jQuery(document).ready(function(){
    var newdiv2 = document.createElement("div");
    newdiv2.id = "blackoverlay";
    newdiv2.style.position = "fixed";
    newdiv2.style.width = "0%";
    newdiv2.style.height = "0%";
    newdiv2.style.background = "black";
    newdiv2.style.opacity = "0.0";
    newdiv2.style.filter = "alpha(opacity=0)";
    newdiv2.style.zIndex = "100";

    var newdiv = document.createElement("div");
    newdiv.id = "overlayinfo";
    newdiv.style.position = "fixed";
    newdiv.style.width = "0px";
    newdiv.style.height = "0px";
    newdiv.style.left = "50%";
    newdiv.style.top = "50%";
    newdiv.style.background = "#111111";
    newdiv.style.marginLeft = "0px";
    newdiv.style.color = "white";
    newdiv.style.textAlign = "center";
    newdiv.style.zIndex = "120";
    newdiv.style.opacity = "0.0";
    newdiv.style.filter = "alpha(opacity=0)";

    jQuery(document.body).prepend(newdiv);
    jQuery(document.body).prepend(newdiv2);
});

function confirmation(id)
{
    CreateOverlayBox('<div class="fastbuy_form"><div <div class="fastbuy_head"><h3>You are not currently subscribed to the premium package.  Would you like to subscribe now?</h3></div><input type="submit" value="Yes" name="yes" onClick="redirectToCheckout('+id+')"><input type="submit" value="No" name="no" onClick="CloseBoxes()"></div>', 300, 75, true);
}

function CreateOverlayBox(content, width, height, border)
{
    jQuery("#blackoverlay").fadeTo(-1, 0.0);
    jQuery("#overlayinfo").fadeTo(-1, 0.0);
    jQuery("#blackoverlay").css({"width" : "100%", "height" : "100%"});
    jQuery("#overlayinfo").css({"width" : width+"px", "height" : height, "margin-left" : width/2*-1+"px"});
    if(border)
        jQuery("#overlayinfo").addClass("colorborder");
    jQuery("#overlayinfo").html(content);
    jQuery("#overlayinfo").css({"margin-top" : jQuery("#overlayinfo").height()/2*-1+"px"});
    jQuery(".linktext").hover(function () {jQuery(this).addClass("linkhovertext");}, function () {jQuery(this).removeClass("linkhovertext");});
    jQuery(".buttoncolor").hover(function () {jQuery(this).addClass("buttoncolorhover");}, function () {jQuery(this).removeClass("buttoncolorhover");});
    jQuery("#blackoverlay").fadeTo(1000, 0.65);
    jQuery("#overlayinfo").fadeTo(1000, 1.0);
}

function redirectToCheckout(id)
{
    jQuery.ajax({
        type: 'GET',
        url: '/store/subsignup/'+id,
        success: function(data) {
            jQuery('#fastbuy_form').html(data);
        }
    });
}

