var WindowManager = function(group)
{
    var curWindowID;
    var lastWindow;
    this.show = function(id,x,y)
    {
    	//fade first, queue up the 2nd
        if(x && y) Utility.setBounds(id,x,y);
        this.lastWindow = this.curWindowID;
        this.curWindowID = id;
        if(this.lastWindow != this.curWindowID)
        {
        	//this.lastWindow ? Utility.fadeInOut(this.curWindowID,this.lastWindow) : Utility.fadeIn(this.curWindowID);
        	this.lastWindow ? Utility.swap(this.lastWindow,this.curWindowID) : Utility.turnOn(this.curWindowID);
        }
    }
    this.hide = function()
    {
        if(this.curWindowID) Utility.fadeOut(this.curWindowID);
        this.curWindowID = null;
    }
    this.swap = function(id1,id2,group,x1,y1,x2,y2)
    {
        if(x1 && y1 && x2 && y2)
        {
            Utility.setBounds(id1,x1,y1);
            Utility.setBounds(id2,x2,y2);
        }
        this.lastWindow = this.curWindowID;
        this.curWindowID = id2;
        if(this.lastWindow != this.curWindowID)
        {
            Utility.fadeInOut(id2,id1);
        } 
    }
    this.setDefault = function(id)
    {
        this.curWindowID = id;
        $(this.curWindowID).style.display = "block";
        
    }
}

var Modal = new WindowManager();
