﻿var FiberChoiceApp = {
    GetDocumentTitle: function () {
        if (document.title != null && document.title != "")
            return document.title;

        return "FiberChoice.com";
    }
};

$(".btnShareThis").ready(function () {
    $(".btnShareThis").click(function (evt) {
        $(".shareThisContainer").css("top", evt.pageY + 20);
        $(".shareThisContainer").css("left", evt.pageX - ($(".shareThisContainer").css("width").replace("px", "") / 1));
        $(".shareThisContainer").show();
        $(".shareThisCloseWin").click(function (evt) {
            evt.preventDefault();
            $(this).unbind('click');
            $(".shareThisContainer").hide();
        });
    });
});

/* Targets will not be found on localhost, but will work absolutely elsewhere */
function poponclickOffers() {
    var widthW = (screen.width / 5)*2 ;
    var heightH = (screen.height / 5)*2;
    var win = window.open("/special-offers/taf.aspx?ID=offers", "popup", "location=0,menubar=0,resizable=0,toolbar=0,scrollbars=1,width=640,height=600");
    var left = (screen.width - widthW) / 2;
    var top = (screen.height - heightH)/4;
    win.moveTo(left, top);  
}

function poponclickSampleTY() {
    var widthW = (screen.width / 5) * 2;
    var heightH = (screen.height / 5) * 2;
    var win = window.open("/special-offers/taf.aspx?ID=sample", "popup", "menubar=0,resizable=1,scrollbars=1,width=640,height=600");
    var left = (screen.width - widthW) / 2;
    var top = (screen.height - heightH) / 4;
    win.moveTo(left, top);
}

function poponclickCouponTY() {
    var widthW = (screen.width / 5) * 2;
    var heightH = (screen.height / 5) * 2;
    var win = window.open("/special-offers/taf.aspx?ID=coupon", "popup", "menubar=0,resizable=1,scrollbars=1,width=640,height=600");
    var left = (screen.width - widthW) / 2;
    var top = (screen.height - heightH) / 4;
    win.moveTo(left, top);
}

function goToPage() {
    window.location = "fiberchoice-benefits/prebiotics-probiotics.aspx"
}

function getLearnMore() {
    window.location = "fiberchoice-benefits/prebiotics-probiotics.aspx"
}

function getCommercial() {
    window.location = "fiberchoice-benefits/tv-commercial.aspx"
}

function popUpFC(htmLoc, width, height, theWindow) {
    //window.open(htmLoc, theWindow, 'titlebar=YES,toolbar=NO,width=' + width + ',height=' + height + ',directories=NO,status=YES,scrollbar=no,resizable=YES,menubar=yes');
    var winleft = (screen.width / 2) - (width / 2); // center the window right to left
    var wintop = (screen.height / 2) - (height / 2); // center the window top to bottom
    window.open(htmLoc, "mainwindow", "top=" + wintop + ",left=" + winleft + ",width=" + width + ",height=" + height + ",buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no"); //YesorNo
}


function noaccordion(obj) {
    $(obj).parent().next().toggleClass("active");
    $(obj).toggleClass("dtAns");
};
 
