﻿/*
* Digital Space Frog, LLC 
*/

window.$ = $telerik.$;
$().ready(function () {
    $('#dialog').jqm();
});

function ShowPopup(url) {
    radopen(url, "ORMC Popup");
    oWnd.set_title("");
}

function ShowSpecialContentPopup(pagename) {
    var oWnd = radopen("specialcontent.aspx?page=" + pagename, pagename);
    oWnd.set_title("");
    oWnd.autoSize(true);
}

function ShowEventPopup(eventID) {
    var oWnd = radopen("eventpopup.aspx?EventID=" + eventID, 'ORMC Event');
    oWnd.SetSize(800, 500);
    oWnd.set_title("Event Information");
}

function ShowPhysicianPopup(physicianID) {
    var oWnd = radopen("physicianpopup.aspx?PhysicianID=" + physicianID, 'Physician Details');
    oWnd.set_title("Physician Details");  
}

function ShowProcedurePopup(ProcedureID) {
    var oWnd = radopen("procedurepopup.aspx?ProcedureID=" + ProcedureID, 'Procedure Details');
    oWnd.set_title("Procedure Explanation");
    oWnd.SetSize(800, 500);
}

function ShowSiteMapPopup() {
    var oWnd = radopen("sitemap.aspx", 'Site Map');
    oWnd.set_title("Oconee Regional Site Map");
    oWnd.SetSize(600, 500);
}

function ShowSpecialtyPopup(SpecialtyName) {
    var oWnd = radopen("specialtypopup.aspx?page=" + SpecialtyName, 'Specialty Details');
    oWnd.set_title("Specialty Description");
    oWnd.SetSize(600, 300);
}

function BlockUICall(msg) {
    $.blockUI({ message: '<div style="float:left;padding:10px;"><img src="http://www.gradeshark.com/common/images/animation/ajax_animate_orange.gif"/> </div>' + '<div class="blockUI_Message">' + msg + '</div>' });
}

// ----------------------------------------------------------------------------------
function ShowRadDialog(url, title, width, height) {
    var oWnd = window.radopen("", "winPublic");

    //set the url, size and title
    oWnd.SetUrl(url);
    oWnd.SetSize(width, height);
    oWnd.SetTitle(title);
    oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Resize)

    return false;
}

function ShowRadDialogParent(url, title, width, height) {
    var oWnd = parent.window.radopen("", "winPublic");

    //set the url, size and title
    oWnd.SetUrl(url);
    oWnd.SetSize(width, height);
    oWnd.SetTitle(title);
    oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Resize)

    return false;
}

function RadDialogResetStatusbar() {
    var oWindow = GetRadWindow();
    if (oWindow) {
        var text = "Ready.";
        oWindow.set_status(text);
    }
}

function OpenDocumentWindow(url, optionalName, optionalWidth, optionalHeight, optionalScroll) {
    debugger;

    var options = "width=%1, height=%2, scrollbars=%3, menubar=no" //, toolbar=no, location=yes, status=yes, resizable=yes"

    if (optionalWidth == null)
        options = options.replace("%1", GetBrowserWindowValue("width"));
    else
        options = options.replace("%1", optionalWidth);

    if (optionalHeight == null)
        options = options.replace("%2", GetBrowserWindowValue("height"));
    else
        options = options.replace("%2", optionalHeight);

    debugger;
    if (optionalScroll == null)
        options = options.replace("%3", "no");
    else
        options = options.replace("%3", optionalScroll);

    var mywin = window.open(url, optionalName, options);

    mywin.focus();

    return false;
}

//function OpenStandardWindow(url, optionalWidth, optionalHeight) {
//    debugger;

//    var options = "width=%1, height=%2, scrollbars=yes, menubar=no, toolbar=no, location=yes, status=yes, resizable=yes"

//    if (optionalWidth == null)
//        options = options.replace("%1", GetBrowserWindowValue("width"));
//    else
//        options = options.replace("%1", optionalWidth);

//    if (optionalHeight == null)
//        options = options.replace("%2", GetBrowserWindowValue("height"));
//    else
//        options = options.replace("%2", optionalHeight);

//    var mywin = window.open(url, optionalName, options);

//    mywin.focus();

//    return false;
//}

function GetRadWindow() {
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}

function CloseRadWindow() {
    GetRadWindow().Close();
}

function OpenStandardWindow(strURL, strWidth, strHeight) {
    debugger;
    window.open(strURL, "", "Width=" + strWidth + ",Height=" + strHeight + ",scrollbars=yes,resizable=yes", 0);
} 

