var sb={base:(typeof window.sbBase!='undefined')?window.sbBase:'/surebert',colors:{},consol:{log:function(){},write:function(){},error:function(){}},createIfNotExists:function(i,o){if(!window[i]&&o!==null){window[i]=o;}},css:{},included:[],include:function(module){if(module.match(',')){var modules=module.split(',');modules.forEach(function(v){sb.include(v);});return true;}
var mods=module.split('.');var path='',file,unit=sb,m;if(mods[0]=='String'||mods[0]=='Element'||mods[0]=='Array'){unit=window;}
for(m=0;m<mods.length;m++){if(m!==0&&m<mods.length&&mods.length>1){path+='.';}
path+=mods[m];try{unit=unit[mods[m]];}catch(e){}
if(typeof unit=='undefined'){this.included.push(path);file=path.replace(/\./g,"/");if(sb.base!='/surebert/load'){file=file+'.js';}
sb.load(sb.base+'/'+file);}}},load:function(url){var evaled=0;(function(){var load=new sb.ajax({url:url,async:0,method:'get',format:'js',debug:sb.loadDebug?1:0,onResponse:function(r){try{evaled=1;}catch(e){evaled=0;delete e.stack;sb.consol.error(sb.messages[13]+"\nURL: "+url+"\n"+sb.objects.dump(e));}
load=null;}}).fetch();}());return evaled;},math:{},messages:[],onbodyload:[],onleavepage:[],toArray:function(o){var a=[];var len=o.length;for(var x=0;x<len;x++){a.push(o[x]);}
return a;},typeOf:function(o){var type='';if(o===null){return'null';}else if(o instanceof Function){type='function';}else if(o instanceof Array){type='array';}else if(typeof o=='number'){type='number';if(String(o).match(/\./)){type='float';}}else if(typeof o=='string'){type='string';}else if(o===true||o===false){type='boolean';}else{type=(typeof o).toLowerCase();}
if(typeof o=='object'){if(typeof o.typeOf=='function'){type=o.typeOf();}else if(o.nodeType){if(o.nodeType==3){type='textnode';}else if(o.nodeType==1){type='element';}}else if(typeof o.length!='undefined'&&type!='array'){type='sb.nodeList';}}
return type;},uid:0,uniqueID:function(){return'uid_'+(sb.uid+=1);},unixTime:function(){return parseInt(String(new Date().getTime()).substring(0,10),10);},functions:{},utils:{},widget:{},forms:{}};$=function(selector,root){root=root||document;if(typeof selector!='string'){if(typeof selector=='object'&&selector!==null){if(Element.emulated===true&&selector.nodeType&&selector.nodeType==1){var ep=Element.prototype;for(var prop in ep){if(ep.hasOwnProperty(prop)){selector[prop]=ep[prop];}}}else if(typeof selector.typeOf=='function'&&selector.typeOf()=='sb.nodeList'){selector.getElementPrototypes();}}
return selector;}
var nodeList=new sb.nodeList();nodeList.setSelector(selector);if(document.querySelectorAllX){nodeList.add(root.querySelectorAll(selector));}else{$.parseSelectors(nodeList,root);}
if(nodeList.length()===0&&nodeList.selector.match(/^\#[\w-]+$/)){return null;}else if(nodeList.length()==1&&(nodeList.selector.match(/^\#[\w-]+$/)||sb.nodeList.singleTags.some(function(v){return v===nodeList.selector;}))){return nodeList.nodes[0];}else{return nodeList;}};$.parseSelectors=function(nodes,within){within=within||document;var root=[within];var found=[],s=0;var selectors=nodes.selector.split(",");var len=selectors.length;var inheriters=[];for(s=0;s<len;s++){inheriters=selectors[s].split(" ");root=[within];selectors[s].split(" ").forEach(function(selector,k,a){if(selector.indexOf(">")+1){root=$.getElementsByParent(selector);if(k+1==a.length){nodes.add(root);}
return true;}else if(selector.indexOf('[')+1){root=$.getElementsByAttributes(root,selector);if(k+1==a.length){nodes.add(root);}
return true;}else if(selector.indexOf("~")+1){root=$.getElementsBySiblingCombinator(root,selector);if(k+1==a.length){nodes.add(root);}
return true;}else if(selector.indexOf("+")+1){root=$.getElementsByAdjacentSibling(root,selector);if(k+1==a.length){nodes.add(root);}
return true;}else if(selector.indexOf(":")+1){root=$.parsePseudoSelectors(root,selector);if(k+1==a.length){nodes.add(root);}
return true;}else if((selector.indexOf("#")===0&&selector.match(/^\#[\w-]+$/))||selector.match(/\w+\#[\w-]+/)){var element=$.getElementById(selector);if(element){root=(element instanceof Array)?element:[element];if(k+1==a.length){nodes.add(root);}}
return true;}else if(selector.indexOf(".")!==false){var period_pos=selector.indexOf(".");var left_bracket_pos=selector.indexOf("[");var right_bracket_pos=selector.indexOf("]");if(period_pos+1&&!(period_pos>left_bracket_pos&&period_pos<right_bracket_pos)){root=$.getElementsByClassName(selector,root[0]);if(k+1==a.length){nodes.add(root);}
return true;}}
root=$.getElementsByTagName(root,selector);if(k+1==a.length){nodes.add(root);}
return true;});}
return nodes;};$.getElementById=function(selector){var parts=selector.split("#");var element=document.getElementById(parts[1]);return element;};$.getElementsByClassName=function(selector,root){var parts=selector.split('.');var nodes=root.getElementsByTagName(parts[0]||'*');var elements=[],className=parts[1],node,cur_class_name,len=nodes.length,x=0;var rg=RegExp("\\b"+className+"\\b");do{node=nodes[x];cur_class_name=node.className;if(cur_class_name.length&&(cur_class_name==className||rg.test(cur_class_name))){elements.push(node);}
x++;}while(x<len);return elements;};$.getElementsByTagName=function(root,tag){root=(root instanceof Array)?root:[root];var matches=[],len1=root.length,len2,x=0,i=0,nodes,elements;for(x=0;x<len1;x++){nodes=root[x].getElementsByTagName(tag||'*');elements=[];len2=nodes.length;for(i=0;i<len2;i++){elements.push(nodes[i]);}
matches=matches.concat(elements);}
return matches;};$.getElementsByAttributes=function(within,selector){var f=1;var tag,attr,operator,value;if(selector.match(/^(?:(\w*|\*))\[(\w+)([=~\|\^\$\*]?)=?['"]?([^\]'"]*)['"]?\]$/)){tag=RegExp.$1;attr=(typeof sb.nodeList.attrConvert=='function')?sb.nodeList.attrConvert(RegExp.$2):RegExp.$2;operator=RegExp.$3;value=RegExp.$4||'';}
var elements=$.getElementsByTagName(within,tag);within=elements.filter(function(el,k,a){el.attrVal=el.getAttribute(attr,2);if(!el.attrVal){return false;}
switch(operator){case'=':if(el.attrVal!=value){return false;}
break;case'~':if(!el.attrVal.match(new RegExp('(^|\\s)'+value+'(\\s|$)'))){return false;}
break;case'|':if(!el.attrVal.match(new RegExp(value+'-'))){return false;}
break;case'^':if(el.attrVal.indexOf(value)!==0){return false;}
break;case'$':if(el.attrVal.lastIndexOf(value)!=(el.attrVal.length-value.length)){return false;}
break;case'*':if(!(el.attrVal.indexOf(value)+1)){return false;}
break;default:if(!el.getAttribute(attr)){return false;}}
return true;});return within;};$.getNextSibling=function(node){while((node=node.nextSibling)&&node.nodeType!=1){}
return node;};$.getPreviousSibling=function(node){while((node=node.previousSibling)&&node.nodeType!=1){}
return node;};$.getFirstChild=function(node){node=node.firstChild;while(node&&node.nodeType&&node.nodeType==3){node=$.getNextSibling(node);}
return node;};$.getLastChild=function(node){node=node.lastChild;while(node&&node.nodeType&&node.nodeType==3){node=$.getPreviousSibling(node);}
return node;};$.getElementsByParent=function(selector){var tags=selector.split(">");var elements=$.getElementsByTagName([document.body],tags[1]);var rg=new RegExp(tags[0],'i');var nodes=[];var len=elements.length;for(var n=0;n<len;n++){if(rg.test(elements[n].parentNode.nodeName)){elements[n].sbid=sb.uniqueID();nodes.push(elements[n]);}}
return nodes;};$.getElementsBySiblingCombinator=function(within,selector){var parts=selector.split("~");var nodeName=parts[0],siblingNodeName=parts[1],elements=[],x=0,nn;var siblings=$.getElementsByTagName(within,nodeName);var len=siblings.length;for(x=0;x<len;x++){var node=siblings[x];while((node=node.nextSibling)){nn=node.nodeName.toLowerCase();if(nn==nodeName){break;}
if(node.nodeType==1&&nn==siblingNodeName){node.sbid=sb.uniqueID();elements.push(node);}}}
return elements;};$.getElementsByAdjacentSibling=function(within,selector){var parts=selector.split("+");var nodeName=parts[0];var adjacentNodeName=parts[1].toUpperCase();var elements=$.getElementsByTagName([document.body],nodeName);elements=(!elements.length)?[elements]:elements;var nodes=[],x=0,node,len=elements.length;for(x=0;x<len;x++){node=$.getNextSibling(elements[x]);if(node&&node.nodeName==adjacentNodeName){nodes.push(node);}}
return nodes;};$.parsePseudoSelectors=function(within,selector){var nth,notSelector,elements=[],parts=selector.split(":");selector=parts[0];var pseudo=parts[1];var nodes=$.getElementsByTagName(within,selector);var parentNode;nodes.forEach(function(node,k,a){switch(pseudo){case'before':var bf=new sb.element({nodeName:'span',innerHTML:'ddd'}).appendToTop(node);elements.push(bf);break;case'first-child':if(!$.getPreviousSibling(node)){elements.push(node);}
break;case'last-child':if(!$.getNextSibling(node)){elements.push(node);}
break;case'empty':if(node.innerHTML===''){elements.push(node);}
break;case'only-child':if(!$.getPreviousSibling(node)&&!$.getNextSibling(node)){elements.push(node);}
break;default:if(pseudo.indexOf('not')+1){notSelector=pseudo.match(/not\((.*?)\)/);if(node.nodeName.toLowerCase()!=notSelector[1]){elements.push(node);}}}});return elements;};sb.$=$;sb.browser={ie6:0,getAgent:function(){var opera=new RegExp("opera/(\\d{1}.\\d{1})","i");var safari=new RegExp("safari/(\\d{3})","i");var firefox=new RegExp("firefox/(\\d{1}.\\d{1})","i");var agent=window.navigator.userAgent;var str;if(window.opera&&window.document.childNodes){this.agent='op';str=agent.match(opera);this.version=str[1];}else if(document.all&&!window.XMLHttpRequest&&document.compatMode){this.agent='ie';this.version=6;sb.browser.ie6=1;}else if(document.all&&window.XMLHttpRequest&&document.compatMode){this.agent='ie';this.version=7;}else if(agent.match(firefox)){this.agent='ff';str=agent.match(firefox);this.version=str[1];}else if(agent.match(safari)){str=agent.match(safari);this.agent='sf';if(agent.match(/iphone/i)){this.agent+='_iphone';}else if(agent.match(/ipod/i)){this.agent+='_ipod';}
if(str[1]<400){this.version=1;}else if(str[1]<500){this.version=2;}else if(str[1]<600){this.version=3;}}else{this.agent='other';}
return this.agent;},measure:function(){sb.browser.w=0;sb.browser.h=0;if(typeof window.innerWidth=='number'){sb.browser.w=window.innerWidth;sb.browser.h=window.innerHeight;}else if(window.document.documentElement&&(window.document.documentElement.clientWidth||window.document.documentElement.clientHeight)){sb.browser.w=document.documentElement.clientWidth;sb.browser.h=document.documentElement.clientHeight;}
return[sb.browser.w,sb.browser.h];},init:function(){this.getAgent();this.measure();}};sb.browser.init();sb.objects={serialize:function(o){var str,arr,a=[];sb.objects.forEach.call(o,function(value,prop,object){if(sb.typeOf(value)=='array'){value.forEach(function(v,k){a.push(prop+'[]='+encodeURIComponent(v));});}else if(typeof value=='object'){sb.objects.forEach.call(value,function(v2,k2,o2){if(typeof v2=='object'||sb.typeOf(v2)=='array'){str=sb.objects.serialize(v2);arr=str.split("&");str='';arr.forEach(function(v3,k3,a3){arr[k3]=v3.replace(/(.*?)=(.*?)/g,prop+"['"+k2+"']['$1']=$2");});a.push(arr.join("&"));}else{a.push(prop+"['"+k2+"']="+encodeURIComponent(v2));}});}else{a.push(prop+'='+encodeURIComponent(value));}});return a.join("&");},infuse:function(from,to){to=to||this;from=from||{};sb.objects.forEach.call(from,function(val,prop,o){try{to[prop]=val;}catch(e){}});from=null;return to;},copy:function(o){var copy={};sb.objects.forEach.call(o,function(val,prop,obj){copy[prop]=val;});return copy;},dump:function(o,pre){var prop,str='';sb.objects.forEach.call(o,function(v,p,o){try{str+="\n\n"+p+' = '+v;}catch(e){str+="\n"+p+' = CANNOT PROCESS VALUE!';}});if(!pre){return str;}else{return'<pre style="margin:5px;border:1px;padding:5px;">'+str+'</pre>';}},forEach:function(func){for(var prop in this){if(this.hasOwnProperty(prop)&&!sb.objects[prop]||prop=='infuse'){func(this[prop],prop,this);}}}};sb.nodeList=function(params){for(var prop in params){this[prop]=params[prop];}
this.nodes=[];this.sb_ids={};var nls=this;['forEach','map','filter','every','some','indexOf','lastIndexOf','inArray'].forEach(function(v,k,a){nls[v]=function(func){return nls.nodes[v](func);};});};sb.nodeList.prototype={selector:'',getElementPrototypes:function(){if(Element.emulated){var x,prop,ep=Element.prototype,len=this.nodes.length;for(x=0;x<len;x++){for(prop in ep){this.nodes[x][prop]=ep[prop];}}}},empty:function(){this.nodes=[];},setSelector:function(selector){this.selector=sb.nodeList.cleanSelector(selector);},add:function(nodes){nodes=nodes instanceof Array||(nodes instanceof NodeList||nodes instanceof StaticNodeList)?nodes:[nodes];var len=nodes.length;var prop,x=0,node;var emulated=Element.emulated;var ep=Element.prototype;for(x=0;x<len;x++){node=nodes[x];if(!node.sb_id){node.sb_id=sb.nodeList.sb_id++;}
if(!this.sb_ids[node.sb_id]){if(emulated){for(prop in ep){node[prop]=ep[prop];}}
this.nodes.push(node);this.sb_ids[node.sb_id]=true;}}},drop:function(el){var t=this;el=$(el);this.nodes=t.nodes.filter(function(v){if(sb.typeOf(el)=='sb.element'){return v!=el;}else{return!el.nodes.some(function(v1){return v===v1;});}});this.length=this.nodes.length;return this;},firePerNode:function(func){if(typeof func=='function'){var args=[];var len=arguments.length;for(var x=1;x<len;x++){args.push(arguments[x]);}
this.nodes.forEach(function(node){func.apply(node,args);});}
return this;},length:function(){return this.nodes.length;},styles:function(styles){this.firePerNode(Element.prototype.styles,styles);},typeOf:function(){return'sb.nodeList';}};sb.nodeList.cleanSelector=function(selector){selector=selector.replace(/^\s+/,'');selector=selector.replace(/\s+$/,'');selector=selector.replace(/, /g,',');selector=selector.replace(/\s*([>~\+])\s*/g,"$1");return selector;};sb.nodeList.sb_id=0;sb.nodeList.singleTags=['html','body','base','head','title'];sb.json={};sb.ajax=function(params){if(window.XMLHttpRequest){this.ajax=new XMLHttpRequest();}else{try{this.ajax=new window.ActiveXObject("Microsoft.XMLHTTP");}catch(e3){throw('This browser does not support surebert');}}
sb.objects.infuse(params,this);if(sb.typeOf(params.data)=='object'){this.data=sb.objects.serialize(params.data);}
this.method=params.method||sb.ajax.defaultMethod;var self=this;this.ajax.onreadystatechange=function(){self.onreadystatechange();};};sb.ajax.defaultMethod='post';sb.ajax.defaultFormat='text';sb.ajax.prototype={debug:sb.ajax.debug||0,timeout:0,onreadystatechange:function(){var js='';if(this.ajax.readyState!=4||this.completed==1){return true;}
this.completed=1;if(typeof this.handler=='function'){this.onResponse=this.handler;}
this.contentType=this.ajax.getResponseHeader("Content-Type");this.contentLength=this.ajax.getResponseHeader("Content-Length");if(this.contentLength>this.maxContentLength){if(typeof this.onContentLengthExceeded=='function'){this.onContentLengthExceeded();}
this.ajax.abort();return;}
if(this.format===''){if(this.contentType){if(this.contentType.match('application/json')){this.format='json';}else if(this.contentType.match('text/javascript')){this.format='javascript';}else if(this.contentType.match('text/xml')){this.format='xml';}else if(this.contentType.match('boolean/value')){this.format='boolean';}}else{this.format=sb.ajax.defaultFormat;}}
if(this.debug){this.log("\nHEADERS\nStatus: "+this.ajax.status+"\nStatus Text: "+this.ajax.statusText+"\n"+this.ajax.getAllResponseHeaders()+"\nRESPONSE: \n"+(this.ajax.responseText||'PAGE WAS BLANK ;(')+"\n");}
if(this.onHeaders(this.ajax.status,this.ajax.statusText)===false||this.ajax.status!=200){return false;}
switch(this.format){case'head':if(typeof this.header==='undefined'){this.response=this.ajax.getAllResponseHeaders();}else{this.response=this.ajax.getResponseHeader(this.header);}
break;case'xml':if(this.ajax.responseXML!==null){this.response=this.ajax.responseXML.documentElement;}else{this.log('invalid XML returned');}
break;case'js':js=this.ajax.responseText;break;case'json':js='this.response='+this.ajax.responseText;break;case'boolean':this.response=(this.ajax.responseText===0)?0:1;break;default:this.response=this.ajax.responseText;}
if(js!==''){try{eval(js);}catch(e2){this.log('Could not eval javascript from server');}}
this.onResponse(this.response);if(typeof this.node!='undefined'){if(sb.$(this.node)){this.node=sb.$(this.node);if(typeof this.node.value!='undefined'){this.node.value=this.ajax.responseText;}else{this.node.innerHTML=this.ajax.responseText;}}else{this.log('Cannot set innerHTML of: '+this.node+' as it does not exist');}}
return this;},abort:function(){this.ajax.abort();if(typeof this.onmillisec!='undefined'){this.timer.reset();}
this.onAbort();},fetch:function(){if(!this.url){throw('A sb.ajax instance has no url set? But is trying to send the following data: '+this.data);}
var url=this.url;this.completed=0;this.data=sb.typeOf(this.data)=='object'?sb.objects.serialize(this.data):this.data;this.async=!this.async?false:true;this.format=this.format||'';this.method=this.method.toUpperCase();if(this.method=='GET'&&this.data!==undefined){url=url+'?'+this.data;}
this.ajax.open(this.method,url,this.async);if(this.method=='POST'){this.ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");}
if(this.timeout){this.count=0;var self=this;this.timer=window.setInterval(function(){if(self.count>=self.timeout){self.abort();self.count=0;if(typeof self.onTimeout=='function'){self.onTimeout();}
window.clearInterval(self.timer);}else{self.count++;}},1);}
this.ajax.send(this.data);if(!this.async){this.onreadystatechange();}},log:function(message){if(this.debug==1){var info=(message||'')+"\nSENT\nURL: ";info+="\nMETHOD: "+this.method+"\nFORMAT: "+this.format+"\nASYNC: "+this.async+"\nDATA: "+this.data;if(sb.consol.ajaxLog){sb.consol.ajaxLog(info);}else if(typeof console!='undefined'){console.log(info);}
if(typeof this.onLog=='function'){this.onLog(info);}}},onResponse:function(){},onTimeout:function(){},onHeaders:function(status,statusText){},onAbort:function(){}};sb.dom={onReady:function(o){var found=0,timer,count=0;o.args=o.args||[];o.interval=o.interval||10;o.tries=o.tries||600;if(o.tries==-1){o.tries=99999999;}
if(typeof o.onReady=='function'){timer=window.setInterval(function(){count+=1;if(count>=o.tries){window.clearTimeout(timer);if(typeof o.onTimeout=='function'){o.onTimeout(o.id);}
return;}
if(o.id=='body'&&document.body){window.clearTimeout(timer);found=1;o.id=document.body;}else if(o.id!='body'&&sb.$(o.id)){window.clearTimeout(timer);found=1;}
if(found==1){o.onReady.apply(sb.$(o.id),o.args);}},o.interval);}else{throw('sb.dom.onReady: You object argument must have a onReady property that runs when the dom element "'+o.id+'" is available');}}};Array.prototype.inArray=function(val){return this.some(function(v){return v===val;});};Array.prototype.remove=function(values){return this.filter(function(v){if(sb.typeOf(values)!='array'){return v!=values;}else{return!values.inArray(v);}});};String.prototype.hex2rgb=function(asArray){var hex=this.replace(/(^\s+|\s+$)/).replace("#","");var rgb=parseInt(hex,16);var r=(rgb>>16)&0xFF;var g=(rgb>>8)&0xFF;var b=rgb&0xFF;if(asArray){return[r,g,b];}else{return'rgb('+r+', '+g+', '+b+')';}};String.prototype.toCamel=function(){return String(this).replace(/[_-]\D/gi,function(m){return m.charAt(m.length-1).toUpperCase();});};sb.styles={numRules:1,sheets:[],pxProps:['fontSize','width','height','padding','border','margin','left','top']};sb.events={add:function(){if(window.addEventListener){return function(el,type,fn){el=sb.$(el);var f=function(e){var sb_target=e.target;var sb_related_target=e.relatedTarget;delete e.target;delete e.relatedTarget;e.__defineGetter__("target",function(){return sb.events.distillTarget(sb_target);});e.__defineGetter__("relatedTarget",function(){return sb.events.distillTarget(sb_related_target);});fn.call(el,e);};var evt={el:el,type:type,fn:f,remove:sb.events.removeThis};el.addEventListener(type,f,false);return sb.events.record(evt);};}else if(window.attachEvent){return function(el,type,fn){el=sb.$(el);var tar=false;var f=function(){var e=window.event;var tar=null;switch(e.type){case'mouseout':tar=e.relatedTarget||e.toElement;break;case'mouseover':tar=e.relatedTarget||e.fromElement;break;}
if(tar){e.relatedTarget=sb.events.distillTarget(tar);}
if(e.srcElement){e.target=sb.events.distillTarget(e.srcElement);}
e.preventDefault=function(){e.returnValue=false;};e.stopPropagation=function(){e.cancelBubble=true;};fn.call(el,e);};var evt={el:el,type:type,fn:f,remove:sb.events.removeThis};el.attachEvent('on'+type,f);return sb.events.record(evt);};}}(),removeThis:function(){sb.events.remove(this);},log:[],record:function(evt){sb.events.log.push(evt);return evt;},remove:function(evt){if(evt.el.removeEventListener){evt.el.removeEventListener(evt.type,evt.fn,false);}else if(evt.el.detachEvent){evt.el.detachEvent("on"+evt.type,evt.fn);}},removeAll:function(){sb.events.log.forEach(function(evt){sb.events.remove(evt);});sb.events.log=[];},distillTarget:function(tar){if(tar&&tar.nodeType&&(tar.nodeType==3||tar.nodeName=='EMBED')){tar=tar.parentNode;}
return $(tar);}};sb.element=function(o){var el,c;if(sb.typeOf(o)=='sb.element'){return o;}
if(typeof o=='object'){if(o.tag=='input'&&sb.dom.createNamedElement){el=new sb.dom.createNamedElement(o.type,o.name,o.checked);}else{el=document.createElement(o.tag);}}
if(Element.emulated){sb.objects.infuse(Element.prototype,el);o=sb.objects.copy(o);}
if(typeof o.addAttributes!='undefined'){el.styles(o.addAttributes);delete o.addAttributes;}
if(typeof o.styles!='undefined'){el.styles(o.styles);delete o.styles;}
if(typeof o.children!='undefined'){var len=o.children.length;for(c=0;c<len;c++){el.appendChild(new sb.element(o.children[c]));}
delete o.children;}
if(typeof o.events!='undefined'){sb.objects.forEach.call(o.events,function(func,event,obj){el.event(event,func);});delete o.events;}
sb.objects.infuse(o,el);if(sb.browser.agent=='ie'&&sb.browser.version<8){if(el.tag=='form'&&sb.events.observer){el._sb_on_submit=sb.events.add(el,'submit',sb.events.observer.delegateEvents);}
el.removeAttribute('tag');}
return el;};if(typeof Element=='undefined'){Element=function(){};Element.emulated=true;Element.prototype={};}
Element.prototype.$=function(selector){return $(selector,this);};Element.prototype.addClassName=function(className){this.className+=' '+className;return this;};Element.prototype.append=function(el){return this.appendChild(sb.$(el));};Element.prototype.appendTo=function(el){return sb.$(el).appendChild(this);};Element.prototype.appendToTop=function(el){el=sb.$(el);if(el.childNodes.length===0){return this.appendTo(el);}else{return this.appendBefore(el.firstChild);}};Element.prototype.appendAfter=function(after){var a=$(after);if(a.nextSibling){while((a=a.nextSibling)&&a.nodeType!=1){}
var nxtSib=a;}
if(nxtSib){return nxtSib.parentNode.insertBefore(this,nxtSib);}else{return this.appendTo(a.parentNode);}};Element.prototype.appendBefore=function(before){before=sb.$(before);return before.parentNode.insertBefore(this,before);};Element.prototype.getX=function(){var x=0,el=this;while(el!==null){x+=el.offsetLeft;el=el.offsetParent;}
return x;};Element.prototype.getY=function(){var y=0,el=this;while(el!==null){y+=el.offsetTop;el=el.offsetParent;}
return y;};Element.prototype.hasClassName=function(classname){return this.className.match("\\b"+classname+"\\b");};Element.prototype.remove=function(){if(typeof this.parentNode!='undefined'){this.parentNode.removeChild(this);}
return this;};Element.prototype.removeClassName=function(className){this.className=this.className.replace(new RegExp("\b*"+className+"\b*"),"");return this;};Element.prototype.replace=function(node){node=sb.$(node);if(typeof node.parentNode!='undefined'){node.parentNode.replaceChild(this,node);}
node=null;return this;};Element.prototype.event=function(evt,func){var event=sb.events.add(this,evt,func);return event;};Element.prototype.eventsAdded=[];Element.prototype.events=function(events){for(var event in events){if(typeof events[event]=='function'){this.event(event,events[event]);}}
return this;};Element.prototype.eventRemove=function(evt){sb.events.remove(evt);return this;};Element.prototype.eventsRemoveAll=function(){this.eventsAdded.forEach(function(evt){sb.events.remove(evt);});this.eventsAdded=[];return this;};Element.prototype.styles=function(params){for(var prop in params){if(params.hasOwnProperty(prop)){try{this.setStyle(prop,params[prop]);}catch(e){}}}
return this;};Element.prototype.getStyle=function(prop){var val;if(prop.match(/^border$/)){prop='border-left-width';}
if(prop.match(/^padding$/)){prop='padding-left';}
if(prop.match(/^margin$/)){prop='margin-left';}
if(prop.match(/^border-color$/)){prop='border-left-color';}
if(this.style[prop]){val=this.style[prop];}else if(this.currentStyle){prop=prop.toCamel();val=this.currentStyle[prop];}else if(document.defaultView&&document.defaultView.getComputedStyle){prop=prop.replace(/([A-Z])/g,"-$1");prop=prop.toLowerCase();val=document.defaultView.getComputedStyle(this,"").getPropertyValue(prop);}else{val=null;}
if(prop=='opacity'&&val===undefined){val=1;}
if(val){if(typeof val=='String'){val=val.toLowerCase();if(val=='rgba(0, 0, 0, 0)'){val='transparent';}
if(typeof sb.colors.html!='undefined'){if(sb.colors.html[val]){val=sb.colors.html[val].hex2rgb();}}
if(val.match("^#")){val=val.hex2rgb();}}
return val;}else{return null;}};Element.prototype.setStyle=function(prop,val){if(sb.styles.pxProps.inArray(prop)&&val!==''&&!val.match(/em|cm|pt|px|%/)){val+='px';}
if(prop=='opacity'&&typeof this.style.filter=='string'&&typeof this.style.zoom=='string'){this.style.opacity=val;this.style.zoom=1;this.style.filter="alpha(opacity:"+val*100+")";}else{if(prop=='cssFloat'&&typeof this.style.styleFloat=='string'){prop='styleFloat';}
if(typeof this.style[prop]=='string'){this.style[prop]=val;}else{throw("style["+prop+"] does not exist in this browser's style implemenation");}}};Element.prototype.typeOf=function(){return'sb.element';};if(!Array.prototype.forEach){sb.include('js1_5');}
if(sb.browser.ie6){sb.include('ie6');}else{sb.ie6={pngFix:function(){},pngFixBg:function(el){}};}
sb.dom.onReady({id:'body',onReady:function(){sb.onbodyload.forEach(function(v){if(typeof v=='function'){v();}});},tries:600,ontimeout:function(){if(typeof sb.onbodynotready=='function'){sb.onbodynotready();}}});sb.events.add(window,'resize',sb.browser.measure);sb.events.add(window,'unload',function(e){sb.onleavepage.forEach(function(v){if(typeof(v)=='function'){v(e);}});sb.events.removeAll();});sb.browser.getHash=function(){var hash=window.location.hash;return hash.substring(1);};sb.browser.getLinkTarget=function(link){return link.href.substring(link.href.indexOf('#')+1);};sb.cookies={path:'/',domain:'',onlog:'',get:function(name){var i,n,parts=document.cookie.split(';');for(i=0;i<parts.length;i++){n=parts[i].split('=');n[0]=n[0].replace(/ /,"");if(name==n[0]){return unescape(n[1]);}}
return false;},set:function(name,value,days){var ck,date=new Date();var exp='';if(days){date.setTime(date.getTime()+(days*24*60*60*1000));exp='; expires='+date.toGMTString();}
ck=name+'='+escape(value)+exp+'; path='+sb.cookies.path+';'+' host='+sb.cookies.domain;document.cookie=ck;},forget:function(name){this.set(name,"",-1);},forgetAll:function(){var n,i,deleted=[],parts=document.cookie.split(';');for(i=0;i<parts.length;i++){n=parts[i].split('=');if(n[0]!==undefined){deleted.push(n[0]);this.set(n[0],"",-1);}}},listAll:function(){var i,c,list=[],parts=document.cookie.split(';');for(i=0;i<parts.length;i++){c=parts[i].split('=');list.push(c[0].replace(/ /,""));}
return list;}};sb.browser.win=function(href,width,height,name){name=name||'docwin';var w=window.open(href,name,"width="+width+",height="+height+",toolbar=0,scrollbars=1,resizable=1");w.focus();return w;};sb.browser.removeSelection=function(){window.setTimeout(function(){try{if(window.getSelection){window.getSelection().removeAllRanges();}else if(document.selection){document.selection.empty();}}catch(e){}},50);};sb.swf=function(params){if(typeof params=='object'){sb.objects.infuse(params,this);}
this.width=this.width||'400px';this.height=this.height||'300px';this.bgColor=this.bgColor||'#FFFFFF';this.version=this.version||5;this.allowFullScreen=this.allowFullScreen||'true';this.alt=this.alt||'';this.src=this.src||'';this.wmode=this.wmode||'';if(typeof this.id=='undefined'){this.id='sb_swf_'+sb.swf.instanceId;sb.swf.instanceId++;}};sb.swf.prototype={getInterface:function(){var movieName=this.id;if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName];}else{return document.getElementById(movieName);}},toHTML:function(){var html='';if(this.version>sb.swf.version){return this.alt;}
if(sb.swf.format=='embed'){html='<embed type="application/x-shockwave-flash" src="'+this.src+'"  id="'+this.id+'" name="'+this.id+'" wmode="'+this.wmode+'" allowScriptAccess="always" allowFullScreen="'+this.allowFullScreen+'" bgcolor="'+this.bgColor+'" ';if(typeof this.flashvars=='object'){html+='FlashVars="'+sb.objects.serialize(this.flashvars)+'" ';}
html+=' width="'+this.width+'" height="'+this.height+'"  />';}else if(sb.swf.format=='object'){html='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'+this.width+'" height="'+this.height+'" id="'+this.id+'" ><param name="movie" value="'+this.src+'" /><param name="bgcolor" value="'+this.bgColor+'" /><param name="wmode" value="'+this.wmode+'" /><param name="allowFullScreen" value="'+this.allowFullScreen+'" /><param name="allowScriptAccess" value="always" />';if(typeof this.flashvars=='object'){html+='<param name="FlashVars" value="'+sb.objects.serialize(this.flashvars)+'">';}
html+='</object>';}
return html;},embed:function(el){el=$(el);el.innerHTML=this.toHTML();return el;}};sb.swf.infuse=sb.objects.infuse;sb.swf.infuse({version:4,swfs:[],instanceId:0,check:function(){var version,description;try{version=new RegExp("\\d{1}\.\\d{0,5}","i");if(window.navigator.plugins["Shockwave Flash"]){description=window.navigator.plugins["Shockwave Flash"].description;if(description.match(version)){sb.swf.version=description.match(version);}}}catch(e){sb.swf.version=0;}
return sb.swf.version;},testIe:function(){try{if(new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash."+sb.swf.version)){return false;}}catch(e){return true;}},ieCheck:function(){try{while(!sb.swf.testIe()){sb.swf.version++;}
sb.swf.version--;return sb.swf.version;}catch(e){return true;}},cleanup:function(){try{sb.$('object').forEach(function(obj){obj.style.display='none';for(var prop in obj){if(typeof obj=='function'){obj[prop]=function(){};}}});}catch(e){}},unload:function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",sb.swf.cleanup);},detect:function(){for(var x=0;x<window.navigator.plugins.length;x++){}
if(window.navigator.plugins&&window.navigator.plugins.length){sb.swf.format='embed';return sb.swf.check();}else if(sb.browser.agent=='ie'){sb.swf.format='object';return sb.swf.ieCheck();}}});sb.swf.detect();if(sb.browser.ie6){var __flash__removeCallback=function(instance,name){if(typeof instance!='null'){instance[name]=null;}};window.attachEvent("onbeforeunload",sb.swf.unload);}
sb.include('swf');sb.flashGate=new sb.swf({src:sb.base+"/FlashGate.swf",width:1,height:1,bgColor:'#FF0000',id:'Flashgate',wmode:'transparent',flashvars:{debug:true}});sb.flashGate.debug=0;sb.flashGateContainer=new sb.element({tag:'x',styles:{display:'block',position:'absolute',left:'-200px',top:'-200px'}});var sb_onFlashGateLoaded=[];sb.dom.onReady({id:'body',onReady:function(){sb.flashGateContainer.appendToTop('body');sb.flashGate.embed(sb.flashGateContainer);sb_onFlashGateLoaded.forEach(function(v){if(typeof v=='function'){v();}})},tries:600,ontimeout:function(){if(sb.flashGate.debug){throw('Cannot append flashGate to browser');}}});sb_onFlashGateLoad=function(){if(sb_onFlashGateLoaded&&sb_onFlashGateLoaded.forEach){sb_onFlashGateLoaded.forEach(function(v){if(typeof v=='function'){v();}});}};sb.include('flashGate');sb.sound=function(params){if(!params.url){throw('You must pass a url to the sb.sound');}
for(var prop in params){this[prop]=params[prop];}
this.id=sb.flashGate.getInterface().sound_create(this.url,this.debug);sb.sound.sounds[this.id]=this;};sb.sound.sounds=[];sb.sound.stopAll=function(url){url=url||'';sb.flashGate.getInterface().sounds_stop_all(url);};sb.sound.setGlobalVolume=function(volume){sb.flashGate.getInterface().sounds_set_global_volume(volume);};sb.sound.muteAll=function(){sb.flashGate.getInterface().sounds_mute_all();};sb.sound.muted=0;sb.sound.prototype={duration:-1,url:'',id:0,play:function(position,loops){if(!sb.sound.muted){position=position||0;loops=loops||0;return sb.flashGate.getInterface().sound_play(this.id,position,loops);}},stop:function(){return sb.flashGate.getInterface().sound_stop(this.id);},getPosition:function(){return sb.flashGate.getInterface().sound_get_position(this.id);},setPositionPercent:function(percent){return sb.flashGate.getInterface().sound_set_position_percent(this.id,percent);},getPositionPercent:function(){return sb.flashGate.getInterface().sound_get_position_percent(this.id);},setPosition:function(position){return sb.flashGate.getInterface().sound_set_position(this.id,position);},getVolume:function(volume){return sb.flashGate.getInterface().sound_get_volume(this.id);},setVolume:function(volume){sb.flashGate.getInterface().sound_set_volume(this.id,volume);},getPan:function(){return sb.flashGate.getInterface().sound_get_pan(this.id);},setPan:function(pan){sb.flashGate.getInterface().sound_set_pan(this.id,pan);},mute:function(){this.setVolume(0);},onID3:function(){},onLoad:function(){},onError:function(){},onProgress:function(data){}};Element.prototype.getDimensions=function(){var display=this.getStyle('display');if(display!='none'&&display!==null){this.width=this.offsetWidth;this.height=this.offsetHeight;}else{var origStyles={visibility:this.style.visibility,position:this.style.position,display:this.style.display};this.styles({visibility:'hidden',position:'absolute',display:'block'});this.width=this.clientWidth;this.height=this.clientHeight;this.styles(origStyles);}
return this;};sb.browser.getScrollPosition=function(){var x=0,y=0;if(window.pageYOffset){y=window.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){y=document.documentElement.scrollTop;}
sb.browser.scrollY=y;if(window.pageXSOffset){x=window.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollLeft){x=document.documentElement.scrollLeft;}
sb.browser.scrollX=x;return[sb.browser.scrollX,sb.browser.scrollY];};sb.events.add(window,'scroll',sb.browser.getScrollPosition);String.prototype.isNumeric=function(){return/^\d+?(\.\d+)?$/.test(this);};sb.include('flashGate');sb.sharedObject={load:function(key){return sb.flashGate.getInterface().storage_engine_get(key);},save:function(key,val){sb.flashGate.getInterface().storage_engine_set(key,val);},clear:function(key){this.save(key,'');},clearAll:function(){sb.flashGate.getInterface().storage_engine_clear_all();}};if(typeof sb.swf=='undefined'){sb.include('swf');}
sb.uploadButton=function(parameters){this.id=sb.uploadButton.uploads.length;for(var prop in parameters){this[prop]=parameters[prop];}
sb.uploadButton.uploads.push(this);this.swf=new sb.swf({src:sb.base+"/UploadButton.swf?id="+this.id,width:this.styles.width||62,height:this.styles.height||24,id:'upload'+this.id,bgcolor:'#000000',wmode:'transparent',flashvars:{debug:(this.debug!=null)?this.debug:true,innerHTML:this.innerHTML||'upload',debugLevel:this.debugLevel||1},version:9,alt:parameters.alt||'<h1>You need <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">flash player 9+</a> to upload</h1>'});this.load_params=function(){this.swf.getInterface().create_upload(this.id);};};sb.uploadButton.uploads=[];sb.uploadButton.prototype={styles:{},toHTML:function(){return this.swf.toHTML();},embed:function(el){this.swf.embed(el);},setStyles:function(styles){this.swf.getInterface().set_button_styles(styles);},cancel:function(name){name=name||'';this.swf.getInterface().upload_cancel(name);},id:0,maxFiles:5,maxFileSizeK:1024,acceptedFileTypes:'*.*',method:'post',url:'',data:{},debug:true,debugLevel:1,onBeforeBrowse:function(data){return true;},onSelect:function(data){return true;},onExceedsMaxFileSizeK:function(file){},onExceedsMaxFiles:function(files){},onError:function(file){},onOpen:function(file){},onReturnData:function(file){},onAllComplete:function(files){},onComplete:function(files){},onAllProgress:function(files){},onProgress:function(files){},onCancelBrowse:function(){},onCancelAll:function(){},onCancelFile:function(){}};sb.md5={hexcase:0,b64pad:'',chrsz:8,test:function(){return this.hex("abc")=="900150983cd24fb0d6963f7d28e17f72";},binl2hex:function(binarray){var hex_tab=this.hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++)
{str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+
hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
return str;},hex:function(s){return this.binl2hex(this.core(this.str2binl(s),s.length*this.chrsz));},b64:function(s){return this.binl2b64(this.core(this.str2binl(s),s.length*this.chrsz));},str:function(s){return this.binl2str(this.core(this.str2binl(s),s.length*this.chrsz));},hex_hmac:function(key,data){return this.binl2hex(this.core_hmac(key,data));},b64_hmac:function(key,data){return this.binl2b64(this.core_hmac(key,data));},str_hmac:function(key,data){return this.binl2str(this.core_hmac(key,data));},core:function(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d;a=this.ff(a,b,c,d,x[i+0],7,-680876936);d=this.ff(d,a,b,c,x[i+1],12,-389564586);c=this.ff(c,d,a,b,x[i+2],17,606105819);b=this.ff(b,c,d,a,x[i+3],22,-1044525330);a=this.ff(a,b,c,d,x[i+4],7,-176418897);d=this.ff(d,a,b,c,x[i+5],12,1200080426);c=this.ff(c,d,a,b,x[i+6],17,-1473231341);b=this.ff(b,c,d,a,x[i+7],22,-45705983);a=this.ff(a,b,c,d,x[i+8],7,1770035416);d=this.ff(d,a,b,c,x[i+9],12,-1958414417);c=this.ff(c,d,a,b,x[i+10],17,-42063);b=this.ff(b,c,d,a,x[i+11],22,-1990404162);a=this.ff(a,b,c,d,x[i+12],7,1804603682);d=this.ff(d,a,b,c,x[i+13],12,-40341101);c=this.ff(c,d,a,b,x[i+14],17,-1502002290);b=this.ff(b,c,d,a,x[i+15],22,1236535329);a=this.gg(a,b,c,d,x[i+1],5,-165796510);d=this.gg(d,a,b,c,x[i+6],9,-1069501632);c=this.gg(c,d,a,b,x[i+11],14,643717713);b=this.gg(b,c,d,a,x[i+0],20,-373897302);a=this.gg(a,b,c,d,x[i+5],5,-701558691);d=this.gg(d,a,b,c,x[i+10],9,38016083);c=this.gg(c,d,a,b,x[i+15],14,-660478335);b=this.gg(b,c,d,a,x[i+4],20,-405537848);a=this.gg(a,b,c,d,x[i+9],5,568446438);d=this.gg(d,a,b,c,x[i+14],9,-1019803690);c=this.gg(c,d,a,b,x[i+3],14,-187363961);b=this.gg(b,c,d,a,x[i+8],20,1163531501);a=this.gg(a,b,c,d,x[i+13],5,-1444681467);d=this.gg(d,a,b,c,x[i+2],9,-51403784);c=this.gg(c,d,a,b,x[i+7],14,1735328473);b=this.gg(b,c,d,a,x[i+12],20,-1926607734);a=this.hh(a,b,c,d,x[i+5],4,-378558);d=this.hh(d,a,b,c,x[i+8],11,-2022574463);c=this.hh(c,d,a,b,x[i+11],16,1839030562);b=this.hh(b,c,d,a,x[i+14],23,-35309556);a=this.hh(a,b,c,d,x[i+1],4,-1530992060);d=this.hh(d,a,b,c,x[i+4],11,1272893353);c=this.hh(c,d,a,b,x[i+7],16,-155497632);b=this.hh(b,c,d,a,x[i+10],23,-1094730640);a=this.hh(a,b,c,d,x[i+13],4,681279174);d=this.hh(d,a,b,c,x[i+0],11,-358537222);c=this.hh(c,d,a,b,x[i+3],16,-722521979);b=this.hh(b,c,d,a,x[i+6],23,76029189);a=this.hh(a,b,c,d,x[i+9],4,-640364487);d=this.hh(d,a,b,c,x[i+12],11,-421815835);c=this.hh(c,d,a,b,x[i+15],16,530742520);b=this.hh(b,c,d,a,x[i+2],23,-995338651);a=this.ii(a,b,c,d,x[i+0],6,-198630844);d=this.ii(d,a,b,c,x[i+7],10,1126891415);c=this.ii(c,d,a,b,x[i+14],15,-1416354905);b=this.ii(b,c,d,a,x[i+5],21,-57434055);a=this.ii(a,b,c,d,x[i+12],6,1700485571);d=this.ii(d,a,b,c,x[i+3],10,-1894986606);c=this.ii(c,d,a,b,x[i+10],15,-1051523);b=this.ii(b,c,d,a,x[i+1],21,-2054922799);a=this.ii(a,b,c,d,x[i+8],6,1873313359);d=this.ii(d,a,b,c,x[i+15],10,-30611744);c=this.ii(c,d,a,b,x[i+6],15,-1560198380);b=this.ii(b,c,d,a,x[i+13],21,1309151649);a=this.ii(a,b,c,d,x[i+4],6,-145523070);d=this.ii(d,a,b,c,x[i+11],10,-1120210379);c=this.ii(c,d,a,b,x[i+2],15,718787259);b=this.ii(b,c,d,a,x[i+9],21,-343485551);a=this.safe_add(a,olda);b=this.safe_add(b,oldb);c=this.safe_add(c,oldc);d=this.safe_add(d,oldd);}
return[a,b,c,d];},cmn:function(q,a,b,x,s,t){return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a,q),this.safe_add(x,t)),s),b);},ff:function(a,b,c,d,x,s,t){return this.cmn((b&c)|((~b)&d),a,b,x,s,t);},gg:function(a,b,c,d,x,s,t){return this.cmn((b&d)|(c&(~d)),a,b,x,s,t);},hh:function(a,b,c,d,x,s,t){return this.cmn(b^c^d,a,b,x,s,t);},ii:function(a,b,c,d,x,s,t){return this.cmn(c^(b|(~d)),a,b,x,s,t);},core_hmac:function(key,data){var bkey=this.str2binl(key);if(bkey.length>16){bkey=this.core(bkey,key.length*this.chrsz);}
var ipad=new Array(16),opad=new Array(16);for(var i=0;i<16;i++){ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}
var hash=this.core(ipad.concat(this.str2binl(data)),512+data.length*this.chrsz);return this.core(opad.concat(hash),512+128);},safe_add:function(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);},bit_rol:function(num,cnt){return(num<<cnt)|(num>>>(32-cnt));},str2binl:function(str){var bin=[];var mask=(1<<this.chrsz)-1;for(var i=0;i<str.length*this.chrsz;i+=this.chrsz){bin[i>>5]|=(str.charCodeAt(i/this.chrsz)&mask)<<(i%32);}
return bin;},binl2str:function(bin){var str="";var mask=(1<<this.chrsz)-1;for(var i=0;i<bin.length*32;i+=this.chrsz){str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);}
return str;},binl2b64:function(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3){var triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>binarray.length*32){str+=sb.md5.b64pad;}else{str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}
return str;}}};String.prototype.md5=function(){return sb.md5.hex(this);};String.prototype.trim=function(){return this.replace(/(^\s+|\s+$)/g,'');};String.prototype.cleanFileName=function(){var ext=this.match(/\.\w{2,3}$/);var str=this.replace(/ext/,'');str=str.replace(/\.\w{2,3}$/,'');str=str.replace(/[^A-Z^a-z^0-9]+/g,' ');str=str.ucwords();str=str.replace(/ /g,'');str+=String(ext).toLowerCase();return str;};String.prototype.basename=function(){var re=new RegExp("/\\/","g");var str=this.replace(re,"/");var filename=str.split("/");return filename[(filename.length-1)];};Element.prototype.mv=function(x,y,z){this.style.left=x+'px';this.style.top=y+'px';if(z){this.style.zIndex=z;}
if(this.getStyle('position')=='static'){this.style.position='absolute';}
this.getPosition();return this;};sb.include('Element.prototype.getDimensions');sb.include('browser.getScrollPosition');Element.prototype.getPosition=function(params){params=params||{};var orig=this;var el=this;orig.top=0;orig.left=0;do{orig.top+=el.offsetTop;orig.left+=el.offsetLeft;if(params.pos=='rel'){el=false;}else{try{el=el.offsetParent;}catch(e){el=false;}}}while(el);if(params.accountForScrollBar){sb.browser.getScrollPosition();if(sb.browser.scrollY){orig.top-=sb.browser.scrollY;}
if(sb.browser.scrollX){orig.left-=sb.browser.scrollX;}}
orig.getDimensions();orig.w=orig.width;orig.h=orig.height;orig.bottom=orig.top+orig.width;orig.right=orig.left+orig.height;return orig;};sb.forms.textarea={getSelection:function(field){field=sb.$(field);var range,sel={},selectionEnd,selectionStart,stored_range;field.focus();if(document.selection){range=document.selection.createRange();stored_range=range.duplicate();stored_range.moveToElementText(field);stored_range.setEndPoint('EndToEnd',range);selectionStart=stored_range.text.length-range.text.length;selectionEnd=selectionStart+range.text.length;sel.begin=selectionStart;sel.end=selectionEnd;}else if(typeof field.selectionStart!='undefined'){sel.begin=field.selectionStart;sel.end=field.selectionEnd;}
sel.caret=sel.begin;sel.before=field.value.substr(0,sel.begin);sel.selected=field.value.substr(sel.begin,(sel.end-sel.begin));sel.after=field.value.substr(sel.end,(field.value.length-sel.end));return sel;},addTags:function(field,beginTag,endTag){field=sb.$(field);var sel=sb.forms.textarea.getSelection(field);var tagLength=beginTag.length+endTag.length;field.value=sel.before+beginTag+sel.selected+endTag+sel.after;window.setTimeout(function(){field.focus();sb.forms.textarea.moveCaret(field,sel.caret);},0);},setSelection:function(field,start,end){var range;field=sb.$(field);if(field.setSelectionRange){field.setSelectionRange(start,end);}else{range=field.createTextRange();range.collapse(true);range.moveStart("character",start);range.moveEnd("character",end-start);range.select();}},replaceSelection:function(field,txt){field=sb.$(field);var sel=sb.forms.textarea.getSelection(field);field.value=sel.before+txt+sel.after;sb.forms.textarea.moveCaret(field,sel.end);field.focus();},insertAtCaret:function(field,txt){field=sb.$(field);sb.forms.textarea.replaceSelection(field,txt);},moveCaret:function(field,pos){var range;field=sb.$(field);if(field.setSelectionRange){field.setSelectionRange(pos,pos);}else{range=field.createTextRange();range.collapse(true);range.moveStart("character",pos);range.moveEnd("character",pos-pos);range.select();}
field.focus();}};sb.include('forms.textarea');sb.include('browser.removeSelection');sb.include('sharedObject');sb.include('String.prototype.isNumeric');sb.forms.textarea.textBling=function(editBar,editBox){this.editBar=$(editBar);this.editBox=$(editBox);this.editBar.editBox=this.editBox;this.addEvents();};sb.forms.textarea.textBling.save=function(){sb.sharedObject.save(this.id,this.value);};sb.forms.textarea.textBling.restore=function(){var str=sb.sharedObject.load(this.id);if(str){this.value=str;}
return this.value;};sb.forms.textarea.textBling.clearStorage=function(){sb.sharedObject.clear(this.id);};sb.forms.textarea.textBling.prototype={renderStyles:1,defaultStyles:["b","i","u","caps","hilite","strike"],buttonCss:0,buttonSize:1,buttonColor:1,fetchBackup:1,checkStorage:function(){return sb.sharedObject.load(this.editBox.id);},clearStorage:function(){sb.sharedObject.clear(this.editBox.id);},addEvents:function(){this.editBox.event('keydown',sb.forms.textarea.textBling.save);this.editBox.event('onchange',sb.forms.textarea.textBling.save);this.editBar.event('mousedown',function(e){var target=e.target;if(target.nodeName=='SPAN'){target=target.parentNode;}
if(target.kind){switch(target.kind){case'basic':sb.forms.textarea.addTags(this.editBox,'['+target.bling+']','[/'+target.bling+']');break;case'prompt':var myPrompt=window.prompt(target.question,"");if(myPrompt){if(myPrompt.isNumeric()){myPrompt+='px';}
sb.forms.textarea.addTags(this.editBox,'['+target.bling+'='+myPrompt+']','[/'+target.bling+']');}
break;case'restore':if(this.editBox.value!==''){if(!window.confirm('Restoring the editor to the last draft saved point will erase anything in your text editor, is that ok?')){return;}}
sb.forms.textarea.textBling.restore.call(this.editBox);break;}
if(typeof this.update=='function'){this.update();}}
sb.browser.removeSelection;});},addButton:function(bling,title){var btn=new sb.element({tag:'button',innerHTML:'<span class="tb_'+bling+'">'+bling+'</span>',bling:bling,title:title||'['+bling+']text[/'+bling+']',kind:'basic'});btn.appendTo(this.editBar);},addPromptButton:function(bling,title,question){var btn=new sb.element({tag:'button',innerHTML:'<span class="tb_'+bling+'">'+bling+'</span>',title:title,bling:bling,kind:'prompt',question:question});btn.appendTo(this.editBar);},addRestoreButton:function(){var str=this.checkStorage();if(str){var btn=new sb.element({tag:'button',innerHTML:'restore backup',styles:{backgroundColor:'red',color:'white'},kind:'restore'});btn.appendTo(this.editBar);}},basic:function(){for(var x=0;x<this.defaultStyles.length;x++){this.addButton(this.defaultStyles[x]);}
if(this.buttonSize==1){this.addPromptButton("size","e.g. [size=12px]12 pixeltext[/size] - sets the font size - use 12px 1.2em large","Enter the font-size in standard form e.g. 12px, 1em, large");}
if(this.buttonColor==1){this.addPromptButton("color","e.g. [color=blue]blue text[/color] - sets the font color for the text in the tags","Enter the color e.g. #FFFFFF or white.");}
this.addPromptButton("link","e.g. [link=http://www.artvoice.com]links the the address in the link tags[/link]","Enter the URL address for the link.");if(this.buttonCss==1){this.addPromptButton("css","e.g. [css=background-color:blue]blue text[/css] - sets the font color for the text in the tags","Enter the any valid CSS style data e.g. background-color:blue;border:2px dotted black;");}},custom:function(customTags){for(var x=0;x<customTags.length;x++){var bling=customTags[x];var title='';if(bling.match(/,/)){var data=bling.split(',');bling=data[0];title=data[1];}
this.addButton(bling,title);}}};sb.browser.$_GET=[];$_GET=sb.browser.$_GET;sb.browser.populateGET=function(){var i,s,val,key;var q=window.location.search.substring(1);var v=q.split("&");for(i=0;i<v.length;i++){s=v[i].split("=");key=unescape(s[0]);val=unescape(s[1]);sb.browser.$_GET[key]=val.replace("+"," ");}};sb.browser.populateGET();