$(function() { 	


///TO FORCE REGISTRATION TO PARENT IF COMING FROM FANCYBOX
       var displayName  = polopoly.user.displayName();

                ///to pull parameters from querystring
                function querySt(ji) {
                    hu = window.location.search.substring(1);
                    gy = hu.split("&");
                    for (i=0;i<gy.length;i++) {
                        ft = gy[i].split("=");
                           if (ft[0] === ji) {
                                return ft[1];
                                }
                        }
                    }


                var win = querySt("win");
                var ps = querySt("ps");

                if(win === "1") {
                    window.parent.document.location.href="?reg_success=true&registration=true&ps=1&win=0";
                }

                //MIGRATED USER NOT SUBSCRIBER
                if(win === "2") {
                    window.parent.document.location.href="?reg_success=true&registration=true&ps=2&win=0";
                }
                    else {
                }



    var newstartUrl = polopoly.cookie.get("newstart");
    var manageUrl = polopoly.cookie.get("manage");

    if (polopoly.user.isNewsdaySubscriber()) {

            if(newstartUrl) {
                newstartUrl = newstartUrl ;
                }

            else {
                newstartUrl = "/subscribe";
                }

            if(manageUrl) {
                manageUrl = manageUrl ;
                }
            else {
                manageUrl = "#";
            }
    }

    ///NOT A NEWSDAY PRINT SUBSCRIBER
    else {
        newstartUrl = "/subscribe" ;
        manageUrl = "#";
    }

});
