﻿
/*
* Pop up message based on JQuery UI Dialog
* http://www.logomark.com/
*
* Author:		Witt
* Create date:  2010-01-08
* Description:	
*/

function messagebox(msg, stitle) {

    // Message content
    if ((!msg) || (msg == "")) {
        return;
    }
    
    // add login link
    var url = $("#stploginurl").attr("value");
    if ((url) && (url != "")) {
        msg = msg.replace('login', '<a href="' + url + '">login</a>');
    }
    
    $(".msgpnl").html(
        '<div class="messagebox">\
            <p>' + msg + '</p>\
        </div>');

    // Message title
    var tit = "99 Cent Promos";
    if ((stitle) && (stitle != "")) {
        tit = stitle;
    }

    
    $(".messagebox").dialog({
        bgiframe: true,
        modal: true,
        title: tit,
        width: 400,
        overlay: {opacity: 0.5, background: "black" },
		show:"clip",
		hide:"clip",
		autoResize:true,
        buttons: {
            Ok: function() {
                $(this).dialog('close');
            }
        }
    });
}

function messageboxrd(msg, stitle, url) {
    // Message content
    if ((!msg) || (msg == "")) {
        return;
    }
    $(".msgpnl").html(
        '<div class="messagebox">\
            <p>' + msg + '</p>\
        </div>');

    // Message title
    var tit = "99centpromos.com";
    if ((stitle) && (stitle != "")) {
        tit = stitle;
    }

    $(".messagebox").dialog({
        bgiframe: true,
        modal: true,
        title: tit,
        width: 400,
        overlay: { opacity: 0.5, background: "black" },
        show: "clip",
        hide: "clip",
        autoResize: true,
        buttons: {
            Ok: function() {
                $(this).dialog('close');
            }
        },
        close: function(event, ui) {
            window.location.replace(url);
        }
    });
}	
