/* The following code was borrowed from various sources, listed respectively */

// From: http://snipplr.com/view.php?codeview&id=44079
// Function for determining whether or not a style is supported by the useragent

var supports = (function() {
   var div = document.createElement('div'),
      vendors = 'Khtml Ms O Moz Webkit'.split(' '),
      len = vendors.length;

   return function(prop,returnVendor) {
      if ( prop in div.style ) return true;

      prop = prop.replace(/^[a-z]/, function(val) {
         return val.toUpperCase();
      });

      while(len--) {
         if ( vendors[len] + prop in div.style ) {
            // browser supports box-shadow. Do what you need.
            // Or use a bang (!) to test if the browser doesn't.
            if (returnVendor)
            	return vendors[len];
            else
	            return true;
         } 
      }
      return false;
   };
})();

// From: http://www.htmldog.com/articles/suckerfish/target/
// Allow for IE useragents to emulate the :target selector

sfTarget = function() {
	var sfEls=document.getElementsByTagName("DIV");
	var aEls = document.getElementsByTagName("A");
	document.lastTarget = null;
	for (var i=0; i<sfEls.length; i++) {
		if (sfEls[i].id) {
			if (location.hash==("#" + sfEls[i].id)) {
				sfEls[i].className+=" " + cls;
				document.lastTarget=sfEls[i];
			}
			for (var j=0; j<aEls.length; j++) {
				if (aEls[j].hash==("#" + sfEls[i].id)) aEls[j].targetEl = sfEls[i]; aEls[j].onclick = function() {
					if (document.lastTarget) document.lastTarget.className = document.lastTarget.className.replace(new RegExp(" sftarget\\b"), "");
					if (this.targetEl) this.targetEl.className+=" sftarget"; document.lastTarget=this.targetEl;
					return true;
				}
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfTarget);
