utf8Decode=function(ia){var ja=new Array();var ka=0;var la='';var j=0;while((ka=ia.search(/[^\x00-\x7F]/))!=-1){la=ia.match(/([^\x00-\x7F]+[\x00-\x7F]{0,10})+/)[0];ja[j++]=ia.substr(0,ka)+this._utf8Decode(la);ia=ia.substr(ka+la.length);}
ja[j++]=ia;return ja.join('');}
_utf8Decode=function(ma){var na=new Array();var oa,code2,code3,code4,j=0;for(var i=0;i<ma.length;){oa=ma.charCodeAt(i++);if(oa>127)code2=ma.charCodeAt(i++);if(oa>223)code3=ma.charCodeAt(i++);if(oa>239)code4=ma.charCodeAt(i++);if(oa<128)na[j++]=String.fromCharCode(oa);else if(oa<224)na[j++]=String.fromCharCode(((oa-192)<<6)+(code2-128));else if(oa<240)na[j++]=String.fromCharCode(((oa-224)<<12)+((code2-128)<<6)+(code3-128));else na[j++]=String.fromCharCode(((oa-240)<<18)+((code2-128)<<12)+((code3-128)<<6)+(code4-128));}
return na.join('');}
JsFrameBase.prototype.ALLOW_FIREBUG=false;JsFrameBase.prototype.TRACE_ERROR="error";JsFrameBase.prototype.TRACE_WARNING="warning";JsFrameBase.prototype.TRACE_DEBUG="debug";JsFrameBase.prototype.nextZIndex=20000;JsFrameBase.prototype.className="JsFrameBase";function JsFrameBase(pa){this.idFrame;this.frameContainer;this.frame;this.isHtmlTextDirty=false;this._useIframe=true;this.getUseIframe=function(){return this._useIframe;}
this.setUseIframe=function(qa){if(this.frame&&this._useIframe!=qa){this.exitDom();this._useIframe=qa;this.enterDom();}
else this._useIframe=qa;}
this._location="";this.getLocation=function(){return this._location;}
this.setLocation=function(ra){ra=unescape(ra);if(ra&&ra!=""&&ra!=this._location){this.trace("location set to "+ra);this.isHtmlTextDirty=true;this._htmlText="";this._location=ra;this.setUseIframe(true);this.applyFrameProperties();}}
this._htmlText="";this.getHtmlText=function(){return this._htmlText;}
this.setHtmlText=function(sa){sa=unescape(sa);if(sa&&sa!=""&&sa!=this._htmlText){this.trace("htmlText set to "+sa);this.isHtmlTextDirty=true;this._htmlText=sa;this._location="";this.setUseIframe(false);this.applyFrameProperties();}}
this._visible=true;this.getVisible=function(){return this._visible;}
this.setVisible=function(ta){this._visible=ta;this.applyFrameProperties();}
this.getVisibility=function(){if(this._visible==true||this._visible=="true")return "visible";else return "hidden";}
this._x=0;this.getX=function(){return this._x;}
this.setX=function(ua){this._x=ua;this.applyFrameProperties();}
this._y=0;this.getY=function(){return this._y;}
this.setY=function(va){this._y=va;this.applyFrameProperties();}
this._width=100;this.getWidth=function(){return this._width;}
this.setWidth=function(wa){this._width=wa;this.applyFrameProperties();}
this._height=100;this.getHeight=function(){return this._height;}
this.setHeight=function(xa){this._height=xa;this.applyFrameProperties();}
this.JsFrameBase=function(pa){this.trace("constructor - id: "+this.idFrame);this.idFrame=pa;}
this.redraw=function(){this.isHtmlTextDirty=true;this.applyFrameProperties();}
this.trace=function(ya,za){if(this.ALLOW_FIREBUG==true&&typeof console!="undefined"){try{switch(za){case this.TRACE_ERROR:console.error(this.className+" - "+this.idFrame+": ",ya);break;case this.TRACE_WARNING:console.warning(this.className+" - "+this.idFrame+": ",ya);break;default:console.log(this.className+" - "+this.idFrame+": ",ya);}}
catch(e){}}
else{}}
this.enterDom=function(){if(!this.frame){this.trace("enterDom "+this.idFrame+" - useIframe = "+this.getUseIframe());if(!$('#frameContainer').length)$('body').append('<div style="position: absolute; z-index: '+(this.nextZIndex++)+'" id="frameContainer"></div>');JsFrameBase.frameContainer=$('#frameContainer');var Aa;if(this.getUseIframe()==true)Aa=$('<iframe frameborder="0" style="position: absolute; z-index: '+(this.nextZIndex++)+'; background-color:transparent; border-width:0" id="'+this.idFrame+'">');else Aa=$('<div style="overflow: auto; position: absolute; z-index: '+(this.nextZIndex++)+'; border: 0px; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px;" id="'+this.idFrame+'" >');$('#frameContainer').append(Aa);this.frame=Aa[0];var Ba=this;setTimeout(function(){Ba.applyFrameProperties();},1);}
else{throw(new Error("enterDom - The frame is allready in the DOM: "+pa));}}
this.applyFrameProperties=function(){if(this.frame){if(this.frame.style.position!="absolute")this.frame.style.position="absolute";if(this.frame.style.top!=this.getY()+"px")this.frame.style.top=this.getY()+"px";if(this.frame.style.visibility!=this.getVisibility()){this.frame.style.visibility=this.getVisibility();}
if(this.frame.style.left!=this.getX()+"px")this.frame.style.left=this.getX()+"px";if(this.frame.style.width!=this.getWidth()+"px")this.frame.style.width=this.getWidth()+"px";if(this.frame.style.height!=this.getHeight()+"px")this.frame.style.height=this.getHeight()+"px";if(this.getUseIframe()==true){if(this.isHtmlTextDirty&&this.frame.src!=this.getLocation()){this.frame.src=this.getLocation();this.isHtmlTextDirty=false;}}
else{if(this.isHtmlTextDirty){this.frame.innerHTML=utf8Decode(this.getHtmlText());this.isHtmlTextDirty=false;}}}}
this.exitDom=function(){if(this.frame){this.trace("exitDom "+this.idFrame);$("#"+this.idFrame).remove();delete this.frame;this.frame=undefined;}
else{this.trace("exitDom error: was not in the dom",this.TRACE_WARNING);}}
this.unload=function(){this.exitDom();}
this.JsFrameBase(pa);}
function initJsFrameResize(Ca){JsFrameBase.resizeSwfId=Ca;}
function onFrameResize(){if(JsFrameBase.resizeSwfId){$ha="silex.interpreter.resizeAllAsFrames:"+$("#"+JsFrameBase.resizeSwfId).width()+","+$("#"+JsFrameBase.resizeSwfId).height()+","+$(window).width()+","+$(window).height();document.getElementById(JsFrameBase.resizeSwfId).SetVariable("silex_exec_str",$ha);}}$(window).resize(onFrameResize);$(document).ready(function(){$(window).resize(onFrameResize);});function addJsFrame(Da){if(!JsFrameBase.jsFrames)JsFrameBase.jsFrames=new Array();if(JsFrameBase.jsFrames[Da]){throw(new Error("addJsFrame - The frame id was allready defined: "+Da));}
JsFrameBase.jsFrames[Da]=new JsFrameBase(Da);return JsFrameBase.jsFrames[Da];}
function getJsFrame(Ea){return JsFrameBase.jsFrames[Ea];}
function removeJsFrame(Fa){JsFrameBase.jsFrames[Fa].unload();delete JsFrameBase.jsFrames[Fa];}
