function setCookie(a,b,c,d,e,f){var g,date;if(typeof c=="number"){date=new Date();date.setTime(date.getTime()+(c*24*60*60*1000));g=date.toGMTString()}document.cookie=a+"="+escape(b)+((g)?"; expires="+g:"")+((d)?"; path="+d:"")+((e)?"; domain="+e:"")+((f)?"; secure":"")}function getCookie(a){var b=a+"=";var d=document.cookie.split(';');for(var i=0;i<d.length;i++){var c=d[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(b)==0)return unescape(c.substring(b.length,c.length))}return null}function deleteCookie(a,b,c){if(getCookie(a)){document.cookie=a+"="+((b)?"; path="+b:"")+((c)?"; domain="+c:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT"}}
var dw_fontSizerDX={sizeUnit:"px",defaultSize:14,maxSize:24,minSize:10,queryName:"dw_fsz",queryNum:true,adjustList:[],setDefaults:function(a,b,c,d,e){this.sizeUnit=a;this.defaultSize=b;this.maxSize=d;this.minSize=c;if(e)this.set(b,c,d,e)},set:function(a,b,c,d){var e=this.adjustList.length;for(var i=0;d[i];i++){this.adjustList[e+i]=[];this.adjustList[e+i]["sel"]=d[i];this.adjustList[e+i]["dflt"]=a;this.adjustList[e+i]["min"]=b||this.minSize;this.adjustList[e+i]["max"]=c||this.maxSize;this.adjustList[e+i]["ratio"]=this.adjustList[e+i]["dflt"]/this.defaultSize}},init:function(){if(!document.getElementById||!document.getElementsByTagName||!dw_fontSizerDX.ready)return;var a,sizerEl,i;a=getValueFromQueryString(this.queryName,this.queryNum);if(isNaN(parseFloat(a))||a>this.maxSize||a<this.minSize){a=getCookie("fontSize");if(isNaN(parseFloat(a))||a>this.maxSize||a<this.minSize){a=this.defaultSize}}this.curSize=this.defaultSize;sizerEl=document.getElementById('sizer');if(sizerEl)sizerEl.style.display="block";if(this.adjustList.length==0){this.setDefaults(this.sizeUnit,this.defaultSize,this.minSize,this.maxSize,['body','td'])}if(a!=this.defaultSize)this.adjust(a-this.defaultSize)},adjust:function(n){if(!this.curSize||!dw_fontSizerDX.ready)return;var a,size,list,i,j;if(n>0){if(this.curSize+n>this.maxSize)n=this.maxSize-this.curSize}else if(n<0){if(this.curSize+n<this.minSize)n=this.minSize-this.curSize}if(n==0)return;this.curSize+=n;a=this.adjustList;for(i=0;a[i];i++){size=this.curSize*a[i]['ratio'];size=Math.max(a[i]['min'],size);size=Math.min(a[i]['max'],size);list=dw_getElementsBySelector(a[i]['sel']);for(j=0;list[j];j++){list[j].style.fontSize=size+this.sizeUnit}}setCookie("fontSize",this.curSize,180,"/")},reset:function(){if(!this.curSize||!dw_fontSizerDX.ready)return;var a=this.adjustList,list,i,j;for(i=0;a[i];i++){list=dw_getElementsBySelector(a[i]['sel']);for(j=0;list[j];j++){list[j].style.fontSize=''}}this.curSize=this.defaultSize;deleteCookie("fontSize","/")}};function dw_getElementsBySelector(a){if(!document.getElementsByTagName)return[];var b=[document],tokens,bits,list,col,els,i,j,k;a=a.normalize();tokens=a.split(' ');for(i=0;tokens[i];i++){if(tokens[i].indexOf('#')!=-1){bits=tokens[i].split('#');var c=document.getElementById(bits[1]);if(!c)return[];if(bits[0]){if(c.tagName.toLowerCase()!=bits[0].toLowerCase())return[]}for(j=0;b[j];j++){if(b[j]==document||dw_contained(c,b[j]))b=[c];else return[]}}else if(tokens[i].indexOf('.')!=-1){bits=tokens[i].split('.');col=[];for(j=0;b[j];j++){els=dw_getElementsByClassName(bits[1],bits[0],b[j]);for(k=0;els[k];k++){col[col.length]=els[k]}}b=[];for(j=0;col[j];j++){b.push(col[j])}}else{els=[];for(j=0;b[j];j++){list=b[j].getElementsByTagName(tokens[i]);for(k=0;list[k];k++){els.push(list[k])}}b=els}}return b};function dw_getElementsByClassName(a,b,c){var d=[],list,i;var e=new RegExp("\\b"+a+"\\b","i");c=c?c:document;if(document.getElementsByTagName){if(!b||b=="*"){list=c.all?c.all:c.getElementsByTagName("*")}else{list=c.getElementsByTagName(b)}for(i=0;list[i];i++)if(e.test(list[i].className))d.push(list[i])}return d};function getValueFromQueryString(a,b){var c="";if(window.location.search){var d=window.location.search.slice(1);var e=d.split("&");var f=[],ar2;for(var i=0;e[i];i++){if(e[i].indexOf("=")!=-1){ar2=e[i].split("=");f[ar2[0]]=ar2[1]}}c=f[a];if(!c&&b){c=d}}return c};function dw_contained(a,b){if(!a)return;while(a=a.parentNode)if(a==b)return true;return false};if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0;arguments[i];i++)this[this.length]=arguments[i];return this[this.length-1]}};String.prototype.normalize=function(){var a=/\s\s+/g;return this.trim().replace(a," ")};String.prototype.trim=function(){var a=/^\s+|\s+$/g;return this.replace(a,"")};var dw_Inf={};dw_Inf.fn=function(v){return eval(v)};dw_fontSizerDX.ready=true;
var Behaviour = { list : new Array, register : function(sheet){ Behaviour.list.push(sheet);}, 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(func){ var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func;} else { window.onload = function() { oldonload(); func();}
}
}
}
Behaviour.start(); function getAllChildren(e) { return e.all ? e.all : e.getElementsByTagName('*');}
document.getElementsBySelector = function(selector) { if (!document.getElementsByTagName) { return new Array();}
var tokens = selector.split(' '); var currentContext = new Array(document); for (var i = 0; i < tokens.length; i++) { token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');; if (token.indexOf('#') > -1) { var bits = token.split('#'); var tagName = bits[0]; var id = bits[1]; var element = document.getElementById(id); if (tagName && element.nodeName.toLowerCase() != tagName) { return new Array();}
currentContext = new Array(element); continue;}
if (token.indexOf('.') > -1) { var bits = token.split('.'); var tagName = bits[0]; var className = bits[1]; if (!tagName) { tagName = '*';}
var found = new Array; var foundCount = 0; for (var h = 0; h < currentContext.length; h++) { var elements; if (tagName == '*') { elements = getAllChildren(currentContext[h]);} else { elements = currentContext[h].getElementsByTagName(tagName);}
for (var j = 0; j < elements.length; j++) { found[foundCount++] = elements[j];}
}
currentContext = new Array; var currentContextIndex = 0; for (var k = 0; k < found.length; k++) { if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) { currentContext[currentContextIndex++] = found[k];}
}
continue;}
if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
      var tagName = RegExp.$1;
      var attrName = RegExp.$2;
      var attrOperator = RegExp.$3;
      var attrValue = RegExp.$4;
      if (!tagName) {
        tagName = '*';
      }
      // Grab all of the tagName elements within current context
      var found = new Array;
      var foundCount = 0;
      for (var h = 0; h < currentContext.length; h++) {
        var elements;
        if (tagName == '*') {
            elements = getAllChildren(currentContext[h]);
        } else {
            elements = currentContext[h].getElementsByTagName(tagName);
        }
        for (var j = 0; j < elements.length; j++) {
          found[foundCount++] = elements[j];
        }
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      var checkFunction; // This function will be used to filter the elements
      switch (attrOperator) {
        case '=': // Equality
          checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
          break;
        case '~': // Match one of space seperated words
          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
          break;
        case '|': // Match start with value followed by optional hyphen
          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
          break;
        case '^': // Match starts with value
          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
          break;
        case '$': // Match ends with value - fails with "Warning" in Opera 7
          checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
          break;
        case '*': // Match ends with value
          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
          break;
        default :
          // Just test for existence of attribute
          checkFunction = function(e) { return e.getAttribute(attrName); };
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      for (var k = 0; k < found.length; k++) {
        if (checkFunction(found[k])) {
          currentContext[currentContextIndex++] = found[k];
        }
      }
      // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
      continue; // Skip to next token
    }

    if (!currentContext[0]){
    	return;
    }

    // If we get here, token is JUST an element (not a class or ID selector)
    tagName = token;
    var found = new Array;
    var foundCount = 0;
    for (var h = 0; h < currentContext.length; h++) {
      var elements = currentContext[h].getElementsByTagName(tagName);
      for (var j = 0; j < elements.length; j++) {
        found[foundCount++] = elements[j];
      }
    }
    currentContext = found;
  }
  return currentContext;
}

