/* Copyright © 2002-2008 Factor of 4, LLC. <http://www.factorof4.com/> */

function sampleDetail (path) {
	var w = window.open(path, 'sample', 'width=750,height=725,location=no,menubar=no,status=no,toolbar=no',true);
	w.focus();
	return false;
}

var highlightAnchor_element = null;
function highlightElement(element, setOn) {
	if ( setOn ) { 
		if ( ! element.className.match(/(^|[^\w-])highlight($|[^\w-])/ ) ) {
			element.className += ' highlight';
		}
	}
	else { 
		element.className.replace(/(^|[^\w-])highlight($|[^\w-])/, '');
	}
}
		

	
function highlightAnchor (id) {
	var new_element;
	if ( arguments.length == 0 || id == '' ) {
		id = window.location.hash;
		if ( id != '' ) {
			id = id.substring(1, id.length); // remove hash
		}
		if ( id != '' ) {
			if ( document.all ) { // IE (x.x ?)
				if ( document.all[id] ) { 
					new_element = document.all[id];
				}
			}
			else if ( document.getElementById ) { // W3C (Mozilla 1/5, etc.)
				if ( document.getElementById(id) ) {
					new_element = document.getElementById(id);
				}	
			}
			else if ( document.ids ) { // poor old Netscape 4...
				if ( document.ids[id] ) {
					new_element = document.ids[id];
				}	
			}
			else { // huh?
			}
		}
	}
	if ( highlightAnchor_element ) {
		highlightElement(highlightAnchor_element, false);
	}
	if ( new_element ) {
		highlightAnchor_element = new_element;
		highlightElement(new_element, true);
	}
}
