function ebusteHideError() { var msgobj = $("eb_dynMsg"); msgobj.style.display = "none"; } function showLoading() { ebusteHideError(); centerPop('eb_loading'); $('eb_loading').style.display = 'block'; } function showCache(cid, cparams) { if (!cid) var cid = 'eb_cache'; if (!$(cid)) { // creer le cache var objBody = $$('body')[0]; objBody.insert(''); } var cachedisp = getStyle(cid, 'display'); // if ($('cache').style.display == 'none') { if (cachedisp == 'none') { //var ifr = $('iframe'); var docSize = getPageSize(); //window.onresize = resizeCache; oO.connect(window, 'resize', oO.resizeCache, false, false); $(cid).style.width = docSize.pageWidth+'px'; $(cid).style.height = docSize.pageHeight+'px'; if (!cparams) cparams = '{ duration: 0.5, to: 0.45 }'; $(cid).appear(cparams.evalJSON()); return true; } } function hideCache(cacheid, cparams) { if (!cparams) $(cacheid).style.display = 'none'; } function showPop(idpop, dparams, cacheid, cparams) { if (!idpop) idpop = 'fenpop'; if (!cacheid) var cacheid = 'eb_cache'; if (showCache(cacheid, cparams)) $(cacheid).observe('click', (function() { hidePop(idpop); }).bind($(cacheid))); centerPop(idpop); oO.connect(window, 'resize', oO.centerPop, false, idpop); oO.connect(window, 'scroll', oO.centerPop, false, idpop); //$(idpop).style.position = 'fixed'; $(idpop).style.display ='block'; } function hidePop(idpop, dparams, cacheid, cparams) { if (!idpop) idpop = 'fenpop'; if (!cacheid) cacheid = 'eb_cache'; hideCache(cacheid, cparams); if (!dparams) $(idpop).style.display ='none'; else $(idpop).fade(dparams.evalJSON()); } var oO = { connect: function(oElem, sEvType, fn, bCapture, param) { oO.p = param; //alert(); return document.addEventListener ? oElem.addEventListener(sEvType, fn, bCapture): oElem.attachEvent ? oElem.attachEvent('on' + sEvType, fn): false; }, resizeCache: function() { var docSize = getPageSize(); $('eb_cache').style.width = docSize.pageWidth+'px'; $('eb_cache').style.height = docSize.pageHeight+'px'; }, centerPop: function() { centerPop(oO.p); } }; /* utils */ function centerPop(idpop) { var offset = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; var ps = getPageSize(); var dim = $(idpop).getDimensions(); var top = parseInt(ps.windowHeight / 2) - parseInt(dim.height / 2) + offset; var left = parseInt(ps.windowWidth / 2) - parseInt(dim.width / 2); $(idpop).style.marginLeft = '0px'; $(idpop).style.top = top+'px'; $(idpop).style.left = left+'px'; } /* recup sur http://forum.alsacreations.com/topic.php?pid=33283&tid=3686&fid=5&p=1 */ function getStyle(el, styleProp) { var x = document.getElementById(el); if (window.getComputedStyle) {// Mozilla var y = window.getComputedStyle(x,null).getPropertyValue(styleProp); } else if (x.currentStyle) {// Explorer 6 if (styleProp!='clip') { while (styleProp.indexOf('-') != -1) { // clear '-' and UpperCase first next letters : background-color => backgroundColor var letter = styleProp.charAt(styleProp.indexOf('-')+1); styleProp = styleProp.replace(/-\S{1}/,letter.toUpperCase()); } var y = eval('x.currentStyle.' + styleProp); } else { // Return clip style in mozilla format : rect(top,right,bottom,left) ctop=x.currentStyle.clipTop; cright=x.currentStyle.clipRight; cbottom=x.currentStyle.clipBottom; cleft=x.currentStyle.clipLeft; y='rect('+ctop+','+cright+','+cbottom+','+cleft+')'; } } return y; } // from window.js Copyright (c) 2006 Sébastien Gruhier (http://xilinus.com, http://itseb.com) function getPageSize(parent){ parent = parent || document.body; var windowWidth, windowHeight; var pageHeight, pageWidth; if (parent != document.body) { windowWidth = parent.getWidth(); windowHeight = parent.getHeight(); pageWidth = parent.scrollWidth; pageHeight = parent.scrollHeight; } else { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = document.body.scrollWidth; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } if (self.innerHeight) { // all except Explorer windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth) { pageWidth = windowWidth; } else { pageWidth = xScroll; } } return {pageWidth: pageWidth ,pageHeight: pageHeight , windowWidth: windowWidth, windowHeight: windowHeight}; }