/* +----------------------------------------------------+ */
/* |  Useful JavaScript                                 | */
/* +----------------------------------------------------+ */

/** Check browser capabilities **/
var W3CDOM = (document.createElement && document.getElementsByTagName);

/**
 * Kill parent framesets, except Wordpress preview frame 
 */
if (top.location != self.location) {
	if (self.location.search.indexOf('preview=true') == -1) {
		top.location.replace(self.location.href);
	}
}

/**
 * Clears default form field contents
 */
function clearField(field)
{
	if (field.defaultValue == field.value) {
		field.value = "";
	}
	return true;
}

/**
 * Create a queue for window.onload events
 * 	From: http://simon.incutio.com/archive/2004/05/26/addLoadEvent
 * 	Example usage:
 * 	addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
 */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
	return true;
}



