var i = 0, minimizedWidth = new Array, minimizedHeight = new Array, windowTopPos = new Array, windowLeftPos = new Array, panel, id; function adjustFullScreenSize() { $(".fullSizeWindow .wincontent").css("width", (window.innerWidth - 32)); $(".fullSizeWindow .wincontent").css("height", (window.innerHeight - 98)); } function makeWindowActive(thisid) { $(".window").each(function() { $(this).css('z-index', $(this).css('z-index') - 1); }); $("#window" + thisid).css('z-index',1000); $(".window").removeClass("activeWindow"); $("#window" + thisid).addClass("activeWindow"); $(".taskbarPanel").removeClass('activeTab'); $("#minimPanel" + thisid).addClass("activeTab"); } function minimizeWindow(id){ windowTopPos[id] = $("#window" + id).css("top"); windowLeftPos[id] = $("#window" + id).css("left"); $("#window" + id).animate({ top: 800, left: 0 }, 200, function() { //animation complete $("#window" + id).addClass('minimizedWindow'); $("#minimPanel" + id).addClass('minimizedTab'); $("#minimPanel" + id).removeClass('activeTab'); }); } function openWindow(id) { if ($('#window' + id).hasClass("minimizedWindow")) { openMinimized(id); } else { makeWindowActive(id); $("#window" + id).removeClass("closed"); $("#minimPanel" + id).removeClass("closed"); } } function closeWindwow(id) { $("#window" + id).addClass("closed"); $("#minimPanel" + id).addClass("closed"); } function openMinimized(id) { $('#window' + id).removeClass("minimizedWindow"); $('#minimPanel' + id).removeClass("minimizedTab"); makeWindowActive(id); $('#window' + id).animate({ top: windowTopPos[id], left: windowLeftPos[id] }, 200, function() { }); } $(document).ready(function(){ $(".window").each(function() { // window template $(this).css('z-index',1000) $(this).attr('data-id', i); minimizedWidth[i] = $(this).width(); minimizedHeight[i] = $(this).height(); windowTopPos[i] = $(this).css("top"); windowLeftPos[i] = $(this).css("left"); $("#taskbar").append('
'); if ($(this).hasClass("closed")) { $("#minimPanel" + i).addClass('closed'); } $(this).attr('id', 'window' + (i++)); $(this).wrapInner(''); $(this).prepend('