
SAPO.Exception=function(className)
{if(className){this.init(className);}};SAPO.Exception.prototype={init:function(className)
{try{this.uri='http://services.sapo.pt/Broker/JSExceptionLog';this.errorHandle=false;this.script=false;this.stoReq=false;this.timeoutToClear=3000;this.className=className||false;}catch(e){}},log:function(errorHandle,method)
{return;var errorObj=this.parseErrorHandle(errorHandle);var queryString='';queryString+='?type='+encodeURIComponent(errorObj.type);if(errorObj.className){if(method&&typeof(method)!='undefined'){queryString+='&class='+encodeURIComponent(errorObj.className+'->'+method);}else{queryString+='&class='+encodeURIComponent(errorObj.className);}}
if(errorObj.url){queryString+='&url='+encodeURIComponent(errorObj.url);}
if(errorObj.message){queryString+='&message='+encodeURIComponent(errorObj.message);}
if(errorObj.name){queryString+='&name='+encodeURIComponent(errorObj.name);}
if(errorObj.line){queryString+='&line='+encodeURIComponent(errorObj.line);}
if(errorObj.file){queryString+='&file='+encodeURIComponent(errorObj.file);}
if(errorObj.stack){queryString+='&stack='+encodeURIComponent(errorObj.stack);}
var uri=this.uri+queryString+'&randNum='+Math.round(1000000*Math.random());this.createScriptTag(uri);return(false);},parseErrorHandle:function(errorHandle)
{var errorObj={type:false,className:this.className||false,url:location.href,message:false,name:false,line:false,stack:false,file:false,creation:false};if(typeof(errorHandle)=='string'){errorObj.type='application';errorObj.message=errorHandle;}else if(typeof(errorHandle)=='object'){errorObj.type='library';if(typeof(errorHandle.name)!='undefined'){errorObj.name=errorHandle.name;}
if(typeof(errorHandle.message)!='undefined'){errorObj.message=errorHandle.message;}
if(typeof(errorHandle.line)!='undefined'||typeof(errorHandle.lineNumber)!='undefined'||typeof(errorHandle.number)!='undefined'){errorObj.line=errorHandle.line||errorHandle.lineNumber||errorHandle.number;}
if(typeof(errorHandle.sourceURL)!='undefined'||typeof(errorHandle.fileName)!='undefined'){errorObj.file=errorHandle.sourceURL||errorHandle.fileName;}
if(typeof(errorHandle.stack)!='undefined'){errorObj.stack=errorHandle.stack;}}
return errorObj;},createScriptTag:function(uri)
{try{this.script=document.createElement('SCRIPT');this.script.type='text/javascript';this.script.src=uri;this.script.charset='utf-8';document.getElementsByTagName('HEAD')[0].appendChild(this.script);this.callBack();}catch(e){}},removeScriptTag:function()
{if(this.script){this.script.parentNode.removeChild(this.script);this.script=null;}},callBack:function()
{this.stoReq=setTimeout(function(){this.removeScriptTag();if(this.stoReq){clearTimeout(this.stoReq);}}.bindObj(this),this.timeoutToClear);}};