/**
 * doijs package
 * 
 * @author donna iwan setiawan
 * @version 1.1 release 6
 * copyright - (c) 2007 - 2010 donna iwan setiawan
 * license - GPL version 3 or any later version <http://www.gnu.org/licenses/gpl-3.0.txt>
 */
doi.widget.overlay=function(){var g=arguments[0]||{},h,n=doi.widget.instance.save(this),l=this,a,f,d=g.zIndex||99999,c=false,k=7,j="doi-widget-overlay",e,i,m=false;if(doi.dom.isDefined(g.animated)){g.animated=!!(g.animated)}else{g.animated=false}function b(){if(doi.browser.msie){if(doi.browser.version<7){doi.dom.style([l.element(),l.iframe()],{position:"absolute",top:"0px",left:"0px"})}a=window.setInterval(function(){var o=doi.dom.screen.width()+doi.dom.parseInt(doi.dom.getStyle(document.body,"margin-left"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"margin-right"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"padding-left"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"padding-right"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"border-left"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"border-right"));var p=doi.dom.screen.height()+doi.dom.parseInt(doi.dom.getStyle(document.body,"margin-top"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"margin-bottom"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"padding-top"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"padding-bottom"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"border-top"))+doi.dom.parseInt(doi.dom.getStyle(document.body,"border-bottom"));var q=doi.dom.dimension.client();o=(q.width<o)?o:q.width;p=(q.height<p)?p:q.height;doi.dom.style([l.element(),l.iframe()],{width:o+"px",height:p+"px"});e=o;i=p},2000)}}this.element=function(){var o=false;switch(arguments[0]){case"iframe":o=doi.dom.$("#"+n+"-frame");break;default:o=doi.dom.$("#"+n)}return o};this.height=function(){return i};this.hide=function(){if(!c){return}var o=k;var p=arguments[0]||{};if(g.animated){window.clearInterval(f);f=window.setInterval(function(){o--;if(o<0){window.clearInterval(f);window.clearInterval(a);doi.dom.style([h,l.iframe()],"visibility:hidden;opacity:0;width:100%;height:100%;");c=false;if(p.hide&&doi.dom.isFunction(p.hide)){p.hide()}}doi.dom.style(h,{opacity:o})},10)}else{window.clearInterval(a);doi.dom.style([h,l.iframe()],"visibility:hidden;opacity:0;width:100%;height:100%;");c=false;if(p.hide&&doi.dom.isFunction(p.hide)){p.hide()}}};this.id=function(){return n};this.iframe=function(){return doi.dom.$("#"+n+"-frame")};this.render=function(){var q=document.createElement("div");document.body.insertBefore(q,document.body.lastChild);q.id=n;doi.dom.className(q,j);h=q;doi.dom.style(h,{visibility:"hidden",opacity:0,zIndex:d,position:"fixed",top:"0px",left:"0px",width:"100%",height:"100%",display:"block"});if(doi.browser.msie){doi.dom.style(h,{position:"absolute"});if(doi.browser.version<7){var p='<iframe id="'+n+'-frame" frameborder="0" scrolling="no"></iframe>';var o=document.createElement("div");o.innerHTML=p;p=o.childNodes[0];q.parentNode.insertBefore(p,q);doi.dom.style(p,{position:"absolute",display:"block",visibility:"hidden",top:"0px",left:"0px",width:"0px",height:"0px",zIndex:d-1})}}doi.event.add(h,"click",function(){if(!m&&l.onOverlayClick&&doi.dom.isFunction(l.onOverlayClick)){l.onOverlayClick();m=true}})};this.show=function(){if(c){return}m=false;b();var r=doi.dom.getStyle(h,"background-color");if(r=="transparent"||r=="rgba(0, 0, 0, 0)"){doi.dom.style(h,"background:black")}var q=0;var o=k;var p=arguments[0];doi.dom.style([h,l.iframe()],"visibility:visible");if(g.animated){f=window.setInterval(function(){q++;if(q>o){window.clearInterval(f);f=false;if(p&&p.show&&doi.dom.isFunction(p.show)){p.show()}return}doi.dom.style(h,{opacity:q})},10)}else{doi.dom.style(h,{opacity:k});if(p.show&&doi.dom.isFunction(p.show)){p.show()}}if(doi.dom.isObject(arguments[0])){if(arguments[0].click&&doi.dom.isFunction(arguments[0].click)){l.onOverlayClick=arguments[0].click}}c=true};this.width=function(){return e};this.zIndex=function(){return d}};
