var Promotion = new Class(
{
    pcode: '',
    redirect_url: '',
    promo_secure_code: '',

    options: {
        'ajaxURL' : '/promo_landing.php'
    },

    initialize: function( pcode, redirect_url, promo_secure_code )
    {
        this.pcode = pcode;
        this.redirect_url = redirect_url;
        this.promo_secure_code = promo_secure_code;
    },

    sendSecureCode: function()
    {
        if(location.href!=parent.location.href || parent.frames.length > 0)
        {
            parent.location.href='/promo_landing.php?pcode=' + this.pcode;
        }

        var cur_promo = this;

        var request = new Request.JSON({
            'method' : 'post',
            'url' : this.options.ajaxURL,
            'data' : {
            'pcode' : this.pcode,
            'promo_secure_code' : this.promo_secure_code            
            },
            'onComplete':function(responseObject)
            {
                parent.location.href=cur_promo.redirect_url;
            }
        });

        request.send(); 
    }
});

