﻿var UNDEFINED;

function createBoundingBox(element){
	var box = new clsBoundingBox(0,0,0,0);
	
	if(!element)return box;
	
	var x=0, y=0, p = element;
	
	while(p){
		x += p.offsetLeft;
		y += p.offsetTop;
		p = p.offsetParent;
	}
	
	box.l = x;
	box.t = y;
	box.r = x + element.offsetWidth;
	box.b = y + element.offsetHeight;
	return box;
}

function clsBoundingBox(x,y,w,h){
	this.l=x;
	this.r=x+w;
	this.t=y;
	this.b=y+h;
}

function UnRegisteredSortByDistance(){
    return window.confirm("We need your location to show you venues by distance from you! \n\n Click OK to sign up now");
}

var currentNav = "sublinks_home";

function FlipNav(navbar){
//    alert(document.getElementById(navbar));
    document.getElementById(currentNav).style.display = "none";
    currentNav = navbar;
    document.getElementById(currentNav).style.display = "inline";
}



function ArrayObjRemove(arr, obj){
    for(i=0; i<arr.length; i++){
        if(arr[i] == obj){
            ArrayRemove(arr, i);
        }
    }
}

function ArrayRemove(arr, index){
    arr[index] = null;
    
	//if rows exist...
	if(arr.length > 0){
		//loop through conditions, starting at index of row to remove
		for(i=index; i<arr.length; i++){
			arr[i] = arr[i+1];
		}
		//reduce array length by one
		arr.length = arr.length - 1;
	} else {
		arr.length = 1;
	}
}
