﻿// Returns named element, allowing for asp.net generated id prefices that may cause issues with identifying nested controls.
// Usage: instead of standard jquery selector of $("#myControl") use $$("myControl")
function $$(id, context) {
    var el = $("#" + id, context);
    if (el.length < 1)
        el = $("[id$=_" + id + "]", context);
    return el;
}


function CreateDialog(pContainer, pHeight, pWidth) {
    $(function () {
        if ($$(pContainer).is(':data(dialog)')) {
            $$(pContainer).dialog("destroy");
        }
        var dlg = $$(pContainer).dialog({
            autoOpen: false,
            width: pWidth,
            maxHeight: pHeight,
            resizable: true,
            modal: true
        });
        dlg.parent().appendTo($("form:first"));
    });
}



function iFrameBreakout() {
    if (top.location != location) {
        top.location.href = document.location.href;
    }
}
