var Behaviour={list:new Array,register:function(a){Behaviour.list.push(a)},start:function(){Behaviour.addLoadEvent(function(){Behaviour.init()})},init:function(){if(arguments.callee.done){return}arguments.callee.done=true;Behaviour.apply()},apply:function(){for(h=0;sheet=Behaviour.list[h];h++){for(selector in sheet){list=document.getElementsBySelector(selector);if(!list){continue}for(i=0;element=list[i];i++){sheet[selector](element)}}}},apply:function(a){for(h=0;sheet=Behaviour.list[h];h++){for(selector in sheet){list=document.getElementsBySelector(selector,a);if(!list){continue}for(i=0;element=list[i];i++){sheet[selector](element)}}}},addLoadEvent:function(a){if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,null)}var b=window.onload;if(typeof window.onload!="function"){window.onload=a}else{window.onload=function(){b();a()}}}};Behaviour.start();function getAllChildren(a){return a.all?a.all:a.getElementsByTagName("*")}document.getElementsBySelector=function(v,r){if(!document.getElementsByTagName){return new Array()}var o=v.split(" ");if(!r){r=document}var f=new Array(r);for(var x=0;x<o.length;x++){token=o[x].replace(/^\s+/,"").replace(/\s+$/,"");if(token.indexOf("#")>-1){var s=token.split("#");var d=s[0];var q=s[1];var b=document.getElementById(q);if(d&&b.nodeName.toLowerCase()!=d){return new Array()}f=new Array(b);continue}if(token.indexOf(".")>-1){var s=token.split(".");var d=s[0];var c=s[1];if(!d){d="*"}var l=new Array;var g=0;for(var y=0;y<f.length;y++){if(f[y]){var m;if(d=="*"){m=getAllChildren(f[y])}else{m=f[y].getElementsByTagName(d)}for(var u=0;u<m.length;u++){l[g++]=m[u]}}}f=new Array;var p=0;for(var t=0;t<l.length;t++){if(l[t].className&&l[t].className.match(new RegExp("\\b"+c+"\\b"))){f[p++]=l[t]}}continue}if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){var d=RegExp.$1;var w=RegExp.$2;var a=RegExp.$3;var n=RegExp.$4;if(!d){d="*"}var l=new Array;var g=0;for(var y=0;y<f.length;y++){if(f[y]){var m;if(d=="*"){m=getAllChildren(f[y])}else{m=f[y].getElementsByTagName(d)}for(var u=0;u<m.length;u++){l[g++]=m[u]}}}f=new Array;var p=0;var e;switch(a){case"=":e=function(j){return(j.getAttribute(w)==n)};break;case"~":e=function(j){return(j.getAttribute(w).match(new RegExp("\\b"+n+"\\b")))};break;case"|":e=function(j){return(j.getAttribute(w).match(new RegExp("^"+n+"-?")))};break;case"^":e=function(j){return(j.getAttribute(w).indexOf(n)==0)};break;case"$":e=function(j){return(j.getAttribute(w).lastIndexOf(n)==j.getAttribute(w).length-n.length)};break;case"*":e=function(j){return(j.getAttribute(w).indexOf(n)>-1)};break;default:e=function(j){return j.getAttribute(w)}}f=new Array;var p=0;for(var t=0;t<l.length;t++){if(e(l[t])){f[p++]=l[t]}}continue}if(!f[0]){return}d=token;var l=new Array;var g=0;for(var y=0;y<f.length;y++){var m=f[y].getElementsByTagName(d);for(var u=0;u<m.length;u++){l[g++]=m[u]}}f=l}return f};
