﻿String.prototype.startsWith = function(pattern) {
    return this.indexOf(pattern) === 0;
}
String.prototype.endsWith = function(pattern) {
	var d = this.length - pattern.length;
	return d >= 0 && this.lastIndexOf(pattern) === d;
}

function getParent(el, tag){
	while(el && el.tagName != tag)
		el = el.parentElement;
	return el;
}

function Inspect( obj, recursive )
{
	var separator = '\n--------------------------------------------------------------------------\n';
	var value = '';

	if ( typeof(obj) == 'string' ) {
		value = obj;
	}
	else {
		for ( var key in obj ) {
			value += key + ' = ' + obj[key];
			value += separator;
		}
	}
	if ( value ) {
		var win = window.open();
		win.document.body.innerText = value;
	}
	
}
