function DynamicAd(B,A){this.id=B;this.container=null;this.disabled=false;this.req=null;this.timer=null;this.options=A||{};this.url=this.options.url||"/geo/DynamicAd/index.html";this.width=this.options.width||null;this.height=this.options.height||null;this.initialize()}DynamicAd.prototype.initialize=function(){this.container=$(this.id);if(!this.container){this.disabled=true;return }this.req=new Ajax(this.url,{method:"get",update:this.container,autoCancel:true,onComplete:function(){if(!this.response.text.toLowerCase().contains("<iframe")){this.evalScripts()}}})};DynamicAd.prototype.createIframe=function(){var B=this.container.getSize();var F=this.container.id;var E=this.container.className;var D=(this.width)?this.width:B.size.x;var A=(this.height)?this.height:B.size.y;var C=new Element("iframe",{id:F,"class":E,src:"",width:D,height:A,scrolling:"no",frameborder:"0",border:"0",styles:{border:"0"}});this.container.replaceWith(C);this.container=C};DynamicAd.prototype.request=function(B,A){if(this.disabled){return }this.stopRequest();if(A&&A>0){this.timer=this.startRequest.delay(A,this,[B])}else{this.startRequest(B)}};DynamicAd.prototype.startRequest=function(B){var A=this.url+"?"+Object.toQueryString(B);if(this.container.tagName.toLowerCase()!="iframe"){this.createIframe(A)}if(this.container.tagName.toLowerCase()=="iframe"){this.container.src=A}else{this.req.request(B)}};DynamicAd.prototype.stopRequest=function(){if(this.timer){$clear(this.timer)}if(this.req){this.req.cancel()}};
