﻿//Root level javascript namespace
var EntourageHelper = new Function();
//Popups static class
EntourageHelper.Popups = new Function();


/* Popups STATIC class static functions */
EntourageHelper.Popups.ShowImagePopup = function(folder, folderId, fileName, width, height, popupTitle) {
	var popupUrl = "/Assets/PopupPages/LargeImageDisplay.aspx?folder=" + folder + "&folderId=" + folderId + "&fileName=" + fileName + "&width=" + width + "&height=" + height;
	EntourageBase.ShowPopup(popupUrl, popupTitle, width + 20, height + 50);
}
//same as the ShowImagePopup function except it shows in a new window instead of a popup
EntourageHelper.Popups.ShowImageNewWindow = function(folder, folderId, fileName, width, height, popupTitle) {
	var popupUrl = "/Assets/PopupPages/LargeImageDisplay.aspx?folder=" + folder + "&folderId=" + folderId + "&fileName=" + fileName + "&width=" + width + "&height=" + height;
	window.open(popupUrl, "", "scrollbars,resizable,width=" + (width + 20) + ",height=" + (height + 50));
}

EntourageHelper.Popups.ShowFriendRequest = function(destinationMemberId) {
	var popupUrl = "/Assets/PopupPages/FriendRequest.aspx?dmid=" + destinationMemberId;
	EntourageBase.ShowPopup(popupUrl, "Friend Request", 560, 190);
}

EntourageHelper.Popups.ShowComposeMessage = function(destinationMemberId) {
	var popupUrl = "/Assets/PopupPages/ComposeMessage.aspx?dmid=" + destinationMemberId;
	EntourageBase.ShowPopup(popupUrl, "Private Message", 560, 300);
}

EntourageHelper.Popups.ShowMemberLoginSignup = function() {
	EntourageBase.ShowPopup("/Assets/PopupPages/MemberSignup.aspx", "Entourage, It's a LifeStyle! Are You In?", 450, 500);
}

EntourageHelper.Popups.ShowForgotLogin = function() {
	EntourageBase.ShowPopup("/Assets/PopupPages/ForgotLogin.aspx", "Get Your Login Information", 500, 150);
}

EntourageHelper.Popups.ShowSetPromoter = function(promoterUsername) {
	EntourageBase.ShowPopup("/Assets/PopupPages/SetPromoter.aspx?promoter=" + promoterUsername, "Make " + promoterUsername + " Your Promoter", 600, 250);
}

/* END: Popups STATIC class static functions */


/* Menu Navigation Helpers*/

var lastMenuShown;
var hideMenuTimeout;

EntourageHelper.MenuLinkOver = function(menuItemLink) {
	window.clearTimeout(hideMenuTimeout);
	if (lastMenuShown)
		lastMenuShown.style.display = 'none';
	lastMenuShown = menuItemLink.parentNode.getElementsByTagName('ul')[0];
	lastMenuShown.style.display = 'block';
}
EntourageHelper.MenuLinkOut = function(menuItemLink) {
	hideMenuTimeout = setTimeout("EntourageHelper.HideLastMenuItem()", 250);
}
EntourageHelper.HideLastMenuItem = function() {
	if (lastMenuShown) 
		lastMenuShown.style.display = 'none';
}

/* END: Menu Navigation Helpers*/


//can be used to capture an enter key press in a textbox and call the click event for the associated button
EntourageHelper.CaptureEnterKey = function(evt) {
	evt = (evt) ? evt : window.event;
	var keyCode = (evt.which) ? evt.which : evt.keyCode;

	if (keyCode == 13) {
		evt.returnValue = false;
		return false;
	}
}    //end of captureEnterKey



