﻿//=============================================
// These are some custom js additions that may
// depend on Prototype >= 1.5
//=============================================

function getFirstParentByTagName(element, tag) {
//returns the element's first parent of type tagNameString or null if no match
	if (element.tagName.toLowerCase() == "html") {
		return null;
	}
	
	if (element.tagName.toLowerCase() == tag.toLowerCase()) {
		return element;
	}
	else {			
		return getFirstParentByTagName(element.parentNode, tag);
	}
}

//add GetWindowSize function to Position object		
Position.GetWindowSize = function(w) {
	w = w ? w : window;
	var width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
	var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
	return [width, height]
}


