top.errno=-1;top.alertError=function(){alert(errno);}
String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");};String.prototype.hashCode=function(){var result=0;for(var i=0;i<this.length;i++){result+=Math.pow(this.charCodeAt(i)*31,this.length-(i+1));}
return result;}
Array.prototype.moveBack=function(index){for(var i=index;i<this.length-1;i++){this[i]=this[i+1];}
this[i]=null;this.length--;}
Array.prototype.moveFoward=function(index){for(var i=this.length;i>index;i--){this[i]=this[i-1];}}
Array.prototype.push=function(){for(var i=0;i<arguments.length;i++){this[this.length]=arguments[i];}
return this.length;}
Array.prototype.pop=function(){return this[this.length];}
Object.prototype.Class=null;Object.prototype.extendedClass="";Object.prototype.implementedClasses=new Array();Object.prototype.equals=function(o){return(this==o);}
Object.prototype.hashCode=function(){return this.toString().hashCode();}
Object.prototype.getClass=function(){return(this.Class==null)?this.constructor:this.Class;}
Object.prototype.getClassName=function(){var sClass=this.getClass().toString();return(sClass.substring(9,sClass.indexOf("(")).trim());}
Object.prototype.addGProp=function(sName,vValue){this[sName]=vValue;var sFuncName=sName.charAt(0).toUpperCase()+sName.substring(1,sName.length);this["get"+sFuncName]=function(){return this[sName];};this["set"+sFuncName]=function(vNewValue){this[sName]=vNewValue;};}
Object.prototype.addTProp=function(sName,vValue,cClass){var sType=(typeof vValue);if(sType=="undefined"&&!cClass){alert("The initial value of property "+sName+" must be set.");return false;}
if(cClass){if(!(vValue instanceof cClass)&&vValue!=null){alert("The initial value assigned is not an instance of class informed.");return false;}}
this[sName]=vValue;var sFuncName=sName.charAt(0).toUpperCase()+sName.substring(1,sName.length);this["get"+sFuncName]=function(){return this[sName];};this["set"+sFuncName]=function(vNewValue){if((typeof vNewValue)!=sType){alert("Property "+sName+" must be of type "+sType+".");return;}
if(cClass){if(sType=="object"){if(!(vNewValue instanceof cClass)){var className=cClass.toString().substring(9,cClass.toString().indexOf("("));alert("New value assigned is not from class "+className);return;}}}
this[sName]=vNewValue;};}
Object.prototype.addFProp=function(sName,vValue){var sType=(typeof vValue);if(sType=="undefined"){alert("The initial value of property "+sName+" must be set.");return;}
this[sName]=vValue;var sFuncName=sName.charAt(0).toUpperCase()+sName.substring(1,sName.length);this["get"+sFuncName]=function(){return this[sName];};this["set"+sFuncName]=function(vNewValue){alert("The property "+sName+" is set to final and cannot have its value changed.");};}
top.check=false;top.extensionErrors=new Array();top.implementationErrors=new Array();top.abstractionErrors=new Array();top.implementsClassList=new Array(new Array(),new Array());top.extendsClassList=new Array(new Array(),new Array());Object.prototype.extendss=function(sSuper){if(!top.checkExtension(this)){return(false);}
top.prepareExtension(this.getClassName(),sSuper);this.extendedClass=sSuper;return(true);}
top.checkExtension=function(oToCheck){if(top.check){if(oToCheck.extendedClass!=""){top.extensionErrors.push("The Class '"+oToCheck.getClassName()+"' is calling 'extendss' more than once");return(false);}}
return(true);}
top.prepareExtension=function(sSub,sSuper){for(var i=0;i<top.extendsClassList[0].length;i++){if(top.extendsClassList[1][i]==sSub){top.extendsClassList[0].moveFoward(i);top.extendsClassList[0][i]=sSub;top.extendsClassList[1].moveFoward(i);top.extendsClassList[1][i]=sSuper;return;}}
top.extendsClassList[0].push(sSub);top.extendsClassList[1].push(sSuper);}
top.extendsAll=function(){var cSub,cSuper,p;for(var i=0;i<top.extendsClassList[0].length;i++){cSub=eval(top.extendsClassList[0][i]);cSuper=eval(top.extendsClassList[1][i]);p=cSub.prototype;cSub.prototype=new cSuper();cSub.prototype.Class=p.constructor;cSub.extendedClass=top.extendsClassList[1][i];}
top.checkAbstraction();}
Object.prototype.implementss=function(){if(!top.checkImplementations(this,implementss.arguments)){return(false);}
this.implementedClasses=implementss.arguments;top.prepareImplementation(this.getClassName(),implementss.arguments);return(true);}
top.checkImplementations=function(o,a){if(top.check){if(o.implementedClasses.length>0){top.implementationErrors.push("The Class '"+o.getClassName()+"' is calling 'implementss' more than once");return(false);}
for(var i=0;i<a.length;i++){for(var j=i+1;j<a.length;j++){if(a[i]==a[j]){top.implementationErrors.push("The Class '"+o.getClassName()+"' is trying to implement the same class more than once");return(false);}}}}
return(true);}
top.prepareImplementation=function(sImplementing,aImplemented){top.implementsClassList[0].push(sImplementing);top.implementsClassList[1].push(aImplemented);}
top.implementsAll=function(){var cImplementing,cImplemented,oImplemented,sImplementing;for(var i=0;i<top.implementsClassList[0].length;i++){cImplementing=eval(top.implementsClassList[0][i]);sImplementing=cImplementing.toString();sPrototype=cImplementing.prototype.constructor.toString();for(var j=0;j<top.implementsClassList[1][i].length;j++){cImplemented=eval(top.implementsClassList[1][i][j]);oImplemented=new cImplemented();for(sProperty in oImplemented){switch(sProperty){case"addGProp":case"addTProp":case"addFProp":case"equals":case"extendss":case"implementss":case"extendedClass":case"implementedClasses":case"getClass":case"getClassName":case"Class":continue;break;default:if(sImplementing.indexOf(sProperty)==-1&&sPrototype.indexOf(sProperty)==-1){eval("cImplementing.prototype."+sProperty+" = oImplemented[sProperty]");}}}
oImplemented=null;}}}
top.checkAbstraction=function(){var cSub,cSuper,sError,sSub,sSuper,oSuper,isAbstract,isMethodEnd,jPosFunction;if(!top.check){return(true);}
for(var i=0;i<top.extendsClassList[0].length;i++){cSub=eval(top.extendsClassList[0][i]);cSuper=eval(top.extendsClassList[1][i]);sSub=cSub.toString();sSuper=cSuper.toString();oSuper=new cSuper();for(sProperty in oSuper){isAbstract=true;isMethodEnd=false;if((typeof oSuper[sProperty])!="function"){continue;}
jPosFunction=sSuper.indexOf("{",sSuper.indexOf(sProperty));for(var j=jPosFunction+1;j<sSuper.length,isAbstract,!isMethodEnd;j++){switch(sSuper.charAt(j)){case' ':case'\n':case'\r':case'\r\n':case'\t':break;case'}':isMethodEnd=true;break;default:isAbstract=false;}}
if(isAbstract){if(sSub.indexOf(sProperty)<0){top.abstractionErrors.push("The abstract method "+sProperty+" in class "+sSuper.substring(9,sSuper.indexOf("("))+" must be overridden in class "+sSub.substring(9,sSub.indexOf("(")));}}}}}
top.alertPreCompilationErrors=function(){var errors;if(!top.check){return(false);}
errors="\nEXTENSION ERRORS:\n\n";for(var i=0;i<top.extensionErrors.length;i++){errors+=top.extensionErrors[i]+"\n";}
alert(errors);errors="\nIMPLEMENTATION ERRORS:\n\n";for(i=0;i<top.implementationErrors.length;i++){errors+=top.implementationErrors[i]+"\n";}
alert(errors);errors="\nABSTRACTION ERRORS:\n\n";for(i=0;i<top.abstractionErrors.length;i++){errors+=top.abstractionErrors[i]+"\n";}
alert(errors);return(true);}
top.setEnvironment=function(){top.implementsAll();top.extendsAll();top.alertPreCompilationErrors();}
top.CLASSPATH="../";top.loadedPackages=new Array();top.importt=function(s,f){if(top.isPackageLoaded(s)){return(false);}
if(!f){f=top;}
var head=f.document.getElementsByTagName("head").item(0);var script=f.document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",top.CLASSPATH+s.replace(/\./g,"/").replace("*","Package")+".js");head.appendChild(script);return(true);}
top.isPackageLoaded=function(sImport){for(var i=0;i<top.loadedPackages.length;i++){if(top.loadedPackages[i]==sImport){return(true);}}
top.loadedPackages.push(sImport);return(false);}
top.getObj=function(sId,oFr){if(!oFr){oFr=top;}
try{if(eval("oFr."+sId)){return(eval("oFr."+sId));}}catch(e){}
try{if(document.all){return(oFr.document.all[sId]);}else if(document.getElementById){if(oFr.document.getElementById(sId)!=null){return(oFr.document.getElementById(sId));}}}catch(e){}
try{if(oFr.document.forms.length>0){for(var i=0;i<oFr.document.forms.length;i++){for(var j=0;j<oFr.document.forms[i].elements.length;j++){if(oFr.document.forms[i].elements[j].name==sId)
return(oFr.document.forms[i].elements[j]);}}}}catch(e){}
return(null);}
top.getInnerHTML=function(sId,oFr){var obj=top.getObj(sId,oFr);try{if(obj.innerHTML){return(obj.innerHTML);}}catch(e){return(null);}}
top.setInnerHTML=function(sId,sNewInnerHTML,oFr){var obj=top.getObj(sId,oFr);try{obj.innerHTML=sNewInnerHTML;return(true);}catch(e){return(false);}}
top.setCookie=function(name,value,expiresOrYear,month,day){if(!expiresOrYear){expiresOrYear=new Date(2100,12,31);}else if(!(expiresOrYear instanceof Date)){expiresOrYear=new Date(expiresOrYear,month,day);}
document.cookie=name+"="+escape(value)+";expires="+expiresOrYear.toGMTString()+"; path=\/";}
top.getCookie=function(name){var cStart,cEnd;name=name+"=";cStart=document.cookie.indexOf(name);if(cStart==-1)return null;cEnd=document.cookie.indexOf(";",cStart+name.length);if(cEnd==-1)cEnd=document.cookie.length;return unescape(document.cookie.substring(cStart+name.length,cEnd));}
top.addEvent=function(o,ev,h){if(o.addEventListener){o.addEventListener(ev,h,true);return true;}else if(o.attachEvent){return o.attachEvent('on'+ev,h);}else{}
return false;}
top.remEvent=function(o,ev,h){if(o.removeEventListener){o.removeEventListener(ev,h,true);return true;}else if(o.detachEvent){return o.detachEvent('on'+ev,h);}else{}
return false;}
top.start=function(){top.setEnvironment();}