
// TRAP ERRORS

function stopError() { // SA 17/07/2001 v01
    // this is for just in case, as there shouldn't be any errors
    // document.bgColor = "#ff0000";
    // return true to suppress the error in the browser
    // return true;
    // return false to release the error to the browser
    // return false;
}

window.onerror = stopError;

// BUST FRAMES

if (self.parent.frames.length != 0) {
    self.parent.location=document.location;
}









// DELETE LATER

function getElementsByClass(searchClass,node,tag) {
// http://www.dustindiaz.com/getelementsbyclass/
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function toggleGrid() {
// use this bookmarklet to toggle the grid:
// javascript:toggleGrid();
    if (document.getElementById) {
        //
        // commented out the following line to get this working with a bookmarklet
        // document.getElementById('togglegrid').blur();

        // toggles the container's grid image on and off
        target = getElementsByClass('container')[0];
        if (target.style.background == "") {
            target.style.background = "url(http://www.clinkit.com/_css/blueprint/src/grid.png)";
        } else {
            target.style.background = "";
        }
        return false;
    }
}

// uncomment the next line to display the grid by default
// i should rewrite this to add an event handler to the onload, not overwrite it
// window.onload = toggleGrid;
