﻿var urlParams = {};
(function () {
    var e,
        a = /\+/g,  // Regex for replacing addition symbol with a space
        r = /([^&=]+)=?([^&]*)/g,
        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
        q = window.location.search.substring(1);

    while (e = r.exec(q))
        urlParams[d(e[1])] = d(e[2]);
})();

$(document).ready(function(){
    if (urlParams["msg"])
    {
        $("#message").show();
        $("#message").text(urlParams["msg"]);
        $("#message").addClass("notifytext");
    }
    else
    {
        $("#message").hide();
    }
});

function spawn( where, width, height ) 
{
	if( window.screen ) 
	{
		spawnWindow = window.open( where, "spawn", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,copyhistory=0,width=" + width + " ,height=" + height + " ,top=" + ( (screen.availHeight / 2) -  (height / 2) ) + ",left=" + ( (screen.availWidth / 2) - (width / 2) ) );
	} else {                        
		spawnWindow = window.open( where, "spawn", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,copyhistory=0,width=" + width + " ,height=" + height);
	}
	if( window.focus ) 
	{
		while( !spawnWindow.focus ) {}
		spawnWindow.focus();
	}
}
