﻿/// <reference path="jquery.intellisense.js"/>
function ShareReport(uid,title,id,source,partner) {
    try {
        var fromName = $('#email_sender_name').val();
        var fromEmail = $('#email_sender_email').val();
        var toEmail = $('#email_to').val();
        var comment = $('#email_comment').val();
        // check to make sure they added something to all the required fields
        if ((fromName.length > 0) && (fromEmail.length > 0) && (toEmail.length > 0)) {
            //submit the request
            BNAlerts.ViewerServices.ShareReport(uid, fromName, fromEmail, toEmail, comment, title, id);
            // hide the email box
            $("#shareEmailPanel").toggle("blind")
            // GA tracking
            pageTracker._trackPageview('/outbound/email/' + source.toString() + partner.toString());
        }
        else {
            if (fromName.length == 0) {
                alert('Please enter your name');
            }
            else if (fromEmail.length == 0) {
                alert('Please enter your email address');
            }
            else if (toEmail.length == 0) {
                alert('Please enter the email address of the recipient');
            }
        }
    }
    catch(exception){}
}
// =====================
// Disable the scout    
// =====================
function DisableScout(alertsettingid) {
    var tempObj = document.getElementById("aDisableScout");
    var command = $('#hidDisableScout');
    if (command.val() == 'disable') {
        //Call the service to change the status
        BNAlerts.ViewerServices.DisableScout(alertsettingid);
        // update the displayed command text
        tempObj.innerHTML = 'Alert disabled';
        command.val("enable");
    }
};    