/* That revolting regular expression explained
/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
\---/ \---/\-------------/ \-------/ | | | | | | | The value | | ~,|,^,$,* or = | Attribute
Tag */
var xmlhttp
if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest();} catch (e) { xmlhttp=false
}
}
function myXMLHttpRequest() { var xmlhttplocal; try { xmlhttplocal= new ActiveXObject("Msxml2.XMLHTTP")
} catch (e) { try { xmlhttplocal= new ActiveXObject("Microsoft.XMLHTTP")
} catch (E) { xmlhttplocal=false;}
}
if (!xmlhttplocal && typeof XMLHttpRequest!='undefined') { try { var xmlhttplocal = new XMLHttpRequest();} catch (e) { var xmlhttplocal=false; alert('couldn\'t create xmlhttp object');}
}
return(xmlhttplocal);}
function sndReq(vote,id_num,ip_num,units) { var theUL = document.getElementById('unit_ul'+id_num); theUL.innerHTML = '<div class="loading"></div>'; xmlhttp.open('get', 'rpc.php?j='+vote+'&q='+id_num+'&t='+ip_num+'&c='+units); xmlhttp.onreadystatechange = handleResponse; xmlhttp.send(null);}
function handleResponse() { if(xmlhttp.readyState == 4){ if (xmlhttp.status == 200){ var response = xmlhttp.responseText; var update = new Array(); if(response.indexOf('|') != -1) { update = response.split('|'); changeText(update[0], update[1]);}
}
}
}
function changeText( div2show, text ) { var IE = (document.all) ? 1 : 0; var DOM = 0; if (parseInt(navigator.appVersion) >=5) {DOM=1}; if (DOM) { var viewer = document.getElementById(div2show); viewer.innerHTML = text;} else if(IE) { document.all[div2show].innerHTML = text;}
}
var ratingAction = { 'a.rater' : function(element){ element.onclick = function(){ var parameterString = this.href.replace(/.*\?(.*)/, "$1"); var parameterTokens = parameterString.split("&"); var parameterList = new Array(); for (j = 0; j < parameterTokens.length; j++) { var parameterName = parameterTokens[j].replace(/(.*)=.*/, "$1"); var parameterValue = parameterTokens[j].replace(/.*=(.*)/, "$1"); parameterList[parameterName] = parameterValue;}
var theratingID = parameterList['q']; var theVote = parameterList['j']; var theuserIP = parameterList['t']; var theunits = parameterList['c']; sndReq(theVote,theratingID,theuserIP,theunits); return false;}
}
}; Behaviour.register(ratingAction);
addEvent(window, "load", makeNiceTitles); var XHTMLNS = "http://www.w3.org/1999/xhtml"; var CURRENT_NICE_TITLE; var browser = new Browser(); function makeNiceTitles() { if (!document.createElement || !document.getElementsByTagName) return; if(!document.createElementNS)
{ document.createElementNS = function(ns,elt) { return document.createElement(elt);}
}
if( !document.links )
{ document.links = document.getElementsByTagName("a");}
for (var ti=0;ti<document.links.length;ti++) { var lnk = document.links[ti]; if (lnk.title) { lnk.setAttribute("nicetitle",lnk.title); lnk.removeAttribute("title"); addEvent(lnk,"mouseover",showNiceTitle); addEvent(lnk,"mouseout",hideNiceTitle); addEvent(lnk,"focus",showNiceTitle); addEvent(lnk,"blur",hideNiceTitle);}
}
var instags = document.getElementsByTagName("ins"); if (instags) { for (var ti=0;ti<instags.length;ti++) { var instag = instags[ti]; if (instag.dateTime) { var strDate = instag.dateTime; var dtIns = new Date(strDate.substring(0,4),parseInt(strDate.substring(4,6)-1),strDate.substring(6,8),strDate.substring(9,11),strDate.substring(11,13),strDate.substring(13,15)); instag.setAttribute("nicetitle","Added on "+dtIns.toString()); addEvent(instag,"mouseover",showNiceTitle); addEvent(instag,"mouseout",hideNiceTitle); addEvent(instag,"focus",showNiceTitle); addEvent(instag,"blur",hideNiceTitle);}
}
}
}
function findPosition( oLink ) { if( oLink.offsetParent ) { for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) { posX += oLink.offsetLeft; posY += oLink.offsetTop;}
return [ posX, posY ];} else { return [ oLink.x, oLink.y ];}
}
function showNiceTitle(e) { if (CURRENT_NICE_TITLE) hideNiceTitle(CURRENT_NICE_TITLE); if (!document.getElementsByTagName) return; if (window.event && window.event.srcElement) { lnk = window.event.srcElement
} else if (e && e.target) { lnk = e.target
}
if (!lnk) return; if (lnk.nodeName.toUpperCase() != 'A') { lnk = getParent(lnk,"A");}
if (!lnk) return; nicetitle = lnk.getAttribute("nicetitle"); var d = document.createElementNS(XHTMLNS,"div"); d.className = "nicetitle"; tnt = document.createTextNode(nicetitle); pat = document.createElementNS(XHTMLNS,"p"); pat.className = "titletext"; pat.appendChild(tnt); d.appendChild(pat); if (lnk.href) { tnd = document.createTextNode(lnk.href); pad = document.createElementNS(XHTMLNS,"p"); pad.className = "destination"; pad.appendChild(tnd); d.appendChild(pad);}
STD_WIDTH = 300; if (lnk.href) { h = lnk.href.length;} else { h = nicetitle.length;}
if (nicetitle.length) { t = nicetitle.length;}
h_pixels = h*6; t_pixels = t*10; if (h_pixels > STD_WIDTH) { w = h_pixels;} else if ((STD_WIDTH>t_pixels) && (t_pixels>h_pixels)) { w = t_pixels;} else if ((STD_WIDTH>t_pixels) && (h_pixels>t_pixels)) { w = h_pixels;} else { w = STD_WIDTH;}
d.style.width = w + 'px'; mpos = findPosition(lnk); mx = mpos[0]; my = mpos[1]; d.style.left = (mx+15) + 'px'; d.style.top = (my+35) + 'px'; if (window.innerWidth && ((mx+w) > window.innerWidth)) { d.style.left = (window.innerWidth - w - 25) + "px";}
if (document.body.scrollWidth && ((mx+w) > document.body.scrollWidth)) { d.style.left = (document.body.scrollWidth - w - 25) + "px";}
document.getElementsByTagName("body")[0].appendChild(d); CURRENT_NICE_TITLE = d;}
function hideNiceTitle(e) { if (!document.getElementsByTagName) return; if (CURRENT_NICE_TITLE) { document.getElementsByTagName("body")[0].removeChild(CURRENT_NICE_TITLE); CURRENT_NICE_TITLE = null;}
}
function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, false); return true;} else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r;} else { return false;}
}
function getParent(el, pTagName) { if (el == null) return null; else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())
return el; else
return getParent(el.parentNode, pTagName);}
function getMousePosition(event) { if (browser.isIE) { x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;}
if (browser.isNS) { x = event.clientX + window.scrollX; y = event.clientY + window.scrollY;}
return [x,y];}
function Browser() { var ua, s, i; this.isIE = false; this.isNS = false; this.version = null; ua = navigator.userAgent; s = "MSIE"; if ((i = ua.indexOf(s)) >= 0) { this.isIE = true; this.version = parseFloat(ua.substr(i + s.length)); return;}
s = "Netscape6/"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = parseFloat(ua.substr(i + s.length)); return;}
s = "Gecko"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = 6.1; return;}
}
