jQuery(document).ready(function() {
    //to get affiliate link on change of drop down box
    jQuery('#wpsa_aff_product').change(function(){
        //console.log(jQuery(this).val());
        jQuery.ajax({
            url : wpsa_affiliate_var.admin_ajax_php,
            data: 'action=wpsa_affiliate_get_afflink&pid='+jQuery(this).val(),
            type: "post",
            beforeSend: function(obj) {
                jQuery('#wpsa_aff_product_link').html('<img id="loading" src="'+wpsa_var.plugindir+'/img/loading.gif">');
            } ,
            success : function(data) {
                jQuery('#wpsa_aff_product_link').html(data);
            }
        });	//end of ajax
    });
    //to get affiliate link on change of drop down box
    jQuery('#wpsa_aff_subscription').change(function(){
        jQuery.ajax({
            url : wpsa_affiliate_var.admin_ajax_php,
            data: 'action=wpsa_affiliate_get_afflink&sid='+jQuery(this).val(),
            type: "post",
            beforeSend: function(obj) {
                jQuery('#wpsa_aff_subscription_link').html('<img id="loading" src="'+wpsa_var.plugindir+'/img/loading.gif">');
            } ,
            success : function(data) {
                jQuery('#wpsa_aff_subscription_link').html(data);
            }
        });	//end of ajax
    });

    jQuery("#tnctext").fancybox({
        'scrolling'	: 'no',
        'titleShow': false
    });
})