//var baseUrl = "http://localhost/newyearsevegala.net";
var baseUrl = "http://www.newyearsevegala.net";

function Relocate(Url) {
	document.location.href = Url;
	return true;
}

// Get the width of the document object inside the
// web browser
function GetDocumentWidth() {
	return document.body.clientWidth;
}

// Return the numeric portion of a pixel width.  For example, 260px becomes 260
function ParseOutPx(str) {
	return str.substr(0,str.length-2);
}

// Center the image passed as a parameter.  This involves
// placing the center of the image at the center of the
// document.
function CenterImageInBrowser(ImageName) {
	// Get the image object by object id
	var Img = document.getElementById(ImageName);
	
	// Get the width of half the document in pixels rounded
	var DocMid = Math.round(GetDocumentWidth()/2);
	
	// Get the width of half the image in pixels rounded
	var ImgMid = Math.round(Img.width/2);
	
	// Setting the position of top and left is absolutely necessary
	// because the tab positioning function relies on retrieving this
	// information and it is blank unless set through code.  When
	// setting this via CSS or HTML it returns blank.
	Img.style.position = "absolute";
	Img.style.top = "0px";
	Img.style.left = DocMid - ImgMid + "px";
	Img.style.width = "357px";
}

function PositionHeader() {
	var SiteTitle = document.getElementById('SiteTitle');
	
	SiteTitle.style.position = "absolute";
	SiteTitle.style.top = "0px";
	SiteTitle.style.left = "25px";
	SiteTitle.style.height = "144px";
}

// Position the content div by code.  This is required in order for the
// tab functionality to work because the tab functionality retrieves
// the style properties which are not set automatically when positioning
// is done via CSS.
function PositionContent(h, t) {
	// Get the contect objects by object id
	var Content = document.getElementById('Content');
	var Content2 = document.getElementById('Content2');
	var toffs = 0; // offset from the hard coded top.  used to insert image bar above
	var hoffs = 0; // offset to add to the height if we want it longer than standard
	
	if (!isNaN(t)) toffs = t;
	if (!isNaN(h)) hoffs = h;
	
	Content.style.position = "absolute";
	Content.style.top = parseInt(toffs + 144) + "px";
	Content.style.left = "25px";
	Content.style.height = parseInt(hoffs + 420) + "px";
	Content.style.width = "900px";
	
	Content2.style.position = "absolute";
	Content2.style.top = parseInt(toffs + 154) + "px";
	Content2.style.left = "35px";
	Content2.style.height = parseInt(hoffs + 400) + "px";
	Content2.style.width = "875px";	
}

function PositionTabs(ObjName) {
	var spacer = 2;
	
	// Get the image object by object id
	var Obj = document.getElementById(ObjName);
	
	// Get the left start of the object
	var tabLeft = parseInt(ParseOutPx(Obj.style.left));
	
	// Get the top start of the object
	var tabTop = parseInt(ParseOutPx(Obj.style.top));

	// Set the tab left the right of the object
	tabLeft = tabLeft + parseInt(ParseOutPx(Obj.style.width));

	// Get references to tab images
	var tabCharity = document.getElementById('charity');
	var tabPhotos = document.getElementById('photos');
	var tabMusic = document.getElementById('music');
	var tabDining = document.getElementById('dining');
	var tabHotel = document.getElementById('hotel');
	var tabTickets = document.getElementById('tickets');
	var tabContact = document.getElementById('contact');
	
	// Set tab positions
	tabCharity.style.position = "absolute";
	tabCharity.style.top = tabTop + "px";
	tabCharity.style.left = tabLeft + spacer + "px";
	tabTop = tabTop + spacer + parseInt(tabCharity.height);	// increment top of tab
	tabPhotos.style.position = "absolute";
	tabPhotos.style.top = tabTop + "px";
	tabPhotos.style.left = tabLeft + spacer + "px";
	tabTop = tabTop + spacer + parseInt(tabPhotos.height); // increment top of tab
	tabMusic.style.position = "absolute";
	tabMusic.style.top = tabTop + "px";
	tabMusic.style.left = tabLeft + spacer + "px";
	tabTop = tabTop + spacer + parseInt(tabMusic.height); // increment top of tab
	tabDining.style.position = "absolute";
	tabDining.style.top = tabTop + "px";
	tabDining.style.left = tabLeft + spacer + "px";
	tabTop = tabTop + spacer + parseInt(tabDining.height); // increment top of tab
	tabHotel.style.position = "absolute";
	tabHotel.style.top = tabTop + "px";
	tabHotel.style.left = tabLeft + spacer + "px";
	tabTop = tabTop + spacer + parseInt(tabHotel.height); // increment top of tab
	tabTickets.style.position = "absolute";
	tabTickets.style.top = tabTop + "px";
	tabTickets.style.left = tabLeft + spacer + "px";
	tabTop = tabTop + spacer + parseInt(tabTickets.height); // increment top of tab
	tabContact.style.position = "absolute";
	tabContact.style.top = tabTop + "px";
	tabContact.style.left = tabLeft + spacer + "px";
}

function PositionTabsBottom(ObjName) {
	var spacer = 2;
	var spacer2 = 25;
	
	// Get the image object by object id
	var Obj = document.getElementById(ObjName);
	
	// Get the left start of the object
	var tabLeft = parseInt(ParseOutPx(Obj.style.left)) + 80;
	
	// Get the top start of the object
	var tabTop = parseInt(ParseOutPx(Obj.style.top));
	
	// Get the bottom of the object
	var tabBottom = parseInt(ParseOutPx(Obj.style.height)) + tabTop;

	// Get references to tab images
	var tabCharity = document.getElementById('charity');
	var tabPhotos = document.getElementById('photos');
	var tabMusic = document.getElementById('music');
	var tabDining = document.getElementById('dining');
	var tabHotel = document.getElementById('hotel');
	var tabTickets = document.getElementById('tickets');
	var tabContact = document.getElementById('contact');
	
	// Set tab positions
	tabCharity.style.position = "absolute";
	tabCharity.style.top = tabBottom + spacer + "px";
	tabCharity.style.left = tabLeft + "px";
	tabLeft = tabLeft + spacer2 + parseInt(tabCharity.width); // increment left of tab
	tabPhotos.style.position = "absolute";
	tabPhotos.style.top = tabBottom + spacer + "px";
	tabPhotos.style.left = tabLeft + "px";
	tabLeft = tabLeft + spacer2 + parseInt(tabPhotos.width); // increment left of tab
	tabMusic.style.position = "absolute";
	tabMusic.style.top = tabBottom + spacer + "px";
	tabMusic.style.left = tabLeft + "px";
	tabLeft = tabLeft + spacer2 + parseInt(tabMusic.width); // increment left of tab
	tabDining.style.position = "absolute";
	tabDining.style.top = tabBottom + spacer + "px";
	tabDining.style.left = tabLeft + "px";
	tabLeft = tabLeft + spacer2 + parseInt(tabDining.width); // increment left of tab
	tabHotel.style.position = "absolute";
	tabHotel.style.top = tabBottom + spacer + "px";
	tabHotel.style.left = tabLeft + "px";
	tabLeft = tabLeft + spacer2 + parseInt(tabHotel.width); // increment left of tab
	tabTickets.style.position = "absolute";
	tabTickets.style.top = tabBottom + spacer + "px";
	tabTickets.style.left = tabLeft + "px";
	tabLeft = tabLeft + spacer2 + parseInt(tabTickets.width); // increment left of tab
	tabContact.style.position = "absolute";
	tabContact.style.top = tabBottom + spacer + "px";
	tabContact.style.left = tabLeft + "px";
}

function ViewImage(Url) {
	var myBrowser = window.open(baseUrl + "/" + Url,'newwin','left=50,top=50,width=425,height=425,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
}

function popWin(Url) {
		var myBrowser = window.open(baseUrl + "/" + Url,'newwin');
}
