// Compacted by ScriptingMagic.com
/*
   Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work
   of Simon Willison (see comments by Simon below).

   Description:
   	
   	Uses css selectors to apply javascript behaviours to enable
   	unobtrusive javascript in html documents.
   	
   Usage:   
   
	var myrules = {
		'b.someclass' : function(element){
			element.onclick = function(){
				alert(this.innerHTML);
			}
		},
		'#someid u' : function(element){
			element.onmouseover = function(){
				this.innerHTML = "BLAH!";
			}
		}
	};
	
	Behaviour.register(myrules);
	
	// Call Behaviour.apply() to re-apply the rules (if you
	// update the dom, etc).
	//  More information: http://ripcord.co.nz/behaviour/
*/
var Behaviour={list:new Array,register:function(a){Behaviour.list.push(a)},start:function(){Behaviour.addLoadEvent(function(){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)}}}},addLoadEvent:function(a){var b=window.onload;if(typeof window.onload!="function"){window.onload=a}else{window.onload=function(){b();a()}}}};Behaviour.start();function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}document.getElementsBySelector=function(a){if(!document.getElementsByTagName){return new Array()}var b=a.split(" ");var c=new Array(document);for(var i=0;i<b.length;i++){token=b[i].replace(/^\s+/,"").replace(/\s+$/,"");if(token.indexOf("#")>-1){var d=token.split("#");var e=d[0];var f=d[1];var g=document.getElementById(f);if(e&&g.nodeName.toLowerCase()!=e){return new Array()}c=new Array(g);continue}if(token.indexOf(".")>-1){var d=token.split(".");var e=d[0];var h=d[1];if(!e){e="*"}var j=new Array;var k=0;for(var l=0;l<c.length;l++){var m;if(e=="*"){m=getAllChildren(c[l])}else{m=c[l].getElementsByTagName(e)}for(var n=0;n<m.length;n++){j[k++]=m[n]}}c=new Array;var o=0;for(var p=0;p<j.length;p++){if(j[p].className&&j[p].className.match(new RegExp("\\b"+h+"\\b"))){c[o++]=j[p]}}continue}if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){var e=RegExp.$1;var q=RegExp.$2;var r=RegExp.$3;var s=RegExp.$4;if(!e){e="*"}var j=new Array;var k=0;for(var l=0;l<c.length;l++){var m;if(e=="*"){m=getAllChildren(c[l])}else{m=c[l].getElementsByTagName(e)}for(var n=0;n<m.length;n++){j[k++]=m[n]}}c=new Array;var o=0;var t;switch(r){case "=":t=function(u){return (u.getAttribute(q)==s)};break;case "~":t=function(u){return (u.getAttribute(q).match(new RegExp("\\b"+s+"\\b")))};break;case "|":t=function(u){return (u.getAttribute(q).match(new RegExp("^"+s+"-?")))};break;case "^":t=function(u){return (u.getAttribute(q).indexOf(s)==0)};break;case "$":t=function(u){return (u.getAttribute(q).lastIndexOf(s)==u.getAttribute(q).length-s.length)};break;case "*":t=function(u){return (u.getAttribute(q).indexOf(s)>-1)};break;default:t=function(u){return u.getAttribute(q)}}c=new Array;var o=0;for(var p=0;p<j.length;p++){if(t(j[p])){c[o++]=j[p]}}continue}if(!c[0]){return}e=token;var j=new Array;var k=0;for(var l=0;l<c.length;l++){var m=c[l].getElementsByTagName(e);for(var n=0;n<m.length;n++){j[k++]=m[n]}}c=j}return c}