
GOTUIT.PVS.pushEventFilter( "PVS", GOTUIT.PVS.EVENT.FLAG_SUCCESS,
    function( oFilter )
    {
        alert( "That content has been flagged. We will review and remove any offensive content." );
        oFilter.next();
    });

GOTUIT.PVS.pushRequireLoginEventFilter( "PVS", GOTUIT.PVS.EVENT.ADD_TO_FAVORITES, "Login required for the Favorites Feature" );

GOTUIT.PVS.addListener( "PVS", GOTUIT.PVS.EVENT.ADD_TO_FAVORITES_SUCCESS,
    function( oParent, aContent, nIndex )
    {
        if( aContent && aContent.length > 0 )
        {
            alert( "This item was successfully added to your favorites." );
        }
        else
        {
            alert( "This item is already in your favorites." );
        }
    });

GOTUIT.PVS.addListener( "PVS", GOTUIT.PVS.EVENT.ADD_TO_FAVORITES_ERROR,
    function( sErrorCode )
    {
        alert( "This item was not successfully added.  Please try again." );
    });
    
    function openAuxWindow( sLink, sName )
{
    if( sName == null )
        sName = "ff_Aux";

    var win = window.open( sLink, sName, "scrollbars=yes,toolbar=no,width=500,height=507,resizable=no,location=no,menubar=no,titlebar=no,status=no"  );
    if( window.focus )
        win.focus();
}

GOTUIT.PVS.pushEventFilter( "PVS", GOTUIT.PVS.EVENT.USER_REGISTER_SUCCESS, onRegisterSuccess );

function onRegisterSuccess( oFilter, oProfile )
{
    //oProfile.Prize = "1";
    //alert( "prize is " + oProfile.Prize );    

    GOTUIT.DOM.addClass( document.body, "ModalPrize" );

    switch( oProfile.Prize )
    {
        case "0":
            Modalbox.show( "./inc/html/box_postregister_contestclosed.html", {
                title: " ",
                width: 685,
                height: 440,
                inactiveFade: false,
                beforeLoad: function() { },
                beforeHide: function() { }, 
                afterHide: function() {  GOTUIT.DOM.removeClass( document.body, "ModalPrize" ); GOTUIT.PVS.showVideoPlayer(); }
            });
            break;
        case "1":
            Modalbox.show( "./inc/html/box_postregister_contestclosed.html", {
                title: " ",
                width: 685,
                height: 440,
                inactiveFade: false,
                beforeLoad: function() { },
                beforeHide: function() { }, 
                afterHide: function() {  GOTUIT.DOM.removeClass( document.body, "ModalPrize" ); GOTUIT.PVS.showVideoPlayer(); }
            });
            break;
        case "2":
            Modalbox.show( "./inc/html/box_postregister_contestclosed.html", {
                title: " ",
                width: 685,
                height: 440,
                inactiveFade: false,
                beforeLoad: function() { },
                beforeHide: function() { }, 
                afterHide: function() {  GOTUIT.DOM.removeClass( document.body, "ModalPrize" ); GOTUIT.PVS.showVideoPlayer(); }
            });
            break;
        case "9":
            Modalbox.show( "./inc/html/box_postregister_contestclosed.html", {
                title: " ",
                width: 685,
                height: 440,
                inactiveFade: false,
                beforeLoad: function() { },
                beforeHide: function() { }, 
                afterHide: function() {  GOTUIT.DOM.removeClass( document.body, "ModalPrize" ); GOTUIT.PVS.showVideoPlayer(); }
            });
            break;
        default:
            oFilter.next();
            break;
    }
}

GOTUIT.PVS.Extension.User.prototype._isValidDOB = function( sDOB )
{
    try
    {
        if( sDOB != null )
        {
            var aParts = sDOB.split( "/" );
            if( aParts.length == 3 )
            {
                if( aParts[0].length == 2 && aParts[1].length == 2 && aParts[2].length == 4 )
                {
                    if( parseInt( aParts[0], 10 ) && parseInt( aParts[1], 10 ) && parseInt( aParts[2], 10 ) )
                    {
                        var nMonth = parseInt( aParts[0], 10 );
                        var nDay = parseInt( aParts[1], 10 );
                        var nYear = parseInt( aParts[2], 10 );
 
                        var aNumDays = [];
                        aNumDays[1] = 31;
                        aNumDays[2] = 28;
                        aNumDays[3] = 31;
                        aNumDays[4] = 30;
                        aNumDays[5] = 31;
                        aNumDays[6] = 30;
                        aNumDays[7] = 31;
                        aNumDays[8] = 31;
                        aNumDays[9] = 30;
                        aNumDays[10] = 31;
                        aNumDays[11] = 30;
                        aNumDays[12] = 31;
 
                        if( aNumDays[nMonth] == null || nMonth < 1 || nMonth > 12 )
                            return "InvalidDOBMonth";
                        else if( nDay < 1 || nDay > aNumDays[nMonth] )
                            return "InvalidDOBDay";
                        else
                            return null;
                    }
                }
            }
        }
    }
    catch( e )
    {
    }
    return "InvalidDOB";
}