﻿function OpenHtmlPreview() {
    var URL = GetCRMServerUrl() + "WebResources/iotap_/Addons/ReportScheduler/HtmlPreview.htm";
    //window.open(URL, null, "dialogWidth:800px;dialogHeight:600px;center :yes on 1;scrollbars=yes");    
    window.open(URL, null, "scrollbars = 1, resizable=1, width = 800, height = 600");
}

function GetCRMServerUrl() {
    if (document.location.pathname.match('^/?' + Xrm.Page.context.getOrgUniqueName()) != null) { // OnPremise 
        return document.location.protocol + "//" + document.location.host + "/" + Xrm.Page.context.getOrgUniqueName() + "/";
    }
    else { // IFD
        return document.location.protocol + "//" + document.location.host + "/";
    }
}
