﻿function popupwindow(URLStr, width, height) {
    var obj;
    var left = (screen.width / 2) - width / 2;
    var top = (screen.height / 2) - height / 2 - 50;
    var style = 'dialogHeight:' + height + 'px;';
    style += ' dialogWidth:' + width + 'px;';
    style += ' dialogTop:' + top + 'px;';
    style += ' dialogLeft:' + left + 'px;';
    style += ' edge:Raised;Center: Yes; help: no; resizable:no;scroll:auto;status:no';
    var retVal;

    retVal = window.showModalDialog(URLStr, obj, style);
    //retVal = window.showModelessDialog(URLStr, obj, style);	

    return (retVal);
}

function openwindow(url, width, height) {
    var left = (screen.width / 2) - width / 2;
    var top = (screen.height / 2) - height / 2;

    newwindow = window.open(url, 'name', 'height=' + height + ',width=' + width + ',status = 0, resizable = 0, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left + ',top=' + top + ',screenX=' + left + ',screenY=' + top);
    if (window.focus) { newwindow.focus() }
    return false;
}

function BrowseForFile(ControlID, ext, path) {
    if (path == null) { path = '../uploads/'; }

    var ret;
    ext = '&ext=' + ext;
    ret = popupwindow('../Utilities/FileBrowser.aspx?RetURL=yes' + ext, 830, 575);
    if (ret != 'no') {
        var url;
        url = path + ret;
        ControlID.SetText(url);
    }
}

function BrowseForEvent(EventIDControl, EventTitleControl, EventTitleArControl) {
    var ret;

    ret = popupwindow('../Utilities/EventsBrowser.aspx', 1000, 610);
    if (ret != 'no') {
        EventIDControl.SetText(ret[0]);

        if (EventTitleControl != null) { EventTitleControl.SetText(ret[1]); }
        if (EventTitleArControl != null) { EventTitleArControl.SetText(ret[2]); }    
    }
}


function BrowseForVideoFile(i, j) {
    var pk;
    var ret;
    pk = grid.GetRowKey(i);

    ret = popupwindow('../Utilities/FileBrowser.aspx?RetURL=yes&ext=.flv,.mp4&ID=' + pk + '&type=' + j, 830, 575);
    if (ret != 'no' && ret != null) //File Selected
    {
        grid.PerformCallback(pk + ';' + ret + ';' + j);
    }
}



function BrowseForAdvertFile(i, j) {
    var pk;
    var ret;
    pk = grid.GetRowKey(i);

    ret = popupwindow('../Utilities/FileBrowser.aspx?RetURL=yes&ext=.png,.jpg,.gif&ID=' + pk + '&type=' + j, 830, 575);
    if (ret != 'no' && ret != null) //File Selected
    {
        grid.PerformCallback(pk + ';' + ret + ';' + j);
    }
}




function SendEmail(_EventTitle, _EventURL) {
    ret = popupwindow('../Utilities/SendEmail.aspx?EventTitle=' + _EventTitle + '&EventURL=' + _EventURL, 400, 250);
}

function Share(_EventID) {
    ret = popupwindow('../Utilities/Share.aspx?EventID=' + _EventID , 400, 250);
}

function Forget() {
    ret = popupwindow('../Utilities/Forgetpass.aspx', 350, 170);
}

function ChangePassword() {
    ret = popupwindow('../Utilities/Changepass.aspx', 350, 270);
}
