﻿/* Greybox Redux
* Required: http://jquery.com/
* Written by: John Resig
* Based on code by: 4mir Salihefendic (http://amix.dk)
* License: LGPL (read more in LGPL.txt)
*/
/*
var GB_DONE = false;
var GB_HEIGHT = 540;
var GB_WIDTH = 650;
var modal_constants = [["Health Risk Appraisal", "The Prevention Plan", "sites/all/themes/uspmc/images/titulares/hra_pdhi.jpg", 560, 650, false, false],
						["Action Programs", "The Prevention Plan", "sites/all/themes/uspmc/images/titulares/actionprograms_pdhi.jpg", 560, 650, false, false],
						["Messages", "The Prevention Plan", "sites/all/themes/uspmc/images/titulares/messages_pdhi.jpg", 490, 600, false, false],
						["Personal Health Record", "The Prevention Plan", "sites/all/themes/uspmc/images/titulares/phr_pdhi.jpg", 560, 650, false, false],
						["Provider Report", "My Prevention Plan", "", 530, 650, false, true],
						["About Us", "U.S. Preventive Medicine", "sites/all/themes/uspmc/images/titulares/aboutusgl.jpg", 530, 650, false, false],
						["Comments", "", "sites/all/themes/uspmc/images/titulares/commentsgl.jpg", 500, 650, false, false],
						["Registration Window", "", "sites/all/themes/uspmc/images/titulares/member_reg.jpg", 410, 610, false, false],
						["", "", "sites/all/themes/uspmc/images/titulares/member_reg.jpg", 410, 610, false, false],
						["Activate", "", "", 440, 610, false, false],
						["Forgot Password", "Forgot Password", "", 410, 610, false, false],
						["Library", "", "sites/all/themes/uspmc/images/titulares/library.jpg", 440, 640, false, false],
						["Library - Renderer", "", "sites/all/themes/uspmc/images/titulares/library.jpg", 440, 640, false, false],
			    	["flashtour", "Take a Tour", "", 348, 486, false, false],
			    	["My Profile - Instructions", "My Profile - Instructions", "", 505, 610, false, false],
			    	["Rewards - Instructions", "Rewards - Instructions", "", 545, 610, false, false],
			    	["Benefits - Instructions", "Benefits - Instructions", "", 545, 610, false, false],
			    	["PHR - Instructions", "Personal Health Record - Instructions", "", 545, 610, false, false],
			    	["Location for Labs", "Location for Labs", "", 600, 600, false, false],
			    	["Terms of Use", "Terms of Use", "", 560, 610, false, false],
			    	["Help", "Help", "", 332, 610, false, false],
			    	["Video Player", "Video Player", "", 525, 360, false, false],
			    	["Confirm", "Confirm", "", 270, 600, true, false],
			    	["Symptom Checker", "Symptom Checker", "", 640, 650, false, false],
			    	["Schedule Labs", "Schedule Labs", "", 640, 650, true, false],
			    	["Physician Login", "Physician Login", "", 310, 240, false, false],
			    	["Physician Reassignment", "Physician Reassignment", "", 520, 640, false, false],
			    	["Physician Inbox Instructions", "Physician Inbox Instructions", "", 545, 610, false, false],
			    	["Prevention Schedule Guidelines", "Prevention Schedule Guidelines", "", 545, 610, false, false],
			    	["View Animation", "View Animation", "", 680, 505, false, false],
			    	["Results and Recommendations", "Results and Recommendations", "", 530, 614, false, true],
			    	["My Prevention Plan Instructions", "My Prevention Plan Instructions", "", 545, 610, false, false],
			    	["Record New Community Activity", "Record New Community Activity", "", 420, 625, false, false],
			    	["My Community Activity", "My Community Activity", "", 335, 625, false, false],
			    	["Acknowledge Receipt My Prevention Plan", "Acknowledge Receipt My Prevention Plan", "", 520, 610, false, false],
			    	["Available Times and Locations", "Available Times and Locations", "", 500, 625, false, false],
			    	["Lab Location", "Lab Location", "", 600, 650, false, true],
			    	["Welcome Back", "Welcome Back", "", 600, 650, false, true]

					];
var image = "";
var title = "";
var close_button = "";
var print_button = "";
function GB_show(caption, url, height, width, base_path) {
    GB_HEIGHT = height || 400;
    GB_WIDTH = width || 400;
    title = caption;
    setVariables(caption);

    if (base_path) {
        source_path = base_path + "sites/all/themes/uspmc/images/varios";
    } else {
        source_path = "sites/all/themes/uspmc/images/varios";
    }

    if (!GB_DONE) {
        $("#GB_caption").width(width);
        //var cmw = width - 130;
        //$("#GB_cm").width(cmw);
        $(document.body)
      .append("<div id='GB_overlay'></div><div id='GB_window'><div id='GB_caption'></a><div id='GB_cl'></div><div id='GB_cm'></div><div id='GB_cr'><img class='close' id='closegb_window' src='" + source_path + "/btn_close.gif' " + (close_button ? " style='display:none '" : "") + "' alt='Close'/><img class='print' id='print_window' src='" + base_path + "sites/all/themes/uspmc/images/varios/btn_print.gif' " + (print_button ? "" : "style='display:none '") + "' alt='Print'/></div></div>"
        + "</div>");
        $("#GB_window #closegb_window").click(GB_hide);
        $("#GB_window #print_window").click(GB_print);
        $(window).resize(GB_position);
        GB_DONE = true;
    }

    $("#GB_frame").remove();
    if (image == "") {
        $("#GB_window").append("<div id='windowbody'><div id='iframebody'><iframe id='GB_frame' frameborder='0' AllowTransparency='true' src='" + url + "'></iframe></div></div>");
    } else {
        $("#GB_window").append("<div id='windowbody'><div id='iframebody'><img id='imgtitle' src='" + base_path + (image == "", "images/varios/bg_tdl_top.jpg", image) + "' /><iframe id='GB_frame' frameborder='0' AllowTransparency='true' src='" + url + "'></iframe></div></div>");
    }
    $("#GB_window").append("<div id='GB_foot'><div id='GB_fl'></div><div id='GB_fm'></div><div id='GB_fr'></div></div>");

    $("#GB_cm").html(title);


    $("#GB_overlay").width($(document).width());
    $("#GB_overlay").height($(document).height());
    $("#GB_overlay").show();
    if ($('#flashmov').length) {
        $("#flashmov").css("display", "none");
    }
    if ($('#videoxplayer').length) {
        $("#videoxplayer").css("display", "none");
    }
    GB_position();

    if (GB_ANIMATION)
        $("#GB_window").fadeIn("slow");
    else
        $("#GB_window").fadeIn("slow");

    try { top.hideSpinner(); } catch (e) { };

    try {
        if (close_button) {
            document.getElementById("closegb_window").style.display = "none";
        } else {
            document.getElementById("closegb_window").style.display = "inline";
        }
        if (print_button) {
            document.getElementById("print_window").style.display = "inline";
        } else {
            document.getElementById("print_window").style.display = "none";
        }
    } catch (e) {
        // Do nothing
    }
}

function GB_hide() {
    $("#GB_window,#GB_overlay,#GB_floor").hide();
    document.getElementById("iframebody").src = "./sites/all/lib/blank.php";
    document.getElementById("windowbody").removeChild(document.getElementById("iframebody"));
    document.getElementById("GB_window").removeChild(document.getElementById("windowbody"));
    document.getElementById("GB_window").removeChild(document.getElementById("GB_foot"));
    if ($('#flashmov').length) {
        $("#flashmov").css("display", "block");
    }
    try { top.hideSpinner(); } catch (e) { };
    if ($('#videoxplayer').length) {
        $("#videoxplayer").css("display", "block");
    }
    if (parent) {
        if (parent.document) {
            close_action_fld = parent.document.getElementById('close_action');
            if (close_action_fld) {
                if (close_action_fld.value) {
                    try {
                        eval(close_action_fld.value);
                    } catch (err) { }
                }
            }
        }
    }
}

function GB_position() {
    var de = document.documentElement;
    var w = self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
    $("#GB_window").css({ width: GB_WIDTH + "px", height: GB_HEIGHT + "px", left: ((w - GB_WIDTH) / 2) + "px" });
    //$("#GB_floor").css({width:GB_WIDTH+"px",height:(GB_HEIGHT-15)+"px", left: ((w - GB_WIDTH)/2)+"px" });
    if (title == "Rewards - Instructions" || title == "Benefits - Instructions" || title == "Personal Health Record - Instructions" || title == "Terms of Use" || title == "Symptom Checker" || title == "Physician Inbox Instructions" || title == "Prevention Schedule Guidelines" || title == "Physician Reassignment" || title == "My Prevention Plan Instructions") {
        $("#GB_frame").css("height", GB_HEIGHT - 62 + "px");
    } else {
        $("#GB_frame").css("height", GB_HEIGHT - 32 + "px");
    }
    $("#GB_cm").css("width", (GB_WIDTH - 130) + "px");
    $("#GB_fm").css("width", (GB_WIDTH - 130) + "px");
    $("#iframebody").css("height", (GB_HEIGHT - 75) + "px");
    $("#iframebody").css("width", (GB_WIDTH - 6) + "px");
    $("#windowbody").css("height", (GB_HEIGHT - 52) + "px");
    if (GB_HEIGHT > 800) $("#GB_overlay").css("height", (GB_HEIGHT + 52) + "px");
}

function setVariables(param) {
    for (i = 0; i < modal_constants.length; i++) {
        if (modal_constants[i][0] == param) {
            title = modal_constants[i][1];
            image = modal_constants[i][2];
            GB_HEIGHT = modal_constants[i][3];
            GB_WIDTH = modal_constants[i][4];
            close_button = modal_constants[i][5];
            print_button = modal_constants[i][6];
            break;
        }
    }
}

function GB_hide_r(strUrl) {
    $("#GB_window,#GB_overlay,#GB_floor").hide();
    document.getElementById("windowbody").removeChild(document.getElementById("iframebody"));
    document.getElementById("GB_window").removeChild(document.getElementById("windowbody"));
    document.getElementById("GB_window").removeChild(document.getElementById("GB_foot"));
    if ($('#flashmov').length) {
        $("#flashmov").css("display", "block");
    }
    if ($('#videoxplayer').length) {
        $("#videoxplayer").css("display", "block");
    }
    if (parent) {
        if (parent.document) {
            close_action_fld = parent.document.getElementById('close_action');
            if (close_action_fld) {
                if (close_action_fld.value) {
                    try {
                        eval(close_action_fld.value);
                    } catch (err) { }
                }
            }
        }
    }

    location.replace(strUrl);
}

function GB_print() {
    window.frames[0].print();
}

function GB_resize(win) {
    GB_HEIGHT = win.document.body.scrollHeight + 65;
    GB_position();
}
*/

