function showFadePopup(pUrl, pWidth, pHeight, pTop, pLeft){ //try to find or create popup element var p = document.getElementById('popup') if(!p){ var p = document.createElement('div'); p.setAttribute('id','popup'); //document.getElementsByTagName('body')[0].insertBefore(p, document.getElementsByTagName('body')[0].firstChild); document.getElementsByTagName('body')[0].appendChild(p); } //modify popup element p.style.height = pHeight + 'px'; p.style.width = pWidth + 'px'; p.style.top = (!pTop)?((getWindowHeight() - pHeight) / 2) + 'px':pTop; p.style.left = (!pLeft)?((getWindowWidth() - pWidth) / 2) + 'px':pLeft; //try to find and create background carpet element if(! document.getElementById('carpet')){ var c = document.createElement('div'); c.setAttribute('id','carpet'); //document.getElementsByTagName('body')[0].insertBefore(c, document.getElementsByTagName('body')[0].firstChild); document.getElementsByTagName('body')[0].appendChild(c); } //load content for popup Spry.Utils.setInnerHTML('popup',''); Spry.Utils.updateContent('popup',pUrl,null,{preventScripts:true}); //start fading var efCarpet = new Spry.Effect.Fade('carpet',{from:0,to:80, setup:setupPopup}); var efPopup = new Spry.Effect.Fade('popup',{from:0,to:100, setup:setupPopup}); efCarpet.start(); efPopup.start(); } function hideFadePopup(){ var efPopupClose = new Spry.Effect.Fade('popup',{from:100,to:0,finish:closePopup}); var efCarpetClose = new Spry.Effect.Fade('carpet',{from:80,to:0,finish:closePopup}); efCarpetClose.start(); efPopupClose.start(); } function setupPopup(e,fe){ e.style.diplay = "block"; } function closePopup(e,fe){ e.style.display = "none"; } function getWindowWidth(){ if(document.all){ return document.body.offsetWidth; } else { return window.innerWidth; } } function getWindowHeight(){ if(document.all){ return document.body.offsetHeight; } else { return window.innerHeight; } } function filterByName(ds){ var tf = Spry.$('user_search'); var regExp = new RegExp(tf.value, "i"); var userFilterFunc = function(dataSet, row, rowNumber){ var str = row["givenname"] + ' ' + row["surname"]; if (str && str.search(regExp) != -1){ return row; } return null; } ds.filter(userFilterFunc); } function handleSaveUserResponse(req){ Spry.Utils.setInnerHTML(Spry.$('userForm'),req.xhRequest.responseText); }